Commit 0769514a authored by Dmitry Torokhov's avatar Dmitry Torokhov Committed by Vojtech Pavlik

Input: add serio->start() and serio->stop() callback methods that

       are called whenever serio port is finishes being registered
       or unregistered. The callbacks are useful for drivers that
       share interrupt between several ports and there is a danger
       that interrupt handler will reference port that was just
       unregistered.
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
Signed-off-by: default avatarVojtech Pavlik <vojtech@suse.cz>
parent 0416dfc6
......@@ -326,7 +326,10 @@ static void serio_create_port(struct serio *serio)
serio->dev.release = serio_release_port;
if (serio->parent)
serio->dev.parent = &serio->parent->dev;
device_register(&serio->dev);
device_initialize(&serio->dev);
if (serio->start)
serio->start(serio);
device_add(&serio->dev);
}
/*
......@@ -349,6 +352,9 @@ static void serio_destroy_port(struct serio *serio)
put_driver(&drv->driver);
}
if (serio->stop)
serio->stop(serio);
if (serio->parent) {
spin_lock_irqsave(&serio->parent->lock, flags);
serio->parent->child = NULL;
......
......@@ -42,6 +42,8 @@ struct serio {
int (*write)(struct serio *, unsigned char);
int (*open)(struct serio *);
void (*close)(struct serio *);
int (*start)(struct serio *);
void (*stop)(struct serio *);
struct serio *parent, *child;
......
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