From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Ricardo Ribalda <ribalda@chromium.org>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
linux-media@vger.kernel.org, Yunke Cao <yunkec@chromium.org>,
Max Staudt <mstaudt@chromium.org>,
Hans Verkuil <hverkuil-cisco@xs4all.nl>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Tomasz Figa <tfiga@chromium.org>,
Guenter Roeck <linux@roeck-us.net>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Alan Stern <stern@rowland.harvard.edu>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 2/2] media: uvcvideo: Do power management granularly
Date: Tue, 6 Dec 2022 10:51:45 +0900 [thread overview]
Message-ID: <Y46gMfsJkzZgf2Zq@google.com> (raw)
In-Reply-To: <20220920-resend-powersave-v4-2-47484ae40761@chromium.org>
On (22/12/02 18:19), Ricardo Ribalda wrote:
> /* ------------------------------------------------------------------------
> * UVC ioctls
> */
> @@ -249,6 +289,9 @@ static int uvc_v4l2_try_format(struct uvc_streaming *stream,
> * developers test their webcams with the Linux driver as well as with
> * the Windows driver).
> */
> + ret = uvc_pm_get(stream);
> + if (ret)
> + return ret;
> mutex_lock(&stream->mutex);
So here we acquire stream->dev->lock outside of stream->mutex scope
> if (stream->dev->quirks & UVC_QUIRK_PROBE_EXTRAFIELDS)
> probe->dwMaxVideoFrameSize =
> @@ -257,6 +300,7 @@ static int uvc_v4l2_try_format(struct uvc_streaming *stream,
> /* Probe the device. */
> ret = uvc_probe_video(stream, probe);
> mutex_unlock(&stream->mutex);
> + uvc_pm_put(stream);
> if (ret < 0)
> return ret;
[..]
> @@ -468,7 +512,13 @@ static int uvc_v4l2_set_streamparm(struct uvc_streaming *stream,
> }
>
> /* Probe the device with the new settings. */
> + ret = uvc_pm_get(stream);
> + if (ret) {
> + mutex_unlock(&stream->mutex);
> + return ret;
> + }
> ret = uvc_probe_video(stream, &probe);
> + uvc_pm_put(stream);
> if (ret < 0) {
> mutex_unlock(&stream->mutex);
> return ret;
But here we nest and grab stream->dev->lock under stream->mutex.
Is this nesting intentional?
prev parent reply other threads:[~2022-12-06 1:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-02 17:19 [PATCH v4 0/2] media: uvcvideo: Implement granular power management Ricardo Ribalda
2022-12-02 17:19 ` [PATCH v4 1/2] media: uvcvideo: Refactor streamon/streamoff Ricardo Ribalda
2022-12-06 2:12 ` Sergey Senozhatsky
2022-12-02 17:19 ` [PATCH v4 2/2] media: uvcvideo: Do power management granularly Ricardo Ribalda
2022-12-06 1:51 ` Sergey Senozhatsky [this message]
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=Y46gMfsJkzZgf2Zq@google.com \
--to=senozhatsky@chromium.org \
--cc=hverkuil-cisco@xs4all.nl \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=mchehab@kernel.org \
--cc=mstaudt@chromium.org \
--cc=ribalda@chromium.org \
--cc=stern@rowland.harvard.edu \
--cc=tfiga@chromium.org \
--cc=yunkec@chromium.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