Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH v4 0/6] watchdog: w83627hf_wdt: Convert driver to the driver model and add minute support
@ 2026-10-13 13:58 Paul Louvel
  2026-10-13 13:58 ` [PATCH v4 1/6] watchdog: w83627hf_wdt: Fix watchdog identity truncation Paul Louvel
  2026-10-20  2:00 ` [PATCH v4 0/6] watchdog: w83627hf_wdt: Convert driver to the driver model and add minute support Guenter Roeck
  0 siblings, 2 replies; 7+ messages in thread
From: Paul Louvel @ 2026-10-13 13:58 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck
  Cc: Tzung-Bi Shih, linux-watchdog, linux-kernel, Thomas Petazzoni,
	Paul Louvel, stable, kernel test robot

Hi,

This series aims to improve driver readability and convert it to the
Linux driver model by means of a platform driver.
Furthermore, support for minute-based counting has been added to allow
timeout values longer than 255 seconds. When setting a timeout value
that is not a multiple of 60 seconds, the value is rounded up to the
nearest multiple.

Notes:

  - PATCH #2: I could not introduce a macro for each hard-coded value in
    this driver, since some datasheets are not available (to my
    knowledge) on the internet.

  - PATCH #7: I have moved the code that refreshes or stops the watchdog
    timer out of the w83627hf_init() function and into the wdt_probe()
    function. Keeping it there would have led to code duplication.

    Since the timer has a granularity of at most one second, this does
    not introduce an unexpected reboot: the timer cannot expire in
    between, as at most a few milliseconds would have elapsed (the
    margin is < 1s anyway).

This series was tested on a x86-64 board featuring a Nuvoton NCT6126
Super I/O chip.

Best regards,

To: Wim Van Sebroeck <wim@linux-watchdog.org>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Tzung-Bi Shih <tzungbi@kernel.org>
Cc: linux-watchdog@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

Signed-off-by: Paul Louvel <paul.louvel@bootlin.com>
---
Changes in v4:
- Squashed last commit into patch #2.
- Applied suggestions of Tzung-Bi.
- Added one commit in the beginning of the series, fixing an issue
  reported by the kernel test robot that is present in an older commit.
- Link to v3: https://patch.msgid.link/20261004-w83627hf_wdt-improvements-v3-0-8e27b518595e@bootlin.com

Changes in v3:

- Drop the platform device resource for the Super I/O configuration port:
  claiming the shared 0x2e/0x4e port could break concurrent
  request_muxed_region() users on module unload (Sashiko). The port
  address is now passed via platform data together with the
  configuration keys.
- Patches 5 and 6 are merged into "Store Super I/O configurations in platform data".
- Validate platform_get_device_id() and platform_data in probe before
  use.
- struct watchdog_device parent member is now assigned to pdev device
  instance.
- Re-parent this series on 7.3-rc5.
- Remove the dependency in the cover letter since it was merged.

- Link to v2: https://patch.msgid.link/20260726-w83627hf_wdt-improvements-v2-0-3645a2a6c022@bootlin.com

Changes in v2:
- Initialize res stack variable in PATCH #5.
- Reworded PATCH #1. Describe the introduction of BIT().
- Remove the usage in PATCH #8 of goto in error path.
- Dropped PATCH #9. Squashed with PATCH #2.
- Link to v1: https://patch.msgid.link/20260725-w83627hf_wdt-improvements-v1-0-4e9a1b4e8297@bootlin.com

---
Paul Louvel (6):
      watchdog: w83627hf_wdt: Fix watchdog identity truncation
      watchdog: w83627hf_wdt: Replace magic numbers with descriptive macros
      watchdog: w83627hf_wdt: Convert to platform driver model
      watchdog: w83627hf_wdt: Move register offsets into driver data
      watchdog: w83627hf_wdt: Store Super I/O configurations in platform data
      watchdog: w83627hf_wdt: Add minute mode counting

 drivers/watchdog/w83627hf_wdt.c | 467 +++++++++++++++++++++++++---------------
 1 file changed, 299 insertions(+), 168 deletions(-)
---
base-commit: 028ef9c96e96197026887c0f092424679298aae8
change-id: 20260713-w83627hf_wdt-improvements-ba2364157d6e
prerequisite-change-id: 20260705-w83627hf_wdt-nct6126d-9a016bf7c936:v4
prerequisite-patch-id: 1162062ebf31e7c2c70ff52b79118b67b00c396b
prerequisite-patch-id: 9638243b3ade2a4e9c3e94664343b235e5cb806d
prerequisite-patch-id: 73803f726f2fab91516b429f79a59c2d3a574cfe

Best regards,
--  
Paul Louvel, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v4 1/6] watchdog: w83627hf_wdt: Fix watchdog identity truncation
  2026-10-13 13:58 [PATCH v4 0/6] watchdog: w83627hf_wdt: Convert driver to the driver model and add minute support Paul Louvel
@ 2026-10-13 13:58 ` Paul Louvel
  2026-10-19 15:22   ` Tzung-Bi Shih
  2026-10-20  2:00 ` [PATCH v4 0/6] watchdog: w83627hf_wdt: Convert driver to the driver model and add minute support Guenter Roeck
  1 sibling, 1 reply; 7+ messages in thread
From: Paul Louvel @ 2026-10-13 13:58 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck
  Cc: Tzung-Bi Shih, linux-watchdog, linux-kernel, Thomas Petazzoni,
	Paul Louvel, stable, kernel test robot

The identity field in struct watchdog_info is only 32 bytes in size, but
the identity could be at most 33 bytes in this driver, resulting in
truncation.
Remove the "Watchdog" suffix, as this is implied that the device is a
watchdog if a user request his identity.

Cc: <stable@vger.kernel.org>
Fixes: 3d6757a640f8 ("watchdog: w83627hf_wdt: Report the probed chip name via WDIOC_GETSUPPORT")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202610080027.3OsJDwfo-lkp@intel.com/
Signed-off-by: Paul Louvel <paul.louvel@bootlin.com>
---
 drivers/watchdog/w83627hf_wdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/watchdog/w83627hf_wdt.c b/drivers/watchdog/w83627hf_wdt.c
index db77599e43a0..0fc7648ef337 100644
--- a/drivers/watchdog/w83627hf_wdt.c
+++ b/drivers/watchdog/w83627hf_wdt.c
@@ -525,7 +525,7 @@ static int __init wdt_init(void)
 	pr_info("WDT driver for %s Super I/O chip initialising\n",
 		chip_name[chip]);
 
-	snprintf(wdt_info.identity, sizeof(wdt_info.identity), "%s Watchdog",
+	snprintf(wdt_info.identity, sizeof(wdt_info.identity), "%s",
 		 chip_name[chip]);
 
 	watchdog_init_timeout(&wdt_dev, timeout, NULL);

-- 
2.56.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v4 1/6] watchdog: w83627hf_wdt: Fix watchdog identity truncation
  2026-10-13 13:58 ` [PATCH v4 1/6] watchdog: w83627hf_wdt: Fix watchdog identity truncation Paul Louvel
@ 2026-10-19 15:22   ` Tzung-Bi Shih
  2026-10-20  7:52     ` Paul Louvel
  0 siblings, 1 reply; 7+ messages in thread
From: Tzung-Bi Shih @ 2026-10-19 15:22 UTC (permalink / raw)
  To: Paul Louvel
  Cc: Wim Van Sebroeck, Guenter Roeck, linux-watchdog, linux-kernel,
	Thomas Petazzoni, stable, kernel test robot

