From patchwork Tue Jun 14 05:58:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 69964 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp1882141qgf; Mon, 13 Jun 2016 22:58:38 -0700 (PDT) X-Received: by 10.98.91.7 with SMTP id p7mr1803902pfb.8.1465883918468; Mon, 13 Jun 2016 22:58:38 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p81si21575742pfa.12.2016.06.13.22.58.38; Mon, 13 Jun 2016 22:58:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751289AbcFNF6g (ORCPT + 30 others); Tue, 14 Jun 2016 01:58:36 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:16890 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751194AbcFNF6f (ORCPT ); Tue, 14 Jun 2016 01:58:35 -0400 Received: from beagle.diag.org (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id u5E5vrmY023811; Tue, 14 Jun 2016 14:57:54 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com u5E5vrmY023811 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1465883875; bh=s2XlSc+QnpK20iCgaslKn+0Tq1U8JZnQ6cB6WxI0NtU=; h=From:To:Cc:Subject:Date:From; b=ppk8AXbXJLtbjeQLUSYTFGuW2Q9Q9iMHxSRwFdmIABwkFDd9L5BG1sC9Zag3CsCBN w8er+JcMq6o3YtLpqLooa5uHe1fG3CqUnRqJzyM0P9YmvAldOQmApoW08w+FNCx/fa mG878ysszxmD68dt3dpGFCJzUs+47UBqPr14i6rMGF90vov/t9MUgp3k42/AFYzDAE MCK9/WL+/8vZ+7Bh2/tLqN0P4GrHiXVMZt9pYAUgB2G0cbmxLLdnX2Kcg5ern9e6fA Ycj7siw4zsWZBK3c8Bb22v33DkYGMLDHGI6Hlc7IeSE0eE5Sde2u8zkf536WA0r5+M DTF+tpiQyCabQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kernel@vger.kernel.org, Andrew Morton Cc: Rusty Russell , Michal Simek , Linus Torvalds , Arnd Bergmann , Michal Marek , Nicolas Pitre , Masahiro Yamada Subject: [PATCH 1/5] kconfig.h: use __is_defined() to check if MODULE is defined Date: Tue, 14 Jun 2016 14:58:54 +0900 Message-Id: <1465883938-25194-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The macro MODULE is not a config option, it is a per-file build option. So, config_enabled(MODULE) is not sensible. (There is another case in include/linux/export.h, where config_enabled() is used against a non-config option.) This commit renames some macros in include/linux/kconfig.h for the use for non-config macros and replaces config_enabled(MODULE) with __is_defined(MODULE). I am keeping config_enabled() because it is still referenced from some places, but I expect it would be deprecated in the future. Signed-off-by: Masahiro Yamada --- include/linux/kconfig.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) -- 1.9.1 diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h index b33c779..a94b5bf 100644 --- a/include/linux/kconfig.h +++ b/include/linux/kconfig.h @@ -17,10 +17,11 @@ * the last step cherry picks the 2nd arg, we get a zero. */ #define __ARG_PLACEHOLDER_1 0, -#define config_enabled(cfg) _config_enabled(cfg) -#define _config_enabled(value) __config_enabled(__ARG_PLACEHOLDER_##value) -#define __config_enabled(arg1_or_junk) ___config_enabled(arg1_or_junk 1, 0) -#define ___config_enabled(__ignored, val, ...) val +#define config_enabled(cfg) ___is_defined(cfg) +#define __is_defined(x) ___is_defined(x) +#define ___is_defined(val) ____is_defined(__ARG_PLACEHOLDER_##val) +#define ____is_defined(arg1_or_junk) __take_second_arg(arg1_or_junk 1, 0) +#define __take_second_arg(__ignored, val, ...) val /* * IS_BUILTIN(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y', 0 @@ -42,7 +43,7 @@ * built-in code when CONFIG_FOO is set to 'm'. */ #define IS_REACHABLE(option) (config_enabled(option) || \ - (config_enabled(option##_MODULE) && config_enabled(MODULE))) + (config_enabled(option##_MODULE) && __is_defined(MODULE))) /* * IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm',