summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2024-04-15 07:31:30 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2024-04-16 12:27:07 +0200
commit8c29354b8025c0be1737c43e0f1cee6428ae5ba3 (patch)
treeb2dd4adb1ee688399527855fbf7cb0cfb7518d74 /include
parent6f369372f147ea95f1a3b7b90e96fabe1df3fe1d (diff)
downloadbarebox-8c29354b8025c0be1737c43e0f1cee6428ae5ba3.tar.gz
barebox-8c29354b8025c0be1737c43e0f1cee6428ae5ba3.tar.xz
soc: rockchip: io-domain: handle missing supply correctly
The original Linux code calls regulator_get_optional and handles its -ENODEV return code, which morphed into regulator_get when ported to barebox. The error handling stayed as-is leading to causing supplies to trigger errors instead of being silently ignored. As we use NULL to describe the dummy regulator in barebox, we can add a trivial regulator_get_optional implementation and use it to fix the I/O domain driver. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240415053130.368278-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r--include/regulator.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/regulator.h b/include/regulator.h
index 135fe6d91f..305da0d774 100644
--- a/include/regulator.h
+++ b/include/regulator.h
@@ -3,6 +3,7 @@
#define __REGULATOR_H
#include <linux/bitops.h>
+#include <linux/err.h>
struct device;
@@ -284,4 +285,11 @@ static inline int regulator_get_voltage(struct regulator *regulator)
#endif
+static inline struct regulator *regulator_get_optional(struct device *dev,
+ const char *id)
+{
+ return regulator_get(dev, id) ?: ERR_PTR(-ENODEV);
+}
+
+
#endif /* __REGULATOR_H */