From: Dmitry Torokhov <dtor_core@ameritech.net>

I think that serio_dev in serio_open should claim serio before calling
"open" function as it has already been decided that (in case of success)
this serio belongs to that serio_dev.  Otherwise it might try to find an
owner on its own, like i8042 module that calls serio_interrupt which in
turn will do serio_rescan.  From that point on 2 instances may start
fighting over the same serio.



 25-akpm/drivers/input/serio/serio.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff -puN drivers/input/serio/serio.c~claim-serio-early drivers/input/serio/serio.c
--- 25/drivers/input/serio/serio.c~claim-serio-early	Mon Aug 25 13:02:40 2003
+++ 25-akpm/drivers/input/serio/serio.c	Mon Aug 25 13:02:40 2003
@@ -204,9 +204,11 @@ void serio_unregister_device(struct seri
 /* called from serio_dev->connect/disconnect methods under serio_sem */
 int serio_open(struct serio *serio, struct serio_dev *dev)
 {
-	if (serio->open(serio))
-		return -1;
 	serio->dev = dev;
+	if (serio->open(serio)) {
+		serio->dev = NULL;
+		return -1;
+	}
 	return 0;
 }
 

_