Skip to content

Commit 448af2d

Browse files
nfrapradogregkh
authored andcommitted
driver: core: Use dev_* instead of pr_* so device metadata is added
Use the dev_* instead of the pr_* functions to log the status of device probe so that the log message gets the device metadata attached to it. Signed-off-by: "Nícolas F. R. A. Prado" <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 32de4b4 commit 448af2d

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

drivers/base/dd.c

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -397,13 +397,12 @@ bool device_is_bound(struct device *dev)
397397
static void driver_bound(struct device *dev)
398398
{
399399
if (device_is_bound(dev)) {
400-
pr_warn("%s: device %s already bound\n",
401-
__func__, kobject_name(&dev->kobj));
400+
dev_warn(dev, "%s: device already bound\n", __func__);
402401
return;
403402
}
404403

405-
pr_debug("driver: '%s': %s: bound to device '%s'\n", dev->driver->name,
406-
__func__, dev_name(dev));
404+
dev_dbg(dev, "driver: '%s': %s: bound to device\n", dev->driver->name,
405+
__func__);
407406

408407
klist_add_tail(&dev->p->knode_driver, &dev->driver->p->klist_devices);
409408
device_links_driver_bound(dev);
@@ -587,8 +586,8 @@ static int call_driver_probe(struct device *dev, struct device_driver *drv)
587586
break;
588587
case -ENODEV:
589588
case -ENXIO:
590-
pr_debug("%s: probe of %s rejects match %d\n",
591-
drv->name, dev_name(dev), ret);
589+
dev_dbg(dev, "probe with driver %s rejects match %d\n",
590+
drv->name, ret);
592591
break;
593592
default:
594593
/* driver matched but the probe failed */
@@ -620,8 +619,8 @@ static int really_probe(struct device *dev, struct device_driver *drv)
620619
if (link_ret == -EPROBE_DEFER)
621620
return link_ret;
622621

623-
pr_debug("bus: '%s': %s: probing driver %s with device %s\n",
624-
drv->bus->name, __func__, drv->name, dev_name(dev));
622+
dev_dbg(dev, "bus: '%s': %s: probing driver %s with device\n",
623+
drv->bus->name, __func__, drv->name);
625624
if (!list_empty(&dev->devres_head)) {
626625
dev_crit(dev, "Resources present before probing\n");
627626
ret = -EBUSY;
@@ -644,8 +643,7 @@ static int really_probe(struct device *dev, struct device_driver *drv)
644643

645644
ret = driver_sysfs_add(dev);
646645
if (ret) {
647-
pr_err("%s: driver_sysfs_add(%s) failed\n",
648-
__func__, dev_name(dev));
646+
dev_err(dev, "%s: driver_sysfs_add failed\n", __func__);
649647
goto sysfs_failed;
650648
}
651649

@@ -706,8 +704,8 @@ static int really_probe(struct device *dev, struct device_driver *drv)
706704
dev->pm_domain->sync(dev);
707705

708706
driver_bound(dev);
709-
pr_debug("bus: '%s': %s: bound device %s to driver %s\n",
710-
drv->bus->name, __func__, dev_name(dev), drv->name);
707+
dev_dbg(dev, "bus: '%s': %s: bound device to driver %s\n",
708+
drv->bus->name, __func__, drv->name);
711709
goto done;
712710

713711
dev_sysfs_state_synced_failed:
@@ -786,8 +784,8 @@ static int __driver_probe_device(struct device_driver *drv, struct device *dev)
786784
return -EBUSY;
787785

788786
dev->can_match = true;
789-
pr_debug("bus: '%s': %s: matched device %s with driver %s\n",
790-
drv->bus->name, __func__, dev_name(dev), drv->name);
787+
dev_dbg(dev, "bus: '%s': %s: matched device with driver %s\n",
788+
drv->bus->name, __func__, drv->name);
791789

792790
pm_runtime_get_suppliers(dev);
793791
if (dev->parent)

0 commit comments

Comments
 (0)