Commit Graph

1042749 Commits

Author SHA1 Message Date
Mauro Carvalho Chehab
e5c044c8a9 scripts: get_abi.pl: make undefined search more deterministic
Sort keys on hashes during undefined search, in order to
make the script more deterministic.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/5dc55fd42e632a24a48f95212aa6c6bc4b2d11fd.1632865873.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-29 09:10:52 +02:00
Mauro Carvalho Chehab
654e4d5d3d ABI: sysfs-bus-platform: add modalias description
Define the modalias parameter for platform devices, including
the ones exposed via devicetree.

Acked-by: Barry Song <song.bao.hua@hisilicon.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/9cdebbad008886b1d09f5f3ac5d88bee19f08d97.1632750608.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-28 12:48:16 +02:00
Mauro Carvalho Chehab
e080f24795 ABI: sysfs-driver-ufs: Add another What for platform drivers
The current what expressions:
	What:          /sys/bus/platform/drivers/ufshcd/*/...

Doesn't actually match what (some?) platform drivers actually
export. For instance, drivers/scsi/ufs/ufs-hisi.c actually
creates the sysfs struct for ufshcd inside this directory:

	/sys/devices/platform/soc/ff3c0000.ufs

Which has those aliases:

	/sys/devices/virtual/devlink/platform:fff35000.crg_ctrl--platform:ff3c0000.ufs/consumer/
	/sys/bus/platform/drivers/ufshcd-hisi/ff3c0000.ufs/
	/sys/bus/platform/devices/soc/ff3c0000.ufs/
	/sys/bus/platform/devices/ff3c0000.ufs/

So, add another What: for such files that will match the
device ufs entries, e. g.:

	What:          /sys/bus/platform/devices/*.ufs/

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/bc61469964bbcabe38d12aa88f2734d38a8741e5.1632750608.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-28 12:48:16 +02:00
Mauro Carvalho Chehab
3a0d390bd5 ABI: obsolete/sysfs-bus-iio: add some missing blank lines
Avoid those warnings:
	Documentation/ABI/obsolete/sysfs-bus-iio:171: WARNING: Unexpected indentation.
	Documentation/ABI/obsolete/sysfs-bus-iio:12: WARNING: Unexpected indentation.
	Documentation/ABI/obsolete/sysfs-bus-iio:2: WARNING: Unexpected indentation.
	Documentation/ABI/obsolete/sysfs-bus-iio:149: WARNING: Unexpected indentation.

Fixes: caf0fb3bb3 ("iio: Documentation: move incompatible ABI to obsolete")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/602c52c3fb957b9d7d6b72292dc86d295b50c881.1632750608.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-28 12:48:15 +02:00
Mauro Carvalho Chehab
989eff9cdb ABI: sysfs-bus-usb: add missing sysfs fields
There are lots of interface, power and endpoint properties that are currently
missing any documentation.

Add a description for them.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/7f6f7b955032836546f78a9041b22c10b6f4bc5b.1632750608.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-28 12:48:15 +02:00
Mauro Carvalho Chehab
e06ab8d574 ABI: sysfs-bus-usb: use a wildcard for interface name on What
Use <INTERFACE> instead of INTERFACE, in order for the get_abi.pl
script to be able to identify this as a wildcard.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/cec7048385b6a4779894e19af681226e60f4d8b9.1632750608.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-28 12:48:15 +02:00
Mauro Carvalho Chehab
89ae45d72a ABI: sysfs-bus-mdio: add alternate What for mdio symbols
Not all sysfs nodes are shown under:
	/sys/bus/mdio_bus/devices/...
They can also be at:
	/sys/class/mdio_bus/.../

So, update the What: entries to allow both.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/aa51f6c2d482b28a349ba67e2a3904564e67496b.1632750608.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-28 12:48:15 +02:00
Mauro Carvalho Chehab
8a60958923 ABI: sysfs-class-bdi: use What: to describe each property
Instead of listing all bdi entries inside the description, add
one entry for each, just like the remaining ABI files.

That allows get_abi.pl script to properly parse it.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/77e5904dfd275ed2670cd13779e5ef1da96e355c.1632750608.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-28 12:48:15 +02:00
Mauro Carvalho Chehab
bab2f3c14e ABI: sysfs-bus-pci: add a alternative What fields
There are some PCI ABI that aren't shown under:

	/sys/bus/pci/drivers/.../

Because they're registered with a different class. That's
the case of, for instance:

	/sys/bus/i2c/drivers/CHT Whiskey Cove PMIC/unbind

This one is not present under /sys/bus/pci:

	$ find /sys/bus/pci -name 'CHT Whiskey Cove PMIC'

Although clearly this is provided by a PCI driver:

	/sys/devices/pci0000:00/0000:00:02.0/i2c-4/subsystem/drivers/CHT Whiskey Cove PMIC/unbind

So, add an altertate What location in order to match bind/unbind
to such devices.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/15ba8c07f1b0fd7359106920c8e34a7b9af7aea6.1632750608.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-28 12:48:15 +02:00
Mauro Carvalho Chehab
5e58808871 ABI: sysfs-devices-power: add some debug sysfs files
Those files were added back in Apr 2010, but there's no
documentation for them yet.

Fixes: c92445fadb ("PM / Runtime: Add sysfs debug files")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/df6c3ae0ffc2dddf73d7a5baf696a4aa260fb576.1632750608.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-28 12:48:15 +02:00
Mauro Carvalho Chehab
773151dc41 ABI: sysfs-kernel-slab: Document some stats
Document three slab stats that were added in 2011 and 2017.

Fixes: 49e2258586 ("slub: per cpu cache for partial pages")
Fixes: 8eb8284b41 ("usercopy: Prepare for usercopy whitelisting")

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/8960435734c5aa918568ce7891171448c4d68709.1632750608.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-28 12:48:15 +02:00
Mauro Carvalho Chehab
6abac1a8a6 ABI: o2cb: add an obsolete file for /sys/o2cb
This was renamed to /sys/fs/o2cb. Mark the old name as
obsolete.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/25210a6af51b65808e3f102f9f08c3f90b763801.1632750608.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-28 12:48:15 +02:00
Mauro Carvalho Chehab
9919c339ba ABI: sysfs-bus-pci: add documentation for modalias
Even being available since 2005, there's no documentation for
modalias.

Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/9ceb1fcdbef3c0d2d0368dcc2f19084a3e529ad1.1632750608.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-28 12:48:15 +02:00
Mauro Carvalho Chehab
e95d6d8b01 ABI: sysfs-devices: add /dev ABI
Changeset 23681e4791 ("[PATCH] Driver core: allow struct device to have a dev_t")
added a /dev ABI for /sys/devices. Document it.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/bef678e68d1ac8ac504ed6e09f22105b787c877c.1632750608.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-28 12:48:15 +02:00
Mauro Carvalho Chehab
405ea44578 ABI: sysfs-devices-power: document some RPM statistics
Changeset 8d4b9d1bfe ("PM / Runtime: Add runtime PM statistics (v3)")
added runtime_active_time and runtime_suspended_time, in order
to allow powertop to identify the amount of time a device is
active/suspended.

Add an ABI description for those.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/d5524b966d081c650121c4c496c2f7ab3df524e9.1632750608.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-28 12:48:15 +02:00
Mauro Carvalho Chehab
eeac9faf96 ABI: testing/sysfs-module: document initstate
Despite being an old ABI, present on all modules, its documentation
is missing. Add it, based on the original commit.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/b9c72187abce2b0efd1c41646b1d0c66104d90e4.1632750608.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-28 12:48:15 +02:00
Mauro Carvalho Chehab
19aca23125 ABI: stable/sysfs-module: document version and srcversion
Changeset c988d2b284 ("[PATCH] modules: add version and srcversion to sysfs")
added version and srcversion ABI to modules. Document them.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/82bc7ebcc56c68c39b0e9de89cd0e023339d0597.1632750608.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-28 12:48:14 +02:00
Mauro Carvalho Chehab
3b54fc5077 ABI: stable/sysfs-module: better document modules
Instead of placing almost everything there as a text, use
the proper What: for each component of the ABI.

This allows it to be better documented and parsed by
get_abi.pl.

While here, use wildcards for MODULENAME.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/35876c1eabbcd03170d658081030db980b403297.1632750608.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-28 12:48:14 +02:00
Mauro Carvalho Chehab
483f7d699f ABI: evm: place a second what at the next line
Originally, get_abi.pl was using spaces to separate What: parameters,
but there are several references that declare things like:

	/sys/class/powercap/.../<power zone>/enabled

So, the logic was changes in order to properly address it.
That broke the second What added by
Changeset 18e49b3046 ("ABI: security: fix location for evm and ima_policy").

As the only file that defines multiple What: at the same line is
this file, let's move the second What: to a separate line.

Fixes: 18e49b3046 ("ABI: security: fix location for evm and ima_policy")
Fixes: ab9c14805b ("scripts: get_abi.pl: Better handle multiple What parameters")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/1f1e29ccdc0dd0ec089a67b8a4e9650517c6137a.1632823172.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-28 12:45:42 +02:00
Mauro Carvalho Chehab
28331a011d scripts: get_abi.pl: show progress
As parsing the sysfs entries can take a long time, add
progress information.

The progress logic will update the stats on every second,
or on 1% steps of the progress.

When STDERR is a console, it will use a single line, using
a VT-100 command to erase the line before rewriting it.
Otherwise, it will put one message on a separate line.
That would help to identify what parts of sysfs checking
that it is taking more time to process.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/4e581dcbec21ad8a60fff883498018f96f13dd1c.1632823172.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-28 12:45:42 +02:00
Mauro Carvalho Chehab
2833e30aa0 scripts: get_abi.pl: use STDERR for search-string and show-hints
On undefined checks, use STDOUT only for the not found entries.

All other data (search-string and show-hints) is printed at
STDERR.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/51c6a39c82f73b441030c51bf905a1f382452a67.1632823172.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-28 12:45:42 +02:00
Mauro Carvalho Chehab
42f09848cf scripts: get_abi.pl: update its documentation
The current highlight schema is not working properly. So, use,
instead, Pod::Text.

While here, also update the copyright in order to reflect the latest
changes and the e-mail I'm currently using.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/89fcd301e065ed86dfd8670725144b196266b6a4.1632750315.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-28 12:45:36 +02:00
Mauro Carvalho Chehab
87b58c6fae scripts: get_abi.pl: fix parse logic for DT firmware
It doesn't make any sense to parse ABI entries under
/sys/firmware, as those are either specified by ACPI specs
or by Documentation/devicetree.

The current logic to ignore firmware entries is incomplete,
as it ignores just the relative name of the file, and not
its absolute name. This cause errors while parsing the
symlinks.

So, rewrite the logic for it to do a better job.

Tested with both x86 and arm64 (HiKey970) systems.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/1c806eaec96f6706db4b041bbe6a0e2519e9637e.1632750315.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-28 12:45:36 +02:00
Mauro Carvalho Chehab
3a1cc06c0e scripts: get_abi.pl: produce an error if the ref tree is broken
The logic under graph_add_file should create, for every entry, a
__name name array for all entries of the tree. If this fails, the
symlink parsing will break.

Add an error if this ever happens.

While here, improve the output of data dumper to be more
compact and to avoid displaying things like $VAR1=.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/e7dd4d70e206723455d50c851802c8bb6c34941d.1632750315.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-28 12:45:36 +02:00
Mauro Carvalho Chehab
3cb1feadbf ABI: sysfs-platform-intel-pmc: add blank lines to make it valid for ReST
The ReST format requires blank lines before/after identation changes,
for it to properly detect lists.

Fixes: ee7abc105e ("platform/x86: intel_pmc_core: export platform global reset bits via etr3 sysfs file")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/3673e1a255ad4100c933af215b60d68ba126f820.1632740376.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-28 12:45:22 +02:00
Mauro Carvalho Chehab
1f223cdb38 ABI: sysfs-devices-removable: make a table valid as ReST markup
Changeset 70f400d4d9 ("driver core: Move the "removable" attribute from USB to core")
added a table to the file, but not using a valid ReST format.

Change it to avoid build issues when producing documentation with
"make htmldocs".

Fixes: 70f400d4d9 ("driver core: Move the "removable" attribute from USB to core")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/bf83354747b8abaa486fe03af4be2826363469cb.1632740376.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-28 12:45:22 +02:00
Mauro Carvalho Chehab
5ef803538b ABI: configfs-usb-gadget-uac2: fix a broken table
Changeset af6cbe09920 ("usb: gadget: f_uac2: add volume and mute support")
added some new elements to the table but didn't care enough to actually
adjust the columns, causing the output to be broken as warned by
Sphinx when producing the documentation.

Readjust it for it to be a valid ReST table.

Fixes: eaf6cbe099 ("usb: gadget: f_uac2: add volume and mute support")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/d253819a4c201b942d754682bb91dd278300fb79.1632740376.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-28 12:45:22 +02:00
Mauro Carvalho Chehab
1b8af67cae ABI: configfs-usb-gadget-uac1: fix a broken table
Changeset 0356e6283c ("usb: gadget: f_uac1: add volume and mute support")
added some new elements to the table but didn't care enough to actually
adjust the columns, causing the output to be broken as warned by
Sphinx when producing the documentation.

Readjust it for it to be a valid ReST table.

Fixes: 0356e6283c ("usb: gadget: f_uac1: add volume and mute support")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/044b0c14c35922bdcca50551fe2aa870baae9b06.1632740376.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-28 12:45:22 +02:00
Mauro Carvalho Chehab
6b59d8cac1 ABI: sysfs-platform-dptf: Add tables markup to a table
Solve those warnings:
	Documentation/ABI/testing/sysfs-platform-dptf:130: WARNING: Unexpected indentation.
	Documentation/ABI/testing/sysfs-platform-dptf:130: WARNING: Block quote ends without a blank line; unexpected unindent.
	Documentation/ABI/testing/sysfs-platform-dptf:130: WARNING: Definition list ends without a blank line; unexpected unindent.

Fixes: 668ce99e4e ("ACPI: DPTF: Additional sysfs attributes for power participant driver")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/41b5bbac8a67a8c5bc1d3f84de38824e705dea5d.1632740376.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-28 12:45:21 +02:00
Mauro Carvalho Chehab
26d98b9cc0 ABI: sysfs-platform-dell-privacy-wmi: correct ABI entries
As described at Documentation/ABI/README doesn't contain an
Attribute: field.

The way sysfs ABI is supposed to work is that each different
attribute would have a separate file. So, the right way to
map this would be like:

	/sys/.../dell_privacy_supported_type/mic_mute
	/sys/.../dell_privacy_supported_type/camera_shutter

	/sys/.../dell_privacy_current_state/mic_mute
	/sys/.../dell_privacy_current_state/camera_shutter

However, it seems to late to fix that, as this was merged already on
Kernel 5.13, and a change right now would be a regression.

So, instead, let's at least fix the entry to match the expected
format.

While here, fix the format of the contact, which is not a valid
e-mail URL.

This should also fix the current warnings produced when building the
docs:

	Documentation/ABI/testing/sysfs-platform-dell-privacy-wmi:35: WARNING: Unexpected indentation.
	Documentation/ABI/testing/sysfs-platform-dell-privacy-wmi:2: WARNING: Unexpected indentation.

Fixes: 8af9fa37b8 ("platform/x86: dell-privacy: Add support for Dell hardware privacy")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/42846621fdf2bf206feb114d06b14cbc47475fb5.1632740376.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-28 12:45:21 +02:00
Mauro Carvalho Chehab
ff3777d0d6 scripts: get_abi.pl: create a valid ReST with duplicated tags
As warned, /sys/bus/iio/devices/iio:deviceX/fault_ovuv is defined 2 times:

	Warning: /sys/bus/iio/devices/iio:deviceX/fault_ovuv is defined 2 times:  ./Documentation/ABI/testing/sysfs-bus-iio-temperature-max31856:14  ./Documentation/ABI/testing/sysfs-bus-iio-temperature-max31865:0

The logic with joins the two entries is just places the paragraph
for the second entry after the previous one. That could cause more
warnings, as the produced ReST may become invalid, as in the case of
this specific symbol, which ends with a table:

	/new_devel/v4l/docs/Documentation/ABI/testing/sysfs-bus-iio-temperature-max31856:2: WARNING: Malformed table.
	No bottom table border found or no blank line after table bottom.

	===  =======================================================
	'1'  The input voltage is negative or greater than VDD.
	'0'  The input voltage is positive and less than VDD (normal
	     state).
	===  =======================================================
	/new_devel/v4l/docs/Documentation/ABI/testing/sysfs-bus-iio-temperature-max31856:2: WARNING: Blank line required after table.

Address it by adding two blank lines before joining duplicated
symbols.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/4ad2e3a65f781f0f8d40bb75aa5a07aca80564d6.1632740376.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-28 12:45:21 +02:00
Mauro Carvalho Chehab
d4771993f2 scripts: get_abi.pl: ensure that "others" regex will be parsed
The way the search algorithm works is that reduces the number of regex
expressions that will be checked for a given file entry at sysfs. It
does that by looking at the devnode name. For instance, when it checks for
this file:

	/sys/bus/pci/drivers/iosf_mbi_pci/bind

The logic will seek only the "What:" expressions that end with "bind".
Currently, there are just a couple of What expressions that matches
it:

	What: /sys/bus/fsl\-mc/drivers/.*/bind
	What: /sys/bus/pci/drivers/.*/bind

