Commit 7dc72b28 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Driver core: clean up debugging messages

The driver core debugging messages are a mess.  This provides a unified
message that makes them actually useful.

The format for new kobject debug messages should be:
	driver/bus/class: 'OBJECT_NAME': FUNCTION_NAME: message.\n

Note, the class code is not changed in this patch due to pending patches
in my queue that this would conflict with.  A later patch will clean
them up.

Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent e5dd1278
...@@ -80,7 +80,7 @@ static void driver_release(struct kobject *kobj) ...@@ -80,7 +80,7 @@ static void driver_release(struct kobject *kobj)
{ {
struct driver_private *drv_priv = to_driver(kobj); struct driver_private *drv_priv = to_driver(kobj);
pr_debug("%s: freeing %s\n", __FUNCTION__, kobject_name(kobj)); pr_debug("driver: '%s': %s\n", kobject_name(kobj), __FUNCTION__);
kfree(drv_priv); kfree(drv_priv);
} }
...@@ -446,7 +446,7 @@ int bus_add_device(struct device * dev) ...@@ -446,7 +446,7 @@ int bus_add_device(struct device * dev)
int error = 0; int error = 0;
if (bus) { if (bus) {
pr_debug("bus %s: add device %s\n", bus->name, dev->bus_id); pr_debug("bus: '%s': add device %s\n", bus->name, dev->bus_id);
error = device_add_attrs(bus, dev); error = device_add_attrs(bus, dev);
if (error) if (error)
goto out_put; goto out_put;
...@@ -519,7 +519,7 @@ void bus_remove_device(struct device * dev) ...@@ -519,7 +519,7 @@ void bus_remove_device(struct device * dev)
dev->is_registered = 0; dev->is_registered = 0;
klist_del(&dev->knode_bus); klist_del(&dev->knode_bus);
} }
pr_debug("bus %s: remove device %s\n", dev->bus->name, dev->bus_id); pr_debug("bus: '%s': remove device %s\n", dev->bus->name, dev->bus_id);
device_release_driver(dev); device_release_driver(dev);
bus_put(dev->bus); bus_put(dev->bus);
} }
...@@ -637,7 +637,7 @@ int bus_add_driver(struct device_driver *drv) ...@@ -637,7 +637,7 @@ int bus_add_driver(struct device_driver *drv)
if (!bus) if (!bus)
return -EINVAL; return -EINVAL;
pr_debug("bus %s: add driver %s\n", bus->name, drv->name); pr_debug("bus: '%s': add driver %s\n", bus->name, drv->name);
priv = kzalloc(sizeof(*priv), GFP_KERNEL); priv = kzalloc(sizeof(*priv), GFP_KERNEL);
if (!priv) if (!priv)
...@@ -707,7 +707,7 @@ void bus_remove_driver(struct device_driver * drv) ...@@ -707,7 +707,7 @@ void bus_remove_driver(struct device_driver * drv)
driver_remove_attrs(drv->bus, drv); driver_remove_attrs(drv->bus, drv);
driver_remove_file(drv, &driver_attr_uevent); driver_remove_file(drv, &driver_attr_uevent);
klist_remove(&drv->p->knode_bus); klist_remove(&drv->p->knode_bus);
pr_debug("bus %s: remove driver %s\n", drv->bus->name, drv->name); pr_debug("bus: '%s': remove driver %s\n", drv->bus->name, drv->name);
driver_detach(drv); driver_detach(drv);
module_remove_driver(drv); module_remove_driver(drv);
kobject_unregister(&drv->p->kobj); kobject_unregister(&drv->p->kobj);
...@@ -907,7 +907,7 @@ int bus_register(struct bus_type * bus) ...@@ -907,7 +907,7 @@ int bus_register(struct bus_type * bus)
if (retval) if (retval)
goto bus_attrs_fail; goto bus_attrs_fail;
pr_debug("bus type '%s' registered\n", bus->name); pr_debug("bus: '%s': registered\n", bus->name);
return 0; return 0;
bus_attrs_fail: bus_attrs_fail:
...@@ -934,7 +934,7 @@ int bus_register(struct bus_type * bus) ...@@ -934,7 +934,7 @@ int bus_register(struct bus_type * bus)
*/ */
void bus_unregister(struct bus_type * bus) void bus_unregister(struct bus_type * bus)
{ {
pr_debug("bus %s: unregistering\n", bus->name); pr_debug("bus: '%s': unregistering\n", bus->name);
bus_remove_attrs(bus); bus_remove_attrs(bus);
remove_probe_files(bus); remove_probe_files(bus);
kset_unregister(bus->p->drivers_kset); kset_unregister(bus->p->drivers_kset);
......
...@@ -193,15 +193,16 @@ static int dev_uevent(struct kset *kset, struct kobject *kobj, ...@@ -193,15 +193,16 @@ static int dev_uevent(struct kset *kset, struct kobject *kobj,
if (dev->bus && dev->bus->uevent) { if (dev->bus && dev->bus->uevent) {
retval = dev->bus->uevent(dev, env); retval = dev->bus->uevent(dev, env);
if (retval) if (retval)
pr_debug ("%s: bus uevent() returned %d\n", pr_debug("device: '%s': %s: bus uevent() returned %d\n",
__FUNCTION__, retval); dev->bus_id, __FUNCTION__, retval);
} }
/* have the class specific function add its stuff */ /* have the class specific function add its stuff */
if (dev->class && dev->class->dev_uevent) { if (dev->class && dev->class->dev_uevent) {
retval = dev->class->dev_uevent(dev, env); retval = dev->class->dev_uevent(dev, env);
if (retval) if (retval)
pr_debug("%s: class uevent() returned %d\n", pr_debug("device: '%s': %s: class uevent() "
"returned %d\n", dev->bus_id,
__FUNCTION__, retval); __FUNCTION__, retval);
} }
...@@ -209,7 +210,8 @@ static int dev_uevent(struct kset *kset, struct kobject *kobj, ...@@ -209,7 +210,8 @@ static int dev_uevent(struct kset *kset, struct kobject *kobj,
if (dev->type && dev->type->uevent) { if (dev->type && dev->type->uevent) {
retval = dev->type->uevent(dev, env); retval = dev->type->uevent(dev, env);
if (retval) if (retval)
pr_debug("%s: dev_type uevent() returned %d\n", pr_debug("device: '%s': %s: dev_type uevent() "
"returned %d\n", dev->bus_id,
__FUNCTION__, retval); __FUNCTION__, retval);
} }
...@@ -751,7 +753,7 @@ int device_add(struct device *dev) ...@@ -751,7 +753,7 @@ int device_add(struct device *dev)
goto Error; goto Error;
} }
pr_debug("DEV: registering device: ID = '%s'\n", dev->bus_id); pr_debug("device: '%s': %s\n", dev->bus_id, __FUNCTION__);
parent = get_device(dev->parent); parent = get_device(dev->parent);
error = setup_parent(dev, parent); error = setup_parent(dev, parent);
...@@ -1020,7 +1022,7 @@ void device_del(struct device * dev) ...@@ -1020,7 +1022,7 @@ void device_del(struct device * dev)
*/ */
void device_unregister(struct device * dev) void device_unregister(struct device * dev)
{ {
pr_debug("DEV: Unregistering device. ID = '%s'\n", dev->bus_id); pr_debug("device: '%s': %s\n", dev->bus_id, __FUNCTION__);
device_del(dev); device_del(dev);
put_device(dev); put_device(dev);
} }
...@@ -1116,7 +1118,7 @@ EXPORT_SYMBOL_GPL(device_remove_file); ...@@ -1116,7 +1118,7 @@ EXPORT_SYMBOL_GPL(device_remove_file);
static void device_create_release(struct device *dev) static void device_create_release(struct device *dev)
{ {
pr_debug("%s called for %s\n", __FUNCTION__, dev->bus_id); pr_debug("device: '%s': %s\n", dev->bus_id, __FUNCTION__);
kfree(dev); kfree(dev);
} }
...@@ -1259,7 +1261,8 @@ int device_rename(struct device *dev, char *new_name) ...@@ -1259,7 +1261,8 @@ int device_rename(struct device *dev, char *new_name)
if (!dev) if (!dev)
return -EINVAL; return -EINVAL;
pr_debug("DEVICE: renaming '%s' to '%s'\n", dev->bus_id, new_name); pr_debug("device: '%s': %s: renaming to '%s'\n", dev->bus_id,
__FUNCTION__, new_name);
#ifdef CONFIG_SYSFS_DEPRECATED #ifdef CONFIG_SYSFS_DEPRECATED
if ((dev->class) && (dev->parent)) if ((dev->class) && (dev->parent))
...@@ -1378,8 +1381,8 @@ int device_move(struct device *dev, struct device *new_parent) ...@@ -1378,8 +1381,8 @@ int device_move(struct device *dev, struct device *new_parent)
put_device(new_parent); put_device(new_parent);
goto out; goto out;
} }
pr_debug("DEVICE: moving '%s' to '%s'\n", dev->bus_id, pr_debug("device: '%s': %s: moving to '%s'\n", dev->bus_id,
new_parent ? new_parent->bus_id : "<NULL>"); __FUNCTION__, new_parent ? new_parent->bus_id : "<NULL>");
error = kobject_move(&dev->kobj, new_parent_kobj); error = kobject_move(&dev->kobj, new_parent_kobj);
if (error) { if (error) {
put_device(new_parent); put_device(new_parent);
......
...@@ -34,8 +34,8 @@ static void driver_bound(struct device *dev) ...@@ -34,8 +34,8 @@ static void driver_bound(struct device *dev)
return; return;
} }
pr_debug("bound device '%s' to driver '%s'\n", pr_debug("driver: '%s': %s: bound to device '%s'\n", dev->bus_id,
dev->bus_id, dev->driver->name); __FUNCTION__, dev->driver->name);
if (dev->bus) if (dev->bus)
blocking_notifier_call_chain(&dev->bus->p->bus_notifier, blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
...@@ -102,8 +102,8 @@ static int really_probe(struct device *dev, struct device_driver *drv) ...@@ -102,8 +102,8 @@ static int really_probe(struct device *dev, struct device_driver *drv)
int ret = 0; int ret = 0;
atomic_inc(&probe_count); atomic_inc(&probe_count);
pr_debug("%s: Probing driver %s with device %s\n", pr_debug("bus: '%s': %s: probing driver %s with device %s\n",
drv->bus->name, drv->name, dev->bus_id); drv->bus->name, __FUNCTION__, drv->name, dev->bus_id);
WARN_ON(!list_empty(&dev->devres_head)); WARN_ON(!list_empty(&dev->devres_head));
dev->driver = drv; dev->driver = drv;
...@@ -125,8 +125,8 @@ static int really_probe(struct device *dev, struct device_driver *drv) ...@@ -125,8 +125,8 @@ static int really_probe(struct device *dev, struct device_driver *drv)
driver_bound(dev); driver_bound(dev);
ret = 1; ret = 1;
pr_debug("%s: Bound Device %s to Driver %s\n", pr_debug("bus: '%s': %s: bound device %s to driver %s\n",
drv->bus->name, dev->bus_id, drv->name); drv->bus->name, __FUNCTION__, dev->bus_id, drv->name);
goto done; goto done;
probe_failed: probe_failed:
...@@ -192,8 +192,8 @@ int driver_probe_device(struct device_driver * drv, struct device * dev) ...@@ -192,8 +192,8 @@ int driver_probe_device(struct device_driver * drv, struct device * dev)
if (drv->bus->match && !drv->bus->match(dev, drv)) if (drv->bus->match && !drv->bus->match(dev, drv))
goto done; goto done;
pr_debug("%s: Matched Device %s with Driver %s\n", pr_debug("bus: '%s': %s: matched device %s with driver %s\n",
drv->bus->name, dev->bus_id, drv->name); drv->bus->name, __FUNCTION__, dev->bus_id, drv->name);
ret = really_probe(dev, drv); ret = really_probe(dev, drv);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment