Skip to contentSkip to conversation

power-domain: add dummy functions when CONFIG_POWER_DOMAIN not defined

PATCH New Anatolij Gustschin 1 participant 2 messages Aug 6, 2018

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/4 power-domain: add dummy functions when CONFIG_POWER_DOMAIN not defined

From: Peng Fan <[email protected]>

Add dummy functions when CONFIG_POWER_DOMAIN not defined.

---

V3:
- add 'static inline' to fix build breakage
- use -ENOSYS as we do elsewhere to indicate not implemented functionality

V2: Use CONFIG_IS_ENABLED

 include/power-domain.h | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
include/power-domain.h +29 -0
index aba8c0f65c..a558fbbdb2 100644
@@ -87,7 +87,15 @@ struct power_domain {
  * @power_domain	A pointer to a power domain struct to initialize.
  * @return 0 if OK, or a negative error code.
  */
+#if CONFIG_IS_ENABLED(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 -ENOSYS;
+}
+#endif
 
 /**
  * power_domain_free - Free a previously requested power domain.
@@ -96,7 +104,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.
  */
+#if CONFIG_IS_ENABLED(POWER_DOMAIN)
 int power_domain_free(struct power_domain *power_domain);
+#else
+static inline int power_domain_free(struct power_domain *power_domain)
+{
+	return -ENOSYS;
+}
+#endif
 
 /**
  * power_domain_on - Enable power to a power domain.
@@ -105,7 +120,14 @@ int power_domain_free(struct power_domain *power_domain);
  *		requested by power_domain_get().
  * @return 0 if OK, or a negative error code.
  */
+#if CONFIG_IS_ENABLED(POWER_DOMAIN)
 int power_domain_on(struct power_domain *power_domain);
+#else
+static inline int power_domain_on(struct power_domain *power_domain)
+{
+	return -ENOSYS;
+}
+#endif
 
 /**
  * power_domain_off - Disable power ot a power domain.
@@ -114,6 +136,13 @@ int power_domain_on(struct power_domain *power_domain);
  *		requested by power_domain_get().
  * @return 0 if OK, or a negative error code.
  */
+#if CONFIG_IS_ENABLED(POWER_DOMAIN)
 int power_domain_off(struct power_domain *power_domain);
+#else
+static inline int power_domain_off(struct power_domain *power_domain)
+{
+	return -ENOSYS;
+}
+#endif
 
 #endif
Signature · 1 line
2.14.1
#1 lore raw

PATCH v3 1/4 power-domain: add dummy functions when CONFIG_POWER_DOMAIN not defined

Quoted 9 lines · On Mon, 6 Aug 2018 12:02:45 +0200 Anatolij Gustschin agust at denx.de wrote:

From: Peng Fan <[email protected]>

Add dummy functions when CONFIG_POWER_DOMAIN not defined.

---

Quoted 8 lines

V3:
- add 'static inline' to fix build breakage
- use -ENOSYS as we do elsewhere to indicate not implemented functionality

V2: Use CONFIG_IS_ENABLED

 include/power-domain.h | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

Applied to u-boot-staging/agust at denx.de, thanks!

--
Anatolij