It will then run an O(n²) algorithm to seek, which runs quickly
when there are few regexs to seek. There are, however, some What:
expressions that end with a wildcard. Those are harder to process.
Right now, they're all grouped together at the "others" group.

As those don't depend on the basename of the node, add an extra
loop to ensure that those will be processed at the end, if
not done yet.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/9fe7ab46f67575def5db9e83034e9fab43846d84.1632411447.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-23 18:45:08 +02:00
Mauro Carvalho Chehab
f34f67292b scripts: get_abi.pl: precompile what match regexes
In order to earn some time during matches, pre-compile regexes.

Before this patch:
	$ time ./scripts/get_abi.pl undefined |wc -l
	6970

	real	0m54,751s
	user	0m54,022s
	sys	0m0,592s

Afterwards:

	$ time ./scripts/get_abi.pl undefined |wc -l
	6970

	real	0m5,888s
	user	0m5,310s
	sys	0m0,562s

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/ec45de8fcae791aab0880644974a110424423e68.1632411447.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-23 18:45:08 +02:00
Mauro Carvalho Chehab
cb06b8ddeb scripts: get_abi.pl: stop check loop earlier when regex is found
Right now, there are two loops used to seek for a regex. Make
sure that both will be skip when a match is found.

While here, drop the unused $defined variable.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/2ba722d2cdbe7c7d0f1d1b58d350052576d1d703.1632411447.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-23 18:45:08 +02:00
Mauro Carvalho Chehab
0cd9e25b08 scripts: get_abi.pl: ignore some sysfs nodes earlier
When checking for undefined symbols, some nodes aren't easy
or don't make sense to be checked right now. Prevent allocating
memory for those, as they'll be ignored anyway.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/5228789cbef8241d44504ad29fca5cab356cdc53.1632411447.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-23 18:45:08 +02:00
Mauro Carvalho Chehab
9263589422 scripts: get_abi.pl: Better handle leaves with wildcards
When the the leaf of a regex ends with a wildcard, the speedup
algorithm to reduce the number of regexes to seek won't work.

So, when those are found, place at the "others" exception.

That slows down the search from 0.14s to 1 minute on my
machine, but the results are a lot more consistent.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/60bb97cf337333783f9f52e114b896439e9cc215.1632411447.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-23 18:45:08 +02:00
Mauro Carvalho Chehab
46f661fd0f scripts: get_abi.pl: improve debug logic
Add a level for debug, in order to allow it to be extended to
debug other parts of the script.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/0203416c6c418abb4fc20577a5f48d0d2a41bae7.1632411447.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-23 18:45:08 +02:00
Mauro Carvalho Chehab
45495db979 scripts: get_abi.pl: call get_leave() a little late
The $what conversions need to replace some characters to avoid
breaking regex expressions found on some What:.

only after replacing them back, the script should get the
$leave devnode.

Fixes: ca8e055c22 ("scripts: get_abi.pl: add a graph to speedup the undefined algorithm")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/a21631f8a884f50a962beafdd800f27891348d95.1632411447.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-23 18:45:08 +02:00
Mauro Carvalho Chehab
e27c42a52e scripts: get_abi.pl: Fix get_abi.pl search output
Currently, the get_abi.pl will print an invalid symbol
(\xac character). Fix it.

Fixes: ab9c14805b ("scripts: get_abi.pl: Better handle multiple What parameters")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/fb27ac372e38f5ae9d088f9f4e9710c659e0b9e8.1632411447.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-23 18:45:08 +02:00
Mauro Carvalho Chehab
ca8e055c22 scripts: get_abi.pl: add a graph to speedup the undefined algorithm
Searching for symlinks is an expensive operation with the current
logic, as it is at the order of O(n^3). In practice, running the
check spends 2-3 minutes to check all symbols.

Fix it by storing the directory tree into a graph, and using
a Breadth First Search (BFS) to find the links for each sysfs node.

With such improvement, it can now report issues with ~11 seconds
on my machine.

It comes with a price, though: there are more symbols reported
as undefined after this change. I suspect it is due to some
sysfs circular loops that are dropped by BFS. Despite such
increase, it seems that the reports are now more coherent.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/f5c1e7b14a27132821c08f0459ba9aea3ed69028.1631957565.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-21 18:32:53 +02:00
Mauro Carvalho Chehab
0b87a1b81b scripts: get_abi.pl: Ignore fs/cgroup sysfs nodes earlier
In order to speedup the parser and store less data, handle
fs/cgroup exceptions a lot earlier.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/caa37831c9e02ae58677d1515ed7cee94f52ea9d.1631957565.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-21 18:32:53 +02:00
Mauro Carvalho Chehab
50116aec11 scripts: get_abi.pl: don't skip what that ends with wildcards
The search algorithm used inside check_undefined_symbols
has an optimization: it seeks only whats that have the same
leave name. This helps not only to speedup the search, but
it also allows providing a hint about a partial match.

There's a drawback, however: when "what:" finishes with a
wildcard, the logic will skip the what, reporting it as
"not found".

Fix it by grouping the remaining cases altogether, and
disabing any hints for such cases.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/79ba5139643355230e3bba136b20991cfc92020f.1631957565.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-21 18:32:53 +02:00
Mauro Carvalho Chehab
14c942578e scripts: get_abi.pl: add an option to filter undefined results
The output of this script can be too big. Add an option to
filter out results, in order to help finding issues at the
ABI files.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/7b56c10195bb5e5dfd8b5838a3db8d361231d884.1631957565.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-21 18:32:53 +02:00
Mauro Carvalho Chehab
ab02c5150b scripts: get_abi.pl: detect softlinks
The way sysfs works is that the same leave may be present under
/sys/devices, /sys/bus and /sys/class, etc, linked via soft
symlinks.

