[PATCH 2/16] Add serio start and stop methods

Dmitry Torokhov
2004-12-29T07:36:20Z

===================================================================

ChangeSet@1.1957.1.29, 2004-11-12 01:25:01-05:00, dtor_core@ameritech.net
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: Dmitry Torokhov <dtor@mail.ru>

drivers/input/serio/serio.c | 8 +++++++-
include/linux/serio.h | 2 ++
2 files changed, 9 insertions(+), 1 deletion(-)

===================================================================

diff -Nru a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
--- a/drivers/input/serio/serio.c 2004-12-29 01:46:30 -05:00
+++ b/drivers/input/serio/serio.c 2004-12-29 01:46:30 -05:00
@@ -328,7 +328,10 @@
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);
}

/*
@@ -350,6 +353,9 @@
up_write(&serio_bus.subsys.rwsem);
put_driver(&drv->driver);
}
+
+ if (serio->stop)
+ serio->stop(serio);

if (serio->parent) {
spin_lock_irqsave(&serio->parent->lock, flags);
diff -Nru a/include/linux/serio.h b/include/linux/serio.h
--- a/include/linux/serio.h 2004-12-29 01:46:30 -05:00
+++ b/include/linux/serio.h 2004-12-29 01:46:30 -05:00
@@ -42,6 +42,8 @@
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;