<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/watchdog/watchdog_dev.c, branch v6.18.21</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.18.21</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.18.21'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2025-02-18T09:32:33+00:00</updated>
<entry>
<title>watchdog: Switch to use hrtimer_setup()</title>
<updated>2025-02-18T09:32:33+00:00</updated>
<author>
<name>Nam Cao</name>
<email>namcao@linutronix.de</email>
</author>
<published>2025-02-05T10:39:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d2254b0643222ffa7e4e7ac0ae8aa0e4cbf6d09a'/>
<id>urn:sha1:d2254b0643222ffa7e4e7ac0ae8aa0e4cbf6d09a</id>
<content type='text'>
hrtimer_setup() takes the callback function pointer as argument and
initializes the timer completely.

Replace hrtimer_init() and the open coded initialization of
hrtimer::function with the new setup mechanism.

Patch was created by using Coccinelle.

Signed-off-by: Nam Cao &lt;namcao@linutronix.de&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Link: https://lore.kernel.org/all/a5c62f2b5e1ea1cf4d32f37bc2d21a8eeab2f875.1738746821.git.namcao@linutronix.de

</content>
</entry>
<entry>
<title>treewide: Introduce kthread_run_worker[_on_cpu]()</title>
<updated>2025-01-08T17:15:03+00:00</updated>
<author>
<name>Frederic Weisbecker</name>
<email>frederic@kernel.org</email>
</author>
<published>2024-09-26T22:49:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b04e317b522630b46f78ee62ecbdc5734e8d43de'/>
<id>urn:sha1:b04e317b522630b46f78ee62ecbdc5734e8d43de</id>
<content type='text'>
kthread_create() creates a kthread without running it yet. kthread_run()
creates a kthread and runs it.

On the other hand, kthread_create_worker() creates a kthread worker and
runs it.

This difference in behaviours is confusing. Also there is no way to
create a kthread worker and affine it using kthread_bind_mask() or
kthread_affine_preferred() before starting it.

Consolidate the behaviours and introduce kthread_run_worker[_on_cpu]()
that behaves just like kthread_run(). kthread_create_worker[_on_cpu]()
will now only create a kthread worker without starting it.

Signed-off-by: Frederic Weisbecker &lt;frederic@kernel.org&gt;
Signed-off-by: Dan Carpenter &lt;dan.carpenter@linaro.org&gt;
</content>
</entry>
<entry>
<title>watchdog: Make watchdog_class const</title>
<updated>2024-07-10T18:01:30+00:00</updated>
<author>
<name>Thomas Weißschuh</name>
<email>linux@weissschuh.net</email>
</author>
<published>2024-06-13T22:57:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d794a7410177f05b05232fc8cac46db196eafb00'/>
<id>urn:sha1:d794a7410177f05b05232fc8cac46db196eafb00</id>
<content type='text'>
Now that the driver core allows for struct class to be in read-only
memory, mark watchdog_class as const.

Signed-off-by: Thomas Weißschuh &lt;linux@weissschuh.net&gt;
Reviewed-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Link: https://lore.kernel.org/r/20240614-class-const-wdt-v1-1-f9a4e2b1ba76@weissschuh.net
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Signed-off-by: Wim Van Sebroeck &lt;wim@linux-watchdog.org&gt;
</content>
</entry>
<entry>
<title>watchdog: set cdev owner before adding</title>
<updated>2023-12-17T15:14:17+00:00</updated>
<author>
<name>Curtis Klein</name>
<email>curtis.klein@hpe.com</email>
</author>
<published>2023-12-05T19:05:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=38d75297745f04206db9c29bdd75557f0344c7cc'/>
<id>urn:sha1:38d75297745f04206db9c29bdd75557f0344c7cc</id>
<content type='text'>
When the new watchdog character device is registered, it becomes
available for opening. This creates a race where userspace may open the
device before the character device's owner is set. This results in an
imbalance in module_get calls as the cdev_get in cdev_open will not
increment the reference count on the watchdog driver module.

This causes problems when the watchdog character device is released as
the module loader's reference will also be released. This makes it
impossible to open the watchdog device later on as it now appears that
the module is being unloaded. The open will fail with -ENXIO from
chrdev_open.

The legacy watchdog device will fail with -EBUSY from the try_module_get
in watchdog_open because it's module owner is the watchdog core module
so it can still be opened but it will fail to get a refcount on the
underlying watchdog device driver.

Fixes: 72139dfa2464 ("watchdog: Fix the race between the release of watchdog_core_data and cdev")
Signed-off-by: Curtis Klein &lt;curtis.klein@hpe.com&gt;
Reviewed-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Link: https://lore.kernel.org/r/20231205190522.55153-1-curtis.klein@hpe.com
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Signed-off-by: Wim Van Sebroeck &lt;wim@linux-watchdog.org&gt;
</content>
</entry>
<entry>
<title>Merge tag 'linux-watchdog-6.4-rc1' of git://www.linux-watchdog.org/linux-watchdog</title>
<updated>2023-05-05T01:33:56+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2023-05-05T01:33:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=78b421b6a7c6dbb6a213877c742af52330f5026d'/>
<id>urn:sha1:78b421b6a7c6dbb6a213877c742af52330f5026d</id>
<content type='text'>
Pull watchdog updates from Wim Van Sebroeck:

 - Add watchdog driver for StarFive JH7100 and JH7110 Soc

 - Add Rockchip RK3588 devices

 - Add Qualcom IPQ5332 APSS, QCM2290 KPSS and SM6115 SoC devices

 - Add Mediatke MT8365 and MT6735 devices

 - Watchdog-core: Always set WDOG_HW_RUNNING when starting watchdog

 - Convert watchdog platform drivers to return void on the remove
   callback

 - Convert to devm_clk_get_enabled() helpers

 - ... and other small fixes and improvements

* tag 'linux-watchdog-6.4-rc1' of git://www.linux-watchdog.org/linux-watchdog: (72 commits)
  watchdog: dw_wdt: Simplify clk management
  watchdog: dw_wdt: Fix the error handling path of dw_wdt_drv_probe()
  watchdog: starfive: Fix the warning of starfive_wdt_match
  watchdog: starfive: Fix the probe return error if PM and early_enable are both disabled
  MAINTAINERS: Add fragment for Xilinx watchdog driver
  watchdog: menz069_wdt: fix timeout setting
  watchdog: menz069_wdt: fix watchdog initialisation
  dt-bindings: watchdog: alphascale-asm9260: convert to DT schema
  watchdog: loongson1_wdt: Implement restart handler
  dt-bindings: watchdog: Document Qualcomm SM6115 watchdog
  dt-bindings: watchdog: realtek,otto-wdt: simplify requiring interrupt-names
  dt-bindings: watchdog: toshiba,visconti-wdt: simplify with unevaluatedProperties
  dt-bindings: watchdog: fsl-imx7ulp-wdt: simplify with unevaluatedProperties
  dt-bindings: watchdog: arm,sp805: drop unneeded minItems
  dt-bindings: watchdog: drop duplicated GPIO watchdog bindings
  dt-bindings: reset: Add binding for MediaTek MT6735 TOPRGU/WDT
  drivers: watchdog: Add StarFive Watchdog driver
  dt-bindings: watchdog: Add watchdog for StarFive JH7100 and JH7110
  dt-bindings: watchdog: indentation, quotes and white-space cleanup
  watchdog: ebc-c384_wdt: Mark status as orphaned
  ...
</content>
</entry>
<entry>
<title>watchdog: core: Always set WDOG_HW_RUNNING when starting watchdog</title>
<updated>2023-04-22T10:53:38+00:00</updated>
<author>
<name>Guenter Roeck</name>
<email>linux@roeck-us.net</email>
</author>
<published>2023-03-04T16:16:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=12cee6efb7b94918747d09ba7488dd5cb1bbe2be'/>
<id>urn:sha1:12cee6efb7b94918747d09ba7488dd5cb1bbe2be</id>
<content type='text'>
The use of WDOG_HW_RUNNING is currently inconsistent: If set by the
driver, it will remain set until the watchdog device is opened and then
closed. If set by the watchdog core, it is only set if the watchdog
can not be stopped when closed. Subsequenty it is always only set while
the watchdog is closed and the hardware watchdog is running.

This is both misleading and inconsistent: The API states that
watchdog_hw_running() indicates that the hardware watchdog is running.
This is currently not always the case. Set WDOG_HW_RUNNING whenever a
watchdog is successfully started for consistent behavior and to
accurately report its status.

This means that we no longer have to check for both watchdog_active()
and watchdog_hw_running() to check if the watchdog is running because
watchdog_hw_running() now implies watchdog_active(). Simplify the code
accordingly where warranted.

Cc: Wang Wensheng &lt;wangwensheng4@huawei.com&gt;
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Link: https://lore.kernel.org/r/20230304161607.1418952-1-linux@roeck-us.net
Signed-off-by: Wim Van Sebroeck &lt;wim@linux-watchdog.org&gt;
</content>
</entry>
<entry>
<title>drivers: remove struct module * setting from struct class</title>
<updated>2023-03-17T14:16:27+00:00</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@linuxfoundation.org</email>
</author>
<published>2023-03-13T18:18:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=10a03c36b7dd7759788ebc613091d313b60f93e0'/>
<id>urn:sha1:10a03c36b7dd7759788ebc613091d313b60f93e0</id>
<content type='text'>
There is no need to manually set the owner of a struct class, as the
registering function does it automatically, so remove all of the
explicit settings from various drivers that did so as it is unneeded.

This allows us to remove this pointer entirely from this structure going
forward.

Cc: "Rafael J. Wysocki" &lt;rafael@kernel.org&gt;
Link: https://lore.kernel.org/r/20230313181843.1207845-2-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>watchdog: report options in sysfs</title>
<updated>2023-02-18T14:11:40+00:00</updated>
<author>
<name>Thomas Weißschuh</name>
<email>linux@weissschuh.net</email>
</author>
<published>2022-12-19T21:30:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ad8bc199b2e3197f53228fba05128069e31893c7'/>
<id>urn:sha1:ad8bc199b2e3197f53228fba05128069e31893c7</id>
<content type='text'>
This synchronizes the information reported by ioctl and sysfs.
The mismatch is confusing because "wdctl" from util-linux uses the ioctl
when used with root privileges and sysfs without.

Signed-off-by: Thomas Weißschuh &lt;linux@weissschuh.net&gt;
Reviewed-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Link: https://lore.kernel.org/r/20221216-watchdog-sysfs-v2-2-6189311103a9@weissschuh.net
[groeck: Fixed continuation line alignment]
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Signed-off-by: Wim Van Sebroeck &lt;wim@linux-watchdog.org&gt;
</content>
</entry>
<entry>
<title>watchdog: report fw_version in sysfs</title>
<updated>2023-02-18T14:11:40+00:00</updated>
<author>
<name>Thomas Weißschuh</name>
<email>linux@weissschuh.net</email>
</author>
<published>2022-12-19T21:30:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b852e7a4a9ab6a1fb08c5aa36b1043672fd814dc'/>
<id>urn:sha1:b852e7a4a9ab6a1fb08c5aa36b1043672fd814dc</id>
<content type='text'>
This synchronizes the information reported by ioctl and sysfs.
The mismatch is confusing because "wdctl" from util-linux uses the ioctl
when used with root privileges and sysfs without.

The file is called "fw_version" instead of "firmware_version" as
"firmware_version" is already used as custom attribute by single drivers.

Signed-off-by: Thomas Weißschuh &lt;linux@weissschuh.net&gt;
Reviewed-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Link: https://lore.kernel.org/r/20221216-watchdog-sysfs-v2-1-6189311103a9@weissschuh.net
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Signed-off-by: Wim Van Sebroeck &lt;wim@linux-watchdog.org&gt;
</content>
</entry>
<entry>
<title>watchdog: Fix kmemleak in watchdog_cdev_register</title>
<updated>2023-02-18T14:11:36+00:00</updated>
<author>
<name>Chen Jun</name>
<email>chenjun102@huawei.com</email>
</author>
<published>2022-11-16T01:27:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=13721a2ac66b246f5802ba1b75ad8637e53eeecc'/>
<id>urn:sha1:13721a2ac66b246f5802ba1b75ad8637e53eeecc</id>
<content type='text'>
kmemleak reports memory leaks in watchdog_dev_register, as follows:
unreferenced object 0xffff888116233000 (size 2048):
  comm ""modprobe"", pid 28147, jiffies 4353426116 (age 61.741s)
  hex dump (first 32 bytes):
    80 fa b9 05 81 88 ff ff 08 30 23 16 81 88 ff ff  .........0#.....
    08 30 23 16 81 88 ff ff 00 00 00 00 00 00 00 00  .0#.............
  backtrace:
    [&lt;000000007f001ffd&gt;] __kmem_cache_alloc_node+0x157/0x220
    [&lt;000000006a389304&gt;] kmalloc_trace+0x21/0x110
    [&lt;000000008d640eea&gt;] watchdog_dev_register+0x4e/0x780 [watchdog]
    [&lt;0000000053c9f248&gt;] __watchdog_register_device+0x4f0/0x680 [watchdog]
    [&lt;00000000b2979824&gt;] watchdog_register_device+0xd2/0x110 [watchdog]
    [&lt;000000001f730178&gt;] 0xffffffffc10880ae
    [&lt;000000007a1a8bcc&gt;] do_one_initcall+0xcb/0x4d0
    [&lt;00000000b98be325&gt;] do_init_module+0x1ca/0x5f0
    [&lt;0000000046d08e7c&gt;] load_module+0x6133/0x70f0
    ...

unreferenced object 0xffff888105b9fa80 (size 16):
  comm ""modprobe"", pid 28147, jiffies 4353426116 (age 61.741s)
  hex dump (first 16 bytes):
    77 61 74 63 68 64 6f 67 31 00 b9 05 81 88 ff ff  watchdog1.......
  backtrace:
    [&lt;000000007f001ffd&gt;] __kmem_cache_alloc_node+0x157/0x220
    [&lt;00000000486ab89b&gt;] __kmalloc_node_track_caller+0x44/0x1b0
    [&lt;000000005a39aab0&gt;] kvasprintf+0xb5/0x140
    [&lt;0000000024806f85&gt;] kvasprintf_const+0x55/0x180
    [&lt;000000009276cb7f&gt;] kobject_set_name_vargs+0x56/0x150
    [&lt;00000000a92e820b&gt;] dev_set_name+0xab/0xe0
    [&lt;00000000cec812c6&gt;] watchdog_dev_register+0x285/0x780 [watchdog]
    [&lt;0000000053c9f248&gt;] __watchdog_register_device+0x4f0/0x680 [watchdog]
    [&lt;00000000b2979824&gt;] watchdog_register_device+0xd2/0x110 [watchdog]
    [&lt;000000001f730178&gt;] 0xffffffffc10880ae
    [&lt;000000007a1a8bcc&gt;] do_one_initcall+0xcb/0x4d0
    [&lt;00000000b98be325&gt;] do_init_module+0x1ca/0x5f0
    [&lt;0000000046d08e7c&gt;] load_module+0x6133/0x70f0
    ...

The reason is that put_device is not be called if cdev_device_add fails
and wdd-&gt;id != 0.

watchdog_cdev_register
  wd_data = kzalloc                             [1]
  err = dev_set_name                            [2]
  ..
  err = cdev_device_add
  if (err) {
    if (wdd-&gt;id == 0) {  // wdd-&gt;id != 0
      ..
    }
    return err;  // [1],[2] would be leaked

To fix it, call put_device in all wdd-&gt;id cases.

Fixes: 72139dfa2464 ("watchdog: Fix the race between the release of watchdog_core_data and cdev")
Signed-off-by: Chen Jun &lt;chenjun102@huawei.com&gt;
Reviewed-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Link: https://lore.kernel.org/r/20221116012714.102066-1-chenjun102@huawei.com
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Signed-off-by: Wim Van Sebroeck &lt;wim@linux-watchdog.org&gt;
</content>
</entry>
</feed>
