Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2622231pxb; Sun, 17 Oct 2021 20:46:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxoEZl8zfZ4uLFou0EFLpWSxIzKm04MPwyYk+QFft+VwOOiluy1vMnD9VGKV5VJLOQ0PQr X-Received: by 2002:a62:445:0:b0:44c:3b5b:f680 with SMTP id 66-20020a620445000000b0044c3b5bf680mr26763113pfe.30.1634528808862; Sun, 17 Oct 2021 20:46:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634528808; cv=none; d=google.com; s=arc-20160816; b=1JcD0KvygRYhR35a1AV6mr9FLMjjlpueLoJwCRIefetLs/KfRO4yt0//A5LFyygXta MpkfHCBa9QJk72dA6d6KBJayrXP9j5iUgk7b8f5KYph+9TvoiXmYmcS0+LYxxiqOEhd5 srIeAIOQzfPx45kfDLpvRBV68uS2RaHCs65JQ1alh/QrK6xbcrHjQ70sO7dh5F5DXzyy WbejVy6f29wCPTFAUnqEuJ7hMhP9oykEk9ZuUu8QZ4bKJH3kSMd2cFI+IfXfkpJu0e6W DCGf3i33t00bpIGKnpSXWIkAZqPxX5WKSM6D8RRVaxRQA3wb/8wsojQk4tcvDucThvS5 9bHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature:dkim-signature; bh=VSA0/C+Ci58NlZD+rt2K9iw1T0H+yB5CDTqvd/wmN6Y=; b=c7awwhXdlbeHj165I4i5wyLFcr1kurJiBcT0sSChDk+o5/rNdNwcepeBgQRCzkRP0w BQ8JZdzBGukIypo9HgHAvFVznuMePy4wCW+MppoL4O8e9crKvH2av6i9NeUPerut0USX A7g8YPAtKJ+Ecp/47nMP5CoGFseWRrinp6GiFmlcrNXXU1YTOckoeRy2GCxgDMFQLQGr WoewCaG+7CIhDJRqI8xLpBS1WC/h0IoTLGJ5DYVEm/FA79eccyFnlzkS41vJfQkYiuKC gRiz8zLI0FTIidSDXnfq8JzGO5T2ysCw0qEP+uYOdizjoTg1i6v8CQcWakbDF+dPe+kX CMNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joshtriplett.org header.s=fm2 header.b=tk8EU0kT; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=hJ72YBJ3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v1si20182291plg.230.2021.10.17.20.46.36; Sun, 17 Oct 2021 20:46:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@joshtriplett.org header.s=fm2 header.b=tk8EU0kT; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=hJ72YBJ3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344426AbhJQRp3 (ORCPT + 98 others); Sun, 17 Oct 2021 13:45:29 -0400 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:57169 "EHLO wout5-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344366AbhJQRp2 (ORCPT ); Sun, 17 Oct 2021 13:45:28 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 36DE13200927; Sun, 17 Oct 2021 13:43:18 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Sun, 17 Oct 2021 13:43:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= joshtriplett.org; h=date:from:to:cc:subject:message-id :mime-version:content-type; s=fm2; bh=VSA0/C+Ci58NlZD+rt2K9iw1T0 H+yB5CDTqvd/wmN6Y=; b=tk8EU0kTryHQXKjUalVdOsghSS2oJm4WCA1dyPvLH3 OPRPha7C7gJ6oltnSbsJKBqILfKE2RCe7oIQEU3HdfR3xEO+2i2VMbIHmyMgQsWC cJ+MDrqOyYaDir0zKcwWamYQXjWozi+Kg/ZZwg6XY0tiV7D1KT4b8sxVZzAvJzhq rr/mFueyMuz1SOiLisoUWEC+pbtkyrxrgrAx3hiAY/Twn0gTgKpL54emkDlUpU6k doxFXv7KsJcTAAPbC2yyZtZvehrqt2K8A/4lAcaNpRRkrHgLfq52isxOqm2Wosbn zWDoIxqPz7AVqS3PapKYrw4gon+10fDIwl86ABrbINDw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:message-id :mime-version:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=VSA0/C+Ci58NlZD+rt2K9iw1T0H+y B5CDTqvd/wmN6Y=; b=hJ72YBJ3ZdJ/9lnm2HiK9bQSnt6EK4Wd9rFuQ3LhgrlLG +kPLolrr5UGiG5h3S8NafUxsnDYNqtELk/pWxMmVcDVJdeZ/x0BwNyXolgnsjjWj Men3P6UeC7BosXs8N/8JkzVpVf2DSN/wgL804WfJp0Hfy7PBDTKCDin3ffK0fxWN EeHaiFXYmLUgGDXAwnGNuCwqY0ecaP2pPGv1npxZ+ifXLlTBBamlOqgwkBTeFtBb 35whb4jy+zy4nQzIFLR6bjC5RDvJCgTZ9rufhsmQ1iNEpvCt0ypnICFCu6Bn8bMQ wAubVlkGKA+7FwwjGjm34LRQ/FdzRAeQ+kB2xZ8IA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddukedguddugecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkgggtugesthdtredttddtvdenucfhrhhomheplfhoshhhucfv rhhiphhlvghtthcuoehjohhshhesjhhoshhhthhrihhplhgvthhtrdhorhhgqeenucggtf frrghtthgvrhhnpeelleeggedtjeejfeeuvddufeeggfektdefkeehveeuvedvvdfhgeff gfdvgfffkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehjohhshhesjhhoshhhthhrihhplhgvthhtrdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 17 Oct 2021 13:43:16 -0400 (EDT) Date: Sun, 17 Oct 2021 19:43:13 +0200 From: Josh Triplett To: Masahiro Yamada Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] kconfig: Add `make mod2noconfig` to disable module options Message-ID: <37c3a9d3d6fceba0f55d05e7558370e3f60b8bf0.1634492509.git.josh@joshtriplett.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When converting a modular kernel to a monolithic kernel, once the kernel works without loading any modules, this helps to quickly disable all the modules before turning off module support entirely. Refactor conf_rewrite_mod_or_yes to a more general conf_rewrite_tristates that accepts an old and new state. Signed-off-by: Josh Triplett --- scripts/kconfig/Makefile | 3 ++- scripts/kconfig/conf.c | 17 ++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 5a215880b268..b8ef0fb4bbef 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -69,7 +69,7 @@ localyesconfig localmodconfig: $(obj)/conf # deprecated for external use simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \ alldefconfig randconfig listnewconfig olddefconfig syncconfig \ - helpnewconfig yes2modconfig mod2yesconfig + helpnewconfig yes2modconfig mod2yesconfig mod2noconfig PHONY += $(simple-targets) @@ -134,6 +134,7 @@ help: @echo ' randconfig - New config with random answer to all options' @echo ' yes2modconfig - Change answers from yes to mod if possible' @echo ' mod2yesconfig - Change answers from mod to yes if possible' + @echo ' mod2noconfig - Change answers from mod to no if possible' @echo ' listnewconfig - List new options' @echo ' helpnewconfig - List new options and help text' @echo ' olddefconfig - Same as oldconfig but sets new symbols to their' diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 5d84b44a2a2a..5535dddab770 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -35,6 +35,7 @@ enum input_mode { olddefconfig, yes2modconfig, mod2yesconfig, + mod2noconfig, }; static enum input_mode input_mode = oldaskconfig; static int input_mode_opt; @@ -163,8 +164,6 @@ enum conf_def_mode { def_default, def_yes, def_mod, - def_y2m, - def_m2y, def_no, def_random }; @@ -302,12 +301,10 @@ static bool conf_set_all_new_symbols(enum conf_def_mode mode) return has_changed; } -static void conf_rewrite_mod_or_yes(enum conf_def_mode mode) +static void conf_rewrite_tristates(tristate old_val, tristate new_val) { struct symbol *sym; int i; - tristate old_val = (mode == def_y2m) ? yes : mod; - tristate new_val = (mode == def_y2m) ? mod : yes; for_all_symbols(i, sym) { if (sym_get_type(sym) == S_TRISTATE && @@ -696,6 +693,7 @@ static const struct option long_opts[] = { {"olddefconfig", no_argument, &input_mode_opt, olddefconfig}, {"yes2modconfig", no_argument, &input_mode_opt, yes2modconfig}, {"mod2yesconfig", no_argument, &input_mode_opt, mod2yesconfig}, + {"mod2noconfig", no_argument, &input_mode_opt, mod2noconfig}, {NULL, 0, NULL, 0} }; @@ -724,6 +722,7 @@ static void conf_usage(const char *progname) printf(" --randconfig New config with random answer to all options\n"); printf(" --yes2modconfig Change answers from yes to mod if possible\n"); printf(" --mod2yesconfig Change answers from mod to yes if possible\n"); + printf(" --mod2noconfig Change answers from mod to no if possible\n"); printf(" (If none of the above is given, --oldaskconfig is the default)\n"); } @@ -799,6 +798,7 @@ int main(int ac, char **av) case olddefconfig: case yes2modconfig: case mod2yesconfig: + case mod2noconfig: conf_read(NULL); break; case allnoconfig: @@ -873,10 +873,13 @@ int main(int ac, char **av) case savedefconfig: break; case yes2modconfig: - conf_rewrite_mod_or_yes(def_y2m); + conf_rewrite_tristates(yes, mod); break; case mod2yesconfig: - conf_rewrite_mod_or_yes(def_m2y); + conf_rewrite_tristates(mod, yes); + break; + case mod2noconfig: + conf_rewrite_tristates(mod, no); break; case oldaskconfig: rootEntry = &rootmenu; -- 2.33.0