netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anisse Astier <anisse@astier.eu>
To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>,
	Michal Marek <mmarek@suse.cz>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Michael Chan <mchan@broadcom.com>,
	Matt Carlson <mcarlson@broadcom.com>,
	Anisse Astier <anisse@astier.eu>
Subject: [PATCH 1/2] kconfig: Introduce IS_DEPENDENCY_SATISFIED()
Date: Mon,  1 Oct 2012 14:21:19 +0200	[thread overview]
Message-ID: <1349094080-769-1-git-send-email-anisse@astier.eu> (raw)

Most of the time, when we use IS_ENABLED() it's to specify a dependency
on a config option that might be enabled. But if this option is enabled
as a module, and we are built-in, then we'll have missing symbols.

This new macro is therefore useful to specify a dependency on another
config. But it also needs to know our own config option in order to
check if the dependency is properly satisfied.

IS_DEPENDENCY_SATISFIED(CONFIG_SELF, CONFIG_FOO) evaluates to 1 if
CONFIG_FOO is set to 'y' or 'm', and set the same as CONFIG_SELF. It
evaluates to 0 otherwise.

Signed-off-by: Anisse Astier <anisse@astier.eu>
---
 include/linux/kconfig.h |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h
index be342b9..8b8ec1f 100644
--- a/include/linux/kconfig.h
+++ b/include/linux/kconfig.h
@@ -43,4 +43,14 @@
  */
 #define IS_MODULE(option) config_enabled(option##_MODULE)
 
+
+/*
+ * IS_DEPENDENCY_SATISFIED(CONFIG_SELF, CONFIG_FOO) evaluates to 1 if
+ * CONFIG_FOO is set to 'y' or 'm', and set the same as CONFIG_SELF.
+ * Useful for specifying build-time config dependencies.
+ */
+#define IS_DEPENDENCY_SATISFIED(self, dependency) \
+	((config_enabled(self) && config_enabled(dependency)) || \
+	 (config_enabled(self##_MODULE) && config_enabled(dependency##_MODULE)))
+
 #endif /* __LINUX_KCONFIG_H */
-- 
1.7.10.3

             reply	other threads:[~2012-10-01 12:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-01 12:21 Anisse Astier [this message]
2012-10-01 12:21 ` [PATCH 2/2] tg3: fix build-time dependency with IS_DEPENDENCY_SATISFIED() Anisse Astier
2012-10-01 16:10   ` Paul Gortmaker
2012-10-01 21:45     ` David Miller

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=1349094080-769-1-git-send-email-anisse@astier.eu \
    --to=anisse@astier.eu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcarlson@broadcom.com \
    --cc=mchan@broadcom.com \
    --cc=mmarek@suse.cz \
    --cc=netdev@vger.kernel.org \
    --cc=paul.gortmaker@windriver.com \
    --cc=torvalds@linux-foundation.org \
    /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;
as well as URLs for NNTP newsgroup(s).