diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-01-25 11:12:29 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-01-25 11:12:29 +0100 |
commit | 072a51be8ecfb84e15b27b7f80a601560f386788 (patch) | |
tree | cd7bee45536733a987e70037b109eb1bd9a4cc36 /include/linux/device.h | |
parent | Revert "drivers: core: Detach device from power domain on shutdown" (diff) | |
parent | Linux 5.11-rc5 (diff) | |
download | linux-dev-072a51be8ecfb84e15b27b7f80a601560f386788.tar.xz linux-dev-072a51be8ecfb84e15b27b7f80a601560f386788.zip |
Merge 5.11-rc5 into driver-core-next
We need the fixes in here as well.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/device.h')
-rw-r--r-- | include/linux/device.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index cb5eb2e58c25..7619a84f8ce4 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -611,6 +611,18 @@ static inline const char *dev_name(const struct device *dev) return kobject_name(&dev->kobj); } +/** + * dev_bus_name - Return a device's bus/class name, if at all possible + * @dev: struct device to get the bus/class name of + * + * Will return the name of the bus/class the device is attached to. If it is + * not attached to a bus/class, an empty string will be returned. + */ +static inline const char *dev_bus_name(const struct device *dev) +{ + return dev->bus ? dev->bus->name : (dev->class ? dev->class->name : ""); +} + __printf(2, 3) int dev_set_name(struct device *dev, const char *name, ...); #ifdef CONFIG_NUMA |