linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2.6] 1/3 Serio: claim serio early
@ 2003-08-23  6:31 Dmitry Torokhov
  2003-08-25 10:27 ` Vojtech Pavlik
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Torokhov @ 2003-08-23  6:31 UTC (permalink / raw)
  To: linux-kernel; +Cc: Vojtech Pavlik

Hi, 

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.

What you think about the patch below?

Dmitry

diff -urN --exclude-from=/usr/src/exclude 2.6.0-test4/drivers/input/serio/serio.c linux-2.6.0-test4/drivers/input/serio/serio.c
--- 2.6.0-test4/drivers/input/serio/serio.c	2003-08-22 21:53:29.000000000 -0500
+++ linux-2.6.0-test4/drivers/input/serio/serio.c	2003-08-22 22:58:37.000000000 -0500
@@ -204,9 +204,11 @@
 /* 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;
 }
 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-08-25 10:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-23  6:31 [PATCH 2.6] 1/3 Serio: claim serio early Dmitry Torokhov
2003-08-25 10:27 ` Vojtech Pavlik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).