diff options
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/core.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c index a979bc3f49a9..d0f84ff78776 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -29,6 +29,22 @@ int (*platform_notify_remove)(struct device * dev) = NULL; | |||
29 | * sysfs bindings for devices. | 29 | * sysfs bindings for devices. |
30 | */ | 30 | */ |
31 | 31 | ||
32 | /** | ||
33 | * dev_driver_string - Return a device's driver name, if at all possible | ||
34 | * @dev: struct device to get the name of | ||
35 | * | ||
36 | * Will return the device's driver's name if it is bound to a device. If | ||
37 | * the device is not bound to a device, it will return the name of the bus | ||
38 | * it is attached to. If it is not attached to a bus either, an empty | ||
39 | * string will be returned. | ||
40 | */ | ||
41 | const char *dev_driver_string(struct device *dev) | ||
42 | { | ||
43 | return dev->driver ? dev->driver->name : | ||
44 | (dev->bus ? dev->bus->name : ""); | ||
45 | } | ||
46 | EXPORT_SYMBOL_GPL(dev_driver_string); | ||
47 | |||
32 | #define to_dev(obj) container_of(obj, struct device, kobj) | 48 | #define to_dev(obj) container_of(obj, struct device, kobj) |
33 | #define to_dev_attr(_attr) container_of(_attr, struct device_attribute, attr) | 49 | #define to_dev_attr(_attr) container_of(_attr, struct device_attribute, attr) |
34 | 50 | ||