From 534f7d95f6904246b12bbe66385523859de8b7fb Mon Sep 17 00:00:00 2001 From: Bagas Sanjaya Date: Fri, 29 Aug 2025 14:55:11 +0700 Subject: [PATCH 01/14] Documentation: hw-vuln: l1tf: Convert kernel docs external links Convert external links to kernel docs to use internal cross-references. Signed-off-by: Bagas Sanjaya --- Documentation/admin-guide/hw-vuln/l1tf.rst | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Documentation/admin-guide/hw-vuln/l1tf.rst b/Documentation/admin-guide/hw-vuln/l1tf.rst index 3eeeb488d9552..60bfabbf0b6e2 100644 --- a/Documentation/admin-guide/hw-vuln/l1tf.rst +++ b/Documentation/admin-guide/hw-vuln/l1tf.rst @@ -239,9 +239,8 @@ Guest mitigation mechanisms scenarios. For further information about confining guests to a single or to a group - of cores consult the cpusets documentation: - - https://www.kernel.org/doc/Documentation/admin-guide/cgroup-v1/cpusets.rst + of cores consult the :doc:`cgroup cpusets documentation + <../cgroup-v1/cpusets>`. .. _interrupt_isolation: @@ -266,9 +265,7 @@ Guest mitigation mechanisms Interrupt affinity can be controlled by the administrator via the /proc/irq/$NR/smp_affinity[_list] files. Limited documentation is - available at: - - https://www.kernel.org/doc/Documentation/core-api/irq/irq-affinity.rst + available at Documentation/core-api/irq/irq-affinity.rst. .. _smt_control: From cf789a2d49ad4750ac1a569b912621847d967e2c Mon Sep 17 00:00:00 2001 From: Bagas Sanjaya Date: Fri, 29 Aug 2025 14:55:12 +0700 Subject: [PATCH 02/14] Documentation: damon: reclaim: Convert "Free Page Reporting" citation link Use internal cross-reference for the citation link to Free Page Reporting docs. Signed-off-by: Bagas Sanjaya Reviewed-by: SeongJae Park --- Documentation/admin-guide/mm/damon/reclaim.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/admin-guide/mm/damon/reclaim.rst b/Documentation/admin-guide/mm/damon/reclaim.rst index af05ae6170184..92bb7cf1b5587 100644 --- a/Documentation/admin-guide/mm/damon/reclaim.rst +++ b/Documentation/admin-guide/mm/damon/reclaim.rst @@ -298,4 +298,4 @@ granularity reclamation. :: .. [1] https://research.google/pubs/pub48551/ .. [2] https://lwn.net/Articles/787611/ -.. [3] https://www.kernel.org/doc/html/latest/mm/free_page_reporting.html +.. [3] Documentation/mm/free_page_reporting.rst From a1898a926330369f2a97f6c81247c95cf3375dd9 Mon Sep 17 00:00:00 2001 From: Bagas Sanjaya Date: Fri, 29 Aug 2025 14:55:13 +0700 Subject: [PATCH 03/14] Documentation: perf-security: Convert security credentials bibliography link Use internal cross-reference for bibliography link to security credentials docs. Signed-off-by: Bagas Sanjaya --- Documentation/admin-guide/perf-security.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/admin-guide/perf-security.rst b/Documentation/admin-guide/perf-security.rst index 34aa334320cad..ec308e0077142 100644 --- a/Documentation/admin-guide/perf-security.rst +++ b/Documentation/admin-guide/perf-security.rst @@ -311,7 +311,7 @@ Bibliography .. [2] ``_ .. [3] ``_ .. [4] ``_ -.. [5] ``_ +.. [5] Documentation/security/credentials.rst .. [6] ``_ .. [7] ``_ .. [8] ``_ From d35a7a017c659429c601207b8e3f37c86e6c6e5b Mon Sep 17 00:00:00 2001 From: Bagas Sanjaya Date: Fri, 29 Aug 2025 14:55:14 +0700 Subject: [PATCH 04/14] Documentation: amd-pstate: Use internal link to kselftest Convert kselftest docs link to internal cross-reference. Signed-off-by: Bagas Sanjaya --- Documentation/admin-guide/pm/amd-pstate.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Documentation/admin-guide/pm/amd-pstate.rst b/Documentation/admin-guide/pm/amd-pstate.rst index e1771f2225d5f..37082f2493a7c 100644 --- a/Documentation/admin-guide/pm/amd-pstate.rst +++ b/Documentation/admin-guide/pm/amd-pstate.rst @@ -798,5 +798,4 @@ Reference .. [3] Processor Programming Reference (PPR) for AMD Family 19h Model 51h, Revision A1 Processors https://www.amd.com/system/files/TechDocs/56569-A1-PUB.zip -.. [4] Linux Kernel Selftests, - https://www.kernel.org/doc/html/latest/dev-tools/kselftest.html +.. [4] Documentation/dev-tools/kselftest.rst From 5468f76654d4f19626a2250ec04d2f6229d7fad8 Mon Sep 17 00:00:00 2001 From: Bagas Sanjaya Date: Fri, 29 Aug 2025 14:55:15 +0700 Subject: [PATCH 05/14] Documentation: blk-mq: Convert block layer docs external links Convert external links to block layer docs to use internal linking. Signed-off-by: Bagas Sanjaya --- Documentation/block/blk-mq.rst | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/Documentation/block/blk-mq.rst b/Documentation/block/blk-mq.rst index fc06761b6ea90..4d511feda39cf 100644 --- a/Documentation/block/blk-mq.rst +++ b/Documentation/block/blk-mq.rst @@ -87,17 +87,16 @@ IO Schedulers There are several schedulers implemented by the block layer, each one following a heuristic to improve the IO performance. They are "pluggable" (as in plug and play), in the sense of they can be selected at run time using sysfs. You -can read more about Linux's IO schedulers `here -`_. The scheduling -happens only between requests in the same queue, so it is not possible to merge -requests from different queues, otherwise there would be cache trashing and a -need to have a lock for each queue. After the scheduling, the requests are -eligible to be sent to the hardware. One of the possible schedulers to be -selected is the NONE scheduler, the most straightforward one. It will just -place requests on whatever software queue the process is running on, without -any reordering. When the device starts processing requests in the hardware -queue (a.k.a. run the hardware queue), the software queues mapped to that -hardware queue will be drained in sequence according to their mapping. +can read more about Linux's IO schedulers at Documentation/block/index.rst. +The scheduling happens only between requests in the same queue, so it is not +possible to merge requests from different queues, otherwise there would be +cache trashing and a need to have a lock for each queue. After the scheduling, +the requests are eligible to be sent to the hardware. One of the possible +schedulers to be selected is the NONE scheduler, the most straightforward one. +It will just place requests on whatever software queue the process is running +on, without any reordering. When the device starts processing requests in the +hardware queue (a.k.a. run the hardware queue), the software queues mapped to +that hardware queue will be drained in sequence according to their mapping. Hardware dispatch queues ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -143,7 +142,7 @@ Further reading - `NOOP scheduler `_ -- `Null block device driver `_ +- Documentation/block/null_blk.rst Source code documentation ========================= From 417bf09eaae5ed9924c72d93e230ef4b4e52ead3 Mon Sep 17 00:00:00 2001 From: Bagas Sanjaya Date: Fri, 29 Aug 2025 14:55:16 +0700 Subject: [PATCH 06/14] Documentation: bpf: Convert external kernel docs link Convert links to other docs pages that use external links into internal cross-references. Signed-off-by: Bagas Sanjaya --- Documentation/bpf/bpf_iterators.rst | 3 +-- Documentation/bpf/map_xskmap.rst | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Documentation/bpf/bpf_iterators.rst b/Documentation/bpf/bpf_iterators.rst index 189e3ec1c6c8e..c8e68268fb3e7 100644 --- a/Documentation/bpf/bpf_iterators.rst +++ b/Documentation/bpf/bpf_iterators.rst @@ -123,8 +123,7 @@ which often takes time to publish upstream and release. The same is true for pop tools like `ss `_ where any additional information needs a kernel patch. -To solve this problem, the `drgn -`_ tool is often used to +To solve this problem, the :doc:`drgn ` tool is often used to dig out the kernel data with no kernel change. However, the main drawback for drgn is performance, as it cannot do pointer tracing inside the kernel. In addition, drgn cannot validate a pointer value and may read invalid data if the diff --git a/Documentation/bpf/map_xskmap.rst b/Documentation/bpf/map_xskmap.rst index dc143edd92339..58562e37c16a0 100644 --- a/Documentation/bpf/map_xskmap.rst +++ b/Documentation/bpf/map_xskmap.rst @@ -10,7 +10,7 @@ BPF_MAP_TYPE_XSKMAP The ``BPF_MAP_TYPE_XSKMAP`` is used as a backend map for XDP BPF helper call ``bpf_redirect_map()`` and ``XDP_REDIRECT`` action, like 'devmap' and 'cpumap'. -This map type redirects raw XDP frames to `AF_XDP`_ sockets (XSKs), a new type of +This map type redirects raw XDP frames to AF_XDP sockets (XSKs), a new type of address family in the kernel that allows redirection of frames from a driver to user space without having to traverse the full network stack. An AF_XDP socket binds to a single netdev queue. A mapping of XSKs to queues is shown below: @@ -181,12 +181,11 @@ AF_XDP-forwarding programs in the `bpf-examples`_ directory in the `libxdp`_ rep For a detailed explanation of the AF_XDP interface please see: - `libxdp-readme`_. -- `AF_XDP`_ kernel documentation. +- Documentation/networking/af_xdp.rst. .. note:: The most comprehensive resource for using XSKMAPs and AF_XDP is `libxdp`_. .. _libxdp: https://github.com/xdp-project/xdp-tools/tree/master/lib/libxdp -.. _AF_XDP: https://www.kernel.org/doc/html/latest/networking/af_xdp.html .. _bpf-examples: https://github.com/xdp-project/bpf-examples .. _libxdp-readme: https://github.com/xdp-project/xdp-tools/tree/master/lib/libxdp#using-af_xdp-sockets From 54e7bfc7d0f7f432f191814002e3ed39fff2a079 Mon Sep 17 00:00:00 2001 From: Bagas Sanjaya Date: Fri, 29 Aug 2025 14:55:17 +0700 Subject: [PATCH 07/14] Documentation: kasan: Use internal link to kunit Use internal linking to KUnit documentation. Signed-off-by: Bagas Sanjaya --- Documentation/dev-tools/kasan.rst | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Documentation/dev-tools/kasan.rst b/Documentation/dev-tools/kasan.rst index 0a1418ab72fdf..c0896d55c97af 100644 --- a/Documentation/dev-tools/kasan.rst +++ b/Documentation/dev-tools/kasan.rst @@ -562,7 +562,5 @@ There are a few ways to run the KASAN tests. With ``CONFIG_KUNIT`` and ``CONFIG_KASAN_KUNIT_TEST`` built-in, it is also possible to use ``kunit_tool`` to see the results of KUnit tests in a more readable way. This will not print the KASAN reports of the tests that passed. - See `KUnit documentation `_ - for more up-to-date information on ``kunit_tool``. - -.. _KUnit: https://www.kernel.org/doc/html/latest/dev-tools/kunit/index.html + See :doc:`KUnit documentation ` for more up-to-date information + on ``kunit_tool``. From 680c42780a145f4cc1214ce0fcd4aa95cc8d4dff Mon Sep 17 00:00:00 2001 From: Bagas Sanjaya Date: Fri, 29 Aug 2025 14:55:18 +0700 Subject: [PATCH 08/14] Documentation: gpu: Use internal link to kunit Use internal linking to kunit documentation. Signed-off-by: Bagas Sanjaya Acked-by: Thomas Zimmermann --- Documentation/gpu/todo.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst index be8637da3fe95..efe9393f260ae 100644 --- a/Documentation/gpu/todo.rst +++ b/Documentation/gpu/todo.rst @@ -655,9 +655,9 @@ Better Testing Add unit tests using the Kernel Unit Testing (KUnit) framework -------------------------------------------------------------- -The `KUnit `_ -provides a common framework for unit tests within the Linux kernel. Having a -test suite would allow to identify regressions earlier. +The :doc:`KUnit ` provides a common framework for unit +tests within the Linux kernel. Having a test suite would allow to identify +regressions earlier. A good candidate for the first unit tests are the format-conversion helpers in ``drm_format_helper.c``. From 5efc9530a4c3ff83ce4ddfa0884c054e22052860 Mon Sep 17 00:00:00 2001 From: Bagas Sanjaya Date: Fri, 29 Aug 2025 14:55:19 +0700 Subject: [PATCH 09/14] Documentation: filesystems: Fix stale reference to device-mapper docs Commit 6cf2a73cb2bc42 ("docs: device-mapper: move it to the admin-guide") moves device mapper docs to Documentation/admin-guide, but left references (which happen to be external ones) behind, hence 404 when clicking them. Fix the references while also converting them to internal ones. Signed-off-by: Bagas Sanjaya --- Documentation/filesystems/fsverity.rst | 11 +++++------ Documentation/filesystems/ubifs-authentication.rst | 4 ++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Documentation/filesystems/fsverity.rst b/Documentation/filesystems/fsverity.rst index 412cf11e32985..54378a3926de7 100644 --- a/Documentation/filesystems/fsverity.rst +++ b/Documentation/filesystems/fsverity.rst @@ -15,12 +15,11 @@ of read-only files. Currently, it is supported by the ext4, f2fs, and btrfs filesystems. Like fscrypt, not too much filesystem-specific code is needed to support fs-verity. -fs-verity is similar to `dm-verity -`_ -but works on files rather than block devices. On regular files on -filesystems supporting fs-verity, userspace can execute an ioctl that -causes the filesystem to build a Merkle tree for the file and persist -it to a filesystem-specific location associated with the file. +fs-verity is similar to :doc:`dm-verity +` but works on files rather than block +devices. On regular files on filesystems supporting fs-verity, userspace can +execute an ioctl that causes the filesystem to build a Merkle tree for the file +and persist it to a filesystem-specific location associated with the file. After this, the file is made readonly, and all reads from the file are automatically verified against the file's Merkle tree. Reads of any diff --git a/Documentation/filesystems/ubifs-authentication.rst b/Documentation/filesystems/ubifs-authentication.rst index 106bb9c056f61..9fcad59820915 100644 --- a/Documentation/filesystems/ubifs-authentication.rst +++ b/Documentation/filesystems/ubifs-authentication.rst @@ -439,9 +439,9 @@ References [DMC-CBC-ATTACK] https://www.jakoblell.com/blog/2013/12/22/practical-malleability-attack-against-cbc-encrypted-luks-partitions/ -[DM-INTEGRITY] https://www.kernel.org/doc/Documentation/device-mapper/dm-integrity.rst +[DM-INTEGRITY] Documentation/admin-guide/device-mapper/dm-integrity.rst -[DM-VERITY] https://www.kernel.org/doc/Documentation/device-mapper/verity.rst +[DM-VERITY] Documentation/admin-guide/device-mapper/verity.rst [FSCRYPT-POLICY2] https://lore.kernel.org/r/20171023214058.128121-1-ebiggers3@gmail.com/ From aa95d79fee3f87c49dde524371c05f600c9d339a Mon Sep 17 00:00:00 2001 From: Bagas Sanjaya Date: Fri, 29 Aug 2025 14:55:20 +0700 Subject: [PATCH 10/14] Documentation: smb: smbdirect: Convert KSMBD docs link Convert KSMBD docs link to internal link. Signed-off-by: Bagas Sanjaya --- Documentation/filesystems/smb/smbdirect.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/filesystems/smb/smbdirect.rst b/Documentation/filesystems/smb/smbdirect.rst index ca6927c0b2c08..6258de919511f 100644 --- a/Documentation/filesystems/smb/smbdirect.rst +++ b/Documentation/filesystems/smb/smbdirect.rst @@ -76,8 +76,8 @@ Installation Setup and Usage ================ -- Set up and start a KSMBD server as described in the `KSMBD documentation - `_. +- Set up and start a KSMBD server as described in the :doc:`KSMBD documentation + `. Also add the "server multi channel support = yes" parameter to ksmbd.conf. - On the client, mount the share with `rdma` mount option to use SMB Direct From 71eaffbf9c759f2f2902c476763284b3b3efdd4d Mon Sep 17 00:00:00 2001 From: Bagas Sanjaya Date: Fri, 29 Aug 2025 14:55:21 +0700 Subject: [PATCH 11/14] Documentation: net: Convert external kernel networking docs Convert cross-references to kernel networking docs that use external links into internal ones. Signed-off-by: Bagas Sanjaya Reviewed-by: Arthur Kiyanovski --- .../device_drivers/can/ctu/ctucanfd-driver.rst | 3 +-- .../device_drivers/ethernet/amazon/ena.rst | 4 ++-- Documentation/networking/ethtool-netlink.rst | 3 +-- Documentation/networking/snmp_counter.rst | 12 +++++------- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/Documentation/networking/device_drivers/can/ctu/ctucanfd-driver.rst b/Documentation/networking/device_drivers/can/ctu/ctucanfd-driver.rst index 1661d13174d5b..4f9f36414333f 100644 --- a/Documentation/networking/device_drivers/can/ctu/ctucanfd-driver.rst +++ b/Documentation/networking/device_drivers/can/ctu/ctucanfd-driver.rst @@ -40,8 +40,7 @@ About SocketCAN SocketCAN is a standard common interface for CAN devices in the Linux kernel. As the name suggests, the bus is accessed via sockets, similarly to common network devices. The reasoning behind this is in depth -described in `Linux SocketCAN `_. -In short, it offers a +described in Documentation/networking/can.rst. In short, it offers a natural way to implement and work with higher layer protocols over CAN, in the same way as, e.g., UDP/IP over Ethernet. diff --git a/Documentation/networking/device_drivers/ethernet/amazon/ena.rst b/Documentation/networking/device_drivers/ethernet/amazon/ena.rst index 14784a0a6a8a1..b7b314de857b0 100644 --- a/Documentation/networking/device_drivers/ethernet/amazon/ena.rst +++ b/Documentation/networking/device_drivers/ethernet/amazon/ena.rst @@ -366,9 +366,9 @@ RSS DEVLINK SUPPORT =============== -.. _`devlink`: https://www.kernel.org/doc/html/latest/networking/devlink/index.html -`devlink`_ supports reloading the driver and initiating re-negotiation with the ENA device +:doc:`devlink ` supports reloading the driver and +initiating re-negotiation with the ENA device .. code-block:: shell diff --git a/Documentation/networking/ethtool-netlink.rst b/Documentation/networking/ethtool-netlink.rst index ab20c644af248..3445b575cb5d3 100644 --- a/Documentation/networking/ethtool-netlink.rst +++ b/Documentation/networking/ethtool-netlink.rst @@ -1100,8 +1100,7 @@ This feature is mainly of interest for specific USB devices which does not cope well with frequent small-sized URBs transmissions. ``ETHTOOL_A_COALESCE_RX_PROFILE`` and ``ETHTOOL_A_COALESCE_TX_PROFILE`` refer -to DIM parameters, see `Generic Network Dynamic Interrupt Moderation (Net DIM) -`_. +to DIM parameters, see Documentation/networking/net_dim.rst. COALESCE_SET ============ diff --git a/Documentation/networking/snmp_counter.rst b/Documentation/networking/snmp_counter.rst index ff1e6a8ffe216..c51d6ca9eff2c 100644 --- a/Documentation/networking/snmp_counter.rst +++ b/Documentation/networking/snmp_counter.rst @@ -782,13 +782,11 @@ TCP ACK skip ============ In some scenarios, kernel would avoid sending duplicate ACKs too frequently. Please find more details in the tcp_invalid_ratelimit -section of the `sysctl document`_. When kernel decides to skip an ACK -due to tcp_invalid_ratelimit, kernel would update one of below -counters to indicate the ACK is skipped in which scenario. The ACK -would only be skipped if the received packet is either a SYN packet or -it has no data. - -.. _sysctl document: https://www.kernel.org/doc/Documentation/networking/ip-sysctl.rst +section of the Documentation/networking/ip-sysctl.rst. When kernel +decides to skip an ACK due to tcp_invalid_ratelimit, kernel would +update one of below counters to indicate the ACK is skipped in +which scenario. The ACK would only be skipped if the received +packet is either a SYN packet or it has no data. * TcpExtTCPACKSkippedSynRecv From 5186933079361a4b92769c3b66e706369873c586 Mon Sep 17 00:00:00 2001 From: Bagas Sanjaya Date: Fri, 29 Aug 2025 14:55:22 +0700 Subject: [PATCH 12/14] ASoC: doc: Internally link to Writing an ALSA Driver docs ASoC codec and platform driver docs contain reference to writing ALSA driver docs, as an external link. Use :doc: directive for the job instead. Signed-off-by: Bagas Sanjaya --- Documentation/sound/soc/codec.rst | 4 ++-- Documentation/sound/soc/platform.rst | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Documentation/sound/soc/codec.rst b/Documentation/sound/soc/codec.rst index af973c4cac930..b9d87a4f929b5 100644 --- a/Documentation/sound/soc/codec.rst +++ b/Documentation/sound/soc/codec.rst @@ -131,8 +131,8 @@ The codec driver also supports the following ALSA PCM operations:- int (*prepare)(struct snd_pcm_substream *); }; -Please refer to the ALSA driver PCM documentation for details. -https://www.kernel.org/doc/html/latest/sound/kernel-api/writing-an-alsa-driver.html +Please refer to the :doc:`ALSA driver PCM documentation +<../kernel-api/writing-an-alsa-driver>` for details. DAPM description diff --git a/Documentation/sound/soc/platform.rst b/Documentation/sound/soc/platform.rst index 7036630eaf016..bd21d0a4dd9b0 100644 --- a/Documentation/sound/soc/platform.rst +++ b/Documentation/sound/soc/platform.rst @@ -45,8 +45,8 @@ snd_soc_component_driver:- ... }; -Please refer to the ALSA driver documentation for details of audio DMA. -https://www.kernel.org/doc/html/latest/sound/kernel-api/writing-an-alsa-driver.html +Please refer to the :doc:`ALSA driver documentation +<../kernel-api/writing-an-alsa-driver>` for details of audio DMA. An example DMA driver is soc/pxa/pxa2xx-pcm.c From 3658638ce16830ca59e53a0919b893646e58dc62 Mon Sep 17 00:00:00 2001 From: Bagas Sanjaya Date: Fri, 29 Aug 2025 14:55:23 +0700 Subject: [PATCH 13/14] nitro_enclaves: Use internal cross-reference for kernel docs links Convert links to kernel docs pages from external link to internal cross-references. Signed-off-by: Bagas Sanjaya --- Documentation/virt/ne_overview.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Documentation/virt/ne_overview.rst b/Documentation/virt/ne_overview.rst index 74c2f5919c886..572105eab452b 100644 --- a/Documentation/virt/ne_overview.rst +++ b/Documentation/virt/ne_overview.rst @@ -91,10 +91,10 @@ running in the primary VM via a poll notification mechanism. Then the user space enclave process can exit. [1] https://aws.amazon.com/ec2/nitro/nitro-enclaves/ -[2] https://www.kernel.org/doc/html/latest/admin-guide/mm/hugetlbpage.html +[2] Documentation/admin-guide/mm/hugetlbpage.rst [3] https://lwn.net/Articles/807108/ -[4] https://www.kernel.org/doc/html/latest/admin-guide/kernel-parameters.html +[4] Documentation/admin-guide/kernel-parameters.rst [5] https://man7.org/linux/man-pages/man7/vsock.7.html -[6] https://www.kernel.org/doc/html/latest/x86/boot.html -[7] https://www.kernel.org/doc/html/latest/arm64/hugetlbpage.html -[8] https://www.kernel.org/doc/html/latest/arm64/booting.html +[6] Documentation/arch/x86/boot.rst +[7] Documentation/arch/arm64/hugetlbpage.rst +[8] Documentation/arch/arm64/booting.rst From e039867adf87bb69fada6e7e1debd07f1313bf25 Mon Sep 17 00:00:00 2001 From: Bagas Sanjaya Date: Fri, 29 Aug 2025 14:55:24 +0700 Subject: [PATCH 14/14] Documentation: checkpatch: Convert kernel docs references checkpatch documentation has pointer references to various style-related docs. Convert them from external link to internal cross-references. For reference to docs sections, use section names and reference docs path as anchor text. Signed-off-by: Bagas Sanjaya --- Documentation/dev-tools/checkpatch.rst | 121 ++++++++++++------ .../bindings/submitting-patches.rst | 2 + .../driver-api/driver-model/device.rst | 2 + Documentation/filesystems/sysfs.rst | 2 + Documentation/kbuild/reproducible-builds.rst | 2 + Documentation/locking/lockdep-design.rst | 2 + Documentation/process/coding-style.rst | 15 +++ Documentation/process/deprecated.rst | 4 + Documentation/process/submitting-patches.rst | 4 + 9 files changed, 113 insertions(+), 41 deletions(-) diff --git a/Documentation/dev-tools/checkpatch.rst b/Documentation/dev-tools/checkpatch.rst index d5c47e560324f..2ec288d845b81 100644 --- a/Documentation/dev-tools/checkpatch.rst +++ b/Documentation/dev-tools/checkpatch.rst @@ -247,7 +247,7 @@ Allocation style number of elements. sizeof() as the first argument is generally wrong. - See: https://www.kernel.org/doc/html/latest/core-api/memory-allocation.html + See: Documentation/core-api/memory-allocation.rst **ALLOC_SIZEOF_STRUCT** The allocation style is bad. In general for family of @@ -260,13 +260,14 @@ Allocation style p = alloc(sizeof(*p), ...) - See: https://www.kernel.org/doc/html/latest/process/coding-style.html#allocating-memory + See: :ref:`"Allocating memory" section on Documentation/process/coding-style.rst + `. **ALLOC_WITH_MULTIPLY** Prefer kmalloc_array/kcalloc over kmalloc/kzalloc with a sizeof multiply. - See: https://www.kernel.org/doc/html/latest/core-api/memory-allocation.html + See: Documentation/core-api/memory-allocation.rst API usage @@ -287,7 +288,8 @@ API usage Use WARN() and WARN_ON() instead, and handle the "impossible" error condition as gracefully as possible. - See: https://www.kernel.org/doc/html/latest/process/deprecated.html#bug-and-bug-on + See: :ref:`"BUG() and BUG_ON()" section on + Documentation/process/deprecated.rst ` **CONSIDER_KSTRTO** The simple_strtol(), simple_strtoll(), simple_strtoul(), and @@ -296,7 +298,9 @@ API usage kstrtoll(), kstrtoul(), and kstrtoull() functions tend to be the correct replacements. - See: https://www.kernel.org/doc/html/latest/process/deprecated.html#simple-strtol-simple-strtoll-simple-strtoul-simple-strtoull + See: :ref:`"simple_strtol(), simple_strtoll(), simple_strtoul(), + simple_strtoull() section" on Documentation/process/deprecated.rst + ` **CONSTANT_CONVERSION** Use of __constant_ form is discouraged for the following functions:: @@ -340,7 +344,8 @@ API usage The full list of available RCU APIs can be viewed from the kernel docs. - See: https://www.kernel.org/doc/html/latest/RCU/whatisRCU.html#full-list-of-rcu-apis + See: :ref:`"Full list of RCU APIs" section on + Documentation/RCU/whatisRCU.rst <8_whatisRCU>` **DEVICE_ATTR_FUNCTIONS** The function names used in DEVICE_ATTR is unusual. @@ -354,7 +359,8 @@ API usage The function names should preferably follow the above pattern. - See: https://www.kernel.org/doc/html/latest/driver-api/driver-model/device.html#attributes + See: :ref:`"Attributes" section on + Documentation/driver-api/driver-model/device.rst ` **DEVICE_ATTR_RO** The DEVICE_ATTR_RO(name) helper macro can be used instead of @@ -363,7 +369,8 @@ API usage Note that the macro automatically appends _show to the named attribute variable of the device for the show method. - See: https://www.kernel.org/doc/html/latest/driver-api/driver-model/device.html#attributes + See: :ref:`"Attributes" section on + Documentation/driver-api/driver-model/device.rst ` **DEVICE_ATTR_RW** The DEVICE_ATTR_RW(name) helper macro can be used instead of @@ -372,7 +379,8 @@ API usage Note that the macro automatically appends _show and _store to the named attribute variable of the device for the show and store methods. - See: https://www.kernel.org/doc/html/latest/driver-api/driver-model/device.html#attributes + See: :ref:`"Attributes" section on + Documentation/driver-api/driver-model/device.rst ` **DEVICE_ATTR_WO** The DEVICE_AATR_WO(name) helper macro can be used instead of @@ -381,7 +389,8 @@ API usage Note that the macro automatically appends _store to the named attribute variable of the device for the store method. - See: https://www.kernel.org/doc/html/latest/driver-api/driver-model/device.html#attributes + See: :ref:`"Attributes" section on + Documentation/driver-api/driver-model/device.rst ` **DUPLICATED_SYSCTL_CONST** Commit d91bff3011cf ("proc/sysctl: add shared variables for range @@ -443,7 +452,8 @@ API usage lockdep_assert_held() annotations should be preferred over assertions based on spin_is_locked() - See: https://www.kernel.org/doc/html/latest/locking/lockdep-design.html#annotations + See: :ref:`"Annotations" section on + Documentation/locking/lockdep-design.rst ` **UAPI_INCLUDE** No #include statements in include/uapi should use a uapi/ path. @@ -472,13 +482,15 @@ Comments * for files in net/ and drivers/net/ */ - See: https://www.kernel.org/doc/html/latest/process/coding-style.html#commenting + See: :ref:`Commenting section on Documentation/process/coding-style.rst + ` **C99_COMMENTS** C99 style single line comments (//) should not be used. Prefer the block comment style instead. - See: https://www.kernel.org/doc/html/latest/process/coding-style.html#commenting + See: :ref:`Commenting section on Documentation/process/coding-style.rst + ` **DATA_RACE** Applications of data_race() should have a comment so as to document the @@ -512,7 +524,8 @@ Commit message The signed-off-by line does not fall in line with the standards specified by the community. - See: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#developer-s-certificate-of-origin-1-1 + See: :ref:`Developer's Certificate of Origin 1.1 text on + Documentation/process/submitting-patches.rst ` **BAD_STABLE_ADDRESS_STYLE** The email format for stable is incorrect. @@ -534,14 +547,16 @@ Commit message The patch is missing a commit description. A brief description of the changes made by the patch should be added. - See: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#describe-your-changes + See: :ref:`"Describe your changes" section on + Documentation/process/submitting-patches.rst ` **EMAIL_SUBJECT** Naming the tool that found the issue is not very useful in the subject line. A good subject line summarizes the change that the patch brings. - See: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#describe-your-changes + See: :ref:`"Describe your changes" section on + Documentation/process/submitting-patches.rst ` **FROM_SIGN_OFF_MISMATCH** The author's email does not match with that in the Signed-off-by: @@ -560,7 +575,8 @@ Commit message line should be added according to Developer's certificate of Origin. - See: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#sign-your-work-the-developer-s-certificate-of-origin + See: :ref:`"Sign your work - the Developer's Certificate of Origin" + section on Documentation/process/submitting-patches.rst ` **NO_AUTHOR_SIGN_OFF** The author of the patch has not signed off the patch. It is @@ -569,7 +585,8 @@ Commit message written it or otherwise has the rights to pass it on as an open source patch. - See: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#sign-your-work-the-developer-s-certificate-of-origin + See: :ref:`"Sign your work - the Developer's Certificate of Origin" + section on Documentation/process/submitting-patches.rst ` **DIFF_IN_COMMIT_MSG** Avoid having diff content in commit message. @@ -599,14 +616,16 @@ Commit message platform_set_drvdata(), but left the variable "dev" unused, delete it. - See: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#describe-your-changes + See: :ref:`"Describe your changes" section on + Documentation/process/submitting-patches.rst ` **BAD_FIXES_TAG** The Fixes: tag is malformed or does not follow the community conventions. This can occur if the tag have been split into multiple lines (e.g., when pasted in an email program with word wrapping enabled). - See: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#describe-your-changes + See: :ref:`"Describe your changes" section on + Documentation/process/submitting-patches.rst ` Comparison style @@ -646,7 +665,8 @@ Indentation and Line Breaks Outside of comments, documentation and Kconfig, spaces are never used for indentation. - See: https://www.kernel.org/doc/html/latest/process/coding-style.html#indentation + See: :ref:`"Indentation" section on Documentation/process/coding-style.rst + ` **DEEP_INDENTATION** Indentation with 6 or more tabs usually indicate overly indented @@ -678,7 +698,8 @@ Indentation and Line Breaks break; } - See: https://www.kernel.org/doc/html/latest/process/coding-style.html#indentation + See: :ref:`"Indentation" section on Documentation/process/coding-style.rst + ` **LONG_LINE** The line has exceeded the specified maximum length. @@ -690,21 +711,24 @@ Indentation and Line Breaks limit to 100 columns. This is not a hard limit either and it's preferable to stay within 80 columns whenever possible. - See: https://www.kernel.org/doc/html/latest/process/coding-style.html#breaking-long-lines-and-strings + See: :ref:`"Breaking long lines and strings" section on + Documentation/process/coding-style.rst ` **LONG_LINE_STRING** A string starts before but extends beyond the maximum line length. To use a different maximum line length, the --max-line-length=n option may be added while invoking checkpatch. - See: https://www.kernel.org/doc/html/latest/process/coding-style.html#breaking-long-lines-and-strings + See: :ref:`"Breaking long lines and strings" section on + Documentation/process/coding-style.rst ` **LONG_LINE_COMMENT** A comment starts before but extends beyond the maximum line length. To use a different maximum line length, the --max-line-length=n option may be added while invoking checkpatch. - See: https://www.kernel.org/doc/html/latest/process/coding-style.html#breaking-long-lines-and-strings + See: :ref:`"Breaking long lines and strings" section on + Documentation/process/coding-style.rst ` **SPLIT_STRING** Quoted strings that appear as messages in userspace and can be @@ -803,7 +827,8 @@ Macros, Attributes and Symbols and enables warnings if they are used as they can lead to non-deterministic builds. - See: https://www.kernel.org/doc/html/latest/kbuild/reproducible-builds.html#timestamps + See: :ref:`"Timestamps" section on + Documentation/kbuild/reproducible-builds.rst ` **DEFINE_ARCH_HAS** The ARCH_HAS_xyz and ARCH_HAVE_xyz patterns are wrong. @@ -868,7 +893,8 @@ Macros, Attributes and Symbols do_this(b, c); \ } while (0) - See: https://www.kernel.org/doc/html/latest/process/coding-style.html#macros-enums-and-rtl + See: :ref:`"Macros, Enums and RTL" section on + Documentation/process/coding-style.rst ` **PREFER_FALLTHROUGH** Use the `fallthrough;` pseudo keyword instead of @@ -907,7 +933,8 @@ Macros, Attributes and Symbols WARNING: Argument 'a' is not used in function-like macro. - See: https://www.kernel.org/doc/html/latest/process/coding-style.html#macros-enums-and-rtl + See: :ref:`"Macros, Enums and RTL" section on + Documentation/process/coding-style.rst ` **SINGLE_STATEMENT_DO_WHILE_MACRO** For the multi-statement macros, it is necessary to use the do-while @@ -931,7 +958,8 @@ Functions and Variables **CAMELCASE** Avoid CamelCase Identifiers. - See: https://www.kernel.org/doc/html/latest/process/coding-style.html#naming + See: :ref:`"Naming" section on Documentation/process/coding-style.rst + ` **CONST_CONST** Using `const const *` is generally meant to be @@ -1018,7 +1046,8 @@ Permissions Typically only three permissions are used - 0644 (RW), 0444 (RO) and 0200 (WO). - See: https://www.kernel.org/doc/html/latest/filesystems/sysfs.html#attributes + See: :ref:`"Attributes" section on Documentation/filesystems/sysfs.rst + ` **EXECUTE_PERMISSIONS** There is no reason for source files to be executable. The executable @@ -1074,7 +1103,8 @@ Spacing and Brackets body of function } - See: https://www.kernel.org/doc/html/latest/process/coding-style.html#placing-braces-and-spaces + See: :ref:`"Placing Braces and Spaces" section on + Documentation/process/coding-style.rst ` **BRACKET_SPACE** Whitespace before opening bracket '[' is prohibited. @@ -1105,20 +1135,23 @@ Spacing and Brackets **ELSE_AFTER_BRACE** `else {` should follow the closing block `}` on the same line. - See: https://www.kernel.org/doc/html/latest/process/coding-style.html#placing-braces-and-spaces + See: :ref:`"Placing Braces and Spaces" section on + Documentation/process/coding-style.rst ` **LINE_SPACING** Vertical space is wasted given the limited number of lines an editor window can display when multiple blank lines are used. - See: https://www.kernel.org/doc/html/latest/process/coding-style.html#spaces + See: :ref:`"Spaces" subsection on Documentation/process/coding-style.rst + ` **OPEN_BRACE** The opening brace should be following the function definitions on the next line. For any non-functional block it should be on the same line as the last construct. - See: https://www.kernel.org/doc/html/latest/process/coding-style.html#placing-braces-and-spaces + See: :ref:`"Placing Braces and Spaces" section on + Documentation/process/coding-style.rst ` **POINTER_LOCATION** When using pointer data or a function that returns a pointer type, @@ -1130,19 +1163,22 @@ Spacing and Brackets unsigned long long memparse(char *ptr, char **retptr); char *match_strdup(substring_t *s); - See: https://www.kernel.org/doc/html/latest/process/coding-style.html#spaces + See: :ref:`"Spaces" subsection on Documentation/process/coding-style.rst + ` **SPACING** Whitespace style used in the kernel sources is described in kernel docs. - See: https://www.kernel.org/doc/html/latest/process/coding-style.html#spaces + See: :ref:`"Spaces" subsection on Documentation/process/coding-style.rst + ` **TRAILING_WHITESPACE** Trailing whitespace should always be removed. Some editors highlight the trailing whitespace and cause visual distractions when editing files. - See: https://www.kernel.org/doc/html/latest/process/coding-style.html#spaces + See: :ref:`"Spaces" subsection on Documentation/process/coding-style.rst + ` **UNNECESSARY_PARENTHESES** Parentheses are not required in the following cases: @@ -1182,7 +1218,8 @@ Spacing and Brackets ... } while(something); - See: https://www.kernel.org/doc/html/latest/process/coding-style.html#placing-braces-and-spaces + See: :ref:`"Placing Braces and Spaces" section on + Documentation/process/coding-style.rst ` Others @@ -1216,7 +1253,7 @@ Others DT bindings moved to a json-schema based format instead of freeform text. - See: https://www.kernel.org/doc/html/latest/devicetree/bindings/writing-schema.html + See: Documentation/devicetree/bindings/writing-schema.rst **DT_SPLIT_BINDING_PATCH** Devicetree bindings should be their own patch. This is because @@ -1225,7 +1262,9 @@ Others are applied via the same tree), and it makes for a cleaner history in the DT only tree created with git-filter-branch. - See: https://www.kernel.org/doc/html/latest/devicetree/bindings/submitting-patches.html#i-for-patch-submitters + See: :ref:`"For patch submitters" section on + Documentation/devicetree/bindings/submitting-patches.rst + ` **EMBEDDED_FILENAME** Embedding the complete filename path inside the file isn't particularly @@ -1253,7 +1292,7 @@ Others The Linux kernel requires the precise SPDX identifier in all source files, and it is thoroughly documented in the kernel docs. - See: https://www.kernel.org/doc/html/latest/process/license-rules.html + See: Documentation/process/license-rules.rst **TYPO_SPELLING** Some words may have been misspelled. Consider reviewing them. diff --git a/Documentation/devicetree/bindings/submitting-patches.rst b/Documentation/devicetree/bindings/submitting-patches.rst index 46d0b036c97eb..c90b5e6d8be4e 100644 --- a/Documentation/devicetree/bindings/submitting-patches.rst +++ b/Documentation/devicetree/bindings/submitting-patches.rst @@ -4,6 +4,8 @@ Submitting Devicetree (DT) binding patches ========================================== +.. _submitting-dt-patches: + I. For patch submitters ======================= diff --git a/Documentation/driver-api/driver-model/device.rst b/Documentation/driver-api/driver-model/device.rst index 0833be568b06c..7762d11411c5a 100644 --- a/Documentation/driver-api/driver-model/device.rst +++ b/Documentation/driver-api/driver-model/device.rst @@ -35,6 +35,8 @@ A driver can access the lock in the device structure using:: void unlock_device(struct device * dev); +.. _device-attributes: + Attributes ~~~~~~~~~~ diff --git a/Documentation/filesystems/sysfs.rst b/Documentation/filesystems/sysfs.rst index c32993bc83c70..4a61a0c7fd121 100644 --- a/Documentation/filesystems/sysfs.rst +++ b/Documentation/filesystems/sysfs.rst @@ -51,6 +51,8 @@ With the current sysfs implementation the kobject reference count is only modified directly by the function sysfs_schedule_callback(). +.. _sysfs-attributes: + Attributes ~~~~~~~~~~ diff --git a/Documentation/kbuild/reproducible-builds.rst b/Documentation/kbuild/reproducible-builds.rst index f2dcc39044e66..b0d273f871772 100644 --- a/Documentation/kbuild/reproducible-builds.rst +++ b/Documentation/kbuild/reproducible-builds.rst @@ -13,6 +13,8 @@ The `Reproducible Builds project`_ has more information about this general topic. This document covers the various reasons why building the kernel may be unreproducible, and how to avoid them. +.. _kernel-timestamps: + Timestamps ---------- diff --git a/Documentation/locking/lockdep-design.rst b/Documentation/locking/lockdep-design.rst index 56b90eea27312..c924dd4216c56 100644 --- a/Documentation/locking/lockdep-design.rst +++ b/Documentation/locking/lockdep-design.rst @@ -231,6 +231,8 @@ Note: When changing code to use the _nested() primitives, be careful and check really thoroughly that the hierarchy is correctly mapped; otherwise you can get false positives or false negatives. +.. _lockdep-annotations: + Annotations ----------- diff --git a/Documentation/process/coding-style.rst b/Documentation/process/coding-style.rst index d1a8e5465ed95..4a17c60a9240c 100644 --- a/Documentation/process/coding-style.rst +++ b/Documentation/process/coding-style.rst @@ -15,6 +15,8 @@ and NOT read it. Burn them, it's a great symbolic gesture. Anyway, here goes: +.. _indentation-style: + 1) Indentation -------------- @@ -95,6 +97,8 @@ used for indentation, and the above example is deliberately broken. Get a decent editor and don't leave whitespace at the end of lines. +.. _long-line-break: + 2) Breaking long lines and strings ---------------------------------- @@ -117,6 +121,8 @@ However, never break user-visible strings such as printk messages because that breaks the ability to grep for them. +.. _braces-placement: + 3) Placing Braces and Spaces ---------------------------- @@ -231,6 +237,8 @@ Also, use braces when a loop contains more than a single simple statement: do_something(); } +.. _spaces-usage: + 3.1) Spaces *********** @@ -303,6 +311,8 @@ of patches, this may make later patches in the series fail by changing their context lines. +.. _naming-convention: + 4) Naming --------- @@ -594,6 +604,7 @@ fix for this is to split it up into two error labels ``err_free_bar:`` and Ideally you should simulate errors to test all exit paths. +.. _comments-style: 8) Commenting ------------- @@ -792,6 +803,8 @@ Remember: if another thread can find your data structure, and you don't have a reference count on it, you almost certainly have a bug. +.. _macros-style: + 12) Macros, Enums and RTL ------------------------- @@ -932,6 +945,8 @@ already inside a debug-related #ifdef section, printk(KERN_DEBUG ...) can be used. +.. _memory-allocation-style: + 14) Allocating memory --------------------- diff --git a/Documentation/process/deprecated.rst b/Documentation/process/deprecated.rst index 1f7f3e6c9cda9..8ab538034a29b 100644 --- a/Documentation/process/deprecated.rst +++ b/Documentation/process/deprecated.rst @@ -29,6 +29,8 @@ a header file, it isn't the full solution. Such interfaces must either be fully removed from the kernel, or added to this file to discourage others from using them in the future. +.. _bug-macros-deprecated: + BUG() and BUG_ON() ------------------ Use WARN() and WARN_ON() instead, and handle the "impossible" @@ -109,6 +111,8 @@ For more details, also see array3_size() and flex_array_size(), as well as the related check_mul_overflow(), check_add_overflow(), check_sub_overflow(), and check_shl_overflow() family of functions. +.. _simple-strtol-family-deprecated: + simple_strtol(), simple_strtoll(), simple_strtoul(), simple_strtoull() ---------------------------------------------------------------------- The simple_strtol(), simple_strtoll(), diff --git a/Documentation/process/submitting-patches.rst b/Documentation/process/submitting-patches.rst index cede4e7b29af4..34a6a7c8e6f49 100644 --- a/Documentation/process/submitting-patches.rst +++ b/Documentation/process/submitting-patches.rst @@ -393,6 +393,8 @@ e-mail discussions. ``git send-email`` will do this for you automatically. +.. _dco-signoff: + Sign your work - the Developer's Certificate of Origin ------------------------------------------------------ @@ -406,6 +408,8 @@ patch, which certifies that you wrote it or otherwise have the right to pass it on as an open-source patch. The rules are pretty simple: if you can certify the below: +.. _dco-text: + Developer's Certificate of Origin 1.1 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^