On Tue, Oct 13, 2026 at 03:58:45PM +0200, Paul Louvel wrote:
> The identity field in struct watchdog_info is only 32 bytes in size, but
> the identity could be at most 33 bytes in this driver, resulting in
> truncation.
> Remove the "Watchdog" suffix, as this is implied that the device is a
> watchdog if a user request his identity.
> 
> Cc: <stable@vger.kernel.org>
> Fixes: 3d6757a640f8 ("watchdog: w83627hf_wdt: Report the probed chip name via WDIOC_GETSUPPORT")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202610080027.3OsJDwfo-lkp@intel.com/

The patch doesn't really fix anything.  The longest string in `chip_name`
with the " Watchdog" suffix is still under 32 bytes.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v4 0/6] watchdog: w83627hf_wdt: Convert driver to the driver model and add minute support
  2026-10-13 13:58 [PATCH v4 0/6] watchdog: w83627hf_wdt: Convert driver to the driver model and add minute support Paul Louvel
  2026-10-13 13:58 ` [PATCH v4 1/6] watchdog: w83627hf_wdt: Fix watchdog identity truncation Paul Louvel
@ 2026-10-20  2:00 ` Guenter Roeck
  2026-10-20  8:02   ` Paul Louvel
  1 sibling, 1 reply; 7+ messages in thread
From: Guenter Roeck @ 2026-10-20  2:00 UTC (permalink / raw)
  To: Paul Louvel, Wim Van Sebroeck
  Cc: Tzung-Bi Shih, linux-watchdog, linux-kernel, Thomas Petazzoni,
	stable, kernel test robot

On 10/13/26 06:58, Paul Louvel wrote:
> Hi,
> 
> This series aims to improve driver readability and convert it to the
> Linux driver model by means of a platform driver.
> Furthermore, support for minute-based counting has been added to allow
> timeout values longer than 255 seconds. When setting a timeout value
> that is not a multiple of 60 seconds, the value is rounded up to the
> nearest multiple.
> 

Please address the issues reported by Tzung-Bi.

Thanks,
Guenter


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v4 1/6] watchdog: w83627hf_wdt: Fix watchdog identity truncation
  2026-10-19 15:22   ` Tzung-Bi Shih
@ 2026-10-20  7:52     ` Paul Louvel
  2026-10-20 13:07       ` Tzung-Bi Shih
  0 siblings, 1 reply; 7+ messages in thread
From: Paul Louvel @ 2026-10-20  7:52 UTC (permalink / raw)
  To: Tzung-Bi Shih, Paul Louvel
  Cc: Wim Van Sebroeck, Guenter Roeck, linux-watchdog, linux-kernel,
	Thomas Petazzoni, stable, kernel test robot

On Mon Oct 19, 2026 at 5:22 PM CEST, Tzung-Bi Shih wrote:
> On Tue, Oct 13, 2026 at 03:58:45PM +0200, Paul Louvel wrote:
>> The identity field in struct watchdog_info is only 32 bytes in size, but
>> the identity could be at most 33 bytes in this driver, resulting in
>> truncation.
>> Remove the "Watchdog" suffix, as this is implied that the device is a
>> watchdog if a user request his identity.
>> 
>> Cc: <stable@vger.kernel.org>
>> Fixes: 3d6757a640f8 ("watchdog: w83627hf_wdt: Report the probed chip name via WDIOC_GETSUPPORT")
>> Reported-by: kernel test robot <lkp@intel.com>
>> Closes: https://lore.kernel.org/oe-kbuild-all/202610080027.3OsJDwfo-lkp@intel.com/
>
> The patch doesn't really fix anything.  The longest string in `chip_name`
> with the " Watchdog" suffix is still under 32 bytes.

Indeed, max is 21.
No idea why it got reported in the first place also.

Best regards,
-- 
Paul Louvel, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v4 0/6] watchdog: w83627hf_wdt: Convert driver to the driver model and add minute support
  2026-10-20  2:00 ` [PATCH v4 0/6] watchdog: w83627hf_wdt: Convert driver to the driver model and add minute support Guenter Roeck
@ 2026-10-20  8:02   ` Paul Louvel
  0 siblings, 0 replies; 7+ messages in thread
