On Sun, Aug 14, 2011 at 12:55 PM, Oliver Neukum <oliver@xxxxxxxxxx> wrote: > Am Samstag, 13. August 2011, 15:29:09 schrieb David Herrmann: >> @@ -362,6 +343,15 @@ static struct wiimote_data *wiimote_create(struct hid_device *hdev) >> >> static void wiimote_destroy(struct wiimote_data *wdata) >> { >> + device_remove_file(&wdata->hdev->dev, &dev_attr_led1); >> + device_remove_file(&wdata->hdev->dev, &dev_attr_led2); >> + device_remove_file(&wdata->hdev->dev, &dev_attr_led3); >> + device_remove_file(&wdata->hdev->dev, &dev_attr_led4); >> + >> + input_unregister_device(wdata->input); >> + hid_hw_stop(wdata->hdev); >> + >> + cancel_work_sync(&wdata->worker); >> kfree(wdata); >> } > > This looks like the work can run on a device whose hardware has already been > stopped. Is this safe? With bthid this is safe, although not very nice. usbhid does not allow this so I will swap the cancel_work_sync() and hid_hw_stop() calls so I do not depend on special bthid behaviour. Nice catch, thanks. > Regards > Oliver > Regards David -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html