[U-Boot] [PATCH 34/41] power-domain: add dummy functions when CONFIG_POWER_DOMAIN not defined

Peng Fan peng.fan at nxp.com
Mon May 28 12:25:19 UTC 2018


Add dummy functions when CONFIG_POWER_DOMAIN not defined.

Signed-off-by: Peng Fan <peng.fan at nxp.com>
Cc: Simon Glass <sjg at chromium.org>
---
 include/power-domain.h | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/include/power-domain.h b/include/power-domain.h
index 9060b174c0..a990479d03 100644
--- a/include/power-domain.h
+++ b/include/power-domain.h
@@ -86,8 +86,16 @@ struct power_domain {
  * @return 0 if OK, or a negative error code.
  */
 
+#ifdef CONFIG_POWER_DOMAIN
 int power_domain_lookup_name(const char *name,
 			     struct power_domain *power_domain);
+#else
+static inline int power_domain_lookup_name(const char *name,
+					   struct power_domain *power_domain)
+{
+	return -EINVAL;
+}
+#endif
 
 /**
  * power_domain_get - Get/request the power domain for a device.
@@ -102,7 +110,15 @@ int power_domain_lookup_name(const char *name,
  * @power_domain	A pointer to a power domain struct to initialize.
  * @return 0 if OK, or a negative error code.
  */
+#ifdef CONFIG_POWER_DOMAIN
 int power_domain_get(struct udevice *dev, struct power_domain *power_domain);
+#else
+static inline int power_domain_get(struct udevice *dev,
+				   struct power_domain *power_domain)
+{
+	return -EINVAL;
+}
+#endif
 
 /**
  * power_domain_free - Free a previously requested power domain.
@@ -111,7 +127,14 @@ int power_domain_get(struct udevice *dev, struct power_domain *power_domain);
  *		requested by power_domain_get().
  * @return 0 if OK, or a negative error code.
  */
+#ifdef CONFIG_POWER_DOMAIN
 int power_domain_free(struct power_domain *power_domain);
+#else
+static inline int power_domain_free(struct power_domain *power_domain)
+{
+	return -EINVAL;
+}
+#endif
 
 /**
  * power_domain_on - Enable power to a power domain.
@@ -120,7 +143,14 @@ int power_domain_free(struct power_domain *power_domain);
  *		requested by power_domain_get().
  * @return 0 if OK, or a negative error code.
  */
+#ifdef CONFIG_POWER_DOMAIN
 int power_domain_on(struct power_domain *power_domain);
+#else
+static inline int power_domain_on(struct power_domain *power_domain);
+{
+	return -EINVAL;
+}
+#endif
 
 /**
  * power_domain_off - Disable power ot a power domain.
@@ -129,6 +159,13 @@ int power_domain_on(struct power_domain *power_domain);
  *		requested by power_domain_get().
  * @return 0 if OK, or a negative error code.
  */
+#ifdef CONFIG_POWER_DOMAIN
 int power_domain_off(struct power_domain *power_domain);
+#else
+static inline int power_domain_off(struct power_domain *power_domain)
+{
+	return -EINVAL;
+}
+#endif
 
 #endif
-- 
2.14.1



More information about the U-Boot mailing list