On Wed, 3 Sep 2014, Dylan Alex Simon wrote: > > Alright, this supports my original hunch. I think I see the race. Could > > you please try the patch below? Thanks. > > > > > > > > > > diff --git a/drivers/hid/hid-thingm.c b/drivers/hid/hid-thingm.c > > index 134be89..743a517 100644 > > --- a/drivers/hid/hid-thingm.c > > +++ b/drivers/hid/hid-thingm.c > > @@ -208,7 +208,7 @@ unregister_red: > > > > static void thingm_remove_rgb(struct thingm_rgb *rgb) > > { > > - flush_work(&rgb->work); > > + cancel_work_sync(&rgb->work); > > led_classdev_unregister(&rgb->red.ldev); > > led_classdev_unregister(&rgb->green.ldev); > > led_classdev_unregister(&rgb->blue.ldev); > > Same problem (only rmmod this time, no write error, but still > doesn't happen every time): I sent you wrong version of the patch, sorry for that. Could you please try the one below instead? diff --git a/drivers/hid/hid-thingm.c b/drivers/hid/hid-thingm.c index 134be89..dffc50d 100644 --- a/drivers/hid/hid-thingm.c +++ b/drivers/hid/hid-thingm.c @@ -208,7 +208,7 @@ unregister_red: static void thingm_remove_rgb(struct thingm_rgb *rgb) { - flush_work(&rgb->work); + cancel_work_sync(&rgb->work); led_classdev_unregister(&rgb->red.ldev); led_classdev_unregister(&rgb->green.ldev); led_classdev_unregister(&rgb->blue.ldev); @@ -286,10 +286,10 @@ static void thingm_remove(struct hid_device *hdev) struct thingm_device *tdev = hid_get_drvdata(hdev); int i; + hid_hw_stop(hdev); + for (i = 0; i < tdev->fwinfo->numrgb; ++i) thingm_remove_rgb(tdev->rgb + i); - - hid_hw_stop(hdev); } static const struct hid_device_id thingm_table[] = { > -- Jiri Kosina SUSE Labs -- 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