Re: [PATCH v4 2/3] media: i2c: ov5647: Switch to using the sub-device state lock

From: xiaolei wang
Date: Wed Jan 07 2026 - 19:52:39 EST


Hi Sakari,

On 1/8/26 06:38, Sakari Ailus 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,

On Thu, Jan 01, 2026 at 06:30:00PM +0800, Xiaolei Wang wrote:
@@ -1297,9 +1285,16 @@ static int ov5647_probe(struct i2c_client *client)
if (ret < 0)
goto power_off;

+ sd->state_lock = sensor->ctrls.lock;
+ ret = v4l2_subdev_init_finalize(sd);
+ if (ret < 0) {
+ ret = dev_err_probe(dev, ret, "failed to init subdev\n");
+ goto power_off;
+ }
+
ret = v4l2_async_register_subdev(sd);
v4l2_async_register_subdev() needs to be called before enabling Runtime PM
below. Not a fault of this patch but it'd be nice to fix that.
Thank you for the review and feedback.

You're absolutely right about the Runtime PM timing issue with

v4l2_async_register_subdev(). I appreciate you pointing that out - I'll

address this in the next version.


if (ret < 0)
- goto power_off;
+ goto v4l2_subdev_cleanup;

/* Enable runtime PM and turn off the device */
pm_runtime_set_active(dev);
The first patch doesn't seem to apply; I've taken earlier a set of ov5647
patches from Dave, could you rebase this on them? They're in my "cleanup"
branch here
<URL:https://git.linuxtv.org/sailus/media_tree.git/log/?h=cleanup>.

I apologize for the conflict with the first patch. I wasn't aware of Dave's

patches that you had already taken. I'll rebase my series on your cleanup

branch and resend a v5.

Best regards,
Xiaolei


--
Kind regards,

Sakari Ailus