diff mbox

[v1,43/49] media: usb: em28xx: prepare for enabling irq in complete()

Message ID 1376756714-25479-44-git-send-email-ming.lei@canonical.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ming Lei Aug. 17, 2013, 4:25 p.m. UTC
Complete() will be run with interrupt enabled, so add local_irq_save()
before acquiring the lock without irqsave().

Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: linux-media@vger.kernel.org
Signed-off-by: Ming Lei <ming.lei@canonical.com>
---
 drivers/media/usb/em28xx/em28xx-audio.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Hans Verkuil Aug. 22, 2013, 12:24 p.m. UTC | #1
On Sat 17 August 2013 18:25:08 Ming Lei wrote:
> Complete() will be run with interrupt enabled, so add local_irq_save()
> before acquiring the lock without irqsave().
> 
> Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
> Cc: linux-media@vger.kernel.org
> Signed-off-by: Ming Lei <ming.lei@canonical.com>

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>

Regards,

	Hans

> ---
>  drivers/media/usb/em28xx/em28xx-audio.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/usb/em28xx/em28xx-audio.c b/drivers/media/usb/em28xx/em28xx-audio.c
> index 2fdb66e..7fd1b2a 100644
> --- a/drivers/media/usb/em28xx/em28xx-audio.c
> +++ b/drivers/media/usb/em28xx/em28xx-audio.c
> @@ -113,6 +113,7 @@ static void em28xx_audio_isocirq(struct urb *urb)
>  		stride = runtime->frame_bits >> 3;
>  
>  		for (i = 0; i < urb->number_of_packets; i++) {
> +			unsigned long flags;
>  			int length =
>  			    urb->iso_frame_desc[i].actual_length / stride;
>  			cp = (unsigned char *)urb->transfer_buffer +
> @@ -134,7 +135,7 @@ static void em28xx_audio_isocirq(struct urb *urb)
>  				       length * stride);
>  			}
>  
> -			snd_pcm_stream_lock(substream);
> +			snd_pcm_stream_lock_irqsave(substream, flags);
>  
>  			dev->adev.hwptr_done_capture += length;
>  			if (dev->adev.hwptr_done_capture >=
> @@ -150,7 +151,7 @@ static void em28xx_audio_isocirq(struct urb *urb)
>  				period_elapsed = 1;
>  			}
>  
> -			snd_pcm_stream_unlock(substream);
> +			snd_pcm_stream_unlock_irqrestore(substream, flags);
>  		}
>  		if (period_elapsed)
>  			snd_pcm_period_elapsed(substream);
> 
--
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 2fdb66e..7fd1b2a 100644
--- a/drivers/media/usb/em28xx/em28xx-audio.c
+++ b/drivers/media/usb/em28xx/em28xx-audio.c
@@ -113,6 +113,7 @@  static void em28xx_audio_isocirq(struct urb *urb)
 		stride = runtime->frame_bits >> 3;
 
 		for (i = 0; i < urb->number_of_packets; i++) {
+			unsigned long flags;
 			int length =
 			    urb->iso_frame_desc[i].actual_length / stride;
 			cp = (unsigned char *)urb->transfer_buffer +
@@ -134,7 +135,7 @@  static void em28xx_audio_isocirq(struct urb *urb)
 				       length * stride);
 			}
 
-			snd_pcm_stream_lock(substream);
+			snd_pcm_stream_lock_irqsave(substream, flags);
 
 			dev->adev.hwptr_done_capture += length;
 			if (dev->adev.hwptr_done_capture >=
@@ -150,7 +151,7 @@  static void em28xx_audio_isocirq(struct urb *urb)
 				period_elapsed = 1;
 			}
 
-			snd_pcm_stream_unlock(substream);
+			snd_pcm_stream_unlock_irqrestore(substream, flags);
 		}
 		if (period_elapsed)
 			snd_pcm_period_elapsed(substream);