* [PATCH v2] media: i2c: ov8858: Don't set fwnode in the driver
@ 2023-10-10 7:07 Ondřej Jirman
2023-10-10 7:21 ` Jacopo Mondi
0 siblings, 1 reply; 2+ messages in thread
From: Ondřej Jirman @ 2023-10-10 7:07 UTC (permalink / raw)
To: linux-rockchip
Cc: Ondrej Jirman, Jacopo Mondi, Nicholas Roth, Sakari Ailus,
Mauro Carvalho Chehab, open list:OMNIVISION OV8858 SENSOR DRIVER,
open list
From: Ondrej Jirman <megi@xff.cz>
This makes the driver work with the new check in
v4l2_async_register_subdev() that was introduced recently in 6.6-rc1.
Without this change, probe fails with:
ov8858 1-0036: Detected OV8858 sensor, revision 0xb2
ov8858 1-0036: sub-device fwnode is an endpoint!
ov8858 1-0036: v4l2 async register subdev failed
ov8858: probe of 1-0036 failed with error -22
This also simplifies the driver a bit.
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
v2:
- call fwnode_handle_put earlier to avoid multiple calls to it in
error code paths (suggested by Jacopo Mondi)
drivers/media/i2c/ov8858.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/media/i2c/ov8858.c b/drivers/media/i2c/ov8858.c
index 3af6125a2eee..4d9fd76e2f60 100644
--- a/drivers/media/i2c/ov8858.c
+++ b/drivers/media/i2c/ov8858.c
@@ -1850,9 +1850,9 @@ static int ov8858_parse_of(struct ov8858 *ov8858)
}
ret = v4l2_fwnode_endpoint_parse(endpoint, &vep);
+ fwnode_handle_put(endpoint);
if (ret) {
dev_err(dev, "Failed to parse endpoint: %d\n", ret);
- fwnode_handle_put(endpoint);
return ret;
}
@@ -1864,12 +1864,9 @@ static int ov8858_parse_of(struct ov8858 *ov8858)
default:
dev_err(dev, "Unsupported number of data lanes %u\n",
ov8858->num_lanes);
- fwnode_handle_put(endpoint);
return -EINVAL;
}
- ov8858->subdev.fwnode = endpoint;
-
return 0;
}
@@ -1913,7 +1910,7 @@ static int ov8858_probe(struct i2c_client *client)
ret = ov8858_init_ctrls(ov8858);
if (ret)
- goto err_put_fwnode;
+ return ret;
sd = &ov8858->subdev;
sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS;
@@ -1964,8 +1961,6 @@ static int ov8858_probe(struct i2c_client *client)
media_entity_cleanup(&sd->entity);
err_free_handler:
v4l2_ctrl_handler_free(&ov8858->ctrl_handler);
-err_put_fwnode:
- fwnode_handle_put(ov8858->subdev.fwnode);
return ret;
}
@@ -1978,7 +1973,6 @@ static void ov8858_remove(struct i2c_client *client)
v4l2_async_unregister_subdev(sd);
media_entity_cleanup(&sd->entity);
v4l2_ctrl_handler_free(&ov8858->ctrl_handler);
- fwnode_handle_put(ov8858->subdev.fwnode);
pm_runtime_disable(&client->dev);
if (!pm_runtime_status_suspended(&client->dev))
--
2.42.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH v2] media: i2c: ov8858: Don't set fwnode in the driver
2023-10-10 7:07 [PATCH v2] media: i2c: ov8858: Don't set fwnode in the driver Ondřej Jirman
@ 2023-10-10 7:21 ` Jacopo Mondi
0 siblings, 0 replies; 2+ messages in thread
From: Jacopo Mondi @ 2023-10-10 7:21 UTC (permalink / raw)
To: Ondřej Jirman
Cc: linux-rockchip, Jacopo Mondi, Nicholas Roth, Sakari Ailus,
Mauro Carvalho Chehab, open list:OMNIVISION OV8858 SENSOR DRIVER,
open list
Hello Ondřej
On Tue, Oct 10, 2023 at 09:07:44AM +0200, Ondřej Jirman wrote:
> From: Ondrej Jirman <megi@xff.cz>
>
> This makes the driver work with the new check in
> v4l2_async_register_subdev() that was introduced recently in 6.6-rc1.
> Without this change, probe fails with:
>
> ov8858 1-0036: Detected OV8858 sensor, revision 0xb2
> ov8858 1-0036: sub-device fwnode is an endpoint!
> ov8858 1-0036: v4l2 async register subdev failed
> ov8858: probe of 1-0036 failed with error -22
>
> This also simplifies the driver a bit.
>
> Signed-off-by: Ondrej Jirman <megi@xff.cz>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Thanks!
> ---
> v2:
> - call fwnode_handle_put earlier to avoid multiple calls to it in
> error code paths (suggested by Jacopo Mondi)
>
> drivers/media/i2c/ov8858.c | 10 ++--------
> 1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/media/i2c/ov8858.c b/drivers/media/i2c/ov8858.c
> index 3af6125a2eee..4d9fd76e2f60 100644
> --- a/drivers/media/i2c/ov8858.c
> +++ b/drivers/media/i2c/ov8858.c
> @@ -1850,9 +1850,9 @@ static int ov8858_parse_of(struct ov8858 *ov8858)
> }
>
> ret = v4l2_fwnode_endpoint_parse(endpoint, &vep);
> + fwnode_handle_put(endpoint);
> if (ret) {
> dev_err(dev, "Failed to parse endpoint: %d\n", ret);
> - fwnode_handle_put(endpoint);
> return ret;
> }
>
> @@ -1864,12 +1864,9 @@ static int ov8858_parse_of(struct ov8858 *ov8858)
> default:
> dev_err(dev, "Unsupported number of data lanes %u\n",
> ov8858->num_lanes);
> - fwnode_handle_put(endpoint);
> return -EINVAL;
> }
>
> - ov8858->subdev.fwnode = endpoint;
> -
> return 0;
> }
>
> @@ -1913,7 +1910,7 @@ static int ov8858_probe(struct i2c_client *client)
>
> ret = ov8858_init_ctrls(ov8858);
> if (ret)
> - goto err_put_fwnode;
> + return ret;
>
> sd = &ov8858->subdev;
> sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS;
> @@ -1964,8 +1961,6 @@ static int ov8858_probe(struct i2c_client *client)
> media_entity_cleanup(&sd->entity);
> err_free_handler:
> v4l2_ctrl_handler_free(&ov8858->ctrl_handler);
> -err_put_fwnode:
> - fwnode_handle_put(ov8858->subdev.fwnode);
>
> return ret;
> }
> @@ -1978,7 +1973,6 @@ static void ov8858_remove(struct i2c_client *client)
> v4l2_async_unregister_subdev(sd);
> media_entity_cleanup(&sd->entity);
> v4l2_ctrl_handler_free(&ov8858->ctrl_handler);
> - fwnode_handle_put(ov8858->subdev.fwnode);
>
> pm_runtime_disable(&client->dev);
> if (!pm_runtime_status_suspended(&client->dev))
> --
> 2.42.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-10-10 7:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-10 7:07 [PATCH v2] media: i2c: ov8858: Don't set fwnode in the driver Ondřej Jirman
2023-10-10 7:21 ` Jacopo Mondi
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®