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

From: Dmitry Torokhov
Date: Wed Dec 29 2004 - 02:41:32 EST



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


ChangeSet@xxxxxxxxxxx, 2004-11-12 01:25:01-05:00, dtor_core@xxxxxxxxxxxxx
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@xxxxxxx>


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;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/