public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Anatolij Gustschin <agust@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 1/4] power-domain: add dummy functions when CONFIG_POWER_DOMAIN not defined
Date: Mon,  6 Aug 2018 12:02:45 +0200	[thread overview]
Message-ID: <20180806100245.6002-1-agust@denx.de> (raw)

From: Peng Fan <peng.fan@nxp.com>

Add dummy functions when CONFIG_POWER_DOMAIN not defined.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
---

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(+)

diff --git a/include/power-domain.h b/include/power-domain.h
index aba8c0f65c..a558fbbdb2 100644
--- a/include/power-domain.h
+++ b/include/power-domain.h
@@ -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
-- 
2.14.1

             reply	other threads:[~2018-08-06 10:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-06 10:02 Anatolij Gustschin [this message]
2018-08-06 10:17 ` [U-Boot] [PATCH v3 1/4] power-domain: add dummy functions when CONFIG_POWER_DOMAIN not defined Anatolij Gustschin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180806100245.6002-1-agust@denx.de \
    --to=agust@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox