public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vojtech Pavlik <vojtech@suse.cz>
To: Dmitry Torokhov <dtor_core@ameritech.net>
Cc: Vojtech Pavlik <vojtech@suse.de>,
	David Fries <dfries@mail.win.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Linux joydev joystick disconnect patch 2.6.11-rc2
Date: Mon, 7 Feb 2005 13:20:33 +0100	[thread overview]
Message-ID: <20050207122033.GA16959@ucw.cz> (raw)
In-Reply-To: <200502062021.13726.dtor_core@ameritech.net>

On Sun, Feb 06, 2005 at 08:21:13PM -0500, Dmitry Torokhov wrote:
> > > Opening braces should go on the same line as the statement (if (...) {).
> >  
> > How about this patch?
> 
> Looks fine now. Hmm, wait a sec... Don't we also need kill_fasync calls in
> disconnect routines as well?

This should do it:


ChangeSet@1.2130, 2005-02-07 13:19:59+01:00, vojtech@suse.cz
  input: Do a kill_fasync() in input handlers on device disconnect
         to notify a client using poll() that the device is gone.
  
  Signed-off-by: Vojtech Pavlik <vojtech@suse.cz>


 evdev.c    |    3 +++
 joydev.c   |    3 +++
 mousedev.c |    3 +++
 tsdev.c    |    3 +++
 4 files changed, 12 insertions(+)


diff -Nru a/drivers/input/evdev.c b/drivers/input/evdev.c
--- a/drivers/input/evdev.c	2005-02-07 13:20:15 +01:00
+++ b/drivers/input/evdev.c	2005-02-07 13:20:15 +01:00
@@ -440,6 +440,7 @@
 static void evdev_disconnect(struct input_handle *handle)
 {
 	struct evdev *evdev = handle->private;
+	struct evdev_list *list;
 
 	class_simple_device_remove(MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + evdev->minor));
 	devfs_remove("input/event%d", evdev->minor);
@@ -448,6 +449,8 @@
 	if (evdev->open) {
 		input_close_device(handle);
 		wake_up_interruptible(&evdev->wait);
+		list_for_each_entry(list, &evdev->list, node)
+			kill_fasync(&list->fasync, SIGIO, POLLHUP | POLLERR);
 	} else
 		evdev_free(evdev);
 }
diff -Nru a/drivers/input/joydev.c b/drivers/input/joydev.c
--- a/drivers/input/joydev.c	2005-02-07 13:20:15 +01:00
+++ b/drivers/input/joydev.c	2005-02-07 13:20:15 +01:00
@@ -462,6 +462,7 @@
 static void joydev_disconnect(struct input_handle *handle)
 {
 	struct joydev *joydev = handle->private;
+	struct joydev_list *list;
 
 	class_simple_device_remove(MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + joydev->minor));
 	devfs_remove("input/js%d", joydev->minor);
@@ -470,6 +471,8 @@
 	if (joydev->open) {
 		input_close_device(handle);
 		wake_up_interruptible(&joydev->wait);
+		list_for_each_entry(list, &joydev->list, node)
+			kill_fasync(&list->fasync, SIGIO, POLLHUP | POLLERR);
 	} else
 		joydev_free(joydev);
 }
diff -Nru a/drivers/input/mousedev.c b/drivers/input/mousedev.c
--- a/drivers/input/mousedev.c	2005-02-07 13:20:15 +01:00
+++ b/drivers/input/mousedev.c	2005-02-07 13:20:15 +01:00
@@ -652,6 +652,7 @@
 static void mousedev_disconnect(struct input_handle *handle)
 {
 	struct mousedev *mousedev = handle->private;
+	struct mousedev_list *list;
 
 	class_simple_device_remove(MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + mousedev->minor));
 	devfs_remove("input/mouse%d", mousedev->minor);
@@ -660,6 +661,8 @@
 	if (mousedev->open) {
 		input_close_device(handle);
 		wake_up_interruptible(&mousedev->wait);
+		list_for_each_entry(list, &mousedev->list, node)
+			kill_fasync(&list->fasync, SIGIO, POLLHUP | POLLERR);
 	} else {
 		if (mousedev_mix.open)
 			input_close_device(handle);
diff -Nru a/drivers/input/tsdev.c b/drivers/input/tsdev.c
--- a/drivers/input/tsdev.c	2005-02-07 13:20:15 +01:00
+++ b/drivers/input/tsdev.c	2005-02-07 13:20:15 +01:00
@@ -424,6 +424,7 @@
 static void tsdev_disconnect(struct input_handle *handle)
 {
 	struct tsdev *tsdev = handle->private;
+	struct tsdev_list *list;
 
 	class_simple_device_remove(MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + tsdev->minor));
 	devfs_remove("input/ts%d", tsdev->minor);
@@ -433,6 +434,8 @@
 	if (tsdev->open) {
 		input_close_device(handle);
 		wake_up_interruptible(&tsdev->wait);
+		list_for_each_entry(list, &tsdev->list, node)
+			kill_fasync(&list->fasync, SIGIO, POLLHUP | POLLERR);
 	} else
 		tsdev_free(tsdev);
 }

-- 
Vojtech Pavlik
SuSE Labs, SuSE CR

  parent reply	other threads:[~2005-02-07 12:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20041123212813.GA3196@spacedout.fries.net>
2005-02-01 14:52 ` [PATCH] Linux joydev joystick disconnect patch 2.6.11-rc2 David Fries
2005-02-01 15:24   ` Dmitry Torokhov
2005-02-06 13:12     ` Vojtech Pavlik
2005-02-07  1:21       ` Dmitry Torokhov
2005-02-07  6:59         ` Vojtech Pavlik
2005-02-07 12:20         ` Vojtech Pavlik [this message]
2005-02-07 14:22           ` Dmitry Torokhov
2005-02-07 18:51             ` Vojtech Pavlik
2005-02-08 15:29           ` David Fries

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=20050207122033.GA16959@ucw.cz \
    --to=vojtech@suse.cz \
    --cc=dfries@mail.win.org \
    --cc=dtor_core@ameritech.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vojtech@suse.de \
    /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