linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dtor_core@ameritech.net>
To: linux-kernel@vger.kernel.org
Cc: Vojtech Pavlik <vojtech@suse.cz>
Subject: [PATCH 2.6] 1/3 Serio: claim serio early
Date: Sat, 23 Aug 2003 01:31:50 -0500	[thread overview]
Message-ID: <200308230131.50388.dtor_core@ameritech.net> (raw)

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;
 }
 


             reply	other threads:[~2003-08-23  6:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-23  6:31 Dmitry Torokhov [this message]
2003-08-25 10:27 ` [PATCH 2.6] 1/3 Serio: claim serio early Vojtech Pavlik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200308230131.50388.dtor_core@ameritech.net \
    --to=dtor_core@ameritech.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vojtech@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).