Commit 8fb49538 authored by Dmitry Torokhov's avatar Dmitry Torokhov Committed by Vojtech Pavlik

Input: make serio implementation more in line with standard

       driver model implementations. serio_register_port is
       always asynchronous to allow freely registering child
       ports. When deregistering serio core still takes care
       of destroying children ports first.
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
Signed-off-by: default avatarVojtech Pavlik <vojtech@suse.cz>
parent e122050f
......@@ -694,6 +694,7 @@ static void psmouse_connect(struct serio *serio, struct serio_driver *drv)
memset(psmouse, 0, sizeof(struct psmouse));
ps2_init(&psmouse->ps2dev, serio);
sprintf(psmouse->phys, "%s/input0", serio->phys);
psmouse->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REL);
psmouse->dev.keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);
psmouse->dev.relbit[0] = BIT(REL_X) | BIT(REL_Y);
......@@ -729,8 +730,6 @@ static void psmouse_connect(struct serio *serio, struct serio_driver *drv)
sprintf(psmouse->devname, "%s %s %s",
psmouse_protocols[psmouse->type], psmouse->vendor, psmouse->name);
sprintf(psmouse->phys, "%s/input0",
serio->phys);
psmouse->dev.name = psmouse->devname;
psmouse->dev.phys = psmouse->phys;
......@@ -754,14 +753,6 @@ static void psmouse_connect(struct serio *serio, struct serio_driver *drv)
device_create_file(&serio->dev, &psmouse_attr_resolution);
device_create_file(&serio->dev, &psmouse_attr_resetafter);
if (serio->child) {
/*
* Nothing to be done here, serio core will detect that
* the driver set serio->child and will register it for us.
*/
printk(KERN_INFO "serio: %s port at %s\n", serio->child->name, psmouse->phys);
}
psmouse_activate(psmouse);
out:
......
......@@ -296,7 +296,8 @@ static void synaptics_pt_create(struct psmouse *psmouse)
psmouse->pt_activate = synaptics_pt_activate;
psmouse->ps2dev.serio->child = serio;
printk(KERN_INFO "serio: %s port at %s\n", serio->name, psmouse->phys);
serio_register_port(serio);
}
/*****************************************************************************
......@@ -552,6 +553,7 @@ static void synaptics_disconnect(struct psmouse *psmouse)
{
synaptics_reset(psmouse);
kfree(psmouse->private);
psmouse->private = NULL;
}
static int synaptics_reconnect(struct psmouse *psmouse)
......@@ -640,9 +642,6 @@ int synaptics_init(struct psmouse *psmouse)
priv->pkt_type = SYN_MODEL_NEWABS(priv->model_id) ? SYN_NEWABS : SYN_OLDABS;
if (SYN_CAP_PASS_THROUGH(priv->capabilities))
synaptics_pt_create(psmouse);
print_ident(priv);
set_input_params(&psmouse->dev, priv);
......@@ -652,6 +651,9 @@ int synaptics_init(struct psmouse *psmouse)
psmouse->reconnect = synaptics_reconnect;
psmouse->pktsize = 6;
if (SYN_CAP_PASS_THROUGH(priv->capabilities))
synaptics_pt_create(psmouse);
#if defined(__i386__)
/*
* Toshiba's KBC seems to have trouble handling data from
......
This diff is collapsed.
......@@ -51,6 +51,7 @@ struct serio {
struct semaphore drv_sem; /* protects serio->drv so attributes can pin driver */
struct device dev;
unsigned int registered; /* port has been fully registered with driver core */
struct list_head node;
};
......@@ -72,8 +73,6 @@ struct serio_driver {
void (*cleanup)(struct serio *);
struct device_driver driver;
struct list_head node;
};
#define to_serio_driver(d) container_of(d, struct serio_driver, driver)
......@@ -83,10 +82,18 @@ void serio_rescan(struct serio *serio);
void serio_reconnect(struct serio *serio);
irqreturn_t serio_interrupt(struct serio *serio, unsigned char data, unsigned int flags, struct pt_regs *regs);
void serio_register_port(struct serio *serio);
void serio_register_port_delayed(struct serio *serio);
void __serio_register_port(struct serio *serio, struct module *owner);
static inline void serio_register_port(struct serio *serio)
{
__serio_register_port(serio, THIS_MODULE);
}
void serio_unregister_port(struct serio *serio);
void serio_unregister_port_delayed(struct serio *serio);
void __serio_unregister_port_delayed(struct serio *serio, struct module *owner);
static inline void serio_unregister_port_delayed(struct serio *serio)
{
__serio_unregister_port_delayed(serio, THIS_MODULE);
}
void serio_register_driver(struct serio_driver *drv);
void serio_unregister_driver(struct serio_driver *drv);
......
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