[PATCH] driver core: add driver name to probe debug print
Francesco Valla <[email protected]> Mon, 29 Jun 2026 23:51:18 +0200
| Newsgroups | org.kernel.vger.linux-embedded,dev.linux.lists.driver-core,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
The initcall_debug command line option is a useful tool while debugging and optimizing the initialization of a new system, mainly because it allows to see probe failures and deferrals without recompiling the kernel (e.g., with CONFIG_DEBUG_DRIVER). However, matching a device with the driver it is being probed with can become difficult, since some devices use names that are not explicit, at least at a first sight (e.g.: '1-0:1.0' or '1-0060'). Add an additional debug print to inform the user which driver is being used for a device, allowing for a quick match. The print is inserted in the same really_probe_debug() wrapper that is already used to report the result of the probe, and is thus not affecting executions not using the initcall_debug option. Suggested-by: Tim Bird <[email protected]> Signed-off-by: Francesco Valla <[email protected]> --- Hello, this very small patch comes from a discussion started at the end of 2024 after a Boot Time SIG meeting [1]; I decided to reduce the patch proposed there by Tim to the bare minimum, as this should already be enough information for a developer to work with. I was unsure on whether to add information to the existing print or introduce a new one; while IMO technically worse, I opted for this second solution, since the existing print *might* be viewed as userspace-facing ABI. I'll be happy to do otherwise if there is consensus. Thank you! Regards, Francesco [1] https://lore.kernel.org/linux-embedded/MW5PR13MB563277AF5972FD2B56026CF9FD3C2@MW5PR13MB5632.namprd13.prod.outlook.com/ --- drivers/base/dd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 60c005223844..3c0930020050 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -782,6 +782,9 @@ static int really_probe_debug(struct device *dev, const struct device_driver *dr ktime_t calltime, rettime; int ret; + /* Don't change this to pr_debug() - see comment below. */ + printk(KERN_DEBUG "probing %s with driver %s\n", dev_name(dev), drv->name); + calltime = ktime_get(); ret = really_probe(dev, drv); rettime = ktime_get(); --- base-commit: dc59e4fea9d83f03bad6bddf3fa2e52491777482 change-id: 20260628-probe_driver-3f14e94573f6 Best regards, -- Francesco Valla <[email protected]>