mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dirk Gouders <dirk@gouders.net>
To: Christoph Hellwig <hch@lst.de>
Cc: Randy Dunlap <rdunlap@infradead.org>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	Richard Weinberger <richard@nod.at>,
	Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>,
	linux-um@lists.infradead.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 4/9] kconfig: include common Kconfig files from top-level Kconfig
Date: Fri, 20 Jul 2018 21:57:36 +0200	[thread overview]
Message-ID: <ghzhyl7k9b.fsf@lena.gouders.net> (raw)
In-Reply-To: <20180719131149.GA12480@lst.de> (Christoph Hellwig's message of "Thu, 19 Jul 2018 15:11:49 +0200")

[-- Attachment #1: Type: text/plain, Size: 1549 bytes --]

Christoph Hellwig <hch@lst.de> writes:

> On Wed, Jul 18, 2018 at 12:06:26AM -0700, Randy Dunlap wrote:
>> All $ARCH look equivalent except for microblaze and nios2.
>> For those, the config SWAP in init/Kconfig (line 221) comes before (and
>> hence takes precedence) over arch/$(SRCARCH)/Kconfig settings, which is
>> def_bool n for both microblaze and nios2.
>
> Both of those are NOMMU architectures, so the default SWAP
> decaration should do the right thing.
>
> I wish the kconfig tools could warn about duplicate symbols, as they
> are basically always bogus or at least very problematic.

Your wish is our command ;-)

A big but: duplicate symbol definitions are explicitely allowed by the
kconfig language, so you find most of those duplicates are actually just
varying dependencies or default values.  At least, it is interesting to
see how "duplicate" symbol definitions are used and perhaps this helps
you with your reordering.

This is just a prototype, that hopefully helps with your current task,
so I did not pay too much attention to make it beautiful.  Please let me
know if anything is missing.

Anyway, apply the patch and then invoke "make symcheckconfig" at the
top-level directory.

Dirk

> I've update the kconfig-cleanup branch in git with the fixes, but
> I didn't have time to do anything but a trivial x86 test yet.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


[-- Attachment #2: symcheckconfig target --]
[-- Type: text/plain, Size: 1934 bytes --]

diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index a3ac2c91331c..52a0ee0637e9 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -222,3 +222,8 @@ $(obj)/.%conf-cfg: $(src)/%conf-cfg.sh FORCE
 	$(call filechk,conf_cfg)
 
 clean-files += .*conf-cfg
+
+PHONY += symcheckconfig
+
+symcheckconfig: $(obj)/conf
+	$< $(silent) --$@ $(Kconfig)
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 671ff5364497..1083ddcdd05e 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -33,6 +33,7 @@ enum input_mode {
 	savedefconfig,
 	listnewconfig,
 	olddefconfig,
+	symcheckconfig,
 };
 static enum input_mode input_mode = oldaskconfig;
 
@@ -466,6 +467,7 @@ static struct option long_opts[] = {
 	 * value but not 'n') with the counter-intuitive name.
 	 */
 	{"oldnoconfig",     no_argument,       NULL, olddefconfig},
+	{"symcheckconfig",     no_argument,       NULL, symcheckconfig},
 	{NULL, 0, NULL, 0}
 };
 
@@ -490,6 +492,31 @@ static void conf_usage(const char *progname)
 	printf("  --randconfig            New config with random answer to all options\n");
 }
 
+static void find_sym_dups(void)
+{
+	struct symbol *sym;
+	struct property *prop;
+	int i;
+	int cnt = 0;
+	char *file;
+	int lineno;
+
+	for_all_symbols(i, sym) {
+		for_all_properties(sym, prop, P_SYMBOL) {
+			if (cnt == 1) {
+				printf("Duplicate symbol %s\n\t(%s:%d):\n", sym->name, file, lineno);
+			}
+			if (cnt)
+				printf("\t(%s:%d)\n", prop->file->name, prop->lineno);
+
+			cnt += 1;
+			file = (char *)prop->file->name;
+			lineno = prop->lineno;
+		}
+		cnt = 0;
+	}
+}
+
 int main(int ac, char **av)
 {
 	const char *progname = av[0];
@@ -560,6 +587,12 @@ int main(int ac, char **av)
 	}
 	name = av[optind];
 	conf_parse(name);
+
+	if (input_mode == symcheckconfig) {
+		find_sym_dups();
+		exit(0);
+	}
+
 	//zconfdump(stdout);
 	if (sync_kconfig) {
 		name = conf_get_configname();

  reply	other threads:[~2018-07-20 20:03 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-08 15:19 include architecture Kconfig files from top-level Kconfig v2 Christoph Hellwig
2018-07-08 15:19 ` [PATCH 1/9] um: stop abusing KBUILD_KCONFIG Christoph Hellwig
2018-07-08 15:19 ` [PATCH 2/9] um: cleanup Kconfig files Christoph Hellwig
2018-07-08 15:19 ` [PATCH 3/9] um: create a proper drivers Kconfig Christoph Hellwig
2018-07-08 15:19 ` [PATCH 4/9] kconfig: include common Kconfig files from top-level Kconfig Christoph Hellwig
2018-07-11 12:21   ` Masahiro Yamada
2018-07-17  6:33     ` Randy Dunlap
2018-07-17  6:42       ` Randy Dunlap
2018-07-17  6:44         ` Randy Dunlap
2018-07-17  6:55           ` Randy Dunlap
2018-07-17 13:00         ` Christoph Hellwig
2018-07-17 12:59       ` Christoph Hellwig
2018-07-18  7:06     ` Randy Dunlap
2018-07-19 13:11       ` Christoph Hellwig
2018-07-20 19:57         ` Dirk Gouders [this message]
2018-07-08 15:20 ` [PATCH 5/9] Kconfig: consolidate the "Kernel hacking" menu Christoph Hellwig
2018-07-08 16:34   ` Randy Dunlap
2018-07-08 15:20 ` [PATCH 6/9] kconfig: include kernel/Kconfig.preempt from init/Kconfig Christoph Hellwig
2018-07-08 16:30   ` Randy Dunlap
2018-07-08 15:20 ` [PATCH 7/9] arch/Kconfig: use a menu to reduce clutter Christoph Hellwig
2018-07-08 15:20 ` [PATCH 8/9] kconfig: move the "Executable file formats" menu to fs/Kconfig.binfmt Christoph Hellwig
2018-07-08 15:20 ` [PATCH 9/9] kconfig: add a Memory Management options" menu Christoph Hellwig
2018-07-23 10:46 ` include architecture Kconfig files from top-level Kconfig v2 Richard Weinberger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ghzhyl7k9b.fsf@lena.gouders.net \
    --to=dirk@gouders.net \
    --cc=hch@lst.de \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-um@lists.infradead.org \
    --cc=rdunlap@infradead.org \
    --cc=richard@nod.at \
    --cc=yamada.masahiro@socionext.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®