Skip to contentSkip to conversation

watchdog - v4.5 Merge Window

GIT PULL Wim Van Sebroeck 1 participant 1 message Jan 16, 2016

Subsystems (20)
lore
Share & tools
lore
#0 lore raw

Hi Linus,

Please pull from 'master' branch of
git://www.linux-watchdog.org/linux-watchdog.git

This adds following items:
* watchdog restart handler support
* watchdog reboot notifier support
* watchdog sysfs attributes
* support for the following new devices: AMD Mullins platform, AMD Carrizo platform, meson8b SoC, CSRatlas7, TS-4800, Alphascale asm9260-wdt, Zodiac, Sigma Designs SMP86xx/SMP87xx
* Changes in refcounting for the watchdog core
* watchdog core improvements
* and small fixes

This will update the following files:

 Documentation/ABI/testing/sysfs-class-watchdog                    |   51 
 Documentation/devicetree/bindings/watchdog/alphascale-asm9260.txt |   35 
 Documentation/devicetree/bindings/watchdog/mt7621-wdt.txt         |   12 
 Documentation/devicetree/bindings/watchdog/sigma,smp8642-wdt.txt  |   18 
 Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt         |   25 
 Documentation/devicetree/bindings/watchdog/ziirave-wdt.txt        |   19 
 Documentation/watchdog/watchdog-kernel-api.txt                    |   77 -
 MAINTAINERS                                                       |    1 
 drivers/hwmon/sch56xx-common.c                                    |   31 
 drivers/watchdog/Kconfig                                          |   65 +
 drivers/watchdog/Makefile                                         |    6 
 drivers/watchdog/asm9260_wdt.c                                    |  403 +++++++
 drivers/watchdog/atlas7_wdt.c                                     |  242 ++++
 drivers/watchdog/bcm2835_wdt.c                                    |    1 
 drivers/watchdog/bcm47xx_wdt.c                                    |   55 
 drivers/watchdog/cadence_wdt.c                                    |   42 
 drivers/watchdog/da9052_wdt.c                                     |   24 
 drivers/watchdog/da9055_wdt.c                                     |   24 
 drivers/watchdog/da9063_wdt.c                                     |   23 
 drivers/watchdog/diag288_wdt.c                                    |   26 
 drivers/watchdog/digicolor_wdt.c                                  |   18 
 drivers/watchdog/dw_wdt.c                                         |    2 
 drivers/watchdog/gpio_wdt.c                                       |   38 
 drivers/watchdog/hpwdt.c                                          |   12 
 drivers/watchdog/imgpdc_wdt.c                                     |   34 
 drivers/watchdog/imx2_wdt.c                                       |   23 
 drivers/watchdog/lpc18xx_wdt.c                                    |   52 
 drivers/watchdog/mena21_wdt.c                                     |    4 
 drivers/watchdog/meson_wdt.c                                      |   88 -
 drivers/watchdog/moxart_wdt.c                                     |   23 
 drivers/watchdog/mt7621_wdt.c                                     |  186 +++
 drivers/watchdog/mtk_wdt.c                                        |   22 
 drivers/watchdog/omap_wdt.c                                       |    7 
 drivers/watchdog/qcom-wdt.c                                       |   50 
 drivers/watchdog/s3c2410_wdt.c                                    |   60 -
 drivers/watchdog/softdog.c                                        |   38 
 drivers/watchdog/sp5100_tco.c                                     |   32 
 drivers/watchdog/stmp3xxx_rtc_wdt.c                               |   25 
 drivers/watchdog/sunxi_wdt.c                                      |   23 
 drivers/watchdog/tangox_wdt.c                                     |  225 +++
 drivers/watchdog/ts4800_wdt.c                                     |  215 +++
 drivers/watchdog/w83627hf_wdt.c                                   |   32 
 drivers/watchdog/watchdog_core.c                                  |  115 +-
 drivers/watchdog/watchdog_core.h                                  |    2 
 drivers/watchdog/watchdog_dev.c                                   |  572 ++++++----
 drivers/watchdog/ziirave_wdt.c                                    |  367 ++++++
 include/linux/bcm47xx_wdt.h                                       |    3 
 include/linux/watchdog.h                                          |   38 
 48 files changed, 2671 insertions(+), 815 deletions(-)

with these Changes:

commit ac36856fe4321454b6789c019c96c3ec854094ed

Author: Arnd Bergmann <[email protected]>
Date:   Fri Jan 8 11:59:34 2016 +0100

watchdog: asm9260: remove __init and __exit annotations

The probe and release functions in this driver are marked as __init and __exit, but this is wrong as indicated by this Kbuild error message:

WARNING: vmlinux.o(.data+0x1d2308): Section mismatch in reference from the variable asm9260_wdt_driver to the function .init.text:asm9260_wdt_probe()

This removes the annotations, to make the sysfs unbind attribute and deferred probing work.

Fixes aae03dc98177 ("watchdog: add Alphascale asm9260-wdt driver")

commit 0254e953537c92df3e7d0176f401a211e944fd61

Author: Guenter Roeck <[email protected]>
Date:   Sun Jan 3 15:11:58 2016 -0800

watchdog: Drop pointer to watchdog device from struct watchdog_device

The lifetime of the watchdog device pointer is different from the lifetime of its character device. Remove it entirely to avoid race conditions.

commit 2c2f3080de7341f58a5d0e8ea31cc66dd369b8f4

Author: Guenter Roeck <[email protected]>
Date:   Sun Jan 3 15:11:57 2016 -0800

watchdog: ziirave: Use watchdog infrastructure to create sysfs attributes

The watchdog core now supports creating driver specific sysfs attributes when creating the watchdog device.

commit faa584757b63aad42d19f1c6a6eac2c848618f83

Author: Guenter Roeck <[email protected]>
Date:   Sun Jan 3 15:11:56 2016 -0800

watchdog: Add support for creating driver specific sysfs attributes

The Zodiac watchdog driver attaches additional sysfs attributes to the watchdog device. This has a number of problems: The watchdog device lifetime differs from the driver lifetime, and the device structure should therefore not be accessed from drivers. Also, creating sysfs attributes after driver registration results in a potential race condition if user space expects the attributes to exist but they don't exist yet.

Add support for creating driver specific sysfs attributes to the watchdog core to solve the problems.

commit 62cd1c40ce1c7c16835b599751c7a002eb5bbdf5

Author: Tomas Winkler <[email protected]>
Date:   Sun Jan 3 13:32:37 2016 +0200

watchdog: kill unref/ref ops

ref/unref ops are not called at all so even marked them as deprecated is misleading, we need to just drop the API.

commit 9ca128a99fa56f006fe6c5801896aea5e00f8479

Author: Fabio Estevam <[email protected]>
Date:   Mon Jan 4 10:30:47 2016 -0200

watchdog: stmp3xxx: Remove unused variables

Commit 8d2fa17151ea3 ("watchdog: stmp3xxx: Stop the watchdog on system halt") introduced the following build warning:

drivers/watchdog/stmp3xxx_rtc_wdt.c: In function 'wdt_notify_sys':
drivers/watchdog/stmp3xxx_rtc_wdt.c:78:29: warning: unused variable 'pdata' [-Wunused-variable]

Remove the unused 'pdata' and 'dev' variables.

commit ab3f09fe16d158cb4f84e558c61ec5d6d601f2e0

Author: John Crispin <[email protected]>
Date:   Mon Jan 4 20:36:38 2016 +0100

watchdog: add MT7621 watchdog support

This patch adds support for the watchdog core found on newer MediaTek Wifi SoCs MT7621 and MT7628. There is no symbol for MT7628 as it is a subtype of MT7620 so we depend on that instead.

commit 3b8d058cfe6a3b14abee324f4c4b33e64bf61aeb

Author: Guenter Roeck <[email protected]>
Date:   Fri Dec 25 16:01:45 2015 -0800

hwmon: (sch56xx) Drop watchdog driver data reference count callbacks

Reference counting is now implemented in the watchdog core and no longer required in watchdog drivers.

commit 43f676ace2e0591718ff493d290bc49b35ec2ffc

Author: Guenter Roeck <[email protected]>
Date:   Fri Dec 25 16:01:44 2015 -0800

watchdog: da9055_wdt: Drop reference counting

Reference counting is now implemented in the watchdog core and no longer required in watchdog drivers.

Since it was implememented a no-op, and since the local memory is allocated with devm_kzalloc(), the reference counting code in the driver really did not really work anyway, and this patch effectively fixes a bug which could cause a crash on unloading if the watchdog device was still open.

commit 756d1e9247dff6d416b0c9e073247f5e808bb5fa

Author: Guenter Roeck <[email protected]>
Date:   Fri Dec 25 16:01:43 2015 -0800

watchdog: da9052_wdt: Drop reference counting

Reference counting is now implemented in the watchdog core and no longer required in watchdog drivers.

Since it was implememented a no-op, and since the local memory is allocated with devm_kzalloc(), the reference counting code in the driver really did not really work anyway, and this patch effectively fixes a bug which could cause a crash on unloading if the watchdog device was still open.

commit b4ffb1909843b28f3b1b60197d517b123b7a9b66

Author: Guenter Roeck <[email protected]>
Date:   Fri Dec 25 16:01:42 2015 -0800

watchdog: Separate and maintain variables based on variable lifetime

All variables required by the watchdog core to manage a watchdog are currently stored in struct watchdog_device. The lifetime of those variables is determined by the watchdog driver. However, the lifetime of variables used by the watchdog core differs from the lifetime of struct watchdog_device. To remedy this situation, watchdog drivers can implement ref and unref callbacks, to be used by the watchdog core to lock struct watchdog_device in memory.

While this solves the immediate problem, it depends on watchdog drivers to actually implement the ref/unref callbacks. This is error prone, often not implemented in the first place, or not implemented correctly.

To solve the problem without requiring driver support, split the variables in struct watchdog_device into two data structures - one for variables associated with the watchdog driver, one for variables associated with the watchdog core. With this approach, the watchdog core can keep track of its variable lifetime and no longer depends on ref/unref callbacks in the driver. As a side effect, some of the variables originally in struct watchdog_driver are now private to the watchdog core and no longer visible in watchdog drivers.

As a side effect of the changes made, an ioctl will now always fail with -ENODEV after a watchdog device was unregistered with the character device still open. Previously, it would only fail with -ENODEV in some situations. Also, ioctl operations are now atomic from driver perspective. With this change, it is now guaranteed that the driver will not unregister a watchdog between a timeout change and the subsequent ping.

The 'ref' and 'unref' callbacks in struct watchdog_driver are no longer used and marked as deprecated.

commit e7d162faa6d067777548cb98d55206cf7cd3438e

Author: Guenter Roeck <[email protected]>
Date:   Fri Dec 25 16:01:41 2015 -0800

watchdog: diag288: Stop re-using watchdog core internal flags

A watchdog driver should not use watchdog subsystem internal flags. Use a driver variable and flag instead to maintain the watchdog state and to determine if a suspend operation is possible or not.

commit 32ecc6392654a0db34b310e8924b5b2c3b8bf503

Author: Guenter Roeck <[email protected]>
Date:   Fri Dec 25 16:01:40 2015 -0800

watchdog: Create watchdog device in watchdog_dev.c

The watchdog character device is currently created in watchdog_dev.c, and the watchdog device in watchdog_core.c. This results in cross-dependencies, since device creation needs to know the watchdog character device number as well as the watchdog class, both of which reside in watchdog_dev.c.