From: Paul Louvel @ 2026-10-20  8:02 UTC (permalink / raw)
  To: Guenter Roeck, Paul Louvel, Wim Van Sebroeck
  Cc: Tzung-Bi Shih, linux-watchdog, linux-kernel, Thomas Petazzoni,
	stable, kernel test robot

On Tue Oct 20, 2026 at 4:00 AM CEST, Guenter Roeck wrote:
> On 10/13/26 06:58, Paul Louvel wrote:
>> Hi,
>> 
>> This series aims to improve driver readability and convert it to the
>> Linux driver model by means of a platform driver.
>> Furthermore, support for minute-based counting has been added to allow
>> timeout values longer than 255 seconds. When setting a timeout value
>> that is not a multiple of 60 seconds, the value is rounded up to the
>> nearest multiple.
>> 
>
> Please address the issues reported by Tzung-Bi.
>
> Thanks,
> Guenter

Will do.

Thanks,
-- 
Paul Louvel, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v4 1/6] watchdog: w83627hf_wdt: Fix watchdog identity truncation
  2026-10-20  7:52     ` Paul Louvel
@ 2026-10-20 13:07       ` Tzung-Bi Shih
  0 siblings, 0 replies; 7+ messages in thread
From: Tzung-Bi Shih @ 2026-10-20 13:07 UTC (permalink / raw)
  To: Paul Louvel
  Cc: Wim Van Sebroeck, Guenter Roeck, linux-watchdog, linux-kernel,
	Thomas Petazzoni, stable, kernel test robot

On Tue, Oct 20, 2026 at 09:52:54AM +0200, Paul Louvel wrote:
> On Mon Oct 19, 2026 at 5:22 PM CEST, Tzung-Bi Shih wrote:
> > On Tue, Oct 13, 2026 at 03:58:45PM +0200, Paul Louvel wrote:
> >> The identity field in struct watchdog_info is only 32 bytes in size, but
> >> the identity could be at most 33 bytes in this driver, resulting in
> >> truncation.
> >> Remove the "Watchdog" suffix, as this is implied that the device is a
> >> watchdog if a user request his identity.
> >> 
> >> Cc: <stable@vger.kernel.org>
> >> Fixes: 3d6757a640f8 ("watchdog: w83627hf_wdt: Report the probed chip name via WDIOC_GETSUPPORT")
> >> Reported-by: kernel test robot <lkp@intel.com>
> >> Closes: https://lore.kernel.org/oe-kbuild-all/202610080027.3OsJDwfo-lkp@intel.com/
> >
> > The patch doesn't really fix anything.  The longest string in `chip_name`
> > with the " Watchdog" suffix is still under 32 bytes.
> 
> Indeed, max is 21.
> No idea why it got reported in the first place also.

It should be from 21 + sizeof(id->name) = 21 + PLATFORM_NAME_SIZE > 32.

   482		snprintf(data->info.identity, sizeof(data->info.identity),
 > 483			 "%s Watchdog", id->name);

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-10-20 13:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-13 13:58 [PATCH v4 0/6] watchdog: w83627hf_wdt: Convert driver to the driver model and add minute support Paul Louvel
2026-10-13 13:58 ` [PATCH v4 1/6] watchdog: w83627hf_wdt: Fix watchdog identity truncation Paul Louvel
2026-10-19 15:22   ` Tzung-Bi Shih
2026-10-20  7:52     ` Paul Louvel
2026-10-20 13:07       ` Tzung-Bi Shih
2026-10-20  2:00 ` [PATCH v4 0/6] watchdog: w83627hf_wdt: Convert driver to the driver model and add minute support Guenter Roeck
2026-10-20  8:02   ` Paul Louvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox