Re: [PATCH 001/002] linux-input: bcm5974-0.31: fixed resourceleak, removed work struct, device data struct introduced

From: Henrik Rydberg
Date: Thu Jul 03 2008 - 12:34:43 EST


On Tue, 2008-07-01 at 15:59 -0700, Andrew Morton wrote:
> > + }
> > +
> > + button = data[1];
> > +
> > + /* only report button state changes */
> > + if (button != dev->bt_state) {
> > + input_report_key(dev->input, BTN_LEFT, button);
> > + input_sync(dev->input);
> > + }
> > +
> > + dev->bt_state = button;
> > +
> > + exit:
> > + retval = usb_submit_urb(dev->bt_urb, GFP_ATOMIC);
>
> GFP_ATOMIC is a red flag. Is this quite unrelaible allocation mode
> really needed here?

Being new to kernel work, I rely a lot on how other drivers work.
However, doing some reading, these are my observations:

* The URB works in interrupt mode.

* The call to usb_submit_urb above is within a completion handler.

* From what I read on kerneltrap (2.6.22), such URBs should be
resubmitted using the ATOMIC method. Maybe this changed, I could not
tell.

* Personally, I am starting to worry about concurrency races, with the
two URBs writing to the same input device. I suppose it depends on
whether they are issued on the same interrupt or not? Spin locks?

Best regards,
Henrik Rydberg


--
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/