diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2024-04-04 13:15:26 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2024-04-05 12:15:58 +0200 |
commit | e268186d8051163a7406fb4cf58f06349665e830 (patch) | |
tree | ff416c75a883507b0993a8e5d7aa0d881521cae4 /include | |
parent | c1bb8f33009e69f2c83d5963278bcf26d88cf819 (diff) | |
download | barebox-e268186d8051163a7406fb4cf58f06349665e830.tar.gz barebox-e268186d8051163a7406fb4cf58f06349665e830.tar.xz |
aiodev: add helper for getting a value by its channel name
It's a common pattern to get an aiochannel by name and the value
afterwards. Add a helper for this pattern.
Link: https://lore.barebox.org/20240404111527.2083308-1-s.hauer@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/aiodev.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/aiodev.h b/include/aiodev.h index 56bd2da9f5..fb0807ad42 100644 --- a/include/aiodev.h +++ b/include/aiodev.h @@ -47,4 +47,13 @@ static inline const char *aiochannel_get_unit(struct aiochannel *aiochan) extern struct list_head aiodevices; #define for_each_aiodevice(aiodevice) list_for_each_entry(aiodevice, &aiodevices, list) +#ifdef CONFIG_AIODEV +int aiochannel_name_get_value(const char *chname, int *value); +#else +static inline int aiochannel_name_get_value(const char *chname, int *value) +{ + return -EOPNOTSUPP; +} +#endif + #endif |