To make it harder to parse, the ABI definition usually refers
only to one of those locations.

So, improve the logic in order to retrieve the symlinks.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/77c49f7d158d88e17f18d40652b75cdde9e179eb.1631957565.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-21 18:32:53 +02:00
Mauro Carvalho Chehab
f090db4395 scripts: get_abi.pl: Check for missing symbols at the ABI specs
Check for the symbols that exists under /sys but aren't
defined at Documentation/ABI.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/958e4f3a319148af6d847c0df95e35426f9c4c5f.1631957565.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-21 18:32:53 +02:00
Mauro Carvalho Chehab
ab9c14805b scripts: get_abi.pl: Better handle multiple What parameters
Using a comma here is problematic, as some What: expressions
may already contain a comma. So, use \xac character instead.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/e83e7ffaf3429f8dfca00d1d01653ecfa36f6119.1631957565.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-21 18:32:53 +02:00
Mauro Carvalho Chehab
eb74c39abd ABI: sysfs-class-rapidio: use wildcards on What definitions
An "N" upper letter is not a wildcard, nor can easily be identified
by script, specially since the USB sysfs define things like.
bNumInterfaces. Use, instead, <N>, in order to let script/get_abi.pl
to convert it into a Regex.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/aa073b85ab04b5b201d40f747ccdb6806f38eb66.1631782432.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-21 18:31:17 +02:00
Mauro Carvalho Chehab
64b609fd68 ABI: sysfs-ptp: use wildcards on What definitions
An "N" upper letter is not a wildcard, nor can easily be identified
by script, specially since the USB sysfs define things like.
bNumInterfaces. Use, instead, <N>, in order to let script/get_abi.pl
to convert it into a Regex.

Acked-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/03dcf9985244f8f9d8202af1ba203abb1f405e7d.1631782432.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-21 18:31:17 +02:00
Mauro Carvalho Chehab
3f6b07adb5 ABI: sysfs-platform-sst-atom: use wildcards on What definitions
%x is not a valid wildcard. Use <x> instead, as this allows
script/get_abi.pl to convert it into a regex.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/ca1f384f1e77210e2807f97abe77a36ac5fa284a.1631782432.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-21 18:31:17 +02:00
Mauro Carvalho Chehab
3d253b9912 ABI: sysfs-firmware-efi-esrt: use wildcards on What definitions
An "N" upper letter is not a wildcard, nor can easily be identified
by script, specially since the USB sysfs define things like.
bNumInterfaces. Use, instead, <N>, in order to let script/get_abi.pl
to convert it into a Regex.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/44f63335333d019490297903609a8a1754a66183.1631782432.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-21 18:31:17 +02:00