diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2024-02-19 18:29:22 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2024-02-20 12:08:30 +0100 |
commit | 8a42a6bf42b0dc1890130055cbf8fa53182023e8 (patch) | |
tree | 6c57e26e6051e4f4170f087c65a62767b2e33be1 | |
parent | 6e08b4ab5bec01146f3152579152872258c0ac24 (diff) | |
download | barebox-8a42a6bf42b0.tar.gz barebox-8a42a6bf42b0.tar.xz |
deep-probe: treat any probe deferral as permanent
As the comment notes, "-EPROBE_DEFER should never appear on a deep-probe
machine so inform the user immediately.". Yet, we still add the device
to the deferred probe list to try it again later, which should only make
a difference if there's a bug with the deep probe mechanism itself.
Therefore, never use the deferred probe list on deep probe system and
directly report any probe deferral as permanent.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20240219172925.3798024-2-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | drivers/base/driver.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/drivers/base/driver.c b/drivers/base/driver.c index 5ead5d961e..3fac9c59f6 100644 --- a/drivers/base/driver.c +++ b/drivers/base/driver.c @@ -106,6 +106,15 @@ int get_free_deviceid(const char *name_template) }; } +static void dev_report_permanent_probe_deferral(struct device *dev) +{ + if (dev->deferred_probe_reason) + dev_err(dev, "probe permanently deferred (%s)\n", + dev->deferred_probe_reason); + else + dev_err(dev, "probe permanently deferred\n"); +} + int device_probe(struct device *dev) { static int depth = 0; @@ -136,17 +145,18 @@ int device_probe(struct device *dev) case 0: return 0; case -EPROBE_DEFER: - list_move(&dev->active, &deferred); - /* * -EPROBE_DEFER should never appear on a deep-probe machine so * inform the user immediately. */ - if (deep_probe_is_supported()) - dev_err(dev, "probe deferred\n"); - else - dev_dbg(dev, "probe deferred\n"); + if (deep_probe_is_supported()) { + dev_report_permanent_probe_deferral(dev); + break; + } + + list_move(&dev->active, &deferred); + dev_dbg(dev, "probe deferred\n"); return -EPROBE_DEFER; case -ENODEV: case -ENXIO: @@ -155,7 +165,6 @@ int device_probe(struct device *dev) default: dev_err(dev, "probe failed: %pe\n", ERR_PTR(ret)); break; - } list_del_init(&dev->active); @@ -382,13 +391,9 @@ static int device_probe_deferred(void) } } while (success); - list_for_each_entry(dev, &deferred, active) { - if (dev->deferred_probe_reason) - dev_err(dev, "probe permanently deferred (%s)\n", - dev->deferred_probe_reason); - else - dev_err(dev, "probe permanently deferred\n"); - } + list_for_each_entry(dev, &deferred, active) + dev_report_permanent_probe_deferral(dev); + return 0; } late_initcall(device_probe_deferred); |