diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2023-09-13 15:24:54 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2023-09-25 09:23:14 +0200 |
commit | d914ef13a983544604e83afc0988c1055ae14a34 (patch) | |
tree | ce97b7a0d289fbd2c504eef84006f7af13e5022c /include/driver.h | |
parent | deb5bf1ef671ff61cd1d657b438b787fd44a0d2f (diff) | |
download | barebox-d914ef13a983544604e83afc0988c1055ae14a34.tar.gz barebox-d914ef13a983544604e83afc0988c1055ae14a34.tar.xz |
driver: add support for device aliases
Device names can get quite long, which makes them cumbersome to use
on the shell, e.g. firmware:zynqmp-firmware:clock-controller.of.
In addition, the names are prone to change when the device tree nodes
are renamed.
One way we work around this is using aliases, but that is partially at
odds with upstream binding. This commit adds an alternative way of
allowing drivers and board code to set an alias that affects only
device_param_complete.
This provides an easy way of defining device names that should be stable
for use in shell scripts.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20230913132456.2211919-2-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/driver.h')
-rw-r--r-- | include/driver.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/driver.h b/include/driver.h index 2651cddecc..a0234fb6c3 100644 --- a/include/driver.h +++ b/include/driver.h @@ -101,6 +101,12 @@ struct device { char *deferred_probe_reason; }; +struct device_alias { + struct device *dev; + struct list_head list; + char name[]; +}; + /** @brief Describes a driver present in the system */ struct driver { /*! The name of this driver. Used to match to @@ -216,6 +222,7 @@ static inline const char *dev_name(const struct device *dev) } int dev_set_name(struct device *dev, const char *fmt, ...); +int dev_add_alias(struct device *dev, const char *fmt, ...); /* * get resource 'num' for a device |