From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kevin Hilman Subject: Re: [PATCH 2/4] [media] davinci: vpif_capture: don't lock over s_stream Date: Mon, 21 Nov 2016 16:10:19 -0800 Message-ID: References: <20161119003208.10550-1-khilman@baylibre.com> <20161119003208.10550-2-khilman@baylibre.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: In-Reply-To: (Hans Verkuil's message of "Mon, 21 Nov 2016 15:37:20 +0100") Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Hans Verkuil Cc: linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Sekhar Nori , Axel Haslam , Bartosz =?utf-8?Q?Go=C5=82aszewski?= , Alexandre Bailon , David Lechner List-Id: devicetree@vger.kernel.org Hans Verkuil writes: > On 19/11/16 01:32, Kevin Hilman wrote: >> Video capture subdevs may be over I2C and may sleep during xfer, so we >> cannot do IRQ-disabled locking when calling the subdev. >> >> Signed-off-by: Kevin Hilman >> --- >> drivers/media/platform/davinci/vpif_capture.c | 4 ++++ >> 1 file changed, 4 insertions(+) >> >> diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c >> index 79cef74e164f..becc3e63b472 100644 >> --- a/drivers/media/platform/davinci/vpif_capture.c >> +++ b/drivers/media/platform/davinci/vpif_capture.c >> @@ -193,12 +193,16 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count) >> } >> } >> >> + spin_unlock_irqrestore(&common->irqlock, flags); >> + >> ret = v4l2_subdev_call(ch->sd, video, s_stream, 1); >> if (ret && ret != -ENOIOCTLCMD && ret != -ENODEV) { >> vpif_dbg(1, debug, "stream on failed in subdev\n"); >> goto err; >> } >> >> + spin_lock_irqsave(&common->irqlock, flags); > > This needs to be moved to right after the v4l2_subdev_call, otherwise the > goto err above will not have the spinlock. Yes indeed. Will respin. Kevin -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-pg0-f45.google.com ([74.125.83.45]:33417 "EHLO mail-pg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753695AbcKVAKV (ORCPT ); Mon, 21 Nov 2016 19:10:21 -0500 Received: by mail-pg0-f45.google.com with SMTP id 3so793579pgd.0 for ; Mon, 21 Nov 2016 16:10:21 -0800 (PST) From: Kevin Hilman To: Hans Verkuil Cc: linux-media@vger.kernel.org, devicetree@vger.kernel.org, Sekhar Nori , Axel Haslam , Bartosz =?utf-8?Q?Go=C5=82aszewski?= , Alexandre Bailon , David Lechner Subject: Re: [PATCH 2/4] [media] davinci: vpif_capture: don't lock over s_stream References: <20161119003208.10550-1-khilman@baylibre.com> <20161119003208.10550-2-khilman@baylibre.com> Date: Mon, 21 Nov 2016 16:10:19 -0800 In-Reply-To: (Hans Verkuil's message of "Mon, 21 Nov 2016 15:37:20 +0100") Message-ID: MIME-Version: 1.0 Content-Type: text/plain Sender: linux-media-owner@vger.kernel.org List-ID: Hans Verkuil writes: > On 19/11/16 01:32, Kevin Hilman wrote: >> Video capture subdevs may be over I2C and may sleep during xfer, so we >> cannot do IRQ-disabled locking when calling the subdev. >> >> Signed-off-by: Kevin Hilman >> --- >> drivers/media/platform/davinci/vpif_capture.c | 4 ++++ >> 1 file changed, 4 insertions(+) >> >> diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c >> index 79cef74e164f..becc3e63b472 100644 >> --- a/drivers/media/platform/davinci/vpif_capture.c >> +++ b/drivers/media/platform/davinci/vpif_capture.c >> @@ -193,12 +193,16 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count) >> } >> } >> >> + spin_unlock_irqrestore(&common->irqlock, flags); >> + >> ret = v4l2_subdev_call(ch->sd, video, s_stream, 1); >> if (ret && ret != -ENOIOCTLCMD && ret != -ENODEV) { >> vpif_dbg(1, debug, "stream on failed in subdev\n"); >> goto err; >> } >> >> + spin_lock_irqsave(&common->irqlock, flags); > > This needs to be moved to right after the v4l2_subdev_call, otherwise the > goto err above will not have the spinlock. Yes indeed. Will respin. Kevin