linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dylan Alex Simon <dylan-kernel@dylex.net>
To: Jiri Kosina <jkosina@suse.cz>
Cc: Benjamin Tissoires <benjamin.tissoires@gmail.com>,
	linux-input@vger.kernel.org
Subject: Re: hid-thingm: kernel panic on remove
Date: Wed, 3 Sep 2014 10:16:01 -0400	[thread overview]
Message-ID: <20140903141601.GA1866@datura.dylex.net> (raw)
In-Reply-To: <alpine.LNX.2.00.1409031509070.12309@pobox.suse.cz>

> Hrm, what we really want is to first destroy the LED interface, otherwise 
> someone might have re-queued the workqueue through thingm_led_set() after 
> it has been flushed / cancelled already.
> 
> Could you please give it one more shot with the patch below? Thanks for 
> your prompt testing.
> 
> 
> diff --git a/drivers/hid/hid-thingm.c b/drivers/hid/hid-thingm.c
> index 134be89..3d8cf5e 100644
> --- a/drivers/hid/hid-thingm.c
> +++ b/drivers/hid/hid-thingm.c
> @@ -208,10 +208,10 @@ unregister_red:
>  
>  static void thingm_remove_rgb(struct thingm_rgb *rgb)
>  {
> -	flush_work(&rgb->work);
>  	led_classdev_unregister(&rgb->red.ldev);
>  	led_classdev_unregister(&rgb->green.ldev);
>  	led_classdev_unregister(&rgb->blue.ldev);
> +	cancel_work_sync(&rgb->work);
>  }
>  
>  static int thingm_probe(struct hid_device *hdev, const struct hid_device_id *id)
> @@ -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[] = {
> 

I think that did the trick.  I've run through the whole cycle about 20 times
in various conditions, and it seems solid so far.  Thanks!

  reply	other threads:[~2014-09-03 14:16 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-02 17:46 hid-thingm: kernel panic on remove Dylan Alex Simon
2014-09-02 19:58 ` Benjamin Tissoires
2014-09-02 20:12   ` Dylan Alex Simon
2014-09-02 21:32   ` Jiri Kosina
2014-09-03  2:35     ` Dylan Alex Simon
2014-09-03  7:29       ` Jiri Kosina
2014-09-03  8:17         ` Dylan Alex Simon
2014-09-03  8:21           ` Jiri Kosina
2014-09-03 13:03             ` Dylan Alex Simon
2014-09-03 13:10               ` Jiri Kosina
2014-09-03 14:16                 ` Dylan Alex Simon [this message]
2014-09-03 14:37                   ` Jiri Kosina
2014-09-04  1:05                     ` Dylan Alex Simon
2014-09-04  7:02                       ` [PATCH] HID: thingm: fix workqueue race " Jiri Kosina
2014-09-03 19:48   ` hid-thingm: kernel panic " Benjamin Tissoires
2014-09-03 21:47     ` Jiri Kosina

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=20140903141601.GA1866@datura.dylex.net \
    --to=dylan-kernel@dylex.net \
    --cc=benjamin.tissoires@gmail.com \
    --cc=jkosina@suse.cz \
    --cc=linux-input@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;
as well as URLs for NNTP newsgroup(s).