Re: power management for usb_hci
Marcel Holtmann <[email protected]>
| Newsgroups | gmane.linux.usb.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Oliver,
> > > Will you post code?
> >
> > http://git.infradead.org/?p=users/holtmann/bluetooth-drivers.git;a=summary
> >
> > Look for the the btusb.ko driver.
>
> +static int btusb_open(struct hci_dev *hdev)
> +{
> + struct btusb_data *data = hdev->driver_data;
> + int err;
> +
> + BT_DBG("%s", hdev->name);
> +
> + if (test_and_set_bit(HCI_RUNNING, &hdev->flags))
> + return 0;
> +
> + if (test_and_set_bit(BTUSB_INTR_RUNNING, &data->flags))
> + return 0;
> +
> + err = btusb_submit_intr_urb(hdev);
> + if (err < 0) {
> + clear_bit(BTUSB_INTR_RUNNING, &hdev->flags);
> + clear_bit(HCI_RUNNING, &hdev->flags);
> + }
> +
> + return err;
> +}
>
> That's a race. Furthermore, if btusb_submit_intr_urb() fails, you'll have
> a second open suceeding without a running urb.
that is totally complicated actually since _open() can only start
interrupt URBs anyway. No need to protect against running interrupt URBs
at that point.
Regards
Marcel
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel