diff mbox

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

Message ID 1376756714-25479-40-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 change to
spin_lock_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/sn9c102/sn9c102_core.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Hans Verkuil Aug. 22, 2013, 12:24 p.m. UTC | #1
On Sat 17 August 2013 18:25:04 Ming Lei wrote:
> Complete() will be run with interrupt enabled, so change to
> spin_lock_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/sn9c102/sn9c102_core.c |    7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/usb/sn9c102/sn9c102_core.c b/drivers/media/usb/sn9c102/sn9c102_core.c
> index 2cb44de..33dc595 100644
> --- a/drivers/media/usb/sn9c102/sn9c102_core.c
> +++ b/drivers/media/usb/sn9c102/sn9c102_core.c
> @@ -784,12 +784,14 @@ end_of_frame:
>  				      cam->sensor.pix_format.pixelformat ==
>  				      V4L2_PIX_FMT_JPEG) && eof)) {
>  					u32 b;
> +					unsigned long flags;
>  
>  					b = (*f)->buf.bytesused;
>  					(*f)->state = F_DONE;
>  					(*f)->buf.sequence= ++cam->frame_count;
>  
> -					spin_lock(&cam->queue_lock);
> +					spin_lock_irqsave(&cam->queue_lock,
> +							  flags);
>  					list_move_tail(&(*f)->frame,
>  						       &cam->outqueue);
>  					if (!list_empty(&cam->inqueue))
> @@ -799,7 +801,8 @@ end_of_frame:
>  							frame );
>  					else
>  						(*f) = NULL;
> -					spin_unlock(&cam->queue_lock);
> +					spin_unlock_irqrestore(&cam->queue_lock,
> +							       flags);
>  
>  					memcpy(cam->sysfs.frame_header,
>  					       cam->sof.header, soflen);
> 
--
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/sn9c102/sn9c102_core.c b/drivers/media/usb/sn9c102/sn9c102_core.c
index 2cb44de..33dc595 100644
--- a/drivers/media/usb/sn9c102/sn9c102_core.c
+++ b/drivers/media/usb/sn9c102/sn9c102_core.c
@@ -784,12 +784,14 @@  end_of_frame:
 				      cam->sensor.pix_format.pixelformat ==
 				      V4L2_PIX_FMT_JPEG) && eof)) {
 					u32 b;
+					unsigned long flags;
 
 					b = (*f)->buf.bytesused;
 					(*f)->state = F_DONE;
 					(*f)->buf.sequence= ++cam->frame_count;
 
-					spin_lock(&cam->queue_lock);
+					spin_lock_irqsave(&cam->queue_lock,
+							  flags);
 					list_move_tail(&(*f)->frame,
 						       &cam->outqueue);
 					if (!list_empty(&cam->inqueue))
@@ -799,7 +801,8 @@  end_of_frame:
 							frame );
 					else
 						(*f) = NULL;
-					spin_unlock(&cam->queue_lock);
+					spin_unlock_irqrestore(&cam->queue_lock,
+							       flags);
 
 					memcpy(cam->sysfs.frame_header,
 					       cam->sof.header, soflen);