* [PATCH v2 0/3] docs: ABI: report a symbol that one file describes twice
@ 2026-11-25 22:17 TAKANO Mitsuhiro
2026-11-25 22:17 ` [PATCH v2 1/3] docs: ABI: mlxreg-io: Drop the second shutdown_unlock entry TAKANO Mitsuhiro
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: TAKANO Mitsuhiro @ 2026-11-25 22:17 UTC (permalink / raw)
To: Jonathan Corbet, linux-doc
Cc: Shuah Khan, Randy Dunlap, Mauro Carvalho Chehab, Jiri Kosina,
Benjamin Tissoires, linux-input, Hans de Goede,
Ilpo Järvinen, Vadim Pasternak, platform-driver-x86,
linux-kernel, TAKANO Mitsuhiro
check_issues() compares a symbol across files, but it skips the case
where one file describes the same symbol twice: the loop returns as
soon as the symbol has one file. The ABI parser keys every entry on
its own, so a repeated symbol on one file is visible as two entries
that point at the same file. Compare at that level.
Doing so surfaces two entries that claim the same ABI:
- shutdown_unlock in sysfs-driver-mlxreg-io, described once in the
October 2021 block and again in May 2025 with a different default;
- the internal MCU protocol_version in sysfs-driver-hid-lenovo-go,
whose entry carries right_handle/, the group the removable
controller lives in.
The two documentation fixes come first, so the tree does not gain
warnings in the middle of the series, and the checker is added last.
Four symbols are described by two files each. That is legitimate when
two drivers expose an attribute with the same name for different
devices, as hid-lenovo-go and hid-lenovo-go-s do, so the cross-file
case keeps being reported, but as information rather than as a
warning.
The first version was posted on 2026-11-25:
https://lore.kernel.org/all/20261125190742.2420486-1-takano32@gmail.com/
This version points the internal MCU entry at the top-level attribute,
which is where sysfs_create_groups() puts it since mcu_attr_group has
no name, and the checker keeps its warning for an entry that ends up
without a file, counts lines rather than occurrences, and drops an
unused loop key.
An AI coding assistant found the two duplicate entries and drafted the
checker. The counts above come from running get_abi.py validate
before and after; the paths and the group were read from the driver,
not from the document being fixed.
TAKANO Mitsuhiro (3):
docs: ABI: mlxreg-io: Drop the second shutdown_unlock entry
docs: ABI: hid-lenovo-go: Point one entry at the top-level attribute
docs: python: abi_parser: Detect a symbol repeated on one file
.../ABI/stable/sysfs-driver-mlxreg-io | 12 -----
.../ABI/testing/sysfs-driver-hid-lenovo-go | 2 +-
tools/lib/python/abi/abi_parser.py | 48 ++++++++++++-------
3 files changed, 33 insertions(+), 29 deletions(-)
base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f
--
2.53.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 1/3] docs: ABI: mlxreg-io: Drop the second shutdown_unlock entry
2026-11-25 22:17 [PATCH v2 0/3] docs: ABI: report a symbol that one file describes twice TAKANO Mitsuhiro
@ 2026-11-25 22:17 ` TAKANO Mitsuhiro
2026-11-25 22:17 ` [PATCH v2 2/3] docs: ABI: hid-lenovo-go: Point one entry at the top-level attribute TAKANO Mitsuhiro
2026-11-25 22:17 ` [PATCH v2 3/3] docs: python: abi_parser: Detect a symbol repeated on one file TAKANO Mitsuhiro
2 siblings, 0 replies; 4+ messages in thread
From: TAKANO Mitsuhiro @ 2026-11-25 22:17 UTC (permalink / raw)
To: Jonathan Corbet, linux-doc
Cc: Shuah Khan, Randy Dunlap, Mauro Carvalho Chehab, Jiri Kosina,
Benjamin Tissoires, linux-input, Hans de Goede,
Ilpo Järvinen, Vadim Pasternak, platform-driver-x86,
linux-kernel, TAKANO Mitsuhiro
Commit 4e29dd3821df ("Documentation/ABI: Add new attribute for
mlxreg-io sysfs interfaces") added shutdown_unlock as a new attribute,
but sysfs-driver-mlxreg-io already described it in the October 2021
block. The tree ended up with two entries for the same file, and with
two different defaults: the older one says "Default is 1", the newer
one says "Default value is 0".
Keep the entry that came first, which documents the behaviour in full
and carries the kernel version the attribute appeared in, and drop the
later copy.
Which default applies is a property of the board's CPLD, not of the
driver: mlxreg_io_attr_show() returns the register bit as it is.
Verification: get_abi.py --dir Documentation/ABI validate no longer
reports shutdown_unlock twice.
Signed-off-by: TAKANO Mitsuhiro <takano32@gmail.com>
---
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.
Documentation/ABI/stable/sysfs-driver-mlxreg-io | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/Documentation/ABI/stable/sysfs-driver-mlxreg-io b/Documentation/ABI/stable/sysfs-driver-mlxreg-io
index f59461111221..00cff8965b22 100644
--- a/Documentation/ABI/stable/sysfs-driver-mlxreg-io
+++ b/Documentation/ABI/stable/sysfs-driver-mlxreg-io
@@ -741,18 +741,6 @@ Description: This file, when set 1, indicates that access to protected
The file is read only.
-What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/shutdown_unlock
-Date: May 2025
-KernelVersion: 6.16
-Contact: Vadim Pasternak <vadimp@nvidia.com>
-Description: When ASICs are getting overheated, system protection
- hardware mechanism enforces system reboot. After system
- reboot ASICs come up in locked state. To unlock ASICs,
- this file should be written 1
- Default value is 0.
-
- The file is read/write.
-
What: /sys/devices/platform/mlxplat/i2c_mlxcpld.*/i2c-*/i2c-*/*-00**/mlxreg-io.*/hwmon/hwmon*/boot_progress
Date: May 2025
KernelVersion: 6.16
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 2/3] docs: ABI: hid-lenovo-go: Point one entry at the top-level attribute
2026-11-25 22:17 [PATCH v2 0/3] docs: ABI: report a symbol that one file describes twice TAKANO Mitsuhiro
2026-11-25 22:17 ` [PATCH v2 1/3] docs: ABI: mlxreg-io: Drop the second shutdown_unlock entry TAKANO Mitsuhiro
@ 2026-11-25 22:17 ` TAKANO Mitsuhiro
2026-11-25 22:17 ` [PATCH v2 3/3] docs: python: abi_parser: Detect a symbol repeated on one file TAKANO Mitsuhiro
2 siblings, 0 replies; 4+ messages in thread
From: TAKANO Mitsuhiro @ 2026-11-25 22:17 UTC (permalink / raw)
To: Jonathan Corbet, linux-doc
Cc: Shuah Khan, Randy Dunlap, Mauro Carvalho Chehab, Jiri Kosina,
Benjamin Tissoires, linux-input, Hans de Goede,
Ilpo Järvinen, Vadim Pasternak, platform-driver-x86,
linux-kernel, TAKANO Mitsuhiro
The protocol_version entry at line 389 describes the internal MCU, but
its path carries a right_handle/ prefix, which is the group the
removable right controller lives in. The entry at line 566 already
uses right_handle/protocol_version for that controller's own attribute,
so two entries claim the same file and abi_parser reports the symbol as
repeated.
The internal MCU attribute is not under a group directory.
LEGO_DEVICE_ATTR_RO() takes its fourth argument as the prefix of the
_show() callback, not as a sysfs group name, and mcu_attr_group has no
.name:
LEGO_DEVICE_ATTR_RO(version_protocol_mcu, "protocol_version",
USB_MCU, version);
static struct attribute *mcu_attrs[] = {
...
&dev_attr_version_product_mcu.attr,
&dev_attr_version_protocol_mcu.attr,
NULL,
};
static const struct attribute_group mcu_attr_group = {
.attrs = mcu_attrs,
};
So the attribute appears directly under the HID device, beside
product_version, and the path loses the prefix.
Signed-off-by: TAKANO Mitsuhiro <takano32@gmail.com>
---
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.
Documentation/ABI/testing/sysfs-driver-hid-lenovo-go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Documentation/ABI/testing/sysfs-driver-hid-lenovo-go b/Documentation/ABI/testing/sysfs-driver-hid-lenovo-go
index c8221373ef76..6ba874913c1e 100644
--- a/Documentation/ABI/testing/sysfs-driver-hid-lenovo-go
+++ b/Documentation/ABI/testing/sysfs-driver-hid-lenovo-go
@@ -386,7 +386,7 @@ Description: This displays the product version of the internal MCU.
Applies to Lenovo Legion Go and Go 2 line of handheld devices.
-What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/right_handle/protocol_version
+What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/protocol_version
Date: April 2026
Contact: linux-input@vger.kernel.org
Description: This displays the protocol version of the internal MCU.
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 3/3] docs: python: abi_parser: Detect a symbol repeated on one file
2026-11-25 22:17 [PATCH v2 0/3] docs: ABI: report a symbol that one file describes twice TAKANO Mitsuhiro
2026-11-25 22:17 ` [PATCH v2 1/3] docs: ABI: mlxreg-io: Drop the second shutdown_unlock entry TAKANO Mitsuhiro
2026-11-25 22:17 ` [PATCH v2 2/3] docs: ABI: hid-lenovo-go: Point one entry at the top-level attribute TAKANO Mitsuhiro
@ 2026-11-25 22:17 ` TAKANO Mitsuhiro
2 siblings, 0 replies; 4+ messages in thread
From: TAKANO Mitsuhiro @ 2026-11-25 22:17 UTC (permalink / raw)
To: Jonathan Corbet, linux-doc
Cc: Shuah Khan, Randy Dunlap, Mauro Carvalho Chehab, Jiri Kosina,
Benjamin Tissoires, linux-input, Hans de Goede,
Ilpo Järvinen, Vadim Pasternak, platform-driver-x86,
linux-kernel, TAKANO Mitsuhiro
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 <takano32@gmail.com>
---
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."""
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-25 22:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25 22:17 [PATCH v2 0/3] docs: ABI: report a symbol that one file describes twice TAKANO Mitsuhiro
2026-11-25 22:17 ` [PATCH v2 1/3] docs: ABI: mlxreg-io: Drop the second shutdown_unlock entry TAKANO Mitsuhiro
2026-11-25 22:17 ` [PATCH v2 2/3] docs: ABI: hid-lenovo-go: Point one entry at the top-level attribute TAKANO Mitsuhiro
2026-11-25 22:17 ` [PATCH v2 3/3] docs: python: abi_parser: Detect a symbol repeated on one file TAKANO Mitsuhiro
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox