CONFIG_DEBUG_INITCALLS can be very useful to roughly pinpoint what causes barebox to hang. With deep probe, most probes run at the same initcall level making the debug option much less useful. Add a new CONFIG_DEBUG_PROBES that will instead log whenever a probe is invoked. The text's horizontal alignment is increased with each recursive probe making the option suitable for debugging some deep probe issues as well. Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> --- common/Kconfig | 4 ++++ drivers/base/driver.c | 17 +++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/common/Kconfig b/common/Kconfig index a2aa0b2568de..05e4bdbba132 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -1497,6 +1497,10 @@ config DEBUG_INITCALLS help If enabled this will print initcall traces. +config DEBUG_PROBES + bool "Trace driver probes" + help + If enabled this will print driver probe traces. config PBL_BREAK bool "Execute software break on pbl start" diff --git a/drivers/base/driver.c b/drivers/base/driver.c index c2ab9d308e91..c6a8aef879af 100644 --- a/drivers/base/driver.c +++ b/drivers/base/driver.c @@ -36,6 +36,12 @@ #include <pinctrl.h> #include <linux/clk/clk-conf.h> +#ifdef CONFIG_DEBUG_PROBES +#define pr_report_probe pr_info +#else +#define pr_report_probe pr_debug +#endif + LIST_HEAD(device_list); EXPORT_SYMBOL(device_list); @@ -82,8 +88,13 @@ int get_free_deviceid(const char *name_template) int device_probe(struct device_d *dev) { + static int depth = 0; int ret; + depth++; + + pr_report_probe("%*sprobe-> %s\n", depth, "", dev_name(dev)); + pinctrl_select_state_default(dev); of_clk_set_defaults(dev->device_node, false); @@ -91,7 +102,7 @@ int device_probe(struct device_d *dev) ret = dev->bus->probe(dev); if (ret == 0) - return 0; + goto out; if (ret == -EPROBE_DEFER) { list_del(&dev->active); @@ -105,7 +116,7 @@ int device_probe(struct device_d *dev) dev_err(dev, "probe deferred\n"); else dev_dbg(dev, "probe deferred\n"); - return ret; + goto out; } list_del(&dev->active); @@ -116,6 +127,8 @@ int device_probe(struct device_d *dev) else dev_err(dev, "probe failed: %s\n", strerror(-ret)); +out: + depth--; return ret; } -- 2.30.2 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox