Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752726Ab2JAM1c (ORCPT ); Mon, 1 Oct 2012 08:27:32 -0400 Received: from mail-we0-f174.google.com ([74.125.82.174]:54148 "EHLO mail-we0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751665Ab2JAM1a (ORCPT ); Mon, 1 Oct 2012 08:27:30 -0400 From: Anisse Astier To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: Paul Gortmaker , Michal Marek , Linus Torvalds , Michael Chan , Matt Carlson , Anisse Astier Subject: [PATCH 1/2] kconfig: Introduce IS_DEPENDENCY_SATISFIED() Date: Mon, 1 Oct 2012 14:21:19 +0200 Message-Id: <1349094080-769-1-git-send-email-anisse@astier.eu> X-Mailer: git-send-email 1.7.10.3 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1621 Lines: 44 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 --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/