mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: xiaolei wang <xiaolei.wang@windriver.com>
To: Tarang Raval <tarang.raval@siliconsignals.io>,
	"sakari.ailus@linux.intel.com" <sakari.ailus@linux.intel.com>,
	"laurent.pinchart@ideasonboard.com"
	<laurent.pinchart@ideasonboard.com>,
	"dave.stevenson@raspberrypi.com" <dave.stevenson@raspberrypi.com>,
	"jacopo@jmondi.org" <jacopo@jmondi.org>,
	"mchehab@kernel.org" <mchehab@kernel.org>,
	"prabhakar.mahadev-lad.rj@bp.renesas.com"
	<prabhakar.mahadev-lad.rj@bp.renesas.com>,
	"hverkuil+cisco@kernel.org" <hverkuil+cisco@kernel.org>,
	"johannes.goede@oss.qualcomm.com"
	<johannes.goede@oss.qualcomm.com>,
	"hverkuil-cisco@xs4all.nl" <hverkuil-cisco@xs4all.nl>,
	"jai.luthra@ideasonboard.com" <jai.luthra@ideasonboard.com>,
	"richard.leitner@linux.dev" <richard.leitner@linux.dev>
Cc: "linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/3] media: i2c: ov9282: Switch to using the sub-device state lock
Date: Sun, 1 Mar 2026 14:37:57 +0800	[thread overview]
Message-ID: <27fcad2a-89d7-4861-89d0-67825888bcf7@windriver.com> (raw)
In-Reply-To: <PN3P287MB1829CA4A49FEFE8E9A35061B8B70A@PN3P287MB1829.INDP287.PROD.OUTLOOK.COM>


On 3/1/26 02:27, Tarang Raval wrote:
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
> Hi Xiaolei,
>
>> Switch to using the sub-device state lock and properly call
>> v4l2_subdev_init_finalize() / v4l2_subdev_cleanup() on probe() /
>> remove().
>>
>> Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com>
> ...
>
>> @@ -1458,16 +1442,20 @@ static int ov9282_probe(struct i2c_client *client)
>>          pm_runtime_enable(ov9282->dev);
>>          pm_runtime_idle(ov9282->dev);
>>
>> +       ret = v4l2_async_register_subdev_sensor(&ov9282->sd);
>> +       if (ret < 0)
>> +               goto v4l2_subdev_cleanup;
>> +
>>          return 0;
>>
>> +v4l2_subdev_cleanup:
>> +       v4l2_subdev_cleanup(&ov9282->sd);
>
> If v4l2_async_register_subdev_sensor() fails, runtime PM remains enabled.
> Can you please disable runtime PM (and set suspended state) on that error path?
Hi Tarang,

Thank you for the review!

You're right, I missed the runtime PM cleanup in the error path.
I'll fix it in v2:

v4l2_subdev_cleanup:
     v4l2_subdev_cleanup(&ov9282->sd);
     pm_runtime_disable(ov9282->dev);
     pm_runtime_set_suspended(ov9282->dev);
     goto error_media_entity;

This ensures runtime PM is properly disabled if subdev registration fails.

Best Regards,
Xiaolei
>
>
>>   error_media_entity:
>>          media_entity_cleanup(&ov9282->sd.entity);
>>   error_handler_free:
>>          v4l2_ctrl_handler_free(ov9282->sd.ctrl_handler);
>>   error_power_off:
>>          ov9282_power_off(ov9282->dev);
>> -error_mutex_destroy:
>> -       mutex_destroy(&ov9282->mutex);
>>
>>          return ret;
>>   }
>> @@ -1481,9 +1469,9 @@ static int ov9282_probe(struct i2c_client *client)
>>   static void ov9282_remove(struct i2c_client *client)
>>   {
>>          struct v4l2_subdev *sd = i2c_get_clientdata(client);
>> -       struct ov9282 *ov9282 = to_ov9282(sd);
>>
>>          v4l2_async_unregister_subdev(sd);
>> +       v4l2_subdev_cleanup(sd);
>>          media_entity_cleanup(&sd->entity);
>>          v4l2_ctrl_handler_free(sd->ctrl_handler);
>>
>> @@ -1491,8 +1479,6 @@ static void ov9282_remove(struct i2c_client *client)
>>          if (!pm_runtime_status_suspended(&client->dev))
>>                  ov9282_power_off(&client->dev);
>>          pm_runtime_set_suspended(&client->dev);
>> -
>> -       mutex_destroy(&ov9282->mutex);
>>   }
>>
>>   static const struct dev_pm_ops ov9282_pm_ops = {
>> --
>> 2.43.0
> with above change
>
> Reviewed-by: Tarang Raval <tarang.raval@siliconsignals.io>
>
> Best Regards,
> Tarang

  reply	other threads:[~2026-03-01  6:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-28  8:33 [PATCH 0/3] media: i2c: ov9282: Modernize driver with CCI and streams API Xiaolei Wang
2026-02-28  8:33 ` [PATCH 1/3] media: i2c: ov9282: Convert to CCI register access helpers Xiaolei Wang
2026-02-28 18:12   ` Tarang Raval
2026-03-01  6:35     ` xiaolei wang
2026-02-28  8:34 ` [PATCH 2/3] media: i2c: ov9282: Switch to using the sub-device state lock Xiaolei Wang
2026-02-28 18:27   ` Tarang Raval
2026-03-01  6:37     ` xiaolei wang [this message]
2026-02-28  8:34 ` [PATCH 3/3] media: i2c: ov9282: switch to {enable,disable}_streams Xiaolei Wang
2026-02-28 18:45   ` Tarang Raval
2026-03-01  6:40     ` xiaolei wang

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=27fcad2a-89d7-4861-89d0-67825888bcf7@windriver.com \
    --to=xiaolei.wang@windriver.com \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=hverkuil+cisco@kernel.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=jacopo@jmondi.org \
    --cc=jai.luthra@ideasonboard.com \
    --cc=johannes.goede@oss.qualcomm.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=richard.leitner@linux.dev \
    --cc=sakari.ailus@linux.intel.com \
    --cc=tarang.raval@siliconsignals.io \
    /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

all inboxes | Powered by JetHome®