mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Benjamin Valentin <benpicco@zedat.fu-berlin.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drivers/input/joystick/xpad.c: Add rumble support for original xbox controller
Date: Sun, 10 Jan 2010 11:56:41 -0800	[thread overview]
Message-ID: <20100110195641.GA27553@core.coreip.homeip.net> (raw)
In-Reply-To: <20100110191112.5c66dc94@rechenknecht2k7>

On Sun, Jan 10, 2010 at 07:11:12PM +0100, Benjamin Valentin wrote:
> On Sat, 9 Jan 2010 23:56:16 -0800
> Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:
> 
> > > --- /usr/src/linux-source-2.6.33/drivers/input/joystick/xpad.c
> > > 2010-01-08 02:56:59.365851076 +0100 +++ xpad.c	2010-01-08
> > > 03:13:38.477835651 +0100 @@ -505,7 +505,7 @@
> > >  	struct usb_endpoint_descriptor *ep_irq_out;
> > >  	int error = -ENOMEM;
> > >  
> > > -	if (xpad->xtype != XTYPE_XBOX360)
> > > +	if (xpad->xtype != XTYPE_XBOX360 && xpad->xtype !=
> > > XTYPE_XBOX) return 0;
> > >  
> > >  	xpad->odata = usb_buffer_alloc(xpad->udev, XPAD_PKT_LEN,
> > > @@ -535,13 +535,13 @@
> > >  
> > >  static void xpad_stop_output(struct usb_xpad *xpad)
> > >  {
> > > -	if (xpad->xtype == XTYPE_XBOX360)
> > > +	if (xpad->xtype == XTYPE_XBOX360 || xpad->xtype !=
> > > XTYPE_XBOX)
> > 
> > This should cretainly be "... || xpad->xtype == XTYPE_XBOX)", I'll fix
> > it up locally.
> 
> Thank you, this made me discover another bug that eventually leads to a
> kernel oops when the device is unplugged while an effect is playing
> (or the effect is somehow else interrupted).
> This should be fixed by taking the mutex when modifying xpad->odata as
> well as checking whether it has been freed before writing to it.
> 

No, you may not take mutex in xpad_play_effect because it is called with
interrupts off and dev->event_lock spinlock held. We probably need a
workqueue-based solution to queue play requests and ensure that 2
different requests do not "step" on each other.

-- 
Dmitry

  reply	other threads:[~2010-01-10 19:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-08  2:32 Benjamin Valentin
2010-01-08  7:50 ` Dmitry Torokhov
2010-01-08 10:26   ` Benjamin Valentin
2010-01-10  7:56     ` Dmitry Torokhov
2010-01-10 18:11       ` Benjamin Valentin
2010-01-10 19:56         ` Dmitry Torokhov [this message]
2010-01-10 20:48           ` Benjamin Valentin
2010-01-13 21:31           ` Benjamin Valentin

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=20100110195641.GA27553@core.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=benpicco@zedat.fu-berlin.de \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®