Mauro Carvalho Chehab
2ae7bb570e
scripts: get_abi: ignore code blocks for cross-references
...
The script should not generate cross-references inside
literal blocks.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org >
Link: https://lore.kernel.org/r/a590f994f8a5742db333bde69e88241a080e4fe0.1616668017.git.mchehab+huawei@kernel.org
Signed-off-by: Jonathan Corbet <corbet@lwn.net >
2021-03-31 13:53:16 -06:00
Mauro Carvalho Chehab
c27c2e3441
scripts: get_abi.pl: parse description line per line
...
Change the description parsing logic in rst mode in order
to parse it line per line.
The end result is the same, but doing line per line allows
to add some code to escape literal blocks when seeking for
cross-references.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org >
Link: https://lore.kernel.org/r/d33cfa2e59ecf8f28d4ed7de7402468cf2168921.1616668017.git.mchehab+huawei@kernel.org
Signed-off-by: Jonathan Corbet <corbet@lwn.net >
2021-03-31 13:53:16 -06:00
Mauro Carvalho Chehab
87ec9ea1fc
scripts: get_abi.pl: extend xref match to other types
...
Currently, there are "What:" symbols for more than just
/sys.
Extend the regex to also cover configfs, /proc /dev and /kvd
symbols.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org >
Link: https://lore.kernel.org/r/a1c7e2b2c37ed6e111dfc8641deb37ed96375a63.1616668017.git.mchehab+huawei@kernel.org
Signed-off-by: Jonathan Corbet <corbet@lwn.net >
2021-03-31 13:53:16 -06:00
Mauro Carvalho Chehab
50ebf8f493
get_abi.pl: fix xref boundaries
...
There are some issues with the regex that seeks for What:
cross references: basically, it is mis-identifying the start
and the end boundaries of the regex, which causes :ref: to
be inseerted for the wrong symbols at the wrong places.
Fix it.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org >
Link: https://lore.kernel.org/r/79a14d2518499b76931b5f29c50979987108152d.1616668017.git.mchehab+huawei@kernel.org
Signed-off-by: Jonathan Corbet <corbet@lwn.net >
2021-03-31 13:53:16 -06:00
Mauro Carvalho Chehab
d3e6b2235e
get_abi.pl: seek for all occurrences for Documentation/ABI
...
Instead of retrieving just one match at most, ensure that the entire
description will be parsed.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org >
Link: https://lore.kernel.org/r/17019b73e106d1b1b353b8880ed189bad3604c13.1616668017.git.mchehab+huawei@kernel.org
Signed-off-by: Jonathan Corbet <corbet@lwn.net >
2021-03-31 13:53:15 -06:00
Mauro Carvalho Chehab
b0f9580a88
scripts: get_abi.pl: better handle escape chars on what:
...
The parser for the symbols defined on What: doesn't cover all
chars that need to be scaped, like '{' and '}'. Change the logic
to be more generic, and ensure that the same regex will be used
on both What: and when parsing the cross-references.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org >
Link: https://lore.kernel.org/r/29cb56def89b508fe605bcd2ba74a4376cc08e35.1616668017.git.mchehab+huawei@kernel.org
Signed-off-by: Jonathan Corbet <corbet@lwn.net >
2021-03-31 13:53:15 -06:00
Finn Behrens
c25ce589dc
tweewide: Fix most Shebang lines
...
Change every shebang which does not need an argument to use /usr/bin/env.
This is needed as not every distro has everything under /usr/bin,
sometimes not even bash.
Signed-off-by: Finn Behrens <me@kloenk.de >
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org >
2020-12-08 23:30:04 +09:00
Mauro Carvalho Chehab
9d4fdda334
scripts: get_api.pl: Add sub-titles to ABI output
...
Instead of adding titles just for the files, add titles
for each part of the ABI output, in order to make easier
to search for a symbol there.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org >
Link: https://lore.kernel.org/r/64752a5de06ab8263c296e3ed01414b25861e1eb.1604312590.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-11-02 13:45:37 +01:00
Mauro Carvalho Chehab
daaaf58a2b
scripts: get_abi.pl: Don't let ABI files to create subtitles
...
The ReST output should only contain documentation titles
automatically created by the script.
There are two reasons for that:
1) Consistency.
just a handful ABI docs define titles
2) To avoid critical errors.
Docutils (which is the basis for Sphinx) allows a free
assign of documentation title markups. So, one document
could be doing things like:
Level 1
=======
Level 2
-------
While another one could do the reverse:
Level 1
-------
Level 2
=======
But the same document can't mix.
As the output of get_abi.pl will join contents from multiple
files, if they don't define the levels on a consistent errors,
errors like this can happen:
Sphinx parallel build error:
docutils.utils.SystemMessage: /home/rdunlap/lnx/lnx-510-rc2/Documentation/ABI/testing/sysfs-bus-rapidio:2: (SEVERE/4) Title level inconsistent:
Attributes Common for All RapidIO Devices
-----------------------------------------
Which cause some versions of Sphinx to go into an endless
loop.
It should be noticed that an alternative to that would
be to replace all title occurrences by a single markup,
but that will make the parser more complex, and, due to
(1) it would generate an inconsistent output.
So, better to just remove the titles defined at the ABI
files from the output.
Reported-by: Randy Dunlap <rdunlap@infradead.org >
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org >
Link: https://lore.kernel.org/r/6c62ef5c01d39dee8d891f8390c816d2a889670a.1604312590.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-11-02 13:45:37 +01:00
Mauro Carvalho Chehab
2fcce37a3d
scripts: get_abi.pl: assume ReST format by default
...
All ABI files are now compatible with ReST format. So, change
the script default to assume that the ABI source files
are compatible with ReST.
Acked-by: Jonathan Corbet <corbet@lwn.net >
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org >
Link: https://lore.kernel.org/r/4b0af257010570e0e917d82498e42992bec5e173.1604042072.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-10-30 13:16:03 +01:00
Mauro Carvalho Chehab
54a19b4d3f
docs: ABI: cleanup several ABI documents
...
There are some ABI documents that, while they don't generate
any warnings, they have issues when parsed by get_abi.pl script
on its output result.
Address them, in order to provide a clean output.
Reviewed-by: Tom Rix <trix@redhat.com > # for fpga-manager
Reviewed-By: Kajol Jain<kjain@linux.ibm.com > # for sysfs-bus-event_source-devices-hv_gpci and sysfs-bus-event_source-devices-hv_24x7
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com > #for IIO
Acked-by: Oded Gabbay <oded.gabbay@gmail.com > # for Habanalabs
Acked-by: Vaibhav Jain <vaibhav@linux.ibm.com > # for sysfs-bus-papr-pmem
Acked-by: Cezary Rojewski <cezary.rojewski@intel.com > # for catpt
Acked-by: Suzuki K Poulose <suzuki.poulose@arm.com >
Acked-by: Ilya Dryomov <idryomov@gmail.com > # for rbd
Acked-by: Jonathan Corbet <corbet@lwn.net >
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org >
Link: https://lore.kernel.org/r/5bc78e5b68ed1e9e39135173857cb2e753be868f.1604042072.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-10-30 13:14:29 +01:00
Mauro Carvalho Chehab
75442fb0cc
docs: Kconfig/Makefile: add a check for broken ABI files
...
The files under Documentation/ABI should follow the syntax
as defined at Documentation/ABI/README.
Allow checking if they're following the syntax by running
the ABI parser script on COMPILE_TEST.
With that, when there's a problem with a file under
Documentation/ABI, it would produce a warning like:
Warning: file ./Documentation/ABI/testing/sysfs-bus-pci-devices-aer_stats#14:
What '/sys/bus/pci/devices/<dev>/aer_stats/aer_rootport_total_err_cor' doesn't have a description
Warning: file ./Documentation/ABI/testing/sysfs-bus-pci-devices-aer_stats#21:
What '/sys/bus/pci/devices/<dev>/aer_stats/aer_rootport_total_err_fatal' doesn't have a description
Acked-by: Jonathan Corbet <corbet@lwn.net >
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org >
Link: https://lore.kernel.org/r/57a38de85cb4b548857207cf1fc1bf1ee08613c9.1604042072.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-10-30 13:08:07 +01:00
Mauro Carvalho Chehab
55e5414f2f
scripts: get_abi.pl: auto-generate cross references
...
There are several cross-references that can be automatically
generated:
- References to .rst files inside Documentation/
- References to other ABI files;
- References to ABI symbols at /sys/*.
Add a logic to automatically parse them and convert into
cross references.
Acked-by: Jonathan Corbet <corbet@lwn.net >
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org >
Link: https://lore.kernel.org/r/abe756d4f94fb6ffcc3dd3902a766c7c3990ea89.1604042072.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-10-30 13:02:26 +01:00
Mauro Carvalho Chehab
c01d62d3fe
scripts: get_abi.pl: use bold font for ABI definitions
...
As we're using tables, let's distinguish the ones used by ABI
by using a bold font.
Acked-by: Jonathan Corbet <corbet@lwn.net >
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org >
Link: https://lore.kernel.org/r/9ed645c2519169817379c1df5b8cf03828e92520.1604042072.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-10-30 13:02:26 +01:00
Mauro Carvalho Chehab
a4ea67bc65
scripts: get_abi.pl: prevent duplicated file names
...
The same filename may exist on multiple directories within
ABI. Create separate entries at the internal database for
each of them.
Acked-by: Jonathan Corbet <corbet@lwn.net >
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org >
Link: https://lore.kernel.org/r/ef760f68f54e132c4be52f0027189b4ba31554ec.1604042072.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-10-30 13:02:26 +01:00
Mauro Carvalho Chehab
a16ab14eb7
scripts: get_abi.pl: output users in ReST format
...
Right now, the script only outputs Users on search. Print it
also in ReST format.
Acked-by: Jonathan Corbet <corbet@lwn.net >
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org >
Link: https://lore.kernel.org/r/83def2a692c4c678f21ee6e76b66a54d2be1e796.1604042072.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-10-30 13:02:26 +01:00
Mauro Carvalho Chehab
c7ba333426
scripts: get_abi.pl: detect duplicated ABI definitions
...
The ABI should define only once each What. The current script
logic assumes that.
However, that's not the case, currently: there are several
symbols with a generic definition, and per-driver ones.
Better handle such cases, by preserving the cross-references
with the files that define them, but also track such
cases, producing warnings, as they should be fixed.
Acked-by: Jonathan Corbet <corbet@lwn.net >
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org >
Link: https://lore.kernel.org/r/d7a73b8b3aae5b2bff9279996ff9ca4cdfc89196.1604042072.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-10-30 13:02:26 +01:00
Mauro Carvalho Chehab
234948bf3d
scripts: get_abi.pl: cleanup ABI cross-reference logic
...
Right now, the cross-references are generated on a single
step, when doing ReST output.
While this is nice optimization, it prevents auto-creating
cross-references for ABI symbols.
So, split it into a separate logic.
While here, turn on Perl warnings, as it helps to debug
problems inside the script.
Acked-by: Jonathan Corbet <corbet@lwn.net >
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org >
Link: https://lore.kernel.org/r/dbc97c8c2dfd877921f058134c35b2a8b1f8414b.1604042072.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-10-30 13:02:25 +01:00
Mauro Carvalho Chehab
f82a8a74ea
scripts: get_abi.pl: improve its parser to better catch up indentation
...
The original parser for indentation were relying on having
just one description for each "what". However, that's not
the case: there are a number of ABI symbols that got defined
multiple times.
Improve the parser for it to better handle descriptions
if entries are duplicated.
Acked-by: Jonathan Corbet <corbet@lwn.net >
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org >
Link: https://lore.kernel.org/r/eb458bb30be0e5a89192d6057b2e8a7e910dbcb8.1604042072.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-10-30 13:02:25 +01:00
Mauro Carvalho Chehab
61439c4ada
scripts: get_abi.pl: Allow optionally record from where a line came from
...
The get_abi.pl reads a lot of files and can join them on a
single output file. Store where each "What:" output came from,
in order to be able to optionally display it.
This is useful for the Sphinx extension, with can now be
able to blame what ABI file has issues, and on what line
the What: description with problems begin.
Acked-by: Jonathan Corbet <corbet@lwn.net >
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org >
Link: https://lore.kernel.org/r/befc387011c5e3c6febd285b7f27610e41c90260.1604042072.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-10-30 13:02:25 +01:00
Mauro Carvalho Chehab
e9bca8918e
scripts: get_abi.pl: fix parsing on ReST mode
...
When the source ABI file is using ReST notation, the script
should handle whitespaces and lines with care, as otherwise
the file won't be properly recognized.
Address the bugs that are on such part of the script.
Acked-by: Jonathan Corbet <corbet@lwn.net >
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org >
Link: https://lore.kernel.org/r/5c22c54fbd0cda797b691d52c568be6d0d1079d8.1604042072.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-10-30 13:02:25 +01:00
Mauro Carvalho Chehab
11ce90a45d
scripts: get_abi.pl: change script to allow parsing in ReST mode
...
Right now, several ABI files won't parse as ReST, as they
contain severe violations to the spec, with makes the script
to crash.
So, the code has a sanity logic with escapes bad code and
cleans tags that can cause Sphinx to crash.
Add support for disabling this mode.
Right now, as enabling rst-mode causes crash, it is disabled
by default.
Acked-by: Jonathan Corbet <corbet@lwn.net >
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org >
Link: https://lore.kernel.org/r/34b691e3002e8987c24d851fe37640f95e506a92.1604042072.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-10-30 13:02:25 +01:00
Mauro Carvalho Chehab
ecb351f1c4
doc: ABI scripts: add a SPDX header file
...
released under GPL v2.
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-06-21 16:58:37 +02:00
Mauro Carvalho Chehab
7ce7b89bf5
scripts/get_abi.pl: add a validate command
...
Sometimes, we just want the parser to retrieve all symbols from
ABI, in order to check for parsing errors. So, add a new
"validate" command.
While here, update the man/help pages.
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-06-21 16:57:45 +02:00
Mauro Carvalho Chehab
2c0700e7af
scripts/get_abi.pl: add a handler for invalid "where" tag
...
The ABI README file doesn't provide any meaning for a Where:
tag. Yet, a few ABI symbols use it. So, make the parser
handle it, emitting a warning.
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-06-21 16:57:45 +02:00