Skip to contentSkip to conversation

media: ov13b10: Defer probe if no endpoint found

PATCH In review [email protected] 2 participants 2 messages Jun 13, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: ov13b10: Defer probe if no endpoint found

From: Bingbu Cao <[email protected]>

The ov13b10 need be connected to a CIO2 or IPU device by bridge, sometimes the bridge driver was not probed before ov13b10 driver, then the absence of the fwnode endpoint for this device is expected, so driver return -EPROBE_DEFER in this case to let the probe occur after bridge driver.

---
 drivers/media/i2c/ov13b10.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/media/i2c/ov13b10.c +4 -4
index c1430044fb1e..96d3bd6ab3bd 100644
@@ -1331,6 +1331,10 @@ static int ov13b10_check_hwcfg(struct device *dev)
 	if (!fwnode)
 		return -ENXIO;
 
+	ep = fwnode_graph_get_next_endpoint(fwnode, NULL);
+	if (!ep)
+		return -EPROBE_DEFER;
+
 	ret = fwnode_property_read_u32(dev_fwnode(dev), "clock-frequency",
 				       &ext_clk);
 	if (ret) {
@@ -1344,10 +1348,6 @@ static int ov13b10_check_hwcfg(struct device *dev)
 		return -EINVAL;
 	}
 
-	ep = fwnode_graph_get_next_endpoint(fwnode, NULL);
-	if (!ep)
-		return -ENXIO;
-
 	ret = v4l2_fwnode_endpoint_alloc_parse(ep, &bus_cfg);
 	fwnode_handle_put(ep);
 	if (ret)
Signature · 1 line
2.40.1
Reviewed-by on v1 1/1
#1 lore raw

Hi,

Quoted 42 lines · On Tue, Jun 13, 2023 at 12:55:43PM +0800, [email protected] wrote:

From: Bingbu Cao <[email protected]>

The ov13b10 need be connected to a CIO2 or IPU device by bridge, sometimes the bridge driver was not probed before ov13b10 driver, then the absence of the fwnode endpoint for this device is expected, so driver return -EPROBE_DEFER in this case to let the probe occur after bridge driver.

---
 drivers/media/i2c/ov13b10.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/media/i2c/ov13b10.c +4 -4
index c1430044fb1e..96d3bd6ab3bd 100644
@@ -1331,6 +1331,10 @@ static int ov13b10_check_hwcfg(struct device *dev)
 	if (!fwnode)
 		return -ENXIO;
 
+	ep = fwnode_graph_get_next_endpoint(fwnode, NULL);
+	if (!ep)
+		return -EPROBE_DEFER;
+
 	ret = fwnode_property_read_u32(dev_fwnode(dev), "clock-frequency",
 				       &ext_clk);
 	if (ret) {
@@ -1344,10 +1348,6 @@ static int ov13b10_check_hwcfg(struct device *dev)
 		return -EINVAL;
 	}
 
-	ep = fwnode_graph_get_next_endpoint(fwnode, NULL);
-	if (!ep)
-		return -ENXIO;
-
 	ret = v4l2_fwnode_endpoint_alloc_parse(ep, &bus_cfg);
 	fwnode_handle_put(ep);
 	if (ret)
Signature · 1 line
2.40.1

Looks good to me.
I see that also some others ov driver are using
this solution (ov5693, ov7251)

Thanks,
Tommaso