Create the watchdog device in watchdog_dev.c to simplify the code.

Inspired by earlier patch set from Damien Riegel.

commit 0933b453f1c7104d873aacf8524f8ac380a7ed08

Author: Guenter Roeck <[email protected]>
Date:   Thu Dec 24 14:22:04 2015 -0800

watchdog: qcom-wdt: Do not set 'dev' in struct watchdog_device

The 'dev' pointer in struct watchdog_device is set by the watchdog core when registering the watchdog device and not by the driver. It points to the watchdog device, not its parent.

commit 073523662a821940383eb3bf4064c41b0e3dae0d

Author: Guenter Roeck <[email protected]>
Date:   Thu Dec 24 14:22:03 2015 -0800

watchdog: mena21: Do not use device pointer from struct watchdog_device

The device pointer in struct watchdog_device has a different lifetime than the driver code and should not be used in drivers. Use the pointer to the parent device instead.

commit 8a7b76be691fa30c7650b8e08aae8a7990c93779

Author: Guenter Roeck <[email protected]>
Date:   Thu Dec 24 14:22:02 2015 -0800

watchdog: gpio: Do not use device pointer from struct watchdog_device

The device pointer in struct watchdog_device has a different lifetime than the driver code and should not be used in drivers. Use the pointer to the parent device instead.

commit 3d29f80813ba335a21b56debff8e4b92a2772a64

Author: Guenter Roeck <[email protected]>
Date:   Thu Dec 24 14:22:01 2015 -0800

watchdog: tangox: Print info message using pointer to platform device

The device pointer in struct watchdog_device should not be used by drivers and may be removed in the near future. Use the platform device pointer for info messages instead.

commit 92b3649525a5c3daf0b395b6daeaed1ce0d235c2

Author: Guenter Roeck <[email protected]>
Date:   Thu Dec 24 14:22:00 2015 -0800

watchdog: bcm2835_wdt: Drop log message if watchdog is stopped

Stopping a watchdog is a normal operation and does not warrant a log message.

commit 2bfc9beb61ed042c4c7632bd1c96c9dfbcedcc05

Author: Mans Rullgard <[email protected]>
Date:   Wed Nov 18 17:55:42 2015 +0000

devicetree: watchdog: add binding for Sigma Designs SMP8642 watchdog

This adds a binding for the watchdog in Sigma Designs SMP8642 and similar devices.

commit dca536c433a20f916451d8318f4aa7158c0d811c

Author: Mans Rullgard <[email protected]>
Date:   Thu Nov 19 22:09:05 2015 +0000

watchdog: add support for Sigma Designs SMP86xx/SMP87xx

This adds support for the Sigma Designs SMP86xx/SMP87xx family built-in watchdog.

commit 5c6bb88a1b8890225d83fd00d14cf10ae00df91f

Author: Martyn Welch <[email protected]>
Date:   Wed Nov 25 12:03:34 2015 +0000

Add binding documentation for Zodiac Watchdog Timer

This patchs adds documentation for the binding of the Zodiac RAVE Switch Watchdog Processor. This is an i2c based watchdog.

commit 2a7b753a285ebe1d067b1af98e5aad0cc981fffd

Author: Martyn Welch <[email protected]>
Date:   Tue Dec 1 15:32:47 2015 +0000

watchdog: Zodiac Aerospace RAVE Switch Watchdog Processor Driver

This patch adds a driver for the Zodiac Aerospace RAVE Watchdog Procesor. This device implements a watchdog timer, accessible over I2C.

commit a62a7231899606655e98f060e52c4760cf556811

Author: Oleksij Rempel <[email protected]>
Date:   Wed Nov 25 20:33:23 2015 +0100

DT: watchdog: add Alphascale asm9260 watchdog binding documentation.

commit aae03dc981772ce8fca7eb4f899a22014bc4c38e

Author: Oleksij Rempel <[email protected]>
Date:   Wed Nov 25 20:33:22 2015 +0100

watchdog: add Alphascale asm9260-wdt driver

Add WD support for Alphascale asm9260 SoC. This driver provide support for different function modes:
- HW mode to trigger SoC reset on timeout
- SW mode do soft reset if needed
- DEBUG mode

commit bf9006399939762e6cd32445e848e56727df9d98

Author: Damien Riegel <[email protected]>
Date:   Tue Dec 8 11:37:28 2015 -0500

watchdog: ts4800: add driver for TS-4800 watchdog

This watchdog is instantiated in a FPGA that is memory mapped. It is made of only one register, called the feed register. Writing to this register will re-arm the watchdog for a given time (and enable it if it was disable). It can be disabled by writing a special value into it.

It is part of a syscon block, and the watchdog register offset in this block varies from board to board. This offset is passed in the syscon property after the phandle to the syscon node.

commit b466ee89509a1593441537f34c313edafe2ba47c

Author: Guo Zeng <[email protected]>
Date:   Wed Dec 2 03:37:47 2015 +0000

watchdog: atlas7: add watchdog driver of CSRatlas7

This patch adds watchdog driver for CSRatlas7 platform. On CSRatlas7, the 6th timer can act as a watchdog timer when the Watchdog mode is enabled.

commit 71388840ec360e0489be7a75971b595c729b5323

Author: Carlo Caione <[email protected]>
Date:   Sun Nov 8 13:18:55 2015 +0100

watchdog: meson: Add meson8b SoC specific data

Add SoC specific data in the watchdog driver for the meson8b SoC.

commit 943bf1f6466f81e3ac4322c6887a4f4d68452e7f

Author: Carlo Caione <[email protected]>
Date:   Sun Nov 8 13:18:54 2015 +0100

watchdog: meson: Enable meson SoC specific data

With this patch we refactor the driver code to enable watchdog support for all platforms based on Amlogic meson SoCs.
The new default timeout is also now chosen considering the maximum timeout allowed by the SoC.

commit ca22e79f5667faf7f6ed238e04075aeff936bbab

Author: Mingarelli, Thomas <[email protected]>
Date:   Mon Dec 14 20:22:09 2015 +0000

watchdog: hpwdt: HP rebranding

This patch is for the rebranding changes for the corporate split at HP. There are no functional changes with this patch.

commit 62e21f5d90f162208e43b8a248b01e1a4a24ecbd

Author: Geliang Tang <[email protected]>
Date:   Sun Dec 27 21:15:47 2015 +0800

watchdog: cadence_wdt: use to_platform_device()

Use to_platform_device() instead of open-coding it.

commit 8605fec1ce2a397f738f1c394be7847dacf31b0c

Author: Uwe Kleine-König <[email protected]>
Date:   Tue Dec 15 11:37:41 2015 +0100

watchdog: omap: don't disable the timer when it should be enabled early

With the early_enable module parameter the watchdog can be started during driver probe time. If this is requested the bets are good that the timer is already running, so to narrow the gap where the timer is disabled only call the disable function when the timer shouldn't be started.

commit a6392490fbb18f71d228d9c517516fa78fb23883

Author: Uwe Kleine-König <[email protected]>
Date:   Tue Dec 15 11:37:40 2015 +0100

watchdog: omap: don't disable runtime pm before starting device

omap_wdt_start calls pm_runtime_get_sync so dropping a reference just before calling omap_wdt_start doesn't make much sense. Moreover there is no point to use the synchronous variant of pm_runtime_put because the driver doesn't care if the clock is disabled before or after omap_wdt_probe returns.

commit 3024e0d13b0f34536f94bf0d7cc11443beeee9c5

Author: Jisheng Zhang <[email protected]>
Date:   Tue Dec 15 22:25:27 2015 +0800

watchdog: dw_wdt: fix signedness bug in dw_wdt_top_in_seconds()

On 64bit platforms, "(1 << (16 + top)) / clk_get_rate(dw_wdt.clk)" is sign-extended to 64bit then converted to unsigned 64bit, finally divide the clk rate. If the top is the maximum TOP i.e 15, "(1 << (16 +15))" will be sign-extended to 0xffffffff80000000, then converted to unsigned 0xffffffff80000000, which is a huge number, thus the final result is wrong.

We fix this issue by giving usigned value(1U in this case) at first.

Let's assume clk rate is 25MHZ,
Before the patch:
dw_wdt_top_in_seconds(15) = -864612050

After the patch:
dw_wdt_top_in_seconds(15) = 85

commit 5889f06bd31d542766046faa6b17d957c08e1484

Author: Li RongQing <[email protected]>
Date:   Thu Dec 17 21:30:02 2015 +0800
    watchdog: refuse to unload softdog module when its timer is running
    
    the softdog has static variables which are accessed if its timer is
    still running after the driver is unloaded. and lead to crash:
    
       $modprobe softdog
       $echo 1 >/dev/watchdog
       $modprobe -r softdog
    
       CPU 20 Unable to handle kernel paging request at virtual address
       Oops[#1]:
       CPU: 20 PID: 0 Comm: swapper/20 Not tainted 4.1.13-WR8.0.0.0_standard
       ...
       Modules linked in: [last unloaded: softdog]
        ....
       Call Trace:
       [<ffffffff801e142c>] cascade+0x34/0xb0
       [<ffffffff801e1964>] run_timer_softirq+0x30c/0x368
       [<ffffffff80181044>] __do_softirq+0x1ec/0x418
       [<ffffffff801815d0>] irq_exit+0x90/0x98
       [<ffffffff8010749c>] plat_irq_dispatch+0xa4/0x140
       [<ffffffff80152740>] ret_from_irq+0x0/0x4
       [<ffffffff801529e0>] __r4k_wait+0x20/0x40
       [<ffffffff801c2278>] cpu_startup_entry+0x2a0/0x368
       [<ffffffff8015fa64>] start_secondary+0x444/0x4d8
    
    add the module ref when timer is running to avoid to unload the softdog
    module
    
    Signed-off-by: Li RongQing <[email protected]>
    Signed-off-by: Guenter Roeck <[email protected]>
    Signed-off-by: Wim Van Sebroeck <[email protected]>

commit 8d2fa17151ea33a98b5f70839fd2ffa3bce51de5

Author: Harald Geyer <[email protected]>
Date:   Sat Dec 12 14:32:15 2015 +0000

watchdog: stmp3xxx: Stop the watchdog on system halt

This allows the system to actually halt even if userspace forgot to disable the watchdog first. Old behaviour was that the watchdog forced the system to boot again.

commit bdecfcdb5461834aab24002bb18d3cbdd907b7fb

Author: Huang Rui <[email protected]>
Date:   Mon Nov 23 18:07:35 2015 +0800

sp5100_tco: fix the device check for SB800 and later chipsets

For SB800 and later chipsets, the register definitions are the same with SB800. And for SB700 and older chipsets, the definitions should be same with SP5100/SB7x0.

commit cca118fa2a0a94e0f0b3c8dd1dda922cdee45089

Author: Huang Rui <[email protected]>
Date:   Mon Nov 23 18:07:36 2015 +0800

sp5100_tco: Add AMD Carrizo platform support

sp5100_tco watchdog is also supported on AMD KernCZ chipset of Carrizo platform.

commit 190aa4304de6fe2185d96392ddf56580fa133e99

Author: Denis Turischev <[email protected]>
Date:   Tue Nov 24 10:46:12 2015 +0200

sp5100_tco: Add AMD Mullins platform support

AMD Mullins watchdog is fully compatible to the previous Hudson chipset, reuse the existent sp5100_tco driver.

commit 33b711269ade3f6bc9d9d15e4343e6fa922d999b

Author: Pratyush Anand <[email protected]>
Date:   Thu Dec 17 17:53:59 2015 +0530

watchdog: Read device status through sysfs attributes

This patch adds following attributes to watchdog device's sysfs interface to read its different status.

* state - reads whether device is active or not
* identity - reads Watchdog device's identity string.
* timeout - reads current timeout.
* timeleft - reads timeleft before watchdog generates a reset
* bootstatus - reads status of the watchdog device at boot
* status - reads watchdog device's internal status bits
* nowayout - reads whether nowayout feature was set or not

Testing with iTCO_wdt:
# cd /sys/class/watchdog/watchdog1/
# ls
bootstatus dev device identity nowayout power state subsystem timeleft timeout uevent
# cat identity
iTCO_wdt
# cat timeout
30
# cat state
inactive
# echo > /dev/watchdog1
# cat timeleft
26
# cat state
active
# cat bootstatus
0
# cat nowayout
0

commit 906d7a5cfeda508e7361f021605579a00cd82815

Author: Pratyush Anand <[email protected]>
Date:   Thu Dec 17 17:53:58 2015 +0530

watchdog: Use static struct class watchdog_class in stead of pointer

We need few sysfs attributes to know different status of a watchdog device. To do that, we need to associate .dev_groups with watchdog_class. So convert it from pointer to static.
Putting this static struct in watchdog_dev.c, so that static device attributes defined in that file can be attached to it.

commit d68106bbec2c2a33faacd50a1f7d24954701f505

Author: Damien Riegel <[email protected]>
Date:   Fri Nov 20 16:54:56 2015 -0500

watchdog: w83627hf_wdt: use core reboot notifier

Get rid of the custom reboot notifier block registration and use the one provided by the watchdog core.

commit 84ebcc17f281ed6ce1e6a7b4b0d9f15da727edd5

Author: Damien Riegel <[email protected]>
Date:   Fri Nov 20 16:54:55 2015 -0500

watchdog: softdog: use core reboot notifier

Get rid of the custom reboot notifier block registration and use the one provided by the watchdog core.

commit 28e805b44d52900fc5b05b35ef3945dc6db336a1

Author: Damien Riegel <[email protected]>
Date:   Fri Nov 20 16:54:54 2015 -0500

watchdog: gpio_wdt: use core reboot notifier

Get rid of the custom reboot notifier block registration and use the one provided by the watchdog core.

Note that this watchdog used to stop unconditionnaly on SYS_HALT and SYS_POWER_OFF. The core function now calls ops->stop on SYS_HALT and SYS_DOWN. To prevent the watchdog from being stopped on reboot, the "always-running" property must be set, otherwise it will now be stopped.

commit 5e1f976f43dc6b5903ee4b78536347b5004cefe4

Author: Damien Riegel <[email protected]>
Date:   Fri Nov 20 16:54:53 2015 -0500

watchdog: cadence_wdt: use core reboot notifier

Get rid of the custom reboot notifier block registration and use the one provided by the watchdog core.

commit 2786aadeab263609eb690ca37e7dfd3b9ffa3625

Author: Damien Riegel <[email protected]>
Date:   Fri Nov 20 16:54:52 2015 -0500

watchdog: bcm47xx_wdt: use core reboot notifier

Get rid of the custom reboot notifier block registration and use the one provided by the watchdog core.

commit e131319669e0ef5e6fcd75174daeffa40492135c

Author: Damien Riegel <[email protected]>
Date:   Fri Nov 20 16:54:51 2015 -0500

watchdog: core: add reboot notifier support

Many watchdog drivers register a reboot notifier in order to stop the watchdog on system reboot. Thus we can factorize this code in the watchdog core.

For that purpose, a new notifier block is added in watchdog_device for internal use only, as well as a new watchdog_stop_on_reboot helper function.

If this helper is called, watchdog core registers the related notifier block and will stop the watchdog when SYS_HALT or SYS_DOWN is received.

Since this operation can be critical on some platforms, abort the device registration if the reboot notifier registration fails.

commit 0ebad1e5e5bae3e59125675d37a70d946f283fef

Author: Damien Riegel <[email protected]>
Date:   Mon Nov 16 12:28:11 2015 -0500

watchdog: sunxi_wdt: use core restart handler

Get rid of the custom restart handler by using the one provided by the watchdog core.

commit c71f5cd25f946fe1eb13bb25230ce0a957c9ac16

Author: Damien Riegel <[email protected]>
Date:   Mon Nov 16 12:28:10 2015 -0500

watchdog: s3c2410_wdt: use core restart handler

Get rid of the custom restart handler by using the one provided by the watchdog core.

commit 80969a68ffed12f82e2a29908306ff43a6861a61

Author: Damien Riegel <[email protected]>
Date:   Mon Nov 16 12:28:09 2015 -0500

watchdog: qcom-wdt: use core restart handler

Get rid of the custom restart handler by using the one provided by the watchdog core.

commit e86adc3f631bd9d773f1028d6d88c9f5a02b07a5

Author: Damien Riegel <[email protected]>
Date:   Mon Nov 16 12:28:08 2015 -0500

watchdog: mtk_wdt: use core restart handler

Get rid of the custom restart handler by using the one provided by the watchdog core.

commit 46c17f0f91729404b3578570302db88039fee8b5

Author: Damien Riegel <[email protected]>
Date:   Mon Nov 16 12:28:07 2015 -0500

watchdog: moxart_wdt: use core restart handler

Get rid of the custom restart handler by using the one provided by the watchdog core.

commit 1b6fd59ad810a5fe003521789e7d9e996883450a

Author: Damien Riegel <[email protected]>
Date:   Mon Nov 16 12:28:06 2015 -0500

watchdog: meson_wdt: use core restart handler

Get rid of the custom restart handler by using the one provided by the watchdog core.

commit 2de4e5a67660b79535659f5961a10beaf551b49b

Author: Damien Riegel <[email protected]>
Date:   Mon Nov 16 12:28:05 2015 -0500

watchdog: lpc18xx_wdt: use core restart handler

Get rid of the custom restart handler by using the one provided by the watchdog core.

commit 2d9d24755e7669ec39c946918038ce646e75a67a

Author: Damien Riegel <[email protected]>
Date:   Mon Nov 16 12:28:04 2015 -0500

watchdog: imx2_wdt: use core restart handler

Get rid of the custom restart handler by using the one provided by the watchdog core.

commit 0f10d9c57e56baaf90027bc8bda8ba9e033357e3

Author: Damien Riegel <[email protected]>
Date:   Mon Nov 16 12:28:03 2015 -0500

watchdog: imgpdc_wdt: use core restart handler

Get rid of the custom restart handler by using the one provided by the watchdog core.

commit d3b081857cef5e25d53e5299a2816d1938dae553

Author: Damien Riegel <[email protected]>
Date:   Mon Nov 16 12:28:02 2015 -0500

watchdog: digicolor_wdt: use core restart handler

Get rid of the custom restart handler by using the one provided by the watchdog core.

commit f79781ceadf979e1dcfe366f18ca44f6bc78814f

Author: Damien Riegel <[email protected]>
Date:   Mon Nov 16 12:28:01 2015 -0500

watchdog: da9063_wdt: use core restart handler

Get rid of the custom restart handler by using the one provided by the watchdog core.

commit 65a4a1dc31ad9d73918971f1b89c617812c494bf

Author: Damien Riegel <[email protected]>
Date:   Mon Nov 16 12:28:00 2015 -0500

watchdog: bcm47xx_wdt: use core restart handler

Get rid of the custom restart handler by using the one provided by the watchdog core.

commit 2165bf524da5f5e496d1cdb8c5afae1345ecce1e

Author: Damien Riegel <[email protected]>
Date:   Mon Nov 16 12:27:59 2015 -0500

watchdog: core: add restart handler support

Many watchdog drivers implement the same code to register a restart handler. This patch provides a generic way to set such a function.

The patch adds a new restart watchdog operation. If a restart priority greater than 0 is needed, the driver can call watchdog_set_restart_priority to set it.

commit 1f32f83e5d81c1e99a1c16366e71d5867cd1e364

Author: Guenter Roeck <[email protected]>
Date:   Sat Dec 5 22:18:25 2015 -0800

MAINTAINERS: Add Guenter Roeck as reviewer of watchdog drivers

Guenter has been reviewing watchdog drivers for years, so we might as well make it official.

For completeness, I added the overal diff below.

Greetings,
Wim.

================================================================================

Documentation/ABI/testing/sysfs-class-watchdog new file +51 -0
new file mode 100644
index 0000000..736046b
@@ -0,0 +1,51 @@
+What:		/sys/class/watchdog/watchdogn/bootstatus
+Date:		August 2015
+Contact:	Wim Van Sebroeck <[email protected]>
+Description:
+		It is a read only file. It contains status of the watchdog
+		device at boot. It is equivalent to WDIOC_GETBOOTSTATUS of
+		ioctl interface.
+
+What:		/sys/class/watchdog/watchdogn/identity
+Date:		August 2015
+Contact:	Wim Van Sebroeck <[email protected]>
+Description:
+		It is a read only file. It contains identity string of
+		watchdog device.
+
+What:		/sys/class/watchdog/watchdogn/nowayout
+Date:		August 2015
+Contact:	Wim Van Sebroeck <[email protected]>
+Description:
+		It is a read only file. While reading, it gives '1' if that
+		device supports nowayout feature else, it gives '0'.
+
+What:		/sys/class/watchdog/watchdogn/state
+Date:		August 2015
+Contact:	Wim Van Sebroeck <[email protected]>
+Description:
+		It is a read only file. It gives active/inactive status of
+		watchdog device.
+
+What:		/sys/class/watchdog/watchdogn/status
+Date:		August 2015
+Contact:	Wim Van Sebroeck <[email protected]>
+Description:
+		It is a read only file. It contains watchdog device's
+		internal status bits. It is equivalent to WDIOC_GETSTATUS
+		of ioctl interface.
+
+What:		/sys/class/watchdog/watchdogn/timeleft
+Date:		August 2015
+Contact:	Wim Van Sebroeck <[email protected]>
+Description:
+		It is a read only file. It contains value of time left for
+		reset generation. It is equivalent to WDIOC_GETTIMELEFT of
+		ioctl interface.
+
+What:		/sys/class/watchdog/watchdogn/timeout
+Date:		August 2015
+Contact:	Wim Van Sebroeck <[email protected]>
+Description:
+		It is a read only file. It is read to know about current
+		value of timeout programmed.
Documentation/devicetree/bindings/watchdog/alphascale-asm9260.txt new file +35 -0
new file mode 100644
index 0000000..75b265a
@@ -0,0 +1,35 @@
+Alphascale asm9260 Watchdog timer
+
+Required properties:
+
+- compatible : should be "alphascale,asm9260-wdt".
+- reg : Specifies base physical address and size of the registers.
+- clocks : the clocks feeding the watchdog timer. See clock-bindings.txt
+- clock-names : should be set to
+	"mod" - source for tick counter.
+	"ahb" - ahb gate.
+- resets : phandle pointing to the system reset controller with
+	line index for the watchdog.
+- reset-names : should be set to "wdt_rst".
+
+Optional properties:
+- timeout-sec : shall contain the default watchdog timeout in seconds,
+	if unset, the default timeout is 30 seconds.
+- alphascale,mode : three modes are supported
+	"hw" - hw reset (default).
+	"sw" - sw reset.
+	"debug" - no action is taken.
+
+Example:
+
+watchdog0: watchdog@80048000 {
+	compatible = "alphascale,asm9260-wdt";
+	reg = <0x80048000 0x10>;
+	clocks = <&acc CLKID_SYS_WDT>, <&acc CLKID_AHB_WDT>;
+	clock-names = "mod", "ahb";
+	interrupts = <55>;
+	resets = <&rst WDT_RESET>;
+	reset-names = "wdt_rst";
+	timeout-sec = <30>;
+	alphascale,mode = "hw";
+};
Documentation/devicetree/bindings/watchdog/mt7621-wdt.txt new file +12 -0
new file mode 100644
index 0000000..c15ef0e
@@ -0,0 +1,12 @@
+Ralink Watchdog Timers
+
+Required properties:
+- compatible: must be "mediatek,mt7621-wdt"
+- reg: physical base address of the controller and length of the register range
+
+Example:
+
+	watchdog@100 {
+		compatible = "mediatek,mt7621-wdt";
+		reg = <0x100 0x10>;
+	};
Documentation/devicetree/bindings/watchdog/sigma,smp8642-wdt.txt new file +18 -0
new file mode 100644
index 0000000..5b7ec2c
@@ -0,0 +1,18 @@
+Sigma Designs SMP86xx/SMP87xx watchdog
+
+Required properties:
+- compatible: Should be "sigma,smp8642-wdt"
+- reg: Specifies the physical address region
+- clocks: Should be a phandle to the clock
+
+Optional properties:
+- timeout-sec: watchdog timeout in seconds
+
+Example:
+
+watchdog@1fd00 {
+	compatible = "sigma,smp8642-wdt";
+	reg = <0x1fd00 8>;
+	clocks = <&xtal_in_clk>;
+	timeout-sec = <30>;
+};
Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt new file +25 -0
new file mode 100644
index 0000000..8f6caad
@@ -0,0 +1,25 @@
+Technologic Systems Watchdog
+
+Required properties:
+- compatible: must be "technologic,ts4800-wdt"
+- syscon: phandle / integer array that points to the syscon node which
+          describes the FPGA's syscon registers.
+          - phandle to FPGA's syscon
+          - offset to the watchdog register
+
+Optional property:
+- timeout-sec: contains the watchdog timeout in seconds.
+
+Example:
+
+syscon: syscon@b0010000 {
+	compatible = "syscon", "simple-mfd";
+	reg = <0xb0010000 0x3d>;
+	reg-io-width = <2>;
+
+	wdt@e {
+		compatible = "technologic,ts4800-wdt";
+		syscon = <&syscon 0xe>;
+		timeout-sec = <10>;
+	};
+}
Documentation/devicetree/bindings/watchdog/ziirave-wdt.txt new file +19 -0
new file mode 100644
index 0000000..3d87818
@@ -0,0 +1,19 @@
+Zodiac RAVE Watchdog Timer
+
+Required properties:
+- compatible: must be "zii,rave-wdt"
+- reg: i2c slave address of device, usually 0x38
+
+Optional Properties:
+- timeout-sec: Watchdog timeout value in seconds.
+- reset-duration-ms: Duration of the pulse generated when the watchdog times
+  out. Value in milliseconds.
+
+Example:
+
+	watchdog@38 {
+		compatible = "zii,rave-wdt";
+		reg = <0x38>;
+		timeout-sec = <30>;
+		reset-duration-ms = <30>;
+	};
Documentation/watchdog/watchdog-kernel-api.txt +37 -40

146 lines not on this page · raw message

MAINTAINERS +1 -0
index cba790b..b1e3da7 100644
@@ -11602,6 +11602,7 @@ F:	drivers/input/tablet/wacom_serial4.c
 
 WATCHDOG DEVICE DRIVERS
 M:	Wim Van Sebroeck <[email protected]>
+R:	Guenter Roeck <[email protected]>
 L:	[email protected]
 W:	http://www.linux-watchdog.org/
 T:	git git://www.linux-watchdog.org/linux-watchdog.git
drivers/hwmon/sch56xx-common.c +1 -30
index 7386819..68c350c 100644
@@ -30,7 +30,6 @@
 #include <linux/watchdog.h>
 #include <linux/miscdevice.h>
 #include <linux/uaccess.h>
-#include <linux/kref.h>
 #include <linux/slab.h>
 #include "sch56xx-common.h"
 
@@ -67,7 +66,6 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
 struct sch56xx_watchdog_data {
 	u16 addr;
 	struct mutex *io_lock;
-	struct kref kref;
 	struct watchdog_info wdinfo;
 	struct watchdog_device wddev;
 	u8 watchdog_preset;
@@ -258,15 +256,6 @@ EXPORT_SYMBOL(sch56xx_read_virtual_reg12);
  * Watchdog routines
  */
 
-/* Release our data struct when we're unregistered *and*
-   all references to our watchdog device are released */
-static void watchdog_release_resources(struct kref *r)
-{
-	struct sch56xx_watchdog_data *data =
-		container_of(r, struct sch56xx_watchdog_data, kref);
-	kfree(data);
-}
-
 static int watchdog_set_timeout(struct watchdog_device *wddev,
 				unsigned int timeout)
 {
@@ -395,28 +384,12 @@ static int watchdog_stop(struct watchdog_device *wddev)
 	return 0;
 }
 
-static void watchdog_ref(struct watchdog_device *wddev)
-{
-	struct sch56xx_watchdog_data *data = watchdog_get_drvdata(wddev);
-
-	kref_get(&data->kref);
-}
-
-static void watchdog_unref(struct watchdog_device *wddev)
-{
-	struct sch56xx_watchdog_data *data = watchdog_get_drvdata(wddev);
-
-	kref_put(&data->kref, watchdog_release_resources);
-}
-
 static const struct watchdog_ops watchdog_ops = {
 	.owner		= THIS_MODULE,
 	.start		= watchdog_start,
 	.stop		= watchdog_stop,
 	.ping		= watchdog_trigger,
 	.set_timeout	= watchdog_set_timeout,
-	.ref		= watchdog_ref,
-	.unref		= watchdog_unref,
 };
 
 struct sch56xx_watchdog_data *sch56xx_watchdog_register(struct device *parent,
@@ -448,7 +421,6 @@ struct sch56xx_watchdog_data *sch56xx_watchdog_register(struct device *parent,
 
 	data->addr = addr;
 	data->io_lock = io_lock;
-	kref_init(&data->kref);
 
 	strlcpy(data->wdinfo.identity, "sch56xx watchdog",
 		sizeof(data->wdinfo.identity));
@@ -494,8 +466,7 @@ EXPORT_SYMBOL(sch56xx_watchdog_register);
 void sch56xx_watchdog_unregister(struct sch56xx_watchdog_data *data)
 {
 	watchdog_unregister_device(&data->wddev);
-	kref_put(&data->kref, watchdog_release_resources);
-	/* Don't touch data after this it may have been free-ed! */
+	kfree(data);
 }
 EXPORT_SYMBOL(sch56xx_watchdog_unregister);
 
drivers/watchdog/Kconfig +65 -0

107 lines not on this page · raw message

drivers/watchdog/Makefile +6 -0
index 53d4827..f566753 100644
@@ -30,6 +30,7 @@ obj-$(CONFIG_USBPCWATCHDOG) += pcwd_usb.o
 
 # ARM Architecture
 obj-$(CONFIG_ARM_SP805_WATCHDOG) += sp805_wdt.o
+obj-$(CONFIG_ASM9260_WATCHDOG) += asm9260_wdt.o
 obj-$(CONFIG_AT91RM9200_WATCHDOG) += at91rm9200_wdt.o
 obj-$(CONFIG_AT91SAM9X_WATCHDOG) += at91sam9_wdt.o
 obj-$(CONFIG_CADENCE_WATCHDOG) += cadence_wdt.o
@@ -53,6 +54,7 @@ obj-$(CONFIG_RN5T618_WATCHDOG) += rn5t618_wdt.o
 obj-$(CONFIG_COH901327_WATCHDOG) += coh901327_wdt.o
 obj-$(CONFIG_STMP3XXX_RTC_WATCHDOG) += stmp3xxx_rtc_wdt.o
 obj-$(CONFIG_NUC900_WATCHDOG) += nuc900_wdt.o
+obj-$(CONFIG_TS4800_WATCHDOG) += ts4800_wdt.o
 obj-$(CONFIG_TS72XX_WATCHDOG) += ts72xx_wdt.o
 obj-$(CONFIG_IMX2_WDT) += imx2_wdt.o
 obj-$(CONFIG_UX500_WATCHDOG) += ux500_wdt.o
@@ -69,6 +71,7 @@ obj-$(CONFIG_MEDIATEK_WATCHDOG) += mtk_wdt.o
 obj-$(CONFIG_DIGICOLOR_WATCHDOG) += digicolor_wdt.o
 obj-$(CONFIG_LPC18XX_WATCHDOG) += lpc18xx_wdt.o
 obj-$(CONFIG_BCM7038_WDT) += bcm7038_wdt.o
+obj-$(CONFIG_ATLAS7_WATCHDOG) += atlas7_wdt.o
 
 # AVR32 Architecture
 obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o
@@ -149,6 +152,7 @@ octeon-wdt-y := octeon-wdt-main.o octeon-wdt-nmi.o
 obj-$(CONFIG_LANTIQ_WDT) += lantiq_wdt.o
 obj-$(CONFIG_RALINK_WDT) += rt2880_wdt.o
 obj-$(CONFIG_IMGPDC_WDT) += imgpdc_wdt.o
+obj-$(CONFIG_MT7621_WDT) += mt7621_wdt.o
 
 # PARISC Architecture
 
@@ -187,8 +191,10 @@ obj-$(CONFIG_DA9055_WATCHDOG) += da9055_wdt.o
 obj-$(CONFIG_DA9062_WATCHDOG) += da9062_wdt.o
 obj-$(CONFIG_DA9063_WATCHDOG) += da9063_wdt.o
 obj-$(CONFIG_GPIO_WATCHDOG)	+= gpio_wdt.o
+obj-$(CONFIG_TANGOX_WATCHDOG) += tangox_wdt.o
 obj-$(CONFIG_WM831X_WATCHDOG) += wm831x_wdt.o
 obj-$(CONFIG_WM8350_WATCHDOG) += wm8350_wdt.o
 obj-$(CONFIG_MAX63XX_WATCHDOG) += max63xx_wdt.o
+obj-$(CONFIG_ZIIRAVE_WATCHDOG) += ziirave_wdt.o
 obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o
 obj-$(CONFIG_MENF21BMC_WATCHDOG) += menf21bmc_wdt.o
drivers/watchdog/asm9260_wdt.c new file +403 -0

403 lines not on this page · raw message

drivers/watchdog/atlas7_wdt.c new file +242 -0

242 lines not on this page · raw message

drivers/watchdog/bcm2835_wdt.c +0 -1
index 8a5ce5b..2e6164c 100644
@@ -79,7 +79,6 @@ static int bcm2835_wdt_stop(struct watchdog_device *wdog)
 	struct bcm2835_wdt *wdt = watchdog_get_drvdata(wdog);
 
 	writel_relaxed(PM_PASSWORD | PM_RSTC_RESET, wdt->base + PM_RSTC);
-	dev_info(wdog->dev, "Watchdog timer stopped");
 	return 0;
 }
 
drivers/watchdog/bcm47xx_wdt.c +14 -41

106 lines not on this page · raw message

drivers/watchdog/cadence_wdt.c +3 -39

96 lines not on this page · raw message

drivers/watchdog/da9052_wdt.c +0 -24
index 67e6797..2fc19a3 100644
@@ -31,7 +31,6 @@
 struct da9052_wdt_data {
 	struct watchdog_device wdt;
 	struct da9052 *da9052;
-	struct kref kref;
 	unsigned long jpast;
 };
 
@@ -51,10 +50,6 @@ static const struct {
 };
 
 
-static void da9052_wdt_release_resources(struct kref *r)
-{
-}
-
 static int da9052_wdt_set_timeout(struct watchdog_device *wdt_dev,
 				  unsigned int timeout)
 {
@@ -104,20 +99,6 @@ static int da9052_wdt_set_timeout(struct watchdog_device *wdt_dev,
 	return 0;
 }
 
-static void da9052_wdt_ref(struct watchdog_device *wdt_dev)
-{
-	struct da9052_wdt_data *driver_data = watchdog_get_drvdata(wdt_dev);
-
-	kref_get(&driver_data->kref);
-}
-
-static void da9052_wdt_unref(struct watchdog_device *wdt_dev)
-{
-	struct da9052_wdt_data *driver_data = watchdog_get_drvdata(wdt_dev);
-
-	kref_put(&driver_data->kref, da9052_wdt_release_resources);
-}
-
 static int da9052_wdt_start(struct watchdog_device *wdt_dev)
 {
 	return da9052_wdt_set_timeout(wdt_dev, wdt_dev->timeout);
@@ -170,8 +151,6 @@ static const struct watchdog_ops da9052_wdt_ops = {
 	.stop = da9052_wdt_stop,
 	.ping = da9052_wdt_ping,
 	.set_timeout = da9052_wdt_set_timeout,
-	.ref = da9052_wdt_ref,
-	.unref = da9052_wdt_unref,
 };
 
 
@@ -198,8 +177,6 @@ static int da9052_wdt_probe(struct platform_device *pdev)
 	da9052_wdt->parent = &pdev->dev;
 	watchdog_set_drvdata(da9052_wdt, driver_data);
 
-	kref_init(&driver_data->kref);
-
 	ret = da9052_reg_update(da9052, DA9052_CONTROL_D_REG,
 				DA9052_CONTROLD_TWDSCALE, 0);
 	if (ret < 0) {
@@ -225,7 +202,6 @@ static int da9052_wdt_remove(struct platform_device *pdev)
 	struct da9052_wdt_data *driver_data = platform_get_drvdata(pdev);
 
 	watchdog_unregister_device(&driver_data->wdt);
-	kref_put(&driver_data->kref, da9052_wdt_release_resources);
 
 	return 0;
 }
drivers/watchdog/da9055_wdt.c +0 -24
index 04d1430..8377c43 100644
@@ -35,7 +35,6 @@ MODULE_PARM_DESC(nowayout,
 struct da9055_wdt_data {
 	struct watchdog_device wdt;
 	struct da9055 *da9055;
-	struct kref kref;
 };
 
 static const struct {
@@ -99,24 +98,6 @@ static int da9055_wdt_ping(struct watchdog_device *wdt_dev)
 				 DA9055_WATCHDOG_MASK, 1);
 }
 
-static void da9055_wdt_release_resources(struct kref *r)
-{
-}
-
-static void da9055_wdt_ref(struct watchdog_device *wdt_dev)
-{
-	struct da9055_wdt_data *driver_data = watchdog_get_drvdata(wdt_dev);
-
-	kref_get(&driver_data->kref);
-}
-
-static void da9055_wdt_unref(struct watchdog_device *wdt_dev)
-{
-	struct da9055_wdt_data *driver_data = watchdog_get_drvdata(wdt_dev);
-
-	kref_put(&driver_data->kref, da9055_wdt_release_resources);
-}
-
 static int da9055_wdt_start(struct watchdog_device *wdt_dev)
 {
 	return da9055_wdt_set_timeout(wdt_dev, wdt_dev->timeout);
@@ -138,8 +119,6 @@ static const struct watchdog_ops da9055_wdt_ops = {
 	.stop = da9055_wdt_stop,
 	.ping = da9055_wdt_ping,
 	.set_timeout = da9055_wdt_set_timeout,
-	.ref = da9055_wdt_ref,
-	.unref = da9055_wdt_unref,
 };
 
 static int da9055_wdt_probe(struct platform_device *pdev)
@@ -165,8 +144,6 @@ static int da9055_wdt_probe(struct platform_device *pdev)
 	watchdog_set_nowayout(da9055_wdt, nowayout);
 	watchdog_set_drvdata(da9055_wdt, driver_data);
 
-	kref_init(&driver_data->kref);
-
 	ret = da9055_wdt_stop(da9055_wdt);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "Failed to stop watchdog, %d\n", ret);
@@ -189,7 +166,6 @@ static int da9055_wdt_remove(struct platform_device *pdev)
 	struct da9055_wdt_data *driver_data = platform_get_drvdata(pdev);
 
 	watchdog_unregister_device(&driver_data->wdt);
-	kref_put(&driver_data->kref, da9055_wdt_release_resources);
 
 	return 0;
 }
drivers/watchdog/da9063_wdt.c +6 -17
index 6bf130b..11e8875 100644
@@ -20,7 +20,6 @@
 #include <linux/delay.h>
 #include <linux/mfd/da9063/registers.h>
 #include <linux/mfd/da9063/core.h>
-#include <linux/reboot.h>
 #include <linux/regmap.h>
 
 /*
@@ -39,7 +38,6 @@ static const unsigned int wdt_timeout[] = { 0, 2, 4, 8, 16, 32, 65, 131 };
 struct da9063_watchdog {
 	struct da9063 *da9063;
 	struct watchdog_device wdtdev;
-	struct notifier_block restart_handler;
 };
 
 static unsigned int da9063_wdt_timeout_to_sel(unsigned int secs)
@@ -121,12 +119,9 @@ static int da9063_wdt_set_timeout(struct watchdog_device *wdd,
 	return ret;
 }
 
-static int da9063_wdt_restart_handler(struct notifier_block *this,
-				      unsigned long mode, void *cmd)
+static int da9063_wdt_restart(struct watchdog_device *wdd)
 {
-	struct da9063_watchdog *wdt = container_of(this,
-						   struct da9063_watchdog,
-						   restart_handler);
+	struct da9063_watchdog *wdt = watchdog_get_drvdata(wdd);
 	int ret;
 
 	ret = regmap_write(wdt->da9063->regmap, DA9063_REG_CONTROL_F,
@@ -135,7 +130,7 @@ static int da9063_wdt_restart_handler(struct notifier_block *this,
 		dev_alert(wdt->da9063->dev, "Failed to shutdown (err = %d)\n",
 			  ret);
 
-	return NOTIFY_DONE;
+	return ret;
 }
 
 static const struct watchdog_info da9063_watchdog_info = {
@@ -149,6 +144,7 @@ static const struct watchdog_ops da9063_watchdog_ops = {
 	.stop = da9063_wdt_stop,
 	.ping = da9063_wdt_ping,
 	.set_timeout = da9063_wdt_set_timeout,
+	.restart = da9063_wdt_restart,
 };
 
 static int da9063_wdt_probe(struct platform_device *pdev)
@@ -179,6 +175,8 @@ static int da9063_wdt_probe(struct platform_device *pdev)
 
 	wdt->wdtdev.status = WATCHDOG_NOWAYOUT_INIT_STATUS;
 
+	watchdog_set_restart_priority(&wdt->wdtdev, 128);
+
 	watchdog_set_drvdata(&wdt->wdtdev, wdt);
 	dev_set_drvdata(&pdev->dev, wdt);
 
@@ -186,13 +184,6 @@ static int da9063_wdt_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	wdt->restart_handler.notifier_call = da9063_wdt_restart_handler;
-	wdt->restart_handler.priority = 128;
-	ret = register_restart_handler(&wdt->restart_handler);
-	if (ret)
-		dev_err(wdt->da9063->dev,
-			"Failed to register restart handler (err = %d)\n", ret);
-
 	return 0;
 }
 
@@ -200,8 +191,6 @@ static int da9063_wdt_remove(struct platform_device *pdev)
 {
 	struct da9063_watchdog *wdt = dev_get_drvdata(&pdev->dev);
 
-	unregister_restart_handler(&wdt->restart_handler);
-
 	watchdog_unregister_device(&wdt->wdtdev);
 
 	return 0;
drivers/watchdog/diag288_wdt.c +16 -10
index 3db9d0e..861d3d3 100644
@@ -106,6 +106,10 @@ static int __diag288_lpar(unsigned int func, unsigned int timeout,
 	return __diag288(func, timeout, action, 0);
 }
 
+static unsigned long wdt_status;
+
+#define DIAG_WDOG_BUSY	0
+
 static int wdt_start(struct watchdog_device *dev)
 {
 	char *ebc_cmd;
@@ -113,12 +117,17 @@ static int wdt_start(struct watchdog_device *dev)
 	int ret;
 	unsigned int func;
 
+	if (test_and_set_bit(DIAG_WDOG_BUSY, &wdt_status))
+		return -EBUSY;
+
 	ret = -ENODEV;
 
 	if (MACHINE_IS_VM) {
 		ebc_cmd = kmalloc(MAX_CMDLEN, GFP_KERNEL);
-		if (!ebc_cmd)
+		if (!ebc_cmd) {
+			clear_bit(DIAG_WDOG_BUSY, &wdt_status);
 			return -ENOMEM;
+		}
 		len = strlcpy(ebc_cmd, wdt_cmd, MAX_CMDLEN);
 		ASCEBC(ebc_cmd, MAX_CMDLEN);
 		EBC_TOUPPER(ebc_cmd, MAX_CMDLEN);
@@ -135,6 +144,7 @@ static int wdt_start(struct watchdog_device *dev)
 
 	if (ret) {
 		pr_err("The watchdog cannot be activated\n");
+		clear_bit(DIAG_WDOG_BUSY, &wdt_status);
 		return ret;
 	}
 	return 0;
@@ -146,6 +156,9 @@ static int wdt_stop(struct watchdog_device *dev)
 
 	diag_stat_inc(DIAG_STAT_X288);
 	ret = __diag288(WDT_FUNC_CANCEL, 0, 0, 0);
+
+	clear_bit(DIAG_WDOG_BUSY, &wdt_status);
+
 	return ret;
 }
 
@@ -220,17 +233,10 @@ static struct watchdog_device wdt_dev = {
  * It makes no sense to go into suspend while the watchdog is running.
  * Depending on the memory size, the watchdog might trigger, while we
  * are still saving the memory.
- * We reuse the open flag to ensure that suspend and watchdog open are
- * exclusive operations
  */
 static int wdt_suspend(void)
 {
-	if (test_and_set_bit(WDOG_DEV_OPEN, &wdt_dev.status)) {
-		pr_err("Linux cannot be suspended while the watchdog is in use\n");
-		return notifier_from_errno(-EBUSY);
-	}
-	if (test_bit(WDOG_ACTIVE, &wdt_dev.status)) {
-		clear_bit(WDOG_DEV_OPEN, &wdt_dev.status);
+	if (test_and_set_bit(DIAG_WDOG_BUSY, &wdt_status)) {
 		pr_err("Linux cannot be suspended while the watchdog is in use\n");
 		return notifier_from_errno(-EBUSY);
 	}
@@ -239,7 +245,7 @@ static int wdt_suspend(void)
 
 static int wdt_resume(void)
 {
-	clear_bit(WDOG_DEV_OPEN, &wdt_dev.status);
+	clear_bit(DIAG_WDOG_BUSY, &wdt_status);
 	return NOTIFY_DONE;
 }
 
drivers/watchdog/digicolor_wdt.c +5 -13
index 50abe1b..1ccb0b2 100644
@@ -15,7 +15,6 @@
 #include <linux/delay.h>
 #include <linux/clk.h>
 #include <linux/watchdog.h>
-#include <linux/reboot.h>
 #include <linux/platform_device.h>
 #include <linux/of_address.h>
 
@@ -28,7 +27,6 @@
 struct dc_wdt {
 	void __iomem		*base;
 	struct clk		*clk;
-	struct notifier_block	restart_handler;
 	spinlock_t		lock;
 };
 
@@ -50,16 +48,15 @@ static void dc_wdt_set(struct dc_wdt *wdt, u32 ticks)
 	spin_unlock_irqrestore(&wdt->lock, flags);
 }
 
-static int dc_restart_handler(struct notifier_block *this, unsigned long mode,
-			      void *cmd)
+static int dc_wdt_restart(struct watchdog_device *wdog)
 {
-	struct dc_wdt *wdt = container_of(this, struct dc_wdt, restart_handler);
+	struct dc_wdt *wdt = watchdog_get_drvdata(wdog);
 
 	dc_wdt_set(wdt, 1);
 	/* wait for reset to assert... */
 	mdelay(500);
 
-	return NOTIFY_DONE;
+	return 0;
 }
 
 static int dc_wdt_start(struct watchdog_device *wdog)
@@ -104,6 +101,7 @@ static struct watchdog_ops dc_wdt_ops = {
 	.stop		= dc_wdt_stop,
 	.set_timeout	= dc_wdt_set_timeout,
 	.get_timeleft	= dc_wdt_get_timeleft,
+	.restart        = dc_wdt_restart,
 };
 
 static struct watchdog_info dc_wdt_info = {
@@ -148,6 +146,7 @@ static int dc_wdt_probe(struct platform_device *pdev)
 	spin_lock_init(&wdt->lock);
 
 	watchdog_set_drvdata(&dc_wdt_wdd, wdt);
+	watchdog_set_restart_priority(&dc_wdt_wdd, 128);
 	watchdog_init_timeout(&dc_wdt_wdd, timeout, dev);
 	ret = watchdog_register_device(&dc_wdt_wdd);
 	if (ret) {
@@ -155,12 +154,6 @@ static int dc_wdt_probe(struct platform_device *pdev)
 		goto err_iounmap;
 	}
 
-	wdt->restart_handler.notifier_call = dc_restart_handler;
-	wdt->restart_handler.priority = 128;
-	ret = register_restart_handler(&wdt->restart_handler);
-	if (ret)
-		dev_warn(&pdev->dev, "cannot register restart handler\n");
-
 	return 0;
 
 err_iounmap:
@@ -172,7 +165,6 @@ static int dc_wdt_remove(struct platform_device *pdev)
 {
 	struct dc_wdt *wdt = platform_get_drvdata(pdev);
 
-	unregister_restart_handler(&wdt->restart_handler);
 	watchdog_unregister_device(&dc_wdt_wdd);
 	iounmap(wdt->base);
 
drivers/watchdog/dw_wdt.c +1 -1
index 6ea0634..8fefa4a 100644
@@ -81,7 +81,7 @@ static inline int dw_wdt_top_in_seconds(unsigned top)
 	 * There are 16 possible timeout values in 0..15 where the number of
 	 * cycles is 2 ^ (16 + i) and the watchdog counts down.
 	 */
-	return (1 << (16 + top)) / clk_get_rate(dw_wdt.clk);
+	return (1U << (16 + top)) / clk_get_rate(dw_wdt.clk);
 }
 
 static int dw_wdt_get_top(void)
drivers/watchdog/gpio_wdt.c +4 -34
index 90d59d3..ba066e4 100644
@@ -12,10 +12,8 @@
 #include <linux/err.h>
 #include <linux/delay.h>
 #include <linux/module.h>
-#include <linux/notifier.h>
 #include <linux/of_gpio.h>
 #include <linux/platform_device.h>
-#include <linux/reboot.h>
 #include <linux/watchdog.h>
 
 #define SOFT_TIMEOUT_MIN	1
@@ -36,7 +34,6 @@ struct gpio_wdt_priv {
 	unsigned int		hw_algo;
 	unsigned int		hw_margin;
 	unsigned long		last_jiffies;
-	struct notifier_block	notifier;
 	struct timer_list	timer;
 	struct watchdog_device	wdd;
 };
@@ -57,7 +54,8 @@ static void gpio_wdt_hwping(unsigned long data)
 
 	if (priv->armed && time_after(jiffies, priv->last_jiffies +
 				      msecs_to_jiffies(wdd->timeout * 1000))) {
-		dev_crit(wdd->dev, "Timer expired. System will reboot soon!\n");
+		dev_crit(wdd->parent,
+			 "Timer expired. System will reboot soon!\n");
 		return;
 	}
 
@@ -126,26 +124,6 @@ static int gpio_wdt_set_timeout(struct watchdog_device *wdd, unsigned int t)
 	return gpio_wdt_ping(wdd);
 }
 
-static int gpio_wdt_notify_sys(struct notifier_block *nb, unsigned long code,
-			       void *unused)
-{
-	struct gpio_wdt_priv *priv = container_of(nb, struct gpio_wdt_priv,
-						  notifier);
-
-	mod_timer(&priv->timer, 0);
-
-	switch (code) {
-	case SYS_HALT:
-	case SYS_POWER_OFF:
-		gpio_wdt_disable(priv);
-		break;
-	default:
-		break;
-	}
-
-	return NOTIFY_DONE;
-}
-
 static const struct watchdog_info gpio_wdt_ident = {
 	.options	= WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING |
 			  WDIOF_SETTIMEOUT,
@@ -224,23 +202,16 @@ static int gpio_wdt_probe(struct platform_device *pdev)
 
 	setup_timer(&priv->timer, gpio_wdt_hwping, (unsigned long)&priv->wdd);
 
+	watchdog_stop_on_reboot(&priv->wdd);
+
 	ret = watchdog_register_device(&priv->wdd);
 	if (ret)
 		return ret;
 
-	priv->notifier.notifier_call = gpio_wdt_notify_sys;
-	ret = register_reboot_notifier(&priv->notifier);
-	if (ret)
-		goto error_unregister;
-
 	if (priv->always_running)
 		gpio_wdt_start_impl(priv);
 
 	return 0;
-
-error_unregister:
-	watchdog_unregister_device(&priv->wdd);
-	return ret;
 }
 
 static int gpio_wdt_remove(struct platform_device *pdev)
@@ -248,7 +219,6 @@ static int gpio_wdt_remove(struct platform_device *pdev)
 	struct gpio_wdt_priv *priv = platform_get_drvdata(pdev);
 
 	del_timer_sync(&priv->timer);
-	unregister_reboot_notifier(&priv->notifier);
 	watchdog_unregister_device(&priv->wdd);
 
 	return 0;
drivers/watchdog/hpwdt.c +6 -6
index 286369d..92443c3 100644
@@ -1,11 +1,11 @@
 /*
- *	HP WatchDog Driver
+ *	HPE WatchDog Driver
  *	based on
  *
  *	SoftDog	0.05:	A Software Watchdog Device
  *
- *	(c) Copyright 2007 Hewlett-Packard Development Company, L.P.
- *	Thomas Mingarelli <[email protected]>
+ *	(c) Copyright 2015 Hewlett Packard Enterprise Development LP
+ *	Thomas Mingarelli <[email protected]>
  *
  *	This program is free software; you can redistribute it and/or
  *	modify it under the terms of the GNU General Public License
@@ -580,7 +580,7 @@ static const struct watchdog_info ident = {
 	.options = WDIOF_SETTIMEOUT |
 		   WDIOF_KEEPALIVEPING |
 		   WDIOF_MAGICCLOSE,
-	.identity = "HP iLO2+ HW Watchdog Timer",
+	.identity = "HPE iLO2+ HW Watchdog Timer",
 };
 
 static long hpwdt_ioctl(struct file *file, unsigned int cmd,
@@ -758,7 +758,7 @@ static int hpwdt_init_nmi_decoding(struct pci_dev *dev)
 		goto error2;
 
 	dev_info(&dev->dev,
-			"HP Watchdog Timer Driver: NMI decoding initialized"
+			"HPE Watchdog Timer Driver: NMI decoding initialized"
 			", allow kernel dump: %s (default = 1/ON)\n",
 			(allow_kdump == 0) ? "OFF" : "ON");
 	return 0;
@@ -863,7 +863,7 @@ static int hpwdt_init_one(struct pci_dev *dev,
 		goto error_misc_register;
 	}
 
-	dev_info(&dev->dev, "HP Watchdog Timer Driver: %s"
+	dev_info(&dev->dev, "HPE Watchdog Timer Driver: %s"
 			", timer margin: %d seconds (nowayout=%d).\n",
 			HPWDT_VERSION, soft_margin, nowayout);
 	return 0;
drivers/watchdog/imgpdc_wdt.c +12 -22
index 15ab072..3679f2e 100644
@@ -45,7 +45,6 @@
 #include <linux/log2.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
-#include <linux/reboot.h>
 #include <linux/slab.h>
 #include <linux/watchdog.h>
 
@@ -87,7 +86,6 @@ struct pdc_wdt_dev {
 	struct clk *wdt_clk;
 	struct clk *sys_clk;
 	void __iomem *base;
-	struct notifier_block restart_handler;
 };
 
 static int pdc_wdt_keepalive(struct watchdog_device *wdt_dev)
@@ -152,6 +150,16 @@ static int pdc_wdt_start(struct watchdog_device *wdt_dev)
 	return 0;
 }
 
+static int pdc_wdt_restart(struct watchdog_device *wdt_dev)
+{
+	struct pdc_wdt_dev *wdt = watchdog_get_drvdata(wdt_dev);
+
+	/* Assert SOFT_RESET */
+	writel(0x1, wdt->base + PDC_WDT_SOFT_RESET);
+
+	return 0;
+}
+
 static struct watchdog_info pdc_wdt_info = {
 	.identity	= "IMG PDC Watchdog",
 	.options	= WDIOF_SETTIMEOUT |
@@ -165,20 +173,9 @@ static const struct watchdog_ops pdc_wdt_ops = {
 	.stop		= pdc_wdt_stop,
 	.ping		= pdc_wdt_keepalive,
 	.set_timeout	= pdc_wdt_set_timeout,
+	.restart        = pdc_wdt_restart,
 };
 
-static int pdc_wdt_restart(struct notifier_block *this, unsigned long mode,
-			   void *cmd)
-{
-	struct pdc_wdt_dev *wdt = container_of(this, struct pdc_wdt_dev,
-					       restart_handler);
-
-	/* Assert SOFT_RESET */
-	writel(0x1, wdt->base + PDC_WDT_SOFT_RESET);
-
-	return NOTIFY_OK;
-}
-
 static int pdc_wdt_probe(struct platform_device *pdev)
 {
 	u64 div;
@@ -282,6 +279,7 @@ static int pdc_wdt_probe(struct platform_device *pdev)
 	}
 
 	watchdog_set_nowayout(&pdc_wdt->wdt_dev, nowayout);
+	watchdog_set_restart_priority(&pdc_wdt->wdt_dev, 128);
 
 	platform_set_drvdata(pdev, pdc_wdt);
 
@@ -289,13 +287,6 @@ static int pdc_wdt_probe(struct platform_device *pdev)
 	if (ret)
 		goto disable_wdt_clk;
 
-	pdc_wdt->restart_handler.notifier_call = pdc_wdt_restart;
-	pdc_wdt->restart_handler.priority = 128;
-	ret = register_restart_handler(&pdc_wdt->restart_handler);
-	if (ret)
-		dev_warn(&pdev->dev, "failed to register restart handler: %d\n",
-			 ret);
-
 	return 0;
 
 disable_wdt_clk:
@@ -316,7 +307,6 @@ static int pdc_wdt_remove(struct platform_device *pdev)
 {
 	struct pdc_wdt_dev *pdc_wdt = platform_get_drvdata(pdev);
 
-	unregister_restart_handler(&pdc_wdt->restart_handler);
 	pdc_wdt_stop(&pdc_wdt->wdt_dev);
 	watchdog_unregister_device(&pdc_wdt->wdt_dev);
 	clk_disable_unprepare(pdc_wdt->wdt_clk);
drivers/watchdog/imx2_wdt.c +6 -17
index 29ef719..e47966a 100644
@@ -29,10 +29,8 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
-#include <linux/notifier.h>
 #include <linux/of_address.h>
 #include <linux/platform_device.h>
-#include <linux/reboot.h>
 #include <linux/regmap.h>
 #include <linux/timer.h>
 #include <linux/watchdog.h>
@@ -64,7 +62,6 @@ struct imx2_wdt_device {
 	struct regmap *regmap;
 	struct timer_list timer;	/* Pings the watchdog when closed */
 	struct watchdog_device wdog;
-	struct notifier_block restart_handler;
 };
 
 static bool nowayout = WATCHDOG_NOWAYOUT;
@@ -83,13 +80,11 @@ static const struct watchdog_info imx2_wdt_info = {
 	.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
 };
 
-static int imx2_restart_handler(struct notifier_block *this, unsigned long mode,
-				void *cmd)
+static int imx2_wdt_restart(struct watchdog_device *wdog)
 {
+	struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog);
 	unsigned int wcr_enable = IMX2_WDT_WCR_WDE;
-	struct imx2_wdt_device *wdev = container_of(this,
-						    struct imx2_wdt_device,
-						    restart_handler);
+
 	/* Assert SRS signal */
 	regmap_write(wdev->regmap, IMX2_WDT_WCR, wcr_enable);
 	/*
@@ -105,7 +100,7 @@ static int imx2_restart_handler(struct notifier_block *this, unsigned long mode,
 	/* wait for reset to assert... */
 	mdelay(500);
 
-	return NOTIFY_DONE;
+	return 0;
 }
 
 static inline void imx2_wdt_setup(struct watchdog_device *wdog)
@@ -213,6 +208,7 @@ static const struct watchdog_ops imx2_wdt_ops = {
 	.stop = imx2_wdt_stop,
 	.ping = imx2_wdt_ping,
 	.set_timeout = imx2_wdt_set_timeout,
+	.restart = imx2_wdt_restart,
 };
 
 static const struct regmap_config imx2_wdt_regmap_config = {
@@ -275,6 +271,7 @@ static int __init imx2_wdt_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, wdog);
 	watchdog_set_drvdata(wdog, wdev);
 	watchdog_set_nowayout(wdog, nowayout);
+	watchdog_set_restart_priority(wdog, 128);
 	watchdog_init_timeout(wdog, timeout, &pdev->dev);
 
 	setup_timer(&wdev->timer, imx2_wdt_timer_ping, (unsigned long)wdog);
@@ -294,12 +291,6 @@ static int __init imx2_wdt_probe(struct platform_device *pdev)
 		goto disable_clk;
 	}
 
-	wdev->restart_handler.notifier_call = imx2_restart_handler;
-	wdev->restart_handler.priority = 128;
-	ret = register_restart_handler(&wdev->restart_handler);
-	if (ret)
-		dev_err(&pdev->dev, "cannot register restart handler\n");
-
 	dev_info(&pdev->dev, "timeout %d sec (nowayout=%d)\n",
 		 wdog->timeout, nowayout);
 
@@ -315,8 +306,6 @@ static int __exit imx2_wdt_remove(struct platform_device *pdev)
 	struct watchdog_device *wdog = platform_get_drvdata(pdev);
 	struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog);
 
-	unregister_restart_handler(&wdev->restart_handler);
-
 	watchdog_unregister_device(wdog);
 
 	if (imx2_wdt_is_running(wdev)) {
drivers/watchdog/lpc18xx_wdt.c +21 -31

97 lines not on this page · raw message

drivers/watchdog/mena21_wdt.c +2 -2
index 098fa9c..af6a7c4 100644
@@ -100,12 +100,12 @@ static int a21_wdt_set_timeout(struct watchdog_device *wdt,
 	struct a21_wdt_drv *drv = watchdog_get_drvdata(wdt);
 
 	if (timeout != 1 && timeout != 30) {
-		dev_err(wdt->dev, "Only 1 and 30 allowed as timeout\n");
+		dev_err(wdt->parent, "Only 1 and 30 allowed as timeout\n");
 		return -EINVAL;
 	}
 
 	if (timeout == 30 && wdt->timeout == 1) {
-		dev_err(wdt->dev,
+		dev_err(wdt->parent,
 			"Transition from fast to slow mode not allowed\n");
 		return -EINVAL;
 	}
drivers/watchdog/meson_wdt.c +53 -35

188 lines not on this page · raw message

drivers/watchdog/moxart_wdt.c +6 -17
index 60b0605..885c81b 100644
@@ -15,9 +15,7 @@
 #include <linux/module.h>
 #include <linux/err.h>
 #include <linux/kernel.h>
-#include <linux/notifier.h>
 #include <linux/platform_device.h>
-#include <linux/reboot.h>
 #include <linux/watchdog.h>
 #include <linux/moduleparam.h>
 
@@ -29,22 +27,19 @@ struct moxart_wdt_dev {
 	struct watchdog_device dev;
 	void __iomem *base;
 	unsigned int clock_frequency;
-	struct notifier_block restart_handler;
 };
 
 static int heartbeat;
 
-static int moxart_restart_handle(struct notifier_block *this,
-				 unsigned long mode, void *cmd)
+static int moxart_wdt_restart(struct watchdog_device *wdt_dev)
 {
-	struct moxart_wdt_dev *moxart_wdt = container_of(this,
-							 struct moxart_wdt_dev,
-							 restart_handler);
+	struct moxart_wdt_dev *moxart_wdt = watchdog_get_drvdata(wdt_dev);
+
 	writel(1, moxart_wdt->base + REG_COUNT);
 	writel(0x5ab9, moxart_wdt->base + REG_MODE);
 	writel(0x03, moxart_wdt->base + REG_ENABLE);
 
-	return NOTIFY_DONE;
+	return 0;
 }
 
 static int moxart_wdt_stop(struct watchdog_device *wdt_dev)
@@ -87,6 +82,7 @@ static const struct watchdog_ops moxart_wdt_ops = {
 	.start          = moxart_wdt_start,
 	.stop           = moxart_wdt_stop,
 	.set_timeout    = moxart_wdt_set_timeout,
+	.restart        = moxart_wdt_restart,
 };
 
 static int moxart_wdt_probe(struct platform_device *pdev)
@@ -134,6 +130,7 @@ static int moxart_wdt_probe(struct platform_device *pdev)
 
 	watchdog_init_timeout(&moxart_wdt->dev, heartbeat, dev);
 	watchdog_set_nowayout(&moxart_wdt->dev, nowayout);
+	watchdog_set_restart_priority(&moxart_wdt->dev, 128);
 
 	watchdog_set_drvdata(&moxart_wdt->dev, moxart_wdt);
 
@@ -141,13 +138,6 @@ static int moxart_wdt_probe(struct platform_device *pdev)
 	if (err)
 		return err;
 
-	moxart_wdt->restart_handler.notifier_call = moxart_restart_handle;
-	moxart_wdt->restart_handler.priority = 128;
-	err = register_restart_handler(&moxart_wdt->restart_handler);
-	if (err)
-		dev_err(dev, "cannot register restart notifier (err=%d)\n",
-			err);
-
 	dev_dbg(dev, "Watchdog enabled (heartbeat=%d sec, nowayout=%d)\n",
 		moxart_wdt->dev.timeout, nowayout);
 
@@ -158,7 +148,6 @@ static int moxart_wdt_remove(struct platform_device *pdev)
 {
 	struct moxart_wdt_dev *moxart_wdt = platform_get_drvdata(pdev);
 
-	unregister_restart_handler(&moxart_wdt->restart_handler);
 	moxart_wdt_stop(&moxart_wdt->dev);
 
 	return 0;
drivers/watchdog/mt7621_wdt.c new file +186 -0

186 lines not on this page · raw message

drivers/watchdog/mtk_wdt.c +5 -17
index b751f43..b78776c 100644
@@ -28,8 +28,6 @@
 #include <linux/platform_device.h>
 #include <linux/types.h>
 #include <linux/watchdog.h>
-#include <linux/notifier.h>
-#include <linux/reboot.h>
 #include <linux/delay.h>
 
 #define WDT_MAX_TIMEOUT		31
@@ -64,16 +62,13 @@ static unsigned int timeout = WDT_MAX_TIMEOUT;
 struct mtk_wdt_dev {
 	struct watchdog_device wdt_dev;
 	void __iomem *wdt_base;
-	struct notifier_block restart_handler;
 };
 
-static int mtk_reset_handler(struct notifier_block *this, unsigned long mode,
-				void *cmd)
+static int mtk_wdt_restart(struct watchdog_device *wdt_dev)
 {
-	struct mtk_wdt_dev *mtk_wdt;
+	struct mtk_wdt_dev *mtk_wdt = watchdog_get_drvdata(wdt_dev);
 	void __iomem *wdt_base;
 
-	mtk_wdt = container_of(this, struct mtk_wdt_dev, restart_handler);
 	wdt_base = mtk_wdt->wdt_base;
 
 	while (1) {
@@ -81,7 +76,7 @@ static int mtk_reset_handler(struct notifier_block *this, unsigned long mode,
 		mdelay(5);
 	}
 
-	return NOTIFY_DONE;
+	return 0;
 }
 
 static int mtk_wdt_ping(struct watchdog_device *wdt_dev)
@@ -161,6 +156,7 @@ static const struct watchdog_ops mtk_wdt_ops = {
 	.stop		= mtk_wdt_stop,
 	.ping		= mtk_wdt_ping,
 	.set_timeout	= mtk_wdt_set_timeout,
+	.restart	= mtk_wdt_restart,
 };
 
 static int mtk_wdt_probe(struct platform_device *pdev)
@@ -189,6 +185,7 @@ static int mtk_wdt_probe(struct platform_device *pdev)
 
 	watchdog_init_timeout(&mtk_wdt->wdt_dev, timeout, &pdev->dev);
 	watchdog_set_nowayout(&mtk_wdt->wdt_dev, nowayout);
+	watchdog_set_restart_priority(&mtk_wdt->wdt_dev, 128);
 
 	watchdog_set_drvdata(&mtk_wdt->wdt_dev, mtk_wdt);
 
@@ -198,13 +195,6 @@ static int mtk_wdt_probe(struct platform_device *pdev)
 	if (unlikely(err))
 		return err;
 
-	mtk_wdt->restart_handler.notifier_call = mtk_reset_handler;
-	mtk_wdt->restart_handler.priority = 128;
-	err = register_restart_handler(&mtk_wdt->restart_handler);
-	if (err)
-		dev_warn(&pdev->dev,
-			"cannot register restart handler (err=%d)\n", err);
-
 	dev_info(&pdev->dev, "Watchdog enabled (timeout=%d sec, nowayout=%d)\n",
 			mtk_wdt->wdt_dev.timeout, nowayout);
 
@@ -223,8 +213,6 @@ static int mtk_wdt_remove(struct platform_device *pdev)
 {
 	struct mtk_wdt_dev *mtk_wdt = platform_get_drvdata(pdev);
 
-	unregister_restart_handler(&mtk_wdt->restart_handler);
-
 	watchdog_unregister_device(&mtk_wdt->wdt_dev);
 
 	return 0;
drivers/watchdog/omap_wdt.c +4 -3
index 6f17c93..1b02bfa 100644
@@ -271,7 +271,8 @@ static int omap_wdt_probe(struct platform_device *pdev)
 			wdev->wdog.bootstatus = WDIOF_CARDRESET;
 	}
 
-	omap_wdt_disable(wdev);
+	if (!early_enable)
+		omap_wdt_disable(wdev);
 
 	ret = watchdog_register_device(&wdev->wdog);
 	if (ret) {
@@ -283,11 +284,11 @@ static int omap_wdt_probe(struct platform_device *pdev)
 		readl_relaxed(wdev->base + OMAP_WATCHDOG_REV) & 0xFF,
 		wdev->wdog.timeout);
 
-	pm_runtime_put_sync(wdev->dev);
-
 	if (early_enable)
 		omap_wdt_start(&wdev->wdog);
 
+	pm_runtime_put(wdev->dev);
+
 	return 0;
 }
 
drivers/watchdog/qcom-wdt.c +19 -31

95 lines not on this page · raw message

drivers/watchdog/s3c2410_wdt.c +25 -35

108 lines not on this page · raw message

drivers/watchdog/softdog.c +8 -30
index 0dc5e32..99a06f9 100644
@@ -43,7 +43,6 @@
 #include <linux/types.h>
 #include <linux/timer.h>
 #include <linux/watchdog.h>
-#include <linux/notifier.h>
 #include <linux/reboot.h>
 #include <linux/init.h>
 #include <linux/jiffies.h>
@@ -87,6 +86,7 @@ static struct timer_list watchdog_ticktock =
 
 static void watchdog_fire(unsigned long data)
 {
+	module_put(THIS_MODULE);
 	if (soft_noboot)
 		pr_crit("Triggered - Reboot ignored\n");
 	else if (soft_panic) {
@@ -105,13 +105,16 @@ static void watchdog_fire(unsigned long data)
 
 static int softdog_ping(struct watchdog_device *w)
 {
-	mod_timer(&watchdog_ticktock, jiffies+(w->timeout*HZ));
+	if (!mod_timer(&watchdog_ticktock, jiffies+(w->timeout*HZ)))
+		__module_get(THIS_MODULE);
 	return 0;
 }
 
 static int softdog_stop(struct watchdog_device *w)
 {
-	del_timer(&watchdog_ticktock);
+	if (del_timer(&watchdog_ticktock))
+		module_put(THIS_MODULE);
+
 	return 0;
 }
 
@@ -122,26 +125,9 @@ static int softdog_set_timeout(struct watchdog_device *w, unsigned int t)
 }
 
 /*
- *	Notifier for system down
- */
-
-static int softdog_notify_sys(struct notifier_block *this, unsigned long code,
-	void *unused)
-{
-	if (code == SYS_DOWN || code == SYS_HALT)
-		/* Turn the WDT off */
-		softdog_stop(NULL);
-	return NOTIFY_DONE;
-}
-
-/*
  *	Kernel Interfaces
  */
 
-static struct notifier_block softdog_notifier = {
-	.notifier_call	= softdog_notify_sys,
-};
-
 static struct watchdog_info softdog_info = {
 	.identity = "Software Watchdog",
 	.options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE,
@@ -175,18 +161,11 @@ static int __init watchdog_init(void)
 	softdog_dev.timeout = soft_margin;
 
 	watchdog_set_nowayout(&softdog_dev, nowayout);
-
-	ret = register_reboot_notifier(&softdog_notifier);
-	if (ret) {
-		pr_err("cannot register reboot notifier (err=%d)\n", ret);
-		return ret;
-	}
+	watchdog_stop_on_reboot(&softdog_dev);
 
 	ret = watchdog_register_device(&softdog_dev);
-	if (ret) {
-		unregister_reboot_notifier(&softdog_notifier);
+	if (ret)
 		return ret;
-	}
 
 	pr_info("Software Watchdog Timer: 0.08 initialized. soft_noboot=%d soft_margin=%d sec soft_panic=%d (nowayout=%d)\n",
 		soft_noboot, soft_margin, soft_panic, nowayout);
@@ -197,7 +176,6 @@ static int __init watchdog_init(void)
 static void __exit watchdog_exit(void)
 {
 	watchdog_unregister_device(&softdog_dev);
-	unregister_reboot_notifier(&softdog_notifier);
 }
 
 module_init(watchdog_init);
drivers/watchdog/sp5100_tco.c +20 -12
index eb8044e..6467b91 100644
@@ -306,6 +306,10 @@ static struct miscdevice sp5100_tco_miscdev = {
 static const struct pci_device_id sp5100_tco_pci_tbl[] = {
 	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS, PCI_ANY_ID,
 	  PCI_ANY_ID, },
+	{ PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_HUDSON2_SMBUS, PCI_ANY_ID,
+	  PCI_ANY_ID, },
+	{ PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_KERNCZ_SMBUS, PCI_ANY_ID,
+	  PCI_ANY_ID, },
 	{ 0, },			/* End of list */
 };
 MODULE_DEVICE_TABLE(pci, sp5100_tco_pci_tbl);
@@ -331,21 +335,24 @@ static unsigned char sp5100_tco_setupdevice(void)
 	if (!sp5100_tco_pci)
 		return 0;
 
-	pr_info("PCI Revision ID: 0x%x\n", sp5100_tco_pci->revision);
+	pr_info("PCI Vendor ID: 0x%x, Device ID: 0x%x, Revision ID: 0x%x\n",
+		sp5100_tco_pci->vendor, sp5100_tco_pci->device,
+		sp5100_tco_pci->revision);
 
 	/*
 	 * Determine type of southbridge chipset.
 	 */
-	if (sp5100_tco_pci->revision >= 0x40) {
-		dev_name = SB800_DEVNAME;
-		index_reg = SB800_IO_PM_INDEX_REG;
-		data_reg = SB800_IO_PM_DATA_REG;
-		base_addr = SB800_PM_WATCHDOG_BASE;
-	} else {
+	if (sp5100_tco_pci->device == PCI_DEVICE_ID_ATI_SBX00_SMBUS &&
+	    sp5100_tco_pci->revision < 0x40) {
 		dev_name = SP5100_DEVNAME;
 		index_reg = SP5100_IO_PM_INDEX_REG;
 		data_reg = SP5100_IO_PM_DATA_REG;
 		base_addr = SP5100_PM_WATCHDOG_BASE;
+	} else {
+		dev_name = SB800_DEVNAME;
+		index_reg = SB800_IO_PM_INDEX_REG;
+		data_reg = SB800_IO_PM_DATA_REG;
+		base_addr = SB800_PM_WATCHDOG_BASE;
 	}
 
 	/* Request the IO ports used by this driver */
@@ -381,7 +388,12 @@ static unsigned char sp5100_tco_setupdevice(void)
 	 * Secondly, Find the watchdog timer MMIO address
 	 * from SBResource_MMIO register.
 	 */
-	if (sp5100_tco_pci->revision >= 0x40) {
+	if (sp5100_tco_pci->device == PCI_DEVICE_ID_ATI_SBX00_SMBUS &&
+	    sp5100_tco_pci->revision < 0x40) {
+		/* Read SBResource_MMIO from PCI config(PCI_Reg: 9Ch) */
+		pci_read_config_dword(sp5100_tco_pci,
+				      SP5100_SB_RESOURCE_MMIO_BASE, &val);
+	} else {
 		/* Read SBResource_MMIO from AcpiMmioEn(PM_Reg: 24h) */
 		outb(SB800_PM_ACPI_MMIO_EN+3, SB800_IO_PM_INDEX_REG);
 		val = inb(SB800_IO_PM_DATA_REG);
@@ -391,10 +403,6 @@ static unsigned char sp5100_tco_setupdevice(void)
 		val = val << 8 | inb(SB800_IO_PM_DATA_REG);
 		outb(SB800_PM_ACPI_MMIO_EN+0, SB800_IO_PM_INDEX_REG);
 		val = val << 8 | inb(SB800_IO_PM_DATA_REG);
-	} else {
-		/* Read SBResource_MMIO from PCI config(PCI_Reg: 9Ch) */
-		pci_read_config_dword(sp5100_tco_pci,
-				      SP5100_SB_RESOURCE_MMIO_BASE, &val);
 	}
 
 	/* The SBResource_MMIO is enabled and mapped memory space? */
drivers/watchdog/stmp3xxx_rtc_wdt.c +25 -0
index 3ee6128..d8b11eb 100644
@@ -14,6 +14,8 @@
 #include <linux/watchdog.h>
 #include <linux/platform_device.h>
 #include <linux/stmp3xxx_rtc_wdt.h>
+#include <linux/notifier.h>
+#include <linux/reboot.h>
 
 #define WDOG_TICK_RATE 1000 /* 1 kHz clock */
 #define STMP3XXX_DEFAULT_TIMEOUT 19
@@ -69,6 +71,25 @@ static struct watchdog_device stmp3xxx_wdd = {
 	.status = WATCHDOG_NOWAYOUT_INIT_STATUS,
 };
 
+static int wdt_notify_sys(struct notifier_block *nb, unsigned long code,
+			  void *unused)
[… more lines in the raw message]

Lines of this file are not shown. View the raw message.

drivers/watchdog/sunxi_wdt.c +5 -18
index 47bd8a1..e027deb 100644

Lines of this file are not shown. View the raw message.

drivers/watchdog/tangox_wdt.c new file +225 -0

225 lines not on this page · raw message

drivers/watchdog/ts4800_wdt.c new file +215 -0

215 lines not on this page · raw message

drivers/watchdog/w83627hf_wdt.c +2 -30
index 5824e25..cab14bc 100644

Lines of this file are not shown. View the raw message.

drivers/watchdog/watchdog_core.c +84 -31

115 lines not on this page · raw message

drivers/watchdog/watchdog_core.h +1 -1
index 6c95141..86ff962 100644

Lines of this file are not shown. View the raw message.

drivers/watchdog/watchdog_dev.c +387 -185

572 lines not on this page · raw message

drivers/watchdog/ziirave_wdt.c new file +367 -0

367 lines not on this page · raw message

include/linux/bcm47xx_wdt.h +0 -3
index 5582c21..8d9d07e 100644

Lines of this file are not shown. View the raw message.

include/linux/watchdog.h +23 -15
index 027b1f4..b585fa2 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.