Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1162169lqg; Sat, 2 Mar 2024 20:01:03 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWAgMnlsGbitSfL183iJn8anF6AYZSqlObYsWnVcog4b1e9c2Q/lHXWUzhJrHaxaBpiL8fplQIvh/E+an6mtI2fjwZ8VH58tc4Jtg7rPw== X-Google-Smtp-Source: AGHT+IGLLhtAOTvaiys8Uc/y1ruLwEqjeHqRoNrZc8qWIHMNN8gMjIbF5+W5J4ctmlRUwk2UKlcZ X-Received: by 2002:a05:620a:12f6:b0:788:2448:c79e with SMTP id f22-20020a05620a12f600b007882448c79emr499595qkl.48.1709438463752; Sat, 02 Mar 2024 20:01:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709438463; cv=pass; d=google.com; s=arc-20160816; b=WxQlIWc3UfXBjUcjKfv5JOh43sScHRfo2lwphdHd4Brj5PH/u7EULi1T8LtZe+pJWo c9NiOXKdpOIFx0airhWcAEzG+2+xroKKSmbkY95TEgUs0WepbM1IRsPp5/7aY9Hc3RYV /Vz2ff6xtCcb4SrkunmtU2fCOeNJaqLkgVb60DlVGuFRRo/qD70OsAKpkjnhuphN8QcQ hvlTSDECb6VNJ2Yi0yuBfAaH4sdsIYvHSzVQbS8MGIxc+pajsv1Hxyd2SYsrUaKN1zPr Nbrc0BbZbwywro+fGpuhdYId3emqO4vOpEdJB/zQriwT/W0H/lYwjcDJWOwR612O0aqW kz8g== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=PhiUrETIRMebg6ALoa4IOs7lIQ1EFibqcBeta+nIzG0=; fh=oQbvuNnOUeIuBT5siQdg+euUHNNdn+CeEwAg69/1RSo=; b=X4zdOHPzqdSn4WerJ56Ua9YBToalVU2Kz22FTwOTWElQURomogPySxg9GKCgxgwsE/ s/rGfwLnYPDQSPdQh2REvGThCFx1kKrkFhedpQUsWm/UtVobVkYxawk84/u1vDUJm4YK AQeStrKaUoWzF4UmUbw5bfJLQSGovANt/94rwEgokXx4qKX/sLFS3inYYkzdZLcmL+lT 69FnuLIpqWDxiH7SJ+L4P31PSs5R33lPwDxCIZQHO9YZlBs4b7ViM4M6Xunz/aNq+KhJ w77NbMKkqc4IZ6na7llX3OIAKvgOu2ViZpbDieKhlf49L5TqQWeCCgphZFYejaqRf88Q 75GQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="I6/WB8v0"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-89647-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89647-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id wh16-20020a05620a56d000b0078824f87fd6si171332qkn.637.2024.03.02.20.01.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Mar 2024 20:01:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-89647-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="I6/WB8v0"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-89647-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89647-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 5AC501C210D4 for ; Sun, 3 Mar 2024 04:00:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5CB1E6FB2; Sun, 3 Mar 2024 04:00:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="I6/WB8v0" 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 824007F; Sun, 3 Mar 2024 04:00:40 +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=1709438440; cv=none; b=pv1I3dQhlv80NrEBqqiBWjDR273PecfH0fqAxET8gBp0/Su6k4FlvAd1hJjUyZ3kWnPiCtYMU5KAogh0BoCs5fqu0uQ4IMoDJGKCpJip7SguylhH3prMYL5S5iee44o7vEYaB864oNeh12bsKR75GF9yhtTTfkbm0WKGwoHXu5U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709438440; c=relaxed/simple; bh=Mxd0x4K9NZGsIbjj7+JyTXQS+jqX7z7/GCh2qtsgiqY=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=udCM0OeR4eI45p32Mw62yQWR4kM+gf3I1DJjqIOJuZKnf998fiQpAHuBYQB1Vf9eTsgZ44DexeTOo2sMOi/wZbWyAMjH93QF7WGa8NBE7u+VExd3PCiCsBZALQ/CtTEi0vFu4IPo8f7ET4KtN/qL0EFz6aZz6GOSx0DZwWa3ugU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=I6/WB8v0; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1BB65C433F1; Sun, 3 Mar 2024 04:00:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709438440; bh=Mxd0x4K9NZGsIbjj7+JyTXQS+jqX7z7/GCh2qtsgiqY=; h=From:To:Cc:Subject:Date:From; b=I6/WB8v0xtfAoZ9fO/YJHz0CBTagIz671gnhuLv+pRQSDnvsYOIxdAjZ+RdzKvGpB x/RXj0TYkydoeb1QXSIiPLUnSV8og78DVG6DyWtmP46FrMao3tq3J4iLKsF4BTCF7Z AaruHtJujblerzweEmzLJ3qKv211MKvELXbvr30TrU0H0Fqkg4PC8snPHu8clIvJws GoIWv5B9S6tiqMgiRHU/acj6TecEijtegH3EUe5xaUL2zQWQxojnfThIUEMbLnEPmW VShbeYPr5HvJAslQJJZbU8QZBuX9XLrqkkwwrGSX60vFcSu0dt5mmyT4RlSbtLGVaQ 1mX0uNlNEd0eQ== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH 1/3] kconfig: link menus to a symbol Date: Sun, 3 Mar 2024 13:00:33 +0900 Message-Id: <20240303040035.3450914-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Currently, there is no direct link from (struct symbol *) to (struct menu *). It is still possible to access associated menus through the P_SYMBOL property, because property::menu is the relevant menu entry, but it results in complex code, as seen in get_symbol_str(). Use a linked list for simpler traversal of relevant menus. Signed-off-by: Masahiro Yamada --- scripts/kconfig/expr.h | 5 +++++ scripts/kconfig/menu.c | 4 +++- scripts/kconfig/symbol.c | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h index 3bc375f1a1cd..0158f5eac454 100644 --- a/scripts/kconfig/expr.h +++ b/scripts/kconfig/expr.h @@ -108,6 +108,9 @@ struct symbol { */ tristate visible; + /* config entries associated with this symbol */ + struct list_head menus; + /* SYMBOL_* flags */ int flags; @@ -222,6 +225,8 @@ struct menu { */ struct symbol *sym; + struct list_head link; /* link to symbol::menus */ + /* * The prompt associated with the node. This holds the prompt for a * symbol as well as the text for a menu or comment, along with the diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index 44465945d6b1..571394ed71e0 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -57,8 +57,10 @@ void menu_add_entry(struct symbol *sym) *last_entry_ptr = menu; last_entry_ptr = &menu->next; current_entry = menu; - if (sym) + if (sym) { menu_add_symbol(P_SYMBOL, sym, NULL); + list_add_tail(&menu->link, &sym->menus); + } } struct menu *menu_add_menu(void) diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index dd5cf9727a9a..81fe1884ef8a 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@ -15,18 +15,21 @@ struct symbol symbol_yes = { .name = "y", .curr = { "y", yes }, + .menus = LIST_HEAD_INIT(symbol_yes.menus), .flags = SYMBOL_CONST|SYMBOL_VALID, }; struct symbol symbol_mod = { .name = "m", .curr = { "m", mod }, + .menus = LIST_HEAD_INIT(symbol_mod.menus), .flags = SYMBOL_CONST|SYMBOL_VALID, }; struct symbol symbol_no = { .name = "n", .curr = { "n", no }, + .menus = LIST_HEAD_INIT(symbol_no.menus), .flags = SYMBOL_CONST|SYMBOL_VALID, }; @@ -838,6 +841,7 @@ struct symbol *sym_lookup(const char *name, int flags) symbol->name = new_name; symbol->type = S_UNKNOWN; symbol->flags = flags; + INIT_LIST_HEAD(&symbol->menus); hash_add(sym_hashtable, &symbol->node, hash); -- 2.40.1