diff mbox

[media] em28xx-audio: flush work at .fini

Message ID 1389717879-24939-1-git-send-email-m.chehab@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mauro Carvalho Chehab Jan. 14, 2014, 4:44 p.m. UTC
As a pending action might be still there at the work
thread, flush it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
---
 drivers/media/usb/em28xx/em28xx-audio.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Frank Schäfer Jan. 15, 2014, 9:21 p.m. UTC | #1
Am 14.01.2014 17:44, schrieb Mauro Carvalho Chehab:
> As a pending action might be still there at the work
> thread, flush it.
>
> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
> ---
>  drivers/media/usb/em28xx/em28xx-audio.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/media/usb/em28xx/em28xx-audio.c b/drivers/media/usb/em28xx/em28xx-audio.c
> index 74575e0ed41b..1563f71a5ea2 100644
> --- a/drivers/media/usb/em28xx/em28xx-audio.c
> +++ b/drivers/media/usb/em28xx/em28xx-audio.c
> @@ -967,6 +967,8 @@ static int em28xx_audio_fini(struct em28xx *dev)
>  	em28xx_info("Closing audio extension");
>  
>  	snd_card_disconnect(dev->adev.sndcard);
> +	flush_work(&dev->wq_trigger);
> +
>  	em28xx_audio_free_urb(dev);
>  
>  	if (dev->adev.sndcard) {
audio_trigger() doesn't re-schedule the work and flush_work() waits
until the current work is finished.

No, wait ! You are calling flush_work here for synchronization, right ?
That makes sense, but you should update the patch description. ;)


--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/media/usb/em28xx/em28xx-audio.c b/drivers/media/usb/em28xx/em28xx-audio.c
index 74575e0ed41b..1563f71a5ea2 100644
--- a/drivers/media/usb/em28xx/em28xx-audio.c
+++ b/drivers/media/usb/em28xx/em28xx-audio.c
@@ -967,6 +967,8 @@  static int em28xx_audio_fini(struct em28xx *dev)
 	em28xx_info("Closing audio extension");
 
 	snd_card_disconnect(dev->adev.sndcard);
+	flush_work(&dev->wq_trigger);
+
 	em28xx_audio_free_urb(dev);
 
 	if (dev->adev.sndcard) {