From: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
To: Heimir Thor Sverrisson <heimir.sverrisson@gmail.com>
Cc: sakari.ailus@linux.intel.com, hao.yao@intel.com,
mchehab@kernel.org, linux-media@vger.kernel.org,
hdegoede@redhat.com, joachim.reichel@posteo.de,
Ingvar Hagelund <ingvar@redpill-linpro.com>
Subject: Re: [PATCH v7] media: i2c: Add Omnivision OV02C10 sensor driver
Date: Wed, 22 Jan 2025 10:36:27 +0100 [thread overview]
Message-ID: <Z5C8G3pR1jyTyToZ@linux.intel.com> (raw)
In-Reply-To: <20250116232207.217402-1-heimir.sverrisson@gmail.com>
Hi
On Thu, Jan 16, 2025 at 04:22:07PM -0700, Heimir Thor Sverrisson wrote:
> +static int ov02c10_set_stream(struct v4l2_subdev *sd, int enable)
> +{
> + struct ov02c10 *ov02c10 = to_ov02c10(sd);
> + struct i2c_client *client = v4l2_get_subdevdata(sd);
> + int ret = 0;
> +
> + if (ov02c10->streaming == enable)
> + return 0;
> +
> + mutex_lock(&ov02c10->mutex);
> + if (enable) {
> + ret = pm_runtime_get_sync(&client->dev);
> + if (ret < 0) {
> + pm_runtime_put_noidle(&client->dev);
> + mutex_unlock(&ov02c10->mutex);
> + return ret;
> + }
> +
> + ret = ov02c10_start_streaming(ov02c10);
> + if (ret) {
> + enable = 0;
> + ov02c10_stop_streaming(ov02c10);
> + pm_runtime_put(&client->dev);
> + }
> + } else {
> + ov02c10_stop_streaming(ov02c10);
> + pm_runtime_put(&client->dev);
> + }
> +
> + ov02c10->streaming = enable;
> + mutex_unlock(&ov02c10->mutex);
<snip>
> +static int __maybe_unused ov02c10_resume(struct device *dev)
> +{
> + struct i2c_client *client = to_i2c_client(dev);
> + struct v4l2_subdev *sd = i2c_get_clientdata(client);
> + struct ov02c10 *ov02c10 = to_ov02c10(sd);
> + int ret = 0;
> +
> + mutex_lock(&ov02c10->mutex);
> + if (!ov02c10->streaming)
> + goto exit;
I think pm_runtime_get_sync() can call ov02c10_resume() internally so we
can deadlock on mutex_lock(&ov02c10->mutex). We should avoid calling
pm_runtime_get_sync() with the mutex taken.
It's not practical issue as runtime pm seems to be configured
incorrectly and in any know setup is not needed. So I'm fine
to leave it as is and eventually work on that in incremental patches
after driver merge.
Regards
Stanislaw
next prev parent reply other threads:[~2025-01-22 9:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-16 23:22 [PATCH v7] media: i2c: Add Omnivision OV02C10 sensor driver Heimir Thor Sverrisson
2025-01-22 8:32 ` Sakari Ailus
2025-01-22 9:18 ` Stanislaw Gruszka
2025-01-22 9:23 ` Sakari Ailus
2025-01-27 11:14 ` Hans de Goede
2025-01-22 9:36 ` Stanislaw Gruszka [this message]
2025-01-22 16:52 ` Stanislaw Gruszka
2025-03-11 17:32 ` Bryan O'Donoghue
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=Z5C8G3pR1jyTyToZ@linux.intel.com \
--to=stanislaw.gruszka@linux.intel.com \
--cc=hao.yao@intel.com \
--cc=hdegoede@redhat.com \
--cc=heimir.sverrisson@gmail.com \
--cc=ingvar@redpill-linpro.com \
--cc=joachim.reichel@posteo.de \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.