These definitions are not tied to the driver support, so move them into the better matching device.h header.
Signed-off-by: Ahmad Fatoum <a.fat...@barebox.org> --- include/device.h | 21 +++++++++++++++++++++ include/driver.h | 20 -------------------- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/include/device.h b/include/device.h index 965251e55240..7ef807f7d6b1 100644 --- a/include/device.h +++ b/include/device.h @@ -168,6 +168,27 @@ static inline struct device_node *dev_of_node(struct device *dev) return IS_ENABLED(CONFIG_OFDEVICE) ? dev->of_node : NULL; } +/* dynamically assign the next free id */ +#define DEVICE_ID_DYNAMIC -2 +/* do not use an id (only one device available) */ +#define DEVICE_ID_SINGLE -1 + +static inline const char *dev_id(const struct device *dev) +{ + if (!dev) + return NULL; + return (dev->id != DEVICE_ID_SINGLE) ? dev->unique_name : dev->name; +} + +static inline const char *dev_name(const struct device *dev) +{ + if (!dev) + return NULL; + return dev_id(dev) ?: dev->name; +} + +int dev_set_name(struct device *dev, const char *fmt, ...) __printf(2, 3); + static inline bool dev_is_dma_coherent(struct device *dev) { if (dev) { diff --git a/include/driver.h b/include/driver.h index e1493177e435..c130a3cd63fd 100644 --- a/include/driver.h +++ b/include/driver.h @@ -60,11 +60,6 @@ struct driver { #define device_d device #define driver_d driver -/* dynamically assign the next free id */ -#define DEVICE_ID_DYNAMIC -2 -/* do not use an id (only one device available) */ -#define DEVICE_ID_SINGLE -1 - /* Register devices and drivers. */ int register_driver(struct driver *); @@ -131,21 +126,6 @@ struct device *find_device(const char *str); */ int get_free_deviceid(const char *name_template); -static inline const char *dev_id(const struct device *dev) -{ - if (!dev) - return NULL; - return (dev->id != DEVICE_ID_SINGLE) ? dev->unique_name : dev->name; -} - -static inline const char *dev_name(const struct device *dev) -{ - if (!dev) - return NULL; - return dev_id(dev) ?: dev->name; -} - -int dev_set_name(struct device *dev, const char *fmt, ...) __printf(2, 3); int dev_add_alias(struct device *dev, const char *fmt, ...) __printf(2, 3); /* -- 2.39.5