Re: [PATCH] Linux joydev joystick disconnect patch 2.6.11-rc2
From: Dmitry Torokhov
Date: Sun Feb 06 2005 - 20:23:26 EST
On Sunday 06 February 2005 08:12, Vojtech Pavlik wrote:
> On Tue, Feb 01, 2005 at 10:24:39AM -0500, Dmitry Torokhov wrote:
> > On Tue, 1 Feb 2005 08:52:15 -0600, David Fries <dfries@xxxxxxxxxxxx> wrote:
> > > Currently a blocking read, select, or poll call will not return if a
> > > joystick device is unplugged. This patch allows them to return.
> > >
> > ...
> > > static unsigned int joydev_poll(struct file *file, poll_table *wait)
> > > {
> > > + int mask = 0;
> > > struct joydev_list *list = file->private_data;
> > > poll_wait(file, &list->joydev->wait, wait);
> > > - if (list->head != list->tail || list->startup < list->joydev->nabs + list->joydev->nkey)
> > > - return POLLIN | POLLRDNORM;
> > > - return 0;
> > > + if(!list->joydev->exist)
> > > + mask |= POLLERR;
> >
> > Probably need POLLHUP in addition (or instead of POLLERR).
> >
> > > if (joydev->open)
> > > + {
> > > input_close_device(handle);
> > > + wake_up_interruptible(&joydev->wait);
> > > + }
> > > else
> > > + {
> > > joydev_free(joydev);
> > > + }
> >
> > 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?
--
Dmitry
-
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/