[PATCH master 3/3] reset: core: support deep probe with resets registered in CLK_OF_DECLARE

Ahmad Fatoum ahmad at a3f.at
Mon Jan 9 00:36:00 PST 2023


We already have such an exception for clocks, which may be registered
early outside the driver model using CLK_OF_DECLARE. Add a further
exception for reset controllers, so they too may be registered in
CLK_OF_DECLARE on a deep probe system. Checking for success of
of_device_ensure_probed() here isn't necessary anyways, because if
there is no provider, the list_for_each_entry loop below won't find
any and error is propagated.

Another solution would be to rewrite deep probe drivers to use
the driver model instead of CLK_OF_DECLARE, but this error case
if not very obvious, so save others time by just allowing it.

Signed-off-by: Ahmad Fatoum <ahmad at a3f.at>
---
 drivers/reset/core.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/reset/core.c b/drivers/reset/core.c
index 31fac2de0347..5ab21ac95e3a 100644
--- a/drivers/reset/core.c
+++ b/drivers/reset/core.c
@@ -192,9 +192,8 @@ static struct reset_control *of_reset_control_get_by_index(struct device_node *n
 	if (ret)
 		return ERR_PTR(ret);
 
-	ret = of_device_ensure_probed(args.np);
-	if (ret)
-		return ERR_PTR(ret);
+	/* Ignore error, as CLK_OF_DECLARE resets have no proper driver. */
+	of_device_ensure_probed(args.np);
 
 	rcdev = NULL;
 	list_for_each_entry(r, &reset_controller_list, list) {
-- 
2.38.1




More information about the barebox mailing list