Cleanup Linux Watchdog documentation
Subsystems (2)
v3 cover Cleanup Linux Watchdog documentation
From: Philipp Hahn <[email protected]>
Hello,
while reading the documentation on the Linux kernel watchdog subsystem[1] I noticed some strange looking formatting: structs are detected automatically by Sphinx and the word **after** it is considered the name of the structure, but the watchdog documentation puts the name **before** the word struct; this leads to the wrong word being emphasized.
Also reorganize the index page to better separate the documentation on generic infrastructure from specific drivers – which are mostly obsolete and relevant for historic documentation only.
Please apply; thank you for all your work.
Philipp
[1]: https://docs.kernel.org/watchdog/convert_drivers_to_kernel_api.html
---
Philipp Hahn (5):
watchdog: Change suffix .txt to .rst in references
watchdog: Move struct before name
watchdog: Replace intermixed tab/space indent
watchdog: Separate kind of documentation
watchdog: Prefix WDT with ICS for clarity
v2 -> v1
- Rename wdt.rst to ics-wdt.rst
- Expand abbreviation "ICS" in more places
- Fix wrong reference to samples/watchdog/watchdog-simple.c
v1 -> v2
- Drop invalid SPDX change to Documentation/watchdog/index.rst
- Add SPDX to Documentation/watchdog/wdt.rst
.../convert_drivers_to_kernel_api.rst | 28 +++++++++----------
.../watchdog/{wdt.rst => ics-wdt.rst} | 8 ++++--
Documentation/watchdog/index.rst | 20 +++++++++----
Documentation/watchdog/watchdog-api.rst | 4 +--
.../watchdog/watchdog-kernel-api.rst | 2 +-
drivers/watchdog/Kconfig | 10 ++++---
drivers/watchdog/smsc37b787_wdt.c | 2 +-
7 files changed, 44 insertions(+), 30 deletions(-)
rename Documentation/watchdog/{wdt.rst => ics-wdt.rst} (91%)Signature · 1 line
2.43.0
PATCH v3 1/5 watchdog: Change suffix .txt to .rst in references
From: Philipp Hahn <[email protected]>
Fix link to documentation, which has already been converted to reST. Also remove apostrophes which are no longer needed.
--- Documentation/watchdog/convert_drivers_to_kernel_api.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/watchdog/convert_drivers_to_kernel_api.rst +2 -2
@@ -114,7 +114,7 @@ Add the watchdog operations --------------------------- All possible callbacks are defined in 'struct watchdog_ops'. You can find it -explained in 'watchdog-kernel-api.txt' in this directory. start() and +explained in watchdog-kernel-api.rst in this directory. start() and owner must be set, the rest are optional. You will easily find corresponding functions in the old driver. Note that you will now get a pointer to the watchdog_device as a parameter to these functions, so you probably have to
@@ -153,7 +153,7 @@ Add the watchdog device Now we need to create a 'struct watchdog_device' and populate it with the necessary information for the framework. The struct is also explained in detail -in 'watchdog-kernel-api.txt' in this directory. We pass it the mandatory +in watchdog-kernel-api.rst in this directory. We pass it the mandatory watchdog_info struct and the newly created watchdog_ops. Often, old drivers have their own record-keeping for things like bootstatus and timeout using static variables. Those have to be converted to use the members in
Signature · 1 line
2.43.0
Re: [PATCH v3 1/5] watchdog: Change suffix .txt to .rst in references
Quoted 6 lines · Philipp Hahn
From: Philipp Hahn <[email protected]>
Fix link to documentation, which has already been converted to reST. Also remove apostrophes which are no longer needed.
Signed-off-by Philipp Hahn <[email protected]>
Applied to my watchdog-next branch.
Thanks,
Guenter
PATCH v3 2/5 watchdog: Move `struct` before name
In reply to Philipp HahnFrom: Philipp Hahn <[email protected]>
Write struct before the structure name as Sphinx otherwise uses the following word after it. See
https://docs.kernel.org/watchdog/watchdog-api.html#environmental-monitoring
--- .../convert_drivers_to_kernel_api.rst | 24 +++++++++---------- Documentation/watchdog/watchdog-api.rst | 2 +- .../watchdog/watchdog-kernel-api.rst | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-)
Documentation/watchdog/convert_drivers_to_kernel_api.rst +12 -12
@@ -11,12 +11,12 @@ This document shall guide you for this task. The necessary steps are described as well as things to look out for. -Remove the file_operations struct +Remove the struct file_operations --------------------------------- Old drivers define their own file_operations for actions like open(), write(), etc... These are now handled by the framework and just call the driver when -needed. So, in general, the 'file_operations' struct and assorted functions can +needed. So, in general, the struct file_operations and assorted functions can go. Only very few driver-specific details have to be moved to other functions. Here is a overview of the functions and probably needed actions:
@@ -36,7 +36,7 @@ Here is a overview of the functions and probably needed actions: from the driver: WDIOC_GETSUPPORT: - Returns the mandatory watchdog_info struct from the driver + Returns the mandatory struct watchdog_info from the driver WDIOC_GETSTATUS: Needs the status-callback defined, otherwise returns 0
@@ -88,8 +88,8 @@ refactoring. The rest can go. Remove the miscdevice --------------------- -Since the file_operations are gone now, you can also remove the 'struct -miscdevice'. The framework will create it on watchdog_dev_register() called by +Since the file_operations are gone now, you can also remove the struct +miscdevice. The framework will create it on watchdog_dev_register() called by watchdog_register_device():: -static struct miscdevice s3c2410wdt_miscdev = {
@@ -113,10 +113,10 @@ them. Includes can be removed, too. For example:: Add the watchdog operations --------------------------- -All possible callbacks are defined in 'struct watchdog_ops'. You can find it +All possible callbacks are defined in struct watchdog_ops. You can find it explained in watchdog-kernel-api.rst in this directory. start() and owner must be set, the rest are optional. You will easily find corresponding -functions in the old driver. Note that you will now get a pointer to the +functions in the old driver. Note that you will now get a pointer to the struct watchdog_device as a parameter to these functions, so you probably have to change the function header. Other changes are most likely not needed, because here simply happens the direct hardware access. If you have device-specific
@@ -151,12 +151,12 @@ A typical function-header change looks like:: Add the watchdog device ----------------------- -Now we need to create a 'struct watchdog_device' and populate it with the -necessary information for the framework. The struct is also explained in detail +Now we need to create a struct watchdog_device and populate it with the +necessary information for the framework. The structure is also explained in detail in watchdog-kernel-api.rst in this directory. We pass it the mandatory -watchdog_info struct and the newly created watchdog_ops. Often, old drivers +struct watchdog_info and the newly created struct watchdog_ops. Often, old drivers have their own record-keeping for things like bootstatus and timeout using -static variables. Those have to be converted to use the members in +static variables. Those have to be converted to use the members in struct watchdog_device. Note that the timeout values are unsigned int. Some drivers use signed int, so this has to be converted, too.
@@ -174,7 +174,7 @@ Handle the 'nowayout' feature A few drivers use nowayout statically, i.e. there is no module parameter for it and only CONFIG_WATCHDOG_NOWAYOUT determines if the feature is going to be used. This needs to be converted by initializing the status variable of the -watchdog_device like this:: +struct watchdog_device like this:: .status = WATCHDOG_NOWAYOUT_INIT_STATUS,
Documentation/watchdog/watchdog-api.rst +1 -1
@@ -158,7 +158,7 @@ available to ask what the device can do:: struct watchdog_info ident; ioctl(fd, WDIOC_GETSUPPORT, &ident); -the fields returned in the ident struct are: +the fields returned in the struct watchdog_info are: ================ ============================================= identity a string identifying the watchdog driver
Documentation/watchdog/watchdog-kernel-api.rst +1 -1
@@ -257,7 +257,7 @@ bit-operations. The status bits that are defined are: To set the WDOG_NO_WAY_OUT status bit (before registering your watchdog timer device) you can either: - * set it statically in your watchdog_device struct with + * set it statically in your struct watchdog_device with .status = WATCHDOG_NOWAYOUT_INIT_STATUS,
Signature · 1 line
2.43.0
Re: [PATCH v3 2/5] watchdog: Move `struct` before name
Quoted 7 lines · Philipp Hahn
From: Philipp Hahn <[email protected]>
Write
structbefore the structure name as Sphinx otherwise uses the following word after it. See
https://docs.kernel.org/watchdog/watchdog-api.html#environmental-monitoringSigned-off-by Philipp Hahn <[email protected]>
Applied to my watchdog-next branch.
Thanks,
Guenter
PATCH v3 3/5 watchdog: Replace intermixed tab/space indent
In reply to Philipp HahnFrom: Philipp Hahn <[email protected]>
Consistently indent all lines with tabs instead of having one line using blanks.
--- Documentation/watchdog/watchdog-api.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/watchdog/watchdog-api.rst +1 -1
@@ -161,7 +161,7 @@ available to ask what the device can do:: the fields returned in the struct watchdog_info are: ================ ============================================= - identity a string identifying the watchdog driver + identity a string identifying the watchdog driver firmware_version the firmware version of the card if available options a flags describing what the device supports ================ =============================================
Signature · 1 line
2.43.0
PATCH v3 4/5 watchdog: Separate kind of documentation
In reply to Philipp HahnFrom: Philipp Hahn <[email protected]>
Currently there are several (sub-)documents for "Generic kernel infrastructure API" and several "driver specific" documents. Put each one into its own sub-section.
--- Documentation/watchdog/index.rst | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
Documentation/watchdog/index.rst +15 -5
@@ -4,15 +4,25 @@ Watchdog Support ================ +Kernel infrastructure +===================== + .. toctree:: :maxdepth: 1 - hpwdt - mlx-wdt - pcwd-watchdog watchdog-api watchdog-kernel-api - watchdog-parameters watchdog-pm - wdt convert_drivers_to_kernel_api + +Driver specific +=============== + +.. toctree:: + :maxdepth: 1 + + watchdog-parameters + hpwdt + wdt + mlx-wdt + pcwd-watchdog
Signature · 1 line
2.43.0
Re: [PATCH v3 4/5] watchdog: Separate kind of documentation
Quoted 7 lines · Philipp Hahn
From: Philipp Hahn <[email protected]>
Currently there are several (sub-)documents for "Generic kernel infrastructure API" and several "driver specific" documents. Put each one into its own sub-section.
Signed-off-by Philipp Hahn <[email protected]>
Applied to my watchdog-next branch
Thanks,
Guenter
PATCH v3 5/5 watchdog: Prefix WDT with ICS for clarity
In reply to Philipp HahnFrom: Philipp Hahn <[email protected]>
wdt.rst is only about the Watchdog from "Industrial Computer Source" (ICS). Change the title and rename the file to better express this.
Add missing SPDX license identifier GPL-2.0-or-later same as code to silence checkpatch.
Fix wrong link to sample driver in drivers/watchdog/smsc37b787_wdt.c.
---
Documentation/watchdog/{wdt.rst => ics-wdt.rst} | 8 +++++---
Documentation/watchdog/index.rst | 2 +-
drivers/watchdog/Kconfig | 10 ++++++----
drivers/watchdog/smsc37b787_wdt.c | 2 +-
4 files changed, 13 insertions(+), 9 deletions(-)
rename Documentation/watchdog/{wdt.rst => ics-wdt.rst} (91%)Documentation/watchdog/ics-wdt.rst renamed from Documentation/watchdog/wdt.rst +5 -3
@@ -1,6 +1,8 @@ -============================================================ -WDT Watchdog Timer Interfaces For The Linux Operating System -============================================================ +.. SPDX-License-Identifier: GPL-2.0-or-later + +========================================== +Industrial Computer Source Watchdog Driver +========================================== Last Reviewed: 10/05/2007
Documentation/watchdog/index.rst +1 -1
@@ -23,6 +23,6 @@ Driver specific watchdog-parameters hpwdt - wdt + ics-wdt mlx-wdt pcwd-watchdog
drivers/watchdog/Kconfig +6 -4
@@ -2270,10 +2270,11 @@ config MIXCOMWD Most people will say N. config WDT - tristate "WDT Watchdog timer" + tristate "ICS WDT500P/501P Watchdog timer" depends on ISA help - If you have a WDT500P or WDT501P watchdog board, say Y here, + If you have an Industrial Computer Source (ICS) WDT500P or WDT501P + watchdog board, say Y here, otherwise N. It is not possible to probe for this board, which means that you have to inform the kernel about the IO port and IRQ that is needed (you can do this via the io and irq parameters)
@@ -2304,10 +2305,11 @@ config PCIPCWATCHDOG Most people will say N. config WDTPCI - tristate "PCI-WDT500/501 Watchdog timer" + tristate "ICS PCI-WDT500/501 Watchdog timer" depends on PCI && HAS_IOPORT help - If you have a PCI-WDT500/501 watchdog board, say Y here, otherwise N. + If you have an Industrial Computer Source (ICS) PCI-WDT500/501 watchdog + board, say Y here, otherwise N. If you have a PCI-WDT501 watchdog board then you can enable the temperature sensor by setting the type parameter to 501.
drivers/watchdog/smsc37b787_wdt.c +1 -1
@@ -36,7 +36,7 @@* mknod /dev/watchdog c 10 130 * * For an example userspace keep-alive daemon, see: -* Documentation/watchdog/wdt.rst +* samples/watchdog/watchdog-simple.c */ #define pr_fmt (fmt) KBUILD_MODNAME ": " fmt
Signature · 1 line
2.43.0
Re: [PATCH v3 5/5] watchdog: Prefix WDT with ICS for clarity
Quoted 11 lines · Philipp Hahn
From: Philipp Hahn <[email protected]>
wdt.rstis only about the Watchdog from "Industrial Computer Source" (ICS). Change the title and rename the file to better express this.Add missing SPDX license identifier
GPL-2.0-or-latersame as code to silencecheckpatch.Fix wrong link to sample driver in
drivers/watchdog/smsc37b787_wdt.c.Signed-off-by Philipp Hahn <[email protected]>
Applied to my watchdog-next branch.
Thanks,
Guenter