From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=198.137.202.133 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796345977; b=G0Eb931TdIIjTvrjwsdKO2ld9j2UmIq0IORWzelfU4CPqF3wv3QsBtjpDQHxHZ16YCpc EmtZiUmGga1ojJEq1Tx6x/VdlO6aqDu4EiycKXec94nL21W52FJViwlsaiZdcTJw6XUnH Ut673HEGsAv96xlQIYhKAhWEik4othphnErzm6zK1EJMaCiuRdx1IloKmZB3qZV7QznXN us4gtVnAExntlQALCi5qM/u4tMNqR51Mj4tWJS+IaGnHIoCZMt+4Yuq6vno0Ag6Oj54RX EGtXC8SI90yYWxmpZJ9WahzbLJgtgN6ZLgvYJKOTsw59DroHCEQc/zTtk1S/l+xg+tQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796345977; h=DMARC-Filter:DKIM-Signature:Received:Message-ID:Date:MIME-Version: User-Agent:Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding; bh=y2UWU2vqOwVGExYfy6VRIK7YY80iQP9PozNbQSiq6c4=; b=mgZaXLmeDraL7rrtc7gG1g2Hi/+opTZEtiSoJQODUZ9fhPonUwgaRf88Z20FBo9Ho0M6 E/JJseOhUFjksPWZ9lJgjfIsKH78fl981nm2ghax2nqTDvKMVqSZKxoSwayESAo7NevYa K4ymEp6hkDNt8wXeQnLBK6c9iHlwr6RJVTbeephw6JHbyuTlGXbQ6L34VySgyz0Cd9gCg Oc3ww42GDNyIMxZUJ2XL3lUbZUDuVzqHf3izKIAvroEbTrztTJTTnT/d8uHXxARog2W0W 3E6EIaKoclsPpvfftGBYssQMAce5gDEFDhnuHWGbOskfxg9cObIp8Hilbw/j6Y20BLw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=infradead.org; spf=pass smtp.mailfrom=infradead.org; dkim=pass header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b="A5/MtFCK"; arc=none smtp.remote-ip=198.137.202.133 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 23A05606A335; Fri, 4 Dec 2026 00:59:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 23A05606A335 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=A5/MtFCK DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Sender:Reply-To:Content-ID:Content-Description; bh=y2UWU2vqOwVGExYfy6VRIK7YY80iQP9PozNbQSiq6c4=; b=A5/MtFCKny5JQ+QOtkcbXsWOEJ 1oQX+g6aa0IOxH4LvZqkSbYjk4HFUchK3Lu4P6e5KMyI/dZXCsx6y6k9quqtAoXvnir+o5cf7YJs1 JPU7/EjG9jopWVUwdEvwHULXkD0R4rPGNchRNK+xxtab3leiBSgmXdQ1lSkTd4EiT/hW0GnKpaRtb hSVg1NM1xFfOOi++z7Af1pekQreMf2QvLMD66HORXoC1A+VBcRbewB2TYdJlBYdW7W5PHEIyC+cRt aBqXX7bo7lORXb7OMy04MVbqGZVd28hXlhjkOMj8Tn+/1MVqn09OdFrtpM9kPl7IHXeanfVrvwRLz ZIDxlnxg==; Received: from [50.53.43.113] (helo=[192.168.254.34]) by bombadil.infradead.org with esmtpsa (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZHeB-0000000GI3G-11wq; Fri, 04 Dec 2026 00:59:35 +0000 Message-ID: Date: Thu, 3 Dec 2026 16:59:34 -0800 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 3/3] docs: python: abi_parser: Detect a symbol repeated on one file To: TAKANO Mitsuhiro , Jonathan Corbet , linux-doc@vger.kernel.org Cc: Shuah Khan , Mauro Carvalho Chehab , Jiri Kosina , Benjamin Tissoires , linux-input@vger.kernel.org, Hans de Goede , =?UTF-8?Q?Ilpo_J=C3=A4rvinen?= , Vadim Pasternak , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org References: <20261125221758.2535044-1-takano32@gmail.com> <20261125221758.2535044-4-takano32@gmail.com> Content-Language: en-US From: Randy Dunlap In-Reply-To: <20261125221758.2535044-4-takano32@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 11/25/26 2:17 PM, TAKANO Mitsuhiro wrote: > check_issues() warns when a symbol shows up on more than one file, but > it never looks at a symbol that two entries on the same file claim: > "if len(files) == 1: continue" skips that case. > > The parser stores every entry under a key of its own, so a repeated > symbol on one file is visible as two entries with the same file. > Compare at that level and warn, and keep the cross-file case > informational, because two drivers may expose an attribute with the > same name for different devices, as sysfs-driver-hid-lenovo-go and > sysfs-driver-hid-lenovo-go-s do. > > Verification: get_abi.py --dir Documentation/ABI validate used to > print four warnings for the cross-file case and nothing for the > repeated one. It now prints four informational messages for the > former and two warnings for the latter, at sysfs-driver-mlxreg-io > lines 348 and 744 and at sysfs-driver-hid-lenovo-go lines 389 and > 566. > > Signed-off-by: TAKANO Mitsuhiro Acked-by: Randy Dunlap Tested-by: Randy Dunlap Thanks. > --- > Changes in v2: > - The documents are fixed before the checker is added, so the tree > does not gain warnings in the middle of the series. > - The internal MCU protocol_version entry points at the top-level > attribute; v1 gave it the prefix of the removable controller's > group, which made it name the same file as that entry. > - The checker keeps its warning for an entry without a file, counts > lines rather than occurrences, and drops an unused loop key. > > tools/lib/python/abi/abi_parser.py | 48 ++++++++++++++++++++---------- > 1 file changed, 32 insertions(+), 16 deletions(-) > > diff --git a/tools/lib/python/abi/abi_parser.py b/tools/lib/python/abi/abi_parser.py > index d7bb20ef3acc..8b51659fb6ca 100644 > --- a/tools/lib/python/abi/abi_parser.py > +++ b/tools/lib/python/abi/abi_parser.py > @@ -554,28 +554,44 @@ class AbiParser: > def check_issues(self): > """Warn about duplicated ABI entries.""" > > - for what, v in self.what_symbols.items(): > - files = v.get("file") > - if not files: > + # Two entries on the same file that claim the same symbol are a > + # copy-and-paste mistake. The parser gives every entry a key of its > + # own, so such a pair shows up as two entries here. > + per_file = {} > + for v in self.data.values(): > + if v.get("type") == "File": > + continue > + > + file_ref = v.get("file") > + if not file_ref: > # Should never happen if the parser works properly > - self.log.warning("%s doesn't have a file associated", what) > + self.log.warning("%s doesn't have a file associated", > + v.get("what")) > continue > > - if len(files) == 1: > + fname = file_ref[0][0] > + for what in v.get("what", []): > + per_file.setdefault((fname, what), set()).add(v.get("line_no")) > + > + for (fname, what), lines in sorted(per_file.items()): > + if len(lines) < 2: > continue > > - f = [] > - for fname, lines in sorted(files.items()): > - if not lines: > - f.append(f"{fname}") > - elif len(lines) == 1: > - f.append(f"{fname}:{lines[0]}") > - else: > - m = fname + "lines " > - m += ", ".join(str(x) for x in lines) > - f.append(m) > + self.log.warning("%s is defined %d times at %s: lines %s", > + what, len(lines), fname, > + ", ".join(str(x) for x in sorted(lines))) > + > + # The same symbol on more than one file is normal: two drivers may > + # expose an attribute with the same name for different devices, as > + # sysfs-driver-hid-lenovo-go and sysfs-driver-hid-lenovo-go-s do. > + # Report it, but do not call it a problem. > + for what, v in self.what_symbols.items(): > + files = v.get("file") > + if not files or len(files) < 2: > + continue > > - self.log.warning("%s is defined %d times: %s", what, len(f), "; ".join(f)) > + self.log.info("%s is documented on %d files: %s", what, > + len(files), "; ".join(sorted(files))) > > def search_symbols(self, expr): > """ Searches for ABI symbols.""" -- ~Randy