Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp441966lqj; Sun, 2 Jun 2024 05:54:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUB5joVknnXssI1TfDYz54ltLvl+5VVSnid1CrLAkgQBEY/Dju1H2vnC48meBxsSYKDak3KLDIBCo0RKty9uxRkfMrECzfT0MIQ+pyG9Q== X-Google-Smtp-Source: AGHT+IEAV17hfhO+TN0FVElH+VzH2cRGOhjjC78j8UkUZ1BEaBzt+FFtvH3hebbLn4L2WB5piH5s X-Received: by 2002:a17:90b:1089:b0:2c2:e22:787e with SMTP id 98e67ed59e1d1-2c20e2279d4mr1971893a91.33.1717332892847; Sun, 02 Jun 2024 05:54:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717332892; cv=pass; d=google.com; s=arc-20160816; b=AKjudPRjuMH8HZMVrKHF5Qd5AtlcRAENoyJjfb1BZCw/nbAdl2i6im38HI/yjUKTI1 gLwCq8uWAHjX2yQraxauRTBTKs4LpV5Fs+Mx/AM+HJmvvePV/mi8CAcH6qffYCTvU0m1 jCBzUHqu6VwQkugATBHwfqf5HgLwXw2OhnoIGuT2aBPUQ4UiTH1rS0ZDt9lUR5b2Uiz/ WUmrwKyPJhIG01g30mDg4BjrE3oRILENf6MFlmA45LhDjSTtLdPcsQ/u9YIkhooVVyhK mH34Fk0x+zS/IM6Bb9tnRl80jZIebyxmukF/nCLv4O8exRQDWRG+hV/nFYT7QaP1nbbt gppQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=cHoeyDQK5wACBMZhUTHbjmwdWzm9BbPI164FOm6dHto=; fh=oQbvuNnOUeIuBT5siQdg+euUHNNdn+CeEwAg69/1RSo=; b=UGeTIYrGpJRYUkPyM+501ngI22TayykxkLYaSJZcfr2yRESkBOCkf0nOJUrvz80M4J PJWvZhmHhHKodFXxHg7yOiOHW3CEu/pW5B7v9htsbtYWjWuL2Vi6A8kb1C1LBcfudYA0 C+dKygDEDEwP7jNx2QpAoQgK8KKMxNvoVcB9H01/lrZibYry08A6qWrWW7ZT2Ma/VMHz /h/6guyrLpXgSpxkc2PosI7QrV/IxZKwnYmSGRZnwSfvmtQ8Mx0RfXJn7biQfjsBjZK+ y9yJwQc7giP0sI6PDIQMWk0ImdCZWtQCZd4WI4G99cmqoWIgs0zEgx53le+XrH67uLXK WFvA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QBlomwSg; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-198243-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198243-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6c355157dddsi4508801a12.196.2024.06.02.05.54.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 05:54:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-198243-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QBlomwSg; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-198243-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198243-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7A3B828282F for ; Sun, 2 Jun 2024 12:54:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9626240848; Sun, 2 Jun 2024 12:54:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="QBlomwSg" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD8E13DBBF; Sun, 2 Jun 2024 12:54:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717332867; cv=none; b=CZxmk9exZmgo2VGWvG8UI3d3bKC93wE0gmpxtIzRquDok+jPMFZmyoIZJft8UKv0E5gtjlcgu5pEzxNpXTUS/2NuJ507qHmxt0C4LYcuf959+0iGEP3cYjns0yb9K1G555f7ppiARMJJ3KokwOWWQdqMs/1x+2LGGwYG1OGfoFU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717332867; c=relaxed/simple; bh=UPF+rTM68XnLpCea7WoA/GMqSo6CeLlyZ02RZ4r0zac=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=lXuJk3ikDqMqq6rJW/EP3YiURQnyR3G8K2jQ0XH2MdtXCOfLLBGzcjYuLOd0BH2+GUcRVrfWPdkP2G07SX3VgimR3aKslHfbSQ5s6HFT9x/Ac6QU818/nxCFbvGeI2fmf4IV3caHzcxsIL3nW+HnHGYR8pZJcZDdsGWzDQvkY9c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QBlomwSg; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A708AC4AF0A; Sun, 2 Jun 2024 12:54:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717332867; bh=UPF+rTM68XnLpCea7WoA/GMqSo6CeLlyZ02RZ4r0zac=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QBlomwSguqYcinAwop9pB9hUmtgoAkonroAhYBEAPS6PgSDsoS7gLuU/t9pkReNLi sVzdCZe09vnVN4vS715Srp+RZJN72Ikoi/SkqeGziROhnN0tBSCJ0IpRid80QjZ5G0 pRoXZL7TE3JF0eWSVatt73qObCTMcDnzLe48TEBzAweRwSGzXGUCYSKRGPYnYTx/rJ 9DhrrQGgwy1uOLHKYpTX6F1WhIjVw3mMWnM9L+n3ti4ACkvxMEMJLK1/8wcmV4a7g0 xapAP5Vb/91MjelH/xgapwsGFjOtksA6htpew0THyWN+KJcN1OsuXUV8RnURl1nIlV jHQFtz0kniQ9Q== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH 3/3] kconfig: refactor conf_write_defconfig() to reduce indentation level Date: Sun, 2 Jun 2024 21:54:16 +0900 Message-Id: <20240602125416.976336-3-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240602125416.976336-1-masahiroy@kernel.org> References: <20240602125416.976336-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Reduce the indentation level by continue'ing the loop earlier if (!sym || sym_is_choice(sym)). No functional change intended. Signed-off-by: Masahiro Yamada --- scripts/kconfig/confdata.c | 47 ++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 25c327ae3c5c..1ac7fc9ad756 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -774,34 +774,31 @@ int conf_write_defconfig(const char *filename) struct menu *choice; sym = menu->sym; - if (sym && !sym_is_choice(sym)) { - sym_calc_value(sym); - if (!(sym->flags & SYMBOL_WRITE)) - continue; - sym->flags &= ~SYMBOL_WRITE; - /* If we cannot change the symbol - skip */ - if (!sym_is_changeable(sym)) - continue; - /* If symbol equals to default value - skip */ - if (strcmp(sym_get_string_value(sym), sym_get_string_default(sym)) == 0) - continue; - /* - * If symbol is a choice value and equals to the - * default for a choice - skip. - */ - choice = sym_get_choice_menu(sym); - if (choice) { - struct symbol *ds; + if (!sym || sym_is_choice(sym)) + continue; - ds = sym_choice_default(choice->sym); - if (sym == ds) { - if (sym_get_tristate_value(sym) == yes) - continue; - } - } - print_symbol_for_dotconfig(out, sym); + sym_calc_value(sym); + if (!(sym->flags & SYMBOL_WRITE)) + continue; + sym->flags &= ~SYMBOL_WRITE; + /* Skip unchangeable symbols */ + if (!sym_is_changeable(sym)) + continue; + /* Skip symbols that are equal to the default */ + if (!strcmp(sym_get_string_value(sym), sym_get_string_default(sym))) + continue; + + /* Skip choice values that are equal to the default */ + choice = sym_get_choice_menu(sym); + if (choice) { + struct symbol *ds; + + ds = sym_choice_default(choice->sym); + if (sym == ds && sym_get_tristate_value(sym) == yes) + continue; } + print_symbol_for_dotconfig(out, sym); } fclose(out); return 0; -- 2.40.1