Commit 0669ebea authored by Dmitry Torokhov's avatar Dmitry Torokhov

Input: more renames in serio in preparations to sysfs integration

       - serio_dev -> serio_driver
       - serio_[un]register_device -> serio_[un]register_driver
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent 7990a353
......@@ -524,7 +524,7 @@ static int __init iforce_init(void)
usb_register(&iforce_usb_driver);
#endif
#ifdef CONFIG_JOYSTICK_IFORCE_232
serio_register_device(&iforce_serio_dev);
serio_register_driver(&iforce_serio_drv);
#endif
return 0;
}
......@@ -535,7 +535,7 @@ static void __exit iforce_exit(void)
usb_deregister(&iforce_usb_driver);
#endif
#ifdef CONFIG_JOYSTICK_IFORCE_232
serio_unregister_device(&iforce_serio_dev);
serio_unregister_driver(&iforce_serio_drv);
#endif
}
......
......@@ -124,7 +124,7 @@ static irqreturn_t iforce_serio_irq(struct serio *serio,
return IRQ_HANDLED;
}
static void iforce_serio_connect(struct serio *serio, struct serio_dev *dev)
static void iforce_serio_connect(struct serio *serio, struct serio_driver *drv)
{
struct iforce *iforce;
if (serio->type != (SERIO_RS232 | SERIO_IFORCE))
......@@ -137,7 +137,7 @@ static void iforce_serio_connect(struct serio *serio, struct serio_dev *dev)
iforce->serio = serio;
serio->private = iforce;
if (serio_open(serio, dev)) {
if (serio_open(serio, drv)) {
kfree(iforce);
return;
}
......@@ -158,7 +158,7 @@ static void iforce_serio_disconnect(struct serio *serio)
kfree(iforce);
}
struct serio_dev iforce_serio_dev = {
struct serio_driver iforce_serio_drv = {
.write_wakeup = iforce_serio_write_wakeup,
.interrupt = iforce_serio_irq,
.connect = iforce_serio_connect,
......
......@@ -187,5 +187,5 @@ int iforce_upload_constant(struct iforce*, struct ff_effect*, int is_update);
int iforce_upload_condition(struct iforce*, struct ff_effect*, int is_update);
/* Public variables */
extern struct serio_dev iforce_serio_dev;
extern struct serio_driver iforce_serio_drv;
extern struct usb_driver iforce_usb_driver;
......@@ -146,7 +146,7 @@ static void magellan_disconnect(struct serio *serio)
* it as an input device.
*/
static void magellan_connect(struct serio *serio, struct serio_dev *dev)
static void magellan_connect(struct serio *serio, struct serio_driver *drv)
{
struct magellan *magellan;
int i, t;
......@@ -184,7 +184,7 @@ static void magellan_connect(struct serio *serio, struct serio_dev *dev)
serio->private = magellan;
if (serio_open(serio, dev)) {
if (serio_open(serio, drv)) {
kfree(magellan);
return;
}
......@@ -199,7 +199,7 @@ static void magellan_connect(struct serio *serio, struct serio_dev *dev)
* The serio device structure.
*/
static struct serio_dev magellan_dev = {
static struct serio_driver magellan_drv = {
.interrupt = magellan_interrupt,
.connect = magellan_connect,
.disconnect = magellan_disconnect,
......@@ -211,13 +211,13 @@ static struct serio_dev magellan_dev = {
int __init magellan_init(void)
{
serio_register_device(&magellan_dev);
serio_register_driver(&magellan_drv);
return 0;
}
void __exit magellan_exit(void)
{
serio_unregister_device(&magellan_dev);
serio_unregister_driver(&magellan_drv);
}
module_init(magellan_init);
......
......@@ -201,7 +201,7 @@ static void spaceball_disconnect(struct serio *serio)
* it as an input device.
*/
static void spaceball_connect(struct serio *serio, struct serio_dev *dev)
static void spaceball_connect(struct serio *serio, struct serio_driver *drv)
{
struct spaceball *spaceball;
int i, t, id;
......@@ -254,7 +254,7 @@ static void spaceball_connect(struct serio *serio, struct serio_dev *dev)
serio->private = spaceball;
if (serio_open(serio, dev)) {
if (serio_open(serio, drv)) {
kfree(spaceball);
return;
}
......@@ -269,7 +269,7 @@ static void spaceball_connect(struct serio *serio, struct serio_dev *dev)
* The serio device structure.
*/
static struct serio_dev spaceball_dev = {
static struct serio_driver spaceball_drv = {
.interrupt = spaceball_interrupt,
.connect = spaceball_connect,
.disconnect = spaceball_disconnect,
......@@ -281,13 +281,13 @@ static struct serio_dev spaceball_dev = {
int __init spaceball_init(void)
{
serio_register_device(&spaceball_dev);
serio_register_driver(&spaceball_drv);
return 0;
}
void __exit spaceball_exit(void)
{
serio_unregister_device(&spaceball_dev);
serio_unregister_driver(&spaceball_drv);
}
module_init(spaceball_init);
......
......@@ -162,7 +162,7 @@ static void spaceorb_disconnect(struct serio *serio)
* it as an input device.
*/
static void spaceorb_connect(struct serio *serio, struct serio_dev *dev)
static void spaceorb_connect(struct serio *serio, struct serio_driver *drv)
{
struct spaceorb *spaceorb;
int i, t;
......@@ -201,7 +201,7 @@ static void spaceorb_connect(struct serio *serio, struct serio_dev *dev)
serio->private = spaceorb;
if (serio_open(serio, dev)) {
if (serio_open(serio, drv)) {
kfree(spaceorb);
return;
}
......@@ -213,7 +213,7 @@ static void spaceorb_connect(struct serio *serio, struct serio_dev *dev)
* The serio device structure.
*/
static struct serio_dev spaceorb_dev = {
static struct serio_driver spaceorb_drv = {
.interrupt = spaceorb_interrupt,
.connect = spaceorb_connect,
.disconnect = spaceorb_disconnect,
......@@ -225,13 +225,13 @@ static struct serio_dev spaceorb_dev = {
int __init spaceorb_init(void)
{
serio_register_device(&spaceorb_dev);
serio_register_driver(&spaceorb_drv);
return 0;
}
void __exit spaceorb_exit(void)
{
serio_unregister_device(&spaceorb_dev);
serio_unregister_driver(&spaceorb_drv);
}
module_init(spaceorb_init);
......
......@@ -134,7 +134,7 @@ static void stinger_disconnect(struct serio *serio)
* it as an input device.
*/
static void stinger_connect(struct serio *serio, struct serio_dev *dev)
static void stinger_connect(struct serio *serio, struct serio_driver *drv)
{
struct stinger *stinger;
int i;
......@@ -172,7 +172,7 @@ static void stinger_connect(struct serio *serio, struct serio_dev *dev)
stinger->dev.private = stinger;
serio->private = stinger;
if (serio_open(serio, dev)) {
if (serio_open(serio, drv)) {
kfree(stinger);
return;
}
......@@ -187,7 +187,7 @@ static void stinger_connect(struct serio *serio, struct serio_dev *dev)
* The serio device structure.
*/
static struct serio_dev stinger_dev = {
static struct serio_driver stinger_drv = {
.interrupt = stinger_interrupt,
.connect = stinger_connect,
.disconnect = stinger_disconnect,
......@@ -199,13 +199,13 @@ static struct serio_dev stinger_dev = {
int __init stinger_init(void)
{
serio_register_device(&stinger_dev);
serio_register_driver(&stinger_drv);
return 0;
}
void __exit stinger_exit(void)
{
serio_unregister_device(&stinger_dev);
serio_unregister_driver(&stinger_drv);
}
module_init(stinger_init);
......
......@@ -187,7 +187,7 @@ static void twidjoy_disconnect(struct serio *serio)
* it as an input device.
*/
static void twidjoy_connect(struct serio *serio, struct serio_dev *dev)
static void twidjoy_connect(struct serio *serio, struct serio_driver *drv)
{
struct twidjoy_button_spec *bp;
struct twidjoy *twidjoy;
......@@ -232,7 +232,7 @@ static void twidjoy_connect(struct serio *serio, struct serio_dev *dev)
twidjoy->dev.private = twidjoy;
serio->private = twidjoy;
if (serio_open(serio, dev)) {
if (serio_open(serio, drv)) {
kfree(twidjoy);
return;
}
......@@ -246,7 +246,7 @@ static void twidjoy_connect(struct serio *serio, struct serio_dev *dev)
* The serio device structure.
*/
static struct serio_dev twidjoy_dev = {
static struct serio_driver twidjoy_drv = {
.interrupt = twidjoy_interrupt,
.connect = twidjoy_connect,
.disconnect = twidjoy_disconnect,
......@@ -258,13 +258,13 @@ static struct serio_dev twidjoy_dev = {
int __init twidjoy_init(void)
{
serio_register_device(&twidjoy_dev);
serio_register_driver(&twidjoy_drv);
return 0;
}
void __exit twidjoy_exit(void)
{
serio_unregister_device(&twidjoy_dev);
serio_unregister_driver(&twidjoy_drv);
}
module_init(twidjoy_init);
......
......@@ -139,7 +139,7 @@ static void warrior_disconnect(struct serio *serio)
* it as an input device.
*/
static void warrior_connect(struct serio *serio, struct serio_dev *dev)
static void warrior_connect(struct serio *serio, struct serio_driver *drv)
{
struct warrior *warrior;
int i;
......@@ -185,7 +185,7 @@ static void warrior_connect(struct serio *serio, struct serio_dev *dev)
serio->private = warrior;
if (serio_open(serio, dev)) {
if (serio_open(serio, drv)) {
kfree(warrior);
return;
}
......@@ -199,7 +199,7 @@ static void warrior_connect(struct serio *serio, struct serio_dev *dev)
* The serio device structure.
*/
static struct serio_dev warrior_dev = {
static struct serio_driver warrior_drv = {
.interrupt = warrior_interrupt,
.connect = warrior_connect,
.disconnect = warrior_disconnect,
......@@ -211,13 +211,13 @@ static struct serio_dev warrior_dev = {
int __init warrior_init(void)
{
serio_register_device(&warrior_dev);
serio_register_driver(&warrior_drv);
return 0;
}
void __exit warrior_exit(void)
{
serio_unregister_device(&warrior_dev);
serio_unregister_driver(&warrior_drv);
}
module_init(warrior_init);
......
......@@ -732,7 +732,7 @@ static void atkbd_disconnect(struct serio *serio)
* to the input module.
*/
static void atkbd_connect(struct serio *serio, struct serio_dev *dev)
static void atkbd_connect(struct serio *serio, struct serio_driver *drv)
{
struct atkbd *atkbd;
int i;
......@@ -785,7 +785,7 @@ static void atkbd_connect(struct serio *serio, struct serio_dev *dev)
serio->private = atkbd;
if (serio_open(serio, dev)) {
if (serio_open(serio, drv)) {
kfree(atkbd);
return;
}
......@@ -861,10 +861,10 @@ static void atkbd_connect(struct serio *serio, struct serio_dev *dev)
static int atkbd_reconnect(struct serio *serio)
{
struct atkbd *atkbd = serio->private;
struct serio_dev *dev = serio->dev;
struct serio_driver *drv = serio->drv;
unsigned char param[1];
if (!dev) {
if (!drv) {
printk(KERN_DEBUG "atkbd: reconnect request, but serio is disconnected, ignoring...\n");
return -1;
}
......@@ -890,7 +890,7 @@ static int atkbd_reconnect(struct serio *serio)
return 0;
}
static struct serio_dev atkbd_dev = {
static struct serio_driver atkbd_drv = {
.interrupt = atkbd_interrupt,
.connect = atkbd_connect,
.reconnect = atkbd_reconnect,
......@@ -900,13 +900,13 @@ static struct serio_dev atkbd_dev = {
int __init atkbd_init(void)
{
serio_register_device(&atkbd_dev);
serio_register_driver(&atkbd_drv);
return 0;
}
void __exit atkbd_exit(void)
{
serio_unregister_device(&atkbd_dev);
serio_unregister_driver(&atkbd_drv);
}
module_init(atkbd_init);
......
......@@ -622,7 +622,7 @@ lkkbd_reinit (void *data)
* lkkbd_connect() probes for a LK keyboard and fills the necessary structures.
*/
static void
lkkbd_connect (struct serio *serio, struct serio_dev *dev)
lkkbd_connect (struct serio *serio, struct serio_driver *drv)
{
struct lkkbd *lk;
int i;
......@@ -665,7 +665,7 @@ lkkbd_connect (struct serio *serio, struct serio_dev *dev)
serio->private = lk;
if (serio_open (serio, dev)) {
if (serio_open (serio, drv)) {
kfree (lk);
return;
}
......@@ -703,7 +703,7 @@ lkkbd_disconnect (struct serio *serio)
kfree (lk);
}
static struct serio_dev lkkbd_dev = {
static struct serio_driver lkkbd_drv = {
.connect = lkkbd_connect,
.disconnect = lkkbd_disconnect,
.interrupt = lkkbd_interrupt,
......@@ -715,14 +715,14 @@ static struct serio_dev lkkbd_dev = {
int __init
lkkbd_init (void)
{
serio_register_device (&lkkbd_dev);
serio_register_driver(&lkkbd_drv);
return 0;
}
void __exit
lkkbd_exit (void)
{
serio_unregister_device (&lkkbd_dev);
serio_unregister_driver(&lkkbd_drv);
}
module_init (lkkbd_init);
......
......@@ -82,7 +82,7 @@ irqreturn_t nkbd_interrupt(struct serio *serio,
}
void nkbd_connect(struct serio *serio, struct serio_dev *dev)
void nkbd_connect(struct serio *serio, struct serio_driver *drv)
{
struct nkbd *nkbd;
int i;
......@@ -106,7 +106,7 @@ void nkbd_connect(struct serio *serio, struct serio_dev *dev)
nkbd->dev.private = nkbd;
serio->private = nkbd;
if (serio_open(serio, dev)) {
if (serio_open(serio, drv)) {
kfree(nkbd);
return;
}
......@@ -138,7 +138,7 @@ void nkbd_disconnect(struct serio *serio)
kfree(nkbd);
}
struct serio_dev nkbd_dev = {
struct serio_driver nkbd_drv = {
.interrupt = nkbd_interrupt,
.connect = nkbd_connect,
.disconnect = nkbd_disconnect
......@@ -146,13 +146,13 @@ struct serio_dev nkbd_dev = {
int __init nkbd_init(void)
{
serio_register_device(&nkbd_dev);
serio_register_driver(&nkbd_drv);
return 0;
}
void __exit nkbd_exit(void)
{
serio_unregister_device(&nkbd_dev);
serio_unregister_driver(&nkbd_drv);
}
module_init(nkbd_init);
......
......@@ -221,7 +221,7 @@ static void sunkbd_reinit(void *data)
* sunkbd_connect() probes for a Sun keyboard and fills the necessary structures.
*/
static void sunkbd_connect(struct serio *serio, struct serio_dev *dev)
static void sunkbd_connect(struct serio *serio, struct serio_driver *drv)
{
struct sunkbd *sunkbd;
int i;
......@@ -257,7 +257,7 @@ static void sunkbd_connect(struct serio *serio, struct serio_dev *dev)
serio->private = sunkbd;
if (serio_open(serio, dev)) {
if (serio_open(serio, drv)) {
kfree(sunkbd);
return;
}
......@@ -301,7 +301,7 @@ static void sunkbd_disconnect(struct serio *serio)
kfree(sunkbd);
}
static struct serio_dev sunkbd_dev = {
static struct serio_driver sunkbd_drv = {
.interrupt = sunkbd_interrupt,
.connect = sunkbd_connect,
.disconnect = sunkbd_disconnect
......@@ -313,13 +313,13 @@ static struct serio_dev sunkbd_dev = {
int __init sunkbd_init(void)
{
serio_register_device(&sunkbd_dev);
serio_register_driver(&sunkbd_drv);
return 0;
}
void __exit sunkbd_exit(void)
{
serio_unregister_device(&sunkbd_dev);
serio_unregister_driver(&sunkbd_drv);
}
module_init(sunkbd_init);
......
......@@ -86,7 +86,7 @@ irqreturn_t xtkbd_interrupt(struct serio *serio,
return IRQ_HANDLED;
}
void xtkbd_connect(struct serio *serio, struct serio_dev *dev)
void xtkbd_connect(struct serio *serio, struct serio_driver *drv)
{
struct xtkbd *xtkbd;
int i;
......@@ -111,7 +111,7 @@ void xtkbd_connect(struct serio *serio, struct serio_dev *dev)
serio->private = xtkbd;
if (serio_open(serio, dev)) {
if (serio_open(serio, drv)) {
kfree(xtkbd);
return;
}
......@@ -143,7 +143,7 @@ void xtkbd_disconnect(struct serio *serio)
kfree(xtkbd);
}
struct serio_dev xtkbd_dev = {
struct serio_driver xtkbd_drv = {
.interrupt = xtkbd_interrupt,
.connect = xtkbd_connect,
.disconnect = xtkbd_disconnect
......@@ -151,13 +151,13 @@ struct serio_dev xtkbd_dev = {
int __init xtkbd_init(void)
{
serio_register_device(&xtkbd_dev);
serio_register_driver(&xtkbd_drv);
return 0;
}
void __exit xtkbd_exit(void)
{
serio_unregister_device(&xtkbd_dev);
serio_unregister_driver(&xtkbd_drv);
}
module_init(xtkbd_init);
......
......@@ -678,7 +678,7 @@ static void psmouse_disconnect(struct serio *serio)
* psmouse_connect() is a callback from the serio module when
* an unhandled serio port is found.
*/
static void psmouse_connect(struct serio *serio, struct serio_dev *dev)
static void psmouse_connect(struct serio *serio, struct serio_driver *drv)
{
struct psmouse *psmouse;
......@@ -700,7 +700,7 @@ static void psmouse_connect(struct serio *serio, struct serio_dev *dev)
psmouse->dev.private = psmouse;
serio->private = psmouse;
if (serio_open(serio, dev)) {
if (serio_open(serio, drv)) {
kfree(psmouse);
serio->private = NULL;
return;
......@@ -753,9 +753,9 @@ static void psmouse_connect(struct serio *serio, struct serio_dev *dev)
static int psmouse_reconnect(struct serio *serio)
{
struct psmouse *psmouse = serio->private;
struct serio_dev *dev = serio->dev;
struct serio_driver *drv = serio->drv;
if (!dev || !psmouse) {
if (!drv || !psmouse) {
printk(KERN_DEBUG "psmouse: reconnect request, but serio is disconnected, ignoring...\n");
return -1;
}
......@@ -793,7 +793,7 @@ static int psmouse_reconnect(struct serio *serio)
}
static struct serio_dev psmouse_dev = {
static struct serio_driver psmouse_drv = {
.interrupt = psmouse_interrupt,
.connect = psmouse_connect,
.reconnect = psmouse_reconnect,
......@@ -818,13 +818,13 @@ static inline void psmouse_parse_proto(void)
int __init psmouse_init(void)
{
psmouse_parse_proto();
serio_register_device(&psmouse_dev);
serio_register_driver(&psmouse_drv);
return 0;
}
void __exit psmouse_exit(void)
{
serio_unregister_device(&psmouse_dev);
serio_unregister_driver(&psmouse_drv);
}
module_init(psmouse_init);
......
......@@ -237,7 +237,7 @@ static void sermouse_disconnect(struct serio *serio)
* an unhandled serio port is found.
*/
static void sermouse_connect(struct serio *serio, struct serio_dev *dev)
static void sermouse_connect(struct serio *serio, struct serio_driver *drv)
{
struct sermouse *sermouse;
unsigned char c;
......@@ -279,7 +279,7 @@ static void sermouse_connect(struct serio *serio, struct serio_dev *dev)
sermouse->dev.id.product = c;
sermouse->dev.id.version = 0x0100;
if (serio_open(serio, dev)) {
if (serio_open(serio, drv)) {
kfree(sermouse);
return;
}
......@@ -289,7 +289,7 @@ static void sermouse_connect(struct serio *serio, struct serio_dev *dev)
printk(KERN_INFO "input: %s on %s\n", sermouse_protocols[sermouse->type], serio->phys);
}
static struct serio_dev sermouse_dev = {
static struct serio_driver sermouse_drv = {
.interrupt = sermouse_interrupt,
.connect = sermouse_connect,
.disconnect = sermouse_disconnect
......@@ -297,13 +297,13 @@ static struct serio_dev sermouse_dev = {
int __init sermouse_init(void)
{
serio_register_device(&sermouse_dev);
serio_register_driver(&sermouse_drv);
return 0;
}
void __exit sermouse_exit(void)
{
serio_unregister_device(&sermouse_dev);
serio_unregister_driver(&sermouse_drv);
}
module_init(sermouse_init);
......
......@@ -470,7 +470,7 @@ static psmouse_ret_t synaptics_process_byte(struct psmouse *psmouse, struct pt_r
if (unlikely(priv->pkt_type == SYN_NEWABS))
priv->pkt_type = synaptics_detect_pkt_type(psmouse);
if (psmouse->ptport && psmouse->ptport->serio.dev && synaptics_is_pt_packet(psmouse->packet))
if (psmouse->ptport && psmouse->ptport->serio.drv && synaptics_is_pt_packet(psmouse->packet))
synaptics_pass_pt_packet(&psmouse->ptport->serio, psmouse->packet);
else
synaptics_process_packet(psmouse);
......
......@@ -482,7 +482,7 @@ vsxxxaa_disconnect (struct serio *serio)
}
static void
vsxxxaa_connect (struct serio *serio, struct serio_dev *dev)
vsxxxaa_connect (struct serio *serio, struct serio_driver *drv)
{
struct vsxxxaa *mouse;
......@@ -524,7 +524,7 @@ vsxxxaa_connect (struct serio *serio, struct serio_dev *dev)
mouse->dev.id.bustype = BUS_RS232;
mouse->serio = serio;
if (serio_open (serio, dev)) {
if (serio_open (serio, drv)) {
kfree (mouse);
return;
}
......@@ -540,7 +540,7 @@ vsxxxaa_connect (struct serio *serio, struct serio_dev *dev)
printk (KERN_INFO "input: %s on %s\n", mouse->name, mouse->phys);
}
static struct serio_dev vsxxxaa_dev = {
static struct serio_driver vsxxxaa_drv = {
.connect = vsxxxaa_connect,
.interrupt = vsxxxaa_interrupt,
.disconnect = vsxxxaa_disconnect,
......@@ -549,14 +549,14 @@ static struct serio_dev vsxxxaa_dev = {
int __init
vsxxxaa_init (void)
{
serio_register_device (&vsxxxaa_dev);
serio_register_driver(&vsxxxaa_drv);
return 0;
}
void __exit
vsxxxaa_exit (void)
{
serio_unregister_device (&vsxxxaa_dev);
serio_unregister_driver(&vsxxxaa_drv);
}
module_init (vsxxxaa_init);
......
......@@ -48,27 +48,27 @@ EXPORT_SYMBOL(__serio_register_port);
EXPORT_SYMBOL(serio_unregister_port);
EXPORT_SYMBOL(serio_unregister_port_delayed);
EXPORT_SYMBOL(__serio_unregister_port);
EXPORT_SYMBOL(serio_register_device);
EXPORT_SYMBOL(serio_unregister_device);
EXPORT_SYMBOL(serio_register_driver);
EXPORT_SYMBOL(serio_unregister_driver);
EXPORT_SYMBOL(serio_open);
EXPORT_SYMBOL(serio_close);
EXPORT_SYMBOL(serio_rescan);
EXPORT_SYMBOL(serio_reconnect);
static DECLARE_MUTEX(serio_sem); /* protects serio_list and serio_dev_list */
static DECLARE_MUTEX(serio_sem); /* protects serio_list and serio_diriver_list */
static LIST_HEAD(serio_list);
static LIST_HEAD(serio_dev_list);
static LIST_HEAD(serio_driver_list);
/* serio_find_dev() must be called with serio_sem down. */
/* serio_find_driver() must be called with serio_sem down. */
static void serio_find_dev(struct serio *serio)
static void serio_find_driver(struct serio *serio)
{
struct serio_dev *dev;
struct serio_driver *drv;
list_for_each_entry(dev, &serio_dev_list, node) {
if (serio->dev)
list_for_each_entry(drv, &serio_driver_list, node) {
if (serio->drv)
break;
dev->connect(serio, dev);
drv->connect(serio, drv);
}
}
......@@ -153,15 +153,15 @@ static void serio_handle_events(void)
break;
case SERIO_RECONNECT :
if (event->serio->dev && event->serio->dev->reconnect)
if (event->serio->dev->reconnect(event->serio) == 0)
if (event->serio->drv && event->serio->drv->reconnect)
if (event->serio->drv->reconnect(event->serio) == 0)
break;
/* reconnect failed - fall through to rescan */
case SERIO_RESCAN :
if (event->serio->dev)
event->serio->dev->disconnect(event->serio);
serio_find_dev(event->serio);
if (event->serio->drv)
event->serio->drv->disconnect(event->serio);
serio_find_driver(event->serio);
break;
default:
break;
......@@ -252,7 +252,7 @@ void __serio_register_port(struct serio *serio)
{
spin_lock_init(&serio->lock);
list_add_tail(&serio->node, &serio_list);
serio_find_dev(serio);
serio_find_driver(serio);
}
void serio_unregister_port(struct serio *serio)
......@@ -281,58 +281,58 @@ void __serio_unregister_port(struct serio *serio)
{
serio_remove_pending_events(serio);
list_del_init(&serio->node);
if (serio->dev)
serio->dev->disconnect(serio);
if (serio->drv)
serio->drv->disconnect(serio);
}
/*
* Serio device operations
* Serio driver operations
*/
void serio_register_device(struct serio_dev *dev)
void serio_register_driver(struct serio_driver *drv)
{
struct serio *serio;
down(&serio_sem);
list_add_tail(&dev->node, &serio_dev_list);
list_add_tail(&drv->node, &serio_driver_list);
list_for_each_entry(serio, &serio_list, node)
if (!serio->dev)
dev->connect(serio, dev);
if (!serio->drv)
drv->connect(serio, drv);
up(&serio_sem);
}
void serio_unregister_device(struct serio_dev *dev)
void serio_unregister_driver(struct serio_driver *drv)
{
struct serio *serio;
down(&serio_sem);
list_del_init(&dev->node);
list_del_init(&drv->node);
list_for_each_entry(serio, &serio_list, node) {
if (serio->dev == dev)
dev->disconnect(serio);
serio_find_dev(serio);
if (serio->drv == drv)
drv->disconnect(serio);
serio_find_driver(serio);
}
up(&serio_sem);
}
/* called from serio_dev->connect/disconnect methods under serio_sem */
int serio_open(struct serio *serio, struct serio_dev *dev)
/* called from serio_driver->connect/disconnect methods under serio_sem */
int serio_open(struct serio *serio, struct serio_driver *drv)
{
unsigned long flags;
spin_lock_irqsave(&serio->lock, flags);
serio->dev = dev;
serio->drv = drv;
spin_unlock_irqrestore(&serio->lock, flags);
if (serio->open && serio->open(serio)) {
spin_lock_irqsave(&serio->lock, flags);
serio->dev = NULL;
serio->drv = NULL;
spin_unlock_irqrestore(&serio->lock, flags);
return -1;
}
return 0;
}
/* called from serio_dev->connect/disconnect methods under serio_sem */
/* called from serio_driver->connect/disconnect methods under serio_sem */
void serio_close(struct serio *serio)
{
unsigned long flags;
......@@ -340,7 +340,7 @@ void serio_close(struct serio *serio)
if (serio->close)
serio->close(serio);
spin_lock_irqsave(&serio->lock, flags);
serio->dev = NULL;
serio->drv = NULL;
spin_unlock_irqrestore(&serio->lock, flags);
}
......@@ -352,8 +352,8 @@ irqreturn_t serio_interrupt(struct serio *serio,
spin_lock_irqsave(&serio->lock, flags);
if (likely(serio->dev)) {
ret = serio->dev->interrupt(serio, data, dfl, regs);
if (likely(serio->drv)) {
ret = serio->drv->interrupt(serio, data, dfl, regs);
} else {
if (!dfl) {
if ((serio->type != SERIO_8042 &&
......
......@@ -170,7 +170,7 @@ static void serport_ldisc_write_wakeup(struct tty_struct * tty)
{
struct serport *sp = (struct serport *) tty->disc_data;
serio_dev_write_wakeup(&sp->serio);
serio_drv_write_wakeup(&sp->serio);
}
/*
......
......@@ -111,7 +111,7 @@ static void gunze_disconnect(struct serio *serio)
* and if yes, registers it as an input device.
*/
static void gunze_connect(struct serio *serio, struct serio_dev *dev)
static void gunze_connect(struct serio *serio, struct serio_driver *drv)
{
struct gunze *gunze;
......@@ -142,7 +142,7 @@ static void gunze_connect(struct serio *serio, struct serio_dev *dev)
gunze->dev.id.product = 0x0051;
gunze->dev.id.version = 0x0100;
if (serio_open(serio, dev)) {
if (serio_open(serio, drv)) {
kfree(gunze);
return;
}
......@@ -156,7 +156,7 @@ static void gunze_connect(struct serio *serio, struct serio_dev *dev)
* The serio device structure.
*/
static struct serio_dev gunze_dev = {
static struct serio_driver gunze_drv = {
.interrupt = gunze_interrupt,
.connect = gunze_connect,
.disconnect = gunze_disconnect,
......@@ -168,13 +168,13 @@ static struct serio_dev gunze_dev = {
int __init gunze_init(void)
{
serio_register_device(&gunze_dev);
serio_register_driver(&gunze_drv);
return 0;
}
void __exit gunze_exit(void)
{
serio_unregister_device(&gunze_dev);
serio_unregister_driver(&gunze_drv);
}
module_init(gunze_init);
......
......@@ -373,7 +373,7 @@ static irqreturn_t h3600ts_interrupt(struct serio *serio, unsigned char data,
* new serio device. It looks whether it was registered as a H3600 touchscreen
* and if yes, registers it as an input device.
*/
static void h3600ts_connect(struct serio *serio, struct serio_dev *dev)
static void h3600ts_connect(struct serio *serio, struct serio_driver *drv)
{
struct h3600_dev *ts;
......@@ -441,7 +441,7 @@ static void h3600ts_connect(struct serio *serio, struct serio_dev *dev)
ts->dev.id.product = 0x0666; /* FIXME !!! We can ask the hardware */
ts->dev.id.version = 0x0100;
if (serio_open(serio, dev)) {
if (serio_open(serio, drv)) {
free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, ts);
free_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, ts);
kfree(ts);
......@@ -478,7 +478,7 @@ static void h3600ts_disconnect(struct serio *serio)
* The serio device structure.
*/
static struct serio_dev h3600ts_dev = {
static struct serio_driver h3600ts_drv = {
.interrupt = h3600ts_interrupt,
.connect = h3600ts_connect,
.disconnect = h3600ts_disconnect,
......@@ -490,13 +490,13 @@ static struct serio_dev h3600ts_dev = {
static int __init h3600ts_init(void)
{
serio_register_device(&h3600ts_dev);
serio_register_driver(&h3600ts_drv);
return 0;
}
static void __exit h3600ts_exit(void)
{
serio_unregister_device(&h3600ts_dev);
serio_unregister_driver(&h3600ts_drv);
}
module_init(h3600ts_init);
......
......@@ -39,19 +39,19 @@ struct serio {
int (*open)(struct serio *);
void (*close)(struct serio *);
struct serio_dev *dev; /* Accessed from interrupt, writes must be protected by serio_lock */
struct serio_driver *drv; /* Accessed from interrupt, writes must be protected by serio_lock */
struct list_head node;
};
struct serio_dev {
struct serio_driver {
void *private;
char *name;
void (*write_wakeup)(struct serio *);
irqreturn_t (*interrupt)(struct serio *, unsigned char,
unsigned int, struct pt_regs *);
void (*connect)(struct serio *, struct serio_dev *dev);
void (*connect)(struct serio *, struct serio_driver *drv);
int (*reconnect)(struct serio *);
void (*disconnect)(struct serio *);
void (*cleanup)(struct serio *);
......@@ -59,7 +59,7 @@ struct serio_dev {
struct list_head node;
};
int serio_open(struct serio *serio, struct serio_dev *dev);
int serio_open(struct serio *serio, struct serio_driver *drv);
void serio_close(struct serio *serio);
void serio_rescan(struct serio *serio);
void serio_reconnect(struct serio *serio);
......@@ -71,8 +71,8 @@ void __serio_register_port(struct serio *serio);
void serio_unregister_port(struct serio *serio);
void serio_unregister_port_delayed(struct serio *serio);
void __serio_unregister_port(struct serio *serio);
void serio_register_device(struct serio_dev *dev);
void serio_unregister_device(struct serio_dev *dev);
void serio_register_driver(struct serio_driver *drv);
void serio_unregister_driver(struct serio_driver *drv);
static __inline__ int serio_write(struct serio *serio, unsigned char data)
{
......@@ -82,16 +82,16 @@ static __inline__ int serio_write(struct serio *serio, unsigned char data)
return -1;
}
static __inline__ void serio_dev_write_wakeup(struct serio *serio)
static __inline__ void serio_drv_write_wakeup(struct serio *serio)
{
if (serio->dev && serio->dev->write_wakeup)
serio->dev->write_wakeup(serio);
if (serio->drv && serio->drv->write_wakeup)
serio->drv->write_wakeup(serio);
}
static __inline__ void serio_cleanup(struct serio *serio)
{
if (serio->dev && serio->dev->cleanup)
serio->dev->cleanup(serio);
if (serio->drv && serio->drv->cleanup)
serio->drv->cleanup(serio);
}
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment