diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-28 16:03:26 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-28 16:03:26 -0400 |
commit | 750f77064a290beb162352077b52c61b04bcae0e (patch) | |
tree | 736a8dd043dc4cda298762a80e7c1fbf1bb87742 | |
parent | 89e5d6f0d979f6e7dc2bbb1ebd9e239217e2e952 (diff) | |
parent | b92c803ec61de59e6e4ab9b2748d8e633cec3f08 (diff) |
Merge git://www.linux-watchdog.org/linux-watchdog
Pull watchdog updates from Wim Van Sebroeck:
- Removal of the Documentation/watchdog/00-INDEX file
- Fix boot status reporting for imx2_wdt
- clean-up sp805_wdt, pnx4008_wdt and mpcore_wdt
- convert printk in watchdog drivers to pr_ functions
- change nowayout module parameter to bool for every watchdog device
- conversion of jz4740_wdt, pnx4008_wdt, max63xx_wdt, softdog,
ep93xx_wdt, coh901327 and txx9wdt to new watchdog API
- Add support for the WDIOC_GETTIMELEFT ioctl call to the new watchdog
API
- Change the new watchdog API so that the driver updates the timeout
value
- two fixes for the xen_wdt driver
Fix up conflicts in ep93xx driver due to the same patches being merged
through separate branches.
* git://www.linux-watchdog.org/linux-watchdog: (33 commits)
watchdog: txx9wdt: fix timeout
watchdog: Convert txx9wdt driver to watchdog framework
watchdog: coh901327_wdt.c: fix timeout
watchdog: coh901327: convert to use watchdog core
watchdog: Add support for WDIOC_GETTIMELEFT IOCTL in watchdog core
watchdog: ep93xx_wdt: timeout is an unsigned int value.
watchdog: ep93xx_wdt: Fix timeout after conversion to watchdog core
watchdog: Convert ep93xx driver to watchdog core
watchdog: sp805: Use devm routines
watchdog: sp805: replace readl/writel with lighter _relaxed variants
watchdog: sp805: Fix documentation style comment
watchdog: mpcore_wdt: Allow platform_get_irq() to fail
watchdog: mpcore_wdt: Use devm routines
watchdog: mpcore_wdt: Rename dev to pdev for pointing to struct platform_device
watchdog: xen: don't clear is_active when xen_wdt_stop() failed
watchdog: xen: don't unconditionally enable the watchdog during resume
watchdog: fix compiler error for missing parenthesis
watchdog: ep93xx_wdt.c: fix platform probe
watchdog: ep93xx: Convert the watchdog driver into a platform device.
watchdog: fix set_timeout operations
...
109 files changed, 1786 insertions, 2840 deletions
diff --git a/Documentation/watchdog/00-INDEX b/Documentation/watchdog/00-INDEX deleted file mode 100644 index fc9082a1477a..000000000000 --- a/Documentation/watchdog/00-INDEX +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | 00-INDEX | ||
2 | - this file. | ||
3 | convert_drivers_to_kernel_api.txt | ||
4 | - how-to for converting old watchdog drivers to the new kernel API. | ||
5 | hpwdt.txt | ||
6 | - information on the HP iLO2 NMI watchdog | ||
7 | pcwd-watchdog.txt | ||
8 | - documentation for Berkshire Products PC Watchdog ISA cards. | ||
9 | src/ | ||
10 | - directory holding watchdog related example programs. | ||
11 | watchdog-api.txt | ||
12 | - description of the Linux Watchdog driver API. | ||
13 | watchdog-kernel-api.txt | ||
14 | - description of the Linux WatchDog Timer Driver Core kernel API. | ||
15 | watchdog-parameters.txt | ||
16 | - information on driver parameters (for drivers other than | ||
17 | the ones that have driver-specific files here) | ||
18 | wdt.txt | ||
19 | - description of the Watchdog Timer Interfaces for Linux. | ||
diff --git a/Documentation/watchdog/convert_drivers_to_kernel_api.txt b/Documentation/watchdog/convert_drivers_to_kernel_api.txt index be8119bb15d2..271b8850dde7 100644 --- a/Documentation/watchdog/convert_drivers_to_kernel_api.txt +++ b/Documentation/watchdog/convert_drivers_to_kernel_api.txt | |||
@@ -59,6 +59,10 @@ Here is a overview of the functions and probably needed actions: | |||
59 | WDIOC_GETTIMEOUT: | 59 | WDIOC_GETTIMEOUT: |
60 | No preparations needed | 60 | No preparations needed |
61 | 61 | ||
62 | WDIOC_GETTIMELEFT: | ||
63 | It needs get_timeleft() callback to be defined. Otherwise it | ||
64 | will return EOPNOTSUPP | ||
65 | |||
62 | Other IOCTLs can be served using the ioctl-callback. Note that this is mainly | 66 | Other IOCTLs can be served using the ioctl-callback. Note that this is mainly |
63 | intended for porting old drivers; new drivers should not invent private IOCTLs. | 67 | intended for porting old drivers; new drivers should not invent private IOCTLs. |
64 | Private IOCTLs are processed first. When the callback returns with | 68 | Private IOCTLs are processed first. When the callback returns with |
diff --git a/Documentation/watchdog/watchdog-kernel-api.txt b/Documentation/watchdog/watchdog-kernel-api.txt index 9e162465b0cf..227f6cd0e5fa 100644 --- a/Documentation/watchdog/watchdog-kernel-api.txt +++ b/Documentation/watchdog/watchdog-kernel-api.txt | |||
@@ -1,6 +1,6 @@ | |||
1 | The Linux WatchDog Timer Driver Core kernel API. | 1 | The Linux WatchDog Timer Driver Core kernel API. |
2 | =============================================== | 2 | =============================================== |
3 | Last reviewed: 29-Nov-2011 | 3 | Last reviewed: 16-Mar-2012 |
4 | 4 | ||
5 | Wim Van Sebroeck <wim@iguana.be> | 5 | Wim Van Sebroeck <wim@iguana.be> |
6 | 6 | ||
@@ -77,6 +77,7 @@ struct watchdog_ops { | |||
77 | int (*ping)(struct watchdog_device *); | 77 | int (*ping)(struct watchdog_device *); |
78 | unsigned int (*status)(struct watchdog_device *); | 78 | unsigned int (*status)(struct watchdog_device *); |
79 | int (*set_timeout)(struct watchdog_device *, unsigned int); | 79 | int (*set_timeout)(struct watchdog_device *, unsigned int); |
80 | unsigned int (*get_timeleft)(struct watchdog_device *); | ||
80 | long (*ioctl)(struct watchdog_device *, unsigned int, unsigned long); | 81 | long (*ioctl)(struct watchdog_device *, unsigned int, unsigned long); |
81 | }; | 82 | }; |
82 | 83 | ||
@@ -117,11 +118,13 @@ they are supported. These optional routines/operations are: | |||
117 | status of the device is reported with watchdog WDIOF_* status flags/bits. | 118 | status of the device is reported with watchdog WDIOF_* status flags/bits. |
118 | * set_timeout: this routine checks and changes the timeout of the watchdog | 119 | * set_timeout: this routine checks and changes the timeout of the watchdog |
119 | timer device. It returns 0 on success, -EINVAL for "parameter out of range" | 120 | timer device. It returns 0 on success, -EINVAL for "parameter out of range" |
120 | and -EIO for "could not write value to the watchdog". On success the timeout | 121 | and -EIO for "could not write value to the watchdog". On success this |
121 | value of the watchdog_device will be changed to the value that was just used | 122 | routine should set the timeout value of the watchdog_device to the |
122 | to re-program the watchdog timer device. | 123 | achieved timeout value (which may be different from the requested one |
124 | because the watchdog does not necessarily has a 1 second resolution). | ||
123 | (Note: the WDIOF_SETTIMEOUT needs to be set in the options field of the | 125 | (Note: the WDIOF_SETTIMEOUT needs to be set in the options field of the |
124 | watchdog's info structure). | 126 | watchdog's info structure). |
127 | * get_timeleft: this routines returns the time that's left before a reset. | ||
125 | * ioctl: if this routine is present then it will be called first before we do | 128 | * ioctl: if this routine is present then it will be called first before we do |
126 | our own internal ioctl call handling. This routine should return -ENOIOCTLCMD | 129 | our own internal ioctl call handling. This routine should return -ENOIOCTLCMD |
127 | if a command is not supported. The parameters that are passed to the ioctl | 130 | if a command is not supported. The parameters that are passed to the ioctl |
diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c index 34767a6d7f42..020a6aec2d86 100644 --- a/drivers/char/ipmi/ipmi_watchdog.c +++ b/drivers/char/ipmi/ipmi_watchdog.c | |||
@@ -153,7 +153,7 @@ | |||
153 | #endif | 153 | #endif |
154 | 154 | ||
155 | static DEFINE_MUTEX(ipmi_watchdog_mutex); | 155 | static DEFINE_MUTEX(ipmi_watchdog_mutex); |
156 | static int nowayout = WATCHDOG_NOWAYOUT; | 156 | static bool nowayout = WATCHDOG_NOWAYOUT; |
157 | 157 | ||
158 | static ipmi_user_t watchdog_user; | 158 | static ipmi_user_t watchdog_user; |
159 | static int watchdog_ifnum; | 159 | static int watchdog_ifnum; |
@@ -320,7 +320,7 @@ module_param(start_now, int, 0444); | |||
320 | MODULE_PARM_DESC(start_now, "Set to 1 to start the watchdog as" | 320 | MODULE_PARM_DESC(start_now, "Set to 1 to start the watchdog as" |
321 | "soon as the driver is loaded."); | 321 | "soon as the driver is loaded."); |
322 | 322 | ||
323 | module_param(nowayout, int, 0644); | 323 | module_param(nowayout, bool, 0644); |
324 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started " | 324 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started " |
325 | "(default=CONFIG_WATCHDOG_NOWAYOUT)"); | 325 | "(default=CONFIG_WATCHDOG_NOWAYOUT)"); |
326 | 326 | ||
diff --git a/drivers/hwmon/fschmd.c b/drivers/hwmon/fschmd.c index 8305d29459bd..519ce8b9c142 100644 --- a/drivers/hwmon/fschmd.c +++ b/drivers/hwmon/fschmd.c | |||
@@ -53,8 +53,8 @@ | |||
53 | static const unsigned short normal_i2c[] = { 0x73, I2C_CLIENT_END }; | 53 | static const unsigned short normal_i2c[] = { 0x73, I2C_CLIENT_END }; |
54 | 54 | ||
55 | /* Insmod parameters */ | 55 | /* Insmod parameters */ |
56 | static int nowayout = WATCHDOG_NOWAYOUT; | 56 | static bool nowayout = WATCHDOG_NOWAYOUT; |
57 | module_param(nowayout, int, 0); | 57 | module_param(nowayout, bool, 0); |
58 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" | 58 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" |
59 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 59 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
60 | 60 | ||
diff --git a/drivers/hwmon/w83793.c b/drivers/hwmon/w83793.c index 834e49d1827b..d6b0bdd48651 100644 --- a/drivers/hwmon/w83793.c +++ b/drivers/hwmon/w83793.c | |||
@@ -71,8 +71,8 @@ MODULE_PARM_DESC(timeout, | |||
71 | "Watchdog timeout in minutes. 2<= timeout <=255 (default=" | 71 | "Watchdog timeout in minutes. 2<= timeout <=255 (default=" |
72 | __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); | 72 | __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); |
73 | 73 | ||
74 | static int nowayout = WATCHDOG_NOWAYOUT; | 74 | static bool nowayout = WATCHDOG_NOWAYOUT; |
75 | module_param(nowayout, int, 0); | 75 | module_param(nowayout, bool, 0); |
76 | MODULE_PARM_DESC(nowayout, | 76 | MODULE_PARM_DESC(nowayout, |
77 | "Watchdog cannot be stopped once started (default=" | 77 | "Watchdog cannot be stopped once started (default=" |
78 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 78 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
diff --git a/drivers/staging/mei/wd.c b/drivers/staging/mei/wd.c index a6910da78a64..cf4c29d10e7f 100644 --- a/drivers/staging/mei/wd.c +++ b/drivers/staging/mei/wd.c | |||
@@ -323,6 +323,7 @@ static int mei_wd_ops_set_timeout(struct watchdog_device *wd_dev, unsigned int t | |||
323 | mutex_lock(&dev->device_lock); | 323 | mutex_lock(&dev->device_lock); |
324 | 324 | ||
325 | dev->wd_timeout = timeout; | 325 | dev->wd_timeout = timeout; |
326 | wd_dev->timeout = timeout; | ||
326 | mei_wd_set_start_timeout(dev, dev->wd_timeout); | 327 | mei_wd_set_start_timeout(dev, dev->wd_timeout); |
327 | 328 | ||
328 | mutex_unlock(&dev->device_lock); | 329 | mutex_unlock(&dev->device_lock); |
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 0e7366dfc901..37096246c937 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig | |||
@@ -55,6 +55,7 @@ comment "Watchdog Device Drivers" | |||
55 | 55 | ||
56 | config SOFT_WATCHDOG | 56 | config SOFT_WATCHDOG |
57 | tristate "Software watchdog" | 57 | tristate "Software watchdog" |
58 | select WATCHDOG_CORE | ||
58 | help | 59 | help |
59 | A software monitoring watchdog. This will fail to reboot your system | 60 | A software monitoring watchdog. This will fail to reboot your system |
60 | from some situations that the hardware watchdog will recover | 61 | from some situations that the hardware watchdog will recover |
@@ -74,6 +75,7 @@ config WM831X_WATCHDOG | |||
74 | config WM8350_WATCHDOG | 75 | config WM8350_WATCHDOG |
75 | tristate "WM8350 watchdog" | 76 | tristate "WM8350 watchdog" |
76 | depends on MFD_WM8350 | 77 | depends on MFD_WM8350 |
78 | select WATCHDOG_CORE | ||
77 | help | 79 | help |
78 | Support for the watchdog in the WM8350 AudioPlus PMIC. When | 80 | Support for the watchdog in the WM8350 AudioPlus PMIC. When |
79 | the watchdog triggers the system will be reset. | 81 | the watchdog triggers the system will be reset. |
@@ -217,6 +219,7 @@ config MPCORE_WATCHDOG | |||
217 | config EP93XX_WATCHDOG | 219 | config EP93XX_WATCHDOG |
218 | tristate "EP93xx Watchdog" | 220 | tristate "EP93xx Watchdog" |
219 | depends on ARCH_EP93XX | 221 | depends on ARCH_EP93XX |
222 | select WATCHDOG_CORE | ||
220 | help | 223 | help |
221 | Say Y here if to include support for the watchdog timer | 224 | Say Y here if to include support for the watchdog timer |
222 | embedded in the Cirrus Logic EP93xx family of devices. | 225 | embedded in the Cirrus Logic EP93xx family of devices. |
@@ -234,6 +237,7 @@ config OMAP_WATCHDOG | |||
234 | config PNX4008_WATCHDOG | 237 | config PNX4008_WATCHDOG |
235 | tristate "PNX4008 and LPC32XX Watchdog" | 238 | tristate "PNX4008 and LPC32XX Watchdog" |
236 | depends on ARCH_PNX4008 || ARCH_LPC32XX | 239 | depends on ARCH_PNX4008 || ARCH_LPC32XX |
240 | select WATCHDOG_CORE | ||
237 | help | 241 | help |
238 | Say Y here if to include support for the watchdog timer | 242 | Say Y here if to include support for the watchdog timer |
239 | in the PNX4008 or LPC32XX processor. | 243 | in the PNX4008 or LPC32XX processor. |
@@ -283,6 +287,7 @@ config COH901327_WATCHDOG | |||
283 | bool "ST-Ericsson COH 901 327 watchdog" | 287 | bool "ST-Ericsson COH 901 327 watchdog" |
284 | depends on ARCH_U300 | 288 | depends on ARCH_U300 |
285 | default y if MACH_U300 | 289 | default y if MACH_U300 |
290 | select WATCHDOG_CORE | ||
286 | help | 291 | help |
287 | Say Y here to include Watchdog timer support for the | 292 | Say Y here to include Watchdog timer support for the |
288 | watchdog embedded into the ST-Ericsson U300 series platforms. | 293 | watchdog embedded into the ST-Ericsson U300 series platforms. |
@@ -328,6 +333,7 @@ config TS72XX_WATCHDOG | |||
328 | config MAX63XX_WATCHDOG | 333 | config MAX63XX_WATCHDOG |
329 | tristate "Max63xx watchdog" | 334 | tristate "Max63xx watchdog" |
330 | depends on ARM && HAS_IOMEM | 335 | depends on ARM && HAS_IOMEM |
336 | select WATCHDOG_CORE | ||
331 | help | 337 | help |
332 | Support for memory mapped max63{69,70,71,72,73,74} watchdog timer. | 338 | Support for memory mapped max63{69,70,71,72,73,74} watchdog timer. |
333 | 339 | ||
@@ -955,6 +961,7 @@ config INDYDOG | |||
955 | config JZ4740_WDT | 961 | config JZ4740_WDT |
956 | tristate "Ingenic jz4740 SoC hardware watchdog" | 962 | tristate "Ingenic jz4740 SoC hardware watchdog" |
957 | depends on MACH_JZ4740 | 963 | depends on MACH_JZ4740 |
964 | select WATCHDOG_CORE | ||
958 | help | 965 | help |
959 | Hardware driver for the built-in watchdog timer on Ingenic jz4740 SoCs. | 966 | Hardware driver for the built-in watchdog timer on Ingenic jz4740 SoCs. |
960 | 967 | ||
@@ -996,6 +1003,7 @@ config AR7_WDT | |||
996 | config TXX9_WDT | 1003 | config TXX9_WDT |
997 | tristate "Toshiba TXx9 Watchdog Timer" | 1004 | tristate "Toshiba TXx9 Watchdog Timer" |
998 | depends on CPU_TX39XX || CPU_TX49XX | 1005 | depends on CPU_TX39XX || CPU_TX49XX |
1006 | select WATCHDOG_CORE | ||
999 | help | 1007 | help |
1000 | Hardware driver for the built-in watchdog timer on TXx9 MIPS SoCs. | 1008 | Hardware driver for the built-in watchdog timer on TXx9 MIPS SoCs. |
1001 | 1009 | ||
diff --git a/drivers/watchdog/acquirewdt.c b/drivers/watchdog/acquirewdt.c index b6a2b58cbe64..4397881c83f4 100644 --- a/drivers/watchdog/acquirewdt.c +++ b/drivers/watchdog/acquirewdt.c | |||
@@ -52,6 +52,8 @@ | |||
52 | * Includes, defines, variables, module parameters, ... | 52 | * Includes, defines, variables, module parameters, ... |
53 | */ | 53 | */ |
54 | 54 | ||
55 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
56 | |||
55 | /* Includes */ | 57 | /* Includes */ |
56 | #include <linux/module.h> /* For module specific items */ | 58 | #include <linux/module.h> /* For module specific items */ |
57 | #include <linux/moduleparam.h> /* For new moduleparam's */ | 59 | #include <linux/moduleparam.h> /* For new moduleparam's */ |
@@ -70,7 +72,6 @@ | |||
70 | 72 | ||
71 | /* Module information */ | 73 | /* Module information */ |
72 | #define DRV_NAME "acquirewdt" | 74 | #define DRV_NAME "acquirewdt" |
73 | #define PFX DRV_NAME ": " | ||
74 | #define WATCHDOG_NAME "Acquire WDT" | 75 | #define WATCHDOG_NAME "Acquire WDT" |
75 | /* There is no way to see what the correct time-out period is */ | 76 | /* There is no way to see what the correct time-out period is */ |
76 | #define WATCHDOG_HEARTBEAT 0 | 77 | #define WATCHDOG_HEARTBEAT 0 |
@@ -92,8 +93,8 @@ static int wdt_start = 0x443; | |||
92 | module_param(wdt_start, int, 0); | 93 | module_param(wdt_start, int, 0); |
93 | MODULE_PARM_DESC(wdt_start, "Acquire WDT 'start' io port (default 0x443)"); | 94 | MODULE_PARM_DESC(wdt_start, "Acquire WDT 'start' io port (default 0x443)"); |
94 | 95 | ||
95 | static int nowayout = WATCHDOG_NOWAYOUT; | 96 | static bool nowayout = WATCHDOG_NOWAYOUT; |
96 | module_param(nowayout, int, 0); | 97 | module_param(nowayout, bool, 0); |
97 | MODULE_PARM_DESC(nowayout, | 98 | MODULE_PARM_DESC(nowayout, |
98 | "Watchdog cannot be stopped once started (default=" | 99 | "Watchdog cannot be stopped once started (default=" |
99 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 100 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
@@ -208,8 +209,7 @@ static int acq_close(struct inode *inode, struct file *file) | |||
208 | if (expect_close == 42) { | 209 | if (expect_close == 42) { |
209 | acq_stop(); | 210 | acq_stop(); |
210 | } else { | 211 | } else { |
211 | printk(KERN_CRIT PFX | 212 | pr_crit("Unexpected close, not stopping watchdog!\n"); |
212 | "Unexpected close, not stopping watchdog!\n"); | ||
213 | acq_keepalive(); | 213 | acq_keepalive(); |
214 | } | 214 | } |
215 | clear_bit(0, &acq_is_open); | 215 | clear_bit(0, &acq_is_open); |
@@ -246,27 +246,24 @@ static int __devinit acq_probe(struct platform_device *dev) | |||
246 | 246 | ||
247 | if (wdt_stop != wdt_start) { | 247 | if (wdt_stop != wdt_start) { |
248 | if (!request_region(wdt_stop, 1, WATCHDOG_NAME)) { | 248 | if (!request_region(wdt_stop, 1, WATCHDOG_NAME)) { |
249 | printk(KERN_ERR PFX | 249 | pr_err("I/O address 0x%04x already in use\n", wdt_stop); |
250 | "I/O address 0x%04x already in use\n", wdt_stop); | ||
251 | ret = -EIO; | 250 | ret = -EIO; |
252 | goto out; | 251 | goto out; |
253 | } | 252 | } |
254 | } | 253 | } |
255 | 254 | ||
256 | if (!request_region(wdt_start, 1, WATCHDOG_NAME)) { | 255 | if (!request_region(wdt_start, 1, WATCHDOG_NAME)) { |
257 | printk(KERN_ERR PFX "I/O address 0x%04x already in use\n", | 256 | pr_err("I/O address 0x%04x already in use\n", wdt_start); |
258 | wdt_start); | ||
259 | ret = -EIO; | 257 | ret = -EIO; |
260 | goto unreg_stop; | 258 | goto unreg_stop; |
261 | } | 259 | } |
262 | ret = misc_register(&acq_miscdev); | 260 | ret = misc_register(&acq_miscdev); |
263 | if (ret != 0) { | 261 | if (ret != 0) { |
264 | printk(KERN_ERR PFX | 262 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
265 | "cannot register miscdev on minor=%d (err=%d)\n", | 263 | WATCHDOG_MINOR, ret); |
266 | WATCHDOG_MINOR, ret); | ||
267 | goto unreg_regions; | 264 | goto unreg_regions; |
268 | } | 265 | } |
269 | printk(KERN_INFO PFX "initialized. (nowayout=%d)\n", nowayout); | 266 | pr_info("initialized. (nowayout=%d)\n", nowayout); |
270 | 267 | ||
271 | return 0; | 268 | return 0; |
272 | unreg_regions: | 269 | unreg_regions: |
@@ -308,8 +305,7 @@ static int __init acq_init(void) | |||
308 | { | 305 | { |
309 | int err; | 306 | int err; |
310 | 307 | ||
311 | printk(KERN_INFO | 308 | pr_info("WDT driver for Acquire single board computer initialising\n"); |
312 | "WDT driver for Acquire single board computer initialising.\n"); | ||
313 | 309 | ||
314 | err = platform_driver_register(&acquirewdt_driver); | 310 | err = platform_driver_register(&acquirewdt_driver); |
315 | if (err) | 311 | if (err) |
@@ -332,7 +328,7 @@ static void __exit acq_exit(void) | |||
332 | { | 328 | { |
333 | platform_device_unregister(acq_platform_device); | 329 | platform_device_unregister(acq_platform_device); |
334 | platform_driver_unregister(&acquirewdt_driver); | 330 | platform_driver_unregister(&acquirewdt_driver); |
335 | printk(KERN_INFO PFX "Watchdog Module Unloaded.\n"); | 331 | pr_info("Watchdog Module Unloaded\n"); |
336 | } | 332 | } |
337 | 333 | ||
338 | module_init(acq_init); | 334 | module_init(acq_init); |
diff --git a/drivers/watchdog/advantechwdt.c b/drivers/watchdog/advantechwdt.c index 4d40965d2c9f..72e81058176a 100644 --- a/drivers/watchdog/advantechwdt.c +++ b/drivers/watchdog/advantechwdt.c | |||
@@ -28,6 +28,8 @@ | |||
28 | * add wdt_start and wdt_stop as parameters. | 28 | * add wdt_start and wdt_stop as parameters. |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
32 | |||
31 | #include <linux/module.h> | 33 | #include <linux/module.h> |
32 | #include <linux/moduleparam.h> | 34 | #include <linux/moduleparam.h> |
33 | #include <linux/types.h> | 35 | #include <linux/types.h> |
@@ -43,7 +45,6 @@ | |||
43 | #include <asm/system.h> | 45 | #include <asm/system.h> |
44 | 46 | ||
45 | #define DRV_NAME "advantechwdt" | 47 | #define DRV_NAME "advantechwdt" |
46 | #define PFX DRV_NAME ": " | ||
47 | #define WATCHDOG_NAME "Advantech WDT" | 48 | #define WATCHDOG_NAME "Advantech WDT" |
48 | #define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */ | 49 | #define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */ |
49 | 50 | ||
@@ -77,8 +78,8 @@ MODULE_PARM_DESC(timeout, | |||
77 | "Watchdog timeout in seconds. 1<= timeout <=63, default=" | 78 | "Watchdog timeout in seconds. 1<= timeout <=63, default=" |
78 | __MODULE_STRING(WATCHDOG_TIMEOUT) "."); | 79 | __MODULE_STRING(WATCHDOG_TIMEOUT) "."); |
79 | 80 | ||
80 | static int nowayout = WATCHDOG_NOWAYOUT; | 81 | static bool nowayout = WATCHDOG_NOWAYOUT; |
81 | module_param(nowayout, int, 0); | 82 | module_param(nowayout, bool, 0); |
82 | MODULE_PARM_DESC(nowayout, | 83 | MODULE_PARM_DESC(nowayout, |
83 | "Watchdog cannot be stopped once started (default=" | 84 | "Watchdog cannot be stopped once started (default=" |
84 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 85 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
@@ -207,8 +208,7 @@ static int advwdt_close(struct inode *inode, struct file *file) | |||
207 | if (adv_expect_close == 42) { | 208 | if (adv_expect_close == 42) { |
208 | advwdt_disable(); | 209 | advwdt_disable(); |
209 | } else { | 210 | } else { |
210 | printk(KERN_CRIT PFX | 211 | pr_crit("Unexpected close, not stopping watchdog!\n"); |
211 | "Unexpected close, not stopping watchdog!\n"); | ||
212 | advwdt_ping(); | 212 | advwdt_ping(); |
213 | } | 213 | } |
214 | clear_bit(0, &advwdt_is_open); | 214 | clear_bit(0, &advwdt_is_open); |
@@ -245,18 +245,15 @@ static int __devinit advwdt_probe(struct platform_device *dev) | |||
245 | 245 | ||
246 | if (wdt_stop != wdt_start) { | 246 | if (wdt_stop != wdt_start) { |
247 | if (!request_region(wdt_stop, 1, WATCHDOG_NAME)) { | 247 | if (!request_region(wdt_stop, 1, WATCHDOG_NAME)) { |
248 | printk(KERN_ERR PFX | 248 | pr_err("I/O address 0x%04x already in use\n", |
249 | "I/O address 0x%04x already in use\n", | 249 | wdt_stop); |
250 | wdt_stop); | ||
251 | ret = -EIO; | 250 | ret = -EIO; |
252 | goto out; | 251 | goto out; |
253 | } | 252 | } |
254 | } | 253 | } |
255 | 254 | ||
256 | if (!request_region(wdt_start, 1, WATCHDOG_NAME)) { | 255 | if (!request_region(wdt_start, 1, WATCHDOG_NAME)) { |
257 | printk(KERN_ERR PFX | 256 | pr_err("I/O address 0x%04x already in use\n", wdt_start); |
258 | "I/O address 0x%04x already in use\n", | ||
259 | wdt_start); | ||
260 | ret = -EIO; | 257 | ret = -EIO; |
261 | goto unreg_stop; | 258 | goto unreg_stop; |
262 | } | 259 | } |
@@ -265,18 +262,16 @@ static int __devinit advwdt_probe(struct platform_device *dev) | |||
265 | * if not reset to the default */ | 262 | * if not reset to the default */ |
266 | if (advwdt_set_heartbeat(timeout)) { | 263 | if (advwdt_set_heartbeat(timeout)) { |
267 | advwdt_set_heartbeat(WATCHDOG_TIMEOUT); | 264 | advwdt_set_heartbeat(WATCHDOG_TIMEOUT); |
268 | printk(KERN_INFO PFX | 265 | pr_info("timeout value must be 1<=x<=63, using %d\n", timeout); |
269 | "timeout value must be 1<=x<=63, using %d\n", timeout); | ||
270 | } | 266 | } |
271 | 267 | ||
272 | ret = misc_register(&advwdt_miscdev); | 268 | ret = misc_register(&advwdt_miscdev); |
273 | if (ret != 0) { | 269 | if (ret != 0) { |
274 | printk(KERN_ERR PFX | 270 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
275 | "cannot register miscdev on minor=%d (err=%d)\n", | 271 | WATCHDOG_MINOR, ret); |
276 | WATCHDOG_MINOR, ret); | ||
277 | goto unreg_regions; | 272 | goto unreg_regions; |
278 | } | 273 | } |
279 | printk(KERN_INFO PFX "initialized. timeout=%d sec (nowayout=%d)\n", | 274 | pr_info("initialized. timeout=%d sec (nowayout=%d)\n", |
280 | timeout, nowayout); | 275 | timeout, nowayout); |
281 | out: | 276 | out: |
282 | return ret; | 277 | return ret; |
@@ -318,8 +313,7 @@ static int __init advwdt_init(void) | |||
318 | { | 313 | { |
319 | int err; | 314 | int err; |
320 | 315 | ||
321 | printk(KERN_INFO | 316 | pr_info("WDT driver for Advantech single board computer initialising\n"); |
322 | "WDT driver for Advantech single board computer initialising.\n"); | ||
323 | 317 | ||
324 | err = platform_driver_register(&advwdt_driver); | 318 | err = platform_driver_register(&advwdt_driver); |
325 | if (err) | 319 | if (err) |
@@ -343,7 +337,7 @@ static void __exit advwdt_exit(void) | |||
343 | { | 337 | { |
344 | platform_device_unregister(advwdt_platform_device); | 338 | platform_device_unregister(advwdt_platform_device); |
345 | platform_driver_unregister(&advwdt_driver); | 339 | platform_driver_unregister(&advwdt_driver); |
346 | printk(KERN_INFO PFX "Watchdog Module Unloaded.\n"); | 340 | pr_info("Watchdog Module Unloaded\n"); |
347 | } | 341 | } |
348 | 342 | ||
349 | module_init(advwdt_init); | 343 | module_init(advwdt_init); |
diff --git a/drivers/watchdog/alim1535_wdt.c b/drivers/watchdog/alim1535_wdt.c index f16dcbd475fb..41b84936a521 100644 --- a/drivers/watchdog/alim1535_wdt.c +++ b/drivers/watchdog/alim1535_wdt.c | |||
@@ -7,6 +7,8 @@ | |||
7 | * 2 of the License, or (at your option) any later version. | 7 | * 2 of the License, or (at your option) any later version. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
11 | |||
10 | #include <linux/module.h> | 12 | #include <linux/module.h> |
11 | #include <linux/moduleparam.h> | 13 | #include <linux/moduleparam.h> |
12 | #include <linux/types.h> | 14 | #include <linux/types.h> |
@@ -22,7 +24,6 @@ | |||
22 | #include <linux/io.h> | 24 | #include <linux/io.h> |
23 | 25 | ||
24 | #define WATCHDOG_NAME "ALi_M1535" | 26 | #define WATCHDOG_NAME "ALi_M1535" |
25 | #define PFX WATCHDOG_NAME ": " | ||
26 | #define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */ | 27 | #define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */ |
27 | 28 | ||
28 | /* internal variables */ | 29 | /* internal variables */ |
@@ -39,8 +40,8 @@ MODULE_PARM_DESC(timeout, | |||
39 | "Watchdog timeout in seconds. (0 < timeout < 18000, default=" | 40 | "Watchdog timeout in seconds. (0 < timeout < 18000, default=" |
40 | __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); | 41 | __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); |
41 | 42 | ||
42 | static int nowayout = WATCHDOG_NOWAYOUT; | 43 | static bool nowayout = WATCHDOG_NOWAYOUT; |
43 | module_param(nowayout, int, 0); | 44 | module_param(nowayout, bool, 0); |
44 | MODULE_PARM_DESC(nowayout, | 45 | MODULE_PARM_DESC(nowayout, |
45 | "Watchdog cannot be stopped once started (default=" | 46 | "Watchdog cannot be stopped once started (default=" |
46 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 47 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
@@ -268,8 +269,7 @@ static int ali_release(struct inode *inode, struct file *file) | |||
268 | if (ali_expect_release == 42) | 269 | if (ali_expect_release == 42) |
269 | ali_stop(); | 270 | ali_stop(); |
270 | else { | 271 | else { |
271 | printk(KERN_CRIT PFX | 272 | pr_crit("Unexpected close, not stopping watchdog!\n"); |
272 | "Unexpected close, not stopping watchdog!\n"); | ||
273 | ali_keepalive(); | 273 | ali_keepalive(); |
274 | } | 274 | } |
275 | clear_bit(0, &ali_is_open); | 275 | clear_bit(0, &ali_is_open); |
@@ -399,9 +399,8 @@ static int __init watchdog_init(void) | |||
399 | if not reset to the default */ | 399 | if not reset to the default */ |
400 | if (timeout < 1 || timeout >= 18000) { | 400 | if (timeout < 1 || timeout >= 18000) { |
401 | timeout = WATCHDOG_TIMEOUT; | 401 | timeout = WATCHDOG_TIMEOUT; |
402 | printk(KERN_INFO PFX | 402 | pr_info("timeout value must be 0 < timeout < 18000, using %d\n", |
403 | "timeout value must be 0 < timeout < 18000, using %d\n", | 403 | timeout); |
404 | timeout); | ||
405 | } | 404 | } |
406 | 405 | ||
407 | /* Calculate the watchdog's timeout */ | 406 | /* Calculate the watchdog's timeout */ |
@@ -409,20 +408,18 @@ static int __init watchdog_init(void) | |||
409 | 408 | ||
410 | ret = register_reboot_notifier(&ali_notifier); | 409 | ret = register_reboot_notifier(&ali_notifier); |
411 | if (ret != 0) { | 410 | if (ret != 0) { |
412 | printk(KERN_ERR PFX | 411 | pr_err("cannot register reboot notifier (err=%d)\n", ret); |
413 | "cannot register reboot notifier (err=%d)\n", ret); | ||
414 | goto out; | 412 | goto out; |
415 | } | 413 | } |
416 | 414 | ||
417 | ret = misc_register(&ali_miscdev); | 415 | ret = misc_register(&ali_miscdev); |
418 | if (ret != 0) { | 416 | if (ret != 0) { |
419 | printk(KERN_ERR PFX | 417 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
420 | "cannot register miscdev on minor=%d (err=%d)\n", | 418 | WATCHDOG_MINOR, ret); |
421 | WATCHDOG_MINOR, ret); | ||
422 | goto unreg_reboot; | 419 | goto unreg_reboot; |
423 | } | 420 | } |
424 | 421 | ||
425 | printk(KERN_INFO PFX "initialized. timeout=%d sec (nowayout=%d)\n", | 422 | pr_info("initialized. timeout=%d sec (nowayout=%d)\n", |
426 | timeout, nowayout); | 423 | timeout, nowayout); |
427 | 424 | ||
428 | out: | 425 | out: |
diff --git a/drivers/watchdog/alim7101_wdt.c b/drivers/watchdog/alim7101_wdt.c index 46f4b85b46de..b9e9558ab218 100644 --- a/drivers/watchdog/alim7101_wdt.c +++ b/drivers/watchdog/alim7101_wdt.c | |||
@@ -19,6 +19,8 @@ | |||
19 | * -- Mike Waychison <michael.waychison@sun.com> | 19 | * -- Mike Waychison <michael.waychison@sun.com> |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
23 | |||
22 | #include <linux/module.h> | 24 | #include <linux/module.h> |
23 | #include <linux/moduleparam.h> | 25 | #include <linux/moduleparam.h> |
24 | #include <linux/types.h> | 26 | #include <linux/types.h> |
@@ -36,9 +38,6 @@ | |||
36 | 38 | ||
37 | #include <asm/system.h> | 39 | #include <asm/system.h> |
38 | 40 | ||
39 | #define OUR_NAME "alim7101_wdt" | ||
40 | #define PFX OUR_NAME ": " | ||
41 | |||
42 | #define WDT_ENABLE 0x9C | 41 | #define WDT_ENABLE 0x9C |
43 | #define WDT_DISABLE 0x8C | 42 | #define WDT_DISABLE 0x8C |
44 | 43 | ||
@@ -79,8 +78,8 @@ static unsigned long wdt_is_open; | |||
79 | static char wdt_expect_close; | 78 | static char wdt_expect_close; |
80 | static struct pci_dev *alim7101_pmu; | 79 | static struct pci_dev *alim7101_pmu; |
81 | 80 | ||
82 | static int nowayout = WATCHDOG_NOWAYOUT; | 81 | static bool nowayout = WATCHDOG_NOWAYOUT; |
83 | module_param(nowayout, int, 0); | 82 | module_param(nowayout, bool, 0); |
84 | MODULE_PARM_DESC(nowayout, | 83 | MODULE_PARM_DESC(nowayout, |
85 | "Watchdog cannot be stopped once started (default=" | 84 | "Watchdog cannot be stopped once started (default=" |
86 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 85 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
@@ -112,8 +111,7 @@ static void wdt_timer_ping(unsigned long data) | |||
112 | ALI_7101_GPIO_O, tmp & ~0x20); | 111 | ALI_7101_GPIO_O, tmp & ~0x20); |
113 | } | 112 | } |
114 | } else { | 113 | } else { |
115 | printk(KERN_WARNING PFX | 114 | pr_warn("Heartbeat lost! Will not ping the watchdog\n"); |
116 | "Heartbeat lost! Will not ping the watchdog\n"); | ||
117 | } | 115 | } |
118 | /* Re-set the timer interval */ | 116 | /* Re-set the timer interval */ |
119 | mod_timer(&timer, jiffies + WDT_INTERVAL); | 117 | mod_timer(&timer, jiffies + WDT_INTERVAL); |
@@ -162,7 +160,7 @@ static void wdt_startup(void) | |||
162 | /* Start the timer */ | 160 | /* Start the timer */ |
163 | mod_timer(&timer, jiffies + WDT_INTERVAL); | 161 | mod_timer(&timer, jiffies + WDT_INTERVAL); |
164 | 162 | ||
165 | printk(KERN_INFO PFX "Watchdog timer is now enabled.\n"); | 163 | pr_info("Watchdog timer is now enabled\n"); |
166 | } | 164 | } |
167 | 165 | ||
168 | static void wdt_turnoff(void) | 166 | static void wdt_turnoff(void) |
@@ -170,7 +168,7 @@ static void wdt_turnoff(void) | |||
170 | /* Stop the timer */ | 168 | /* Stop the timer */ |
171 | del_timer_sync(&timer); | 169 | del_timer_sync(&timer); |
172 | wdt_change(WDT_DISABLE); | 170 | wdt_change(WDT_DISABLE); |
173 | printk(KERN_INFO PFX "Watchdog timer is now disabled...\n"); | 171 | pr_info("Watchdog timer is now disabled...\n"); |
174 | } | 172 | } |
175 | 173 | ||
176 | static void wdt_keepalive(void) | 174 | static void wdt_keepalive(void) |
@@ -226,8 +224,7 @@ static int fop_close(struct inode *inode, struct file *file) | |||
226 | wdt_turnoff(); | 224 | wdt_turnoff(); |
227 | else { | 225 | else { |
228 | /* wim: shouldn't there be a: del_timer(&timer); */ | 226 | /* wim: shouldn't there be a: del_timer(&timer); */ |
229 | printk(KERN_CRIT PFX | 227 | pr_crit("device file closed unexpectedly. Will not stop the WDT!\n"); |
230 | "device file closed unexpectedly. Will not stop the WDT!\n"); | ||
231 | } | 228 | } |
232 | clear_bit(0, &wdt_is_open); | 229 | clear_bit(0, &wdt_is_open); |
233 | wdt_expect_close = 0; | 230 | wdt_expect_close = 0; |
@@ -322,8 +319,7 @@ static int wdt_notify_sys(struct notifier_block *this, | |||
322 | * watchdog on reboot with no heartbeat | 319 | * watchdog on reboot with no heartbeat |
323 | */ | 320 | */ |
324 | wdt_change(WDT_ENABLE); | 321 | wdt_change(WDT_ENABLE); |
325 | printk(KERN_INFO PFX "Watchdog timer is now enabled " | 322 | pr_info("Watchdog timer is now enabled with no heartbeat - should reboot in ~1 second\n"); |
326 | "with no heartbeat - should reboot in ~1 second.\n"); | ||
327 | } | 323 | } |
328 | return NOTIFY_DONE; | 324 | return NOTIFY_DONE; |
329 | } | 325 | } |
@@ -352,12 +348,11 @@ static int __init alim7101_wdt_init(void) | |||
352 | struct pci_dev *ali1543_south; | 348 | struct pci_dev *ali1543_south; |
353 | char tmp; | 349 | char tmp; |
354 | 350 | ||
355 | printk(KERN_INFO PFX "Steve Hill <steve@navaho.co.uk>.\n"); | 351 | pr_info("Steve Hill <steve@navaho.co.uk>\n"); |
356 | alim7101_pmu = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, | 352 | alim7101_pmu = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, |
357 | NULL); | 353 | NULL); |
358 | if (!alim7101_pmu) { | 354 | if (!alim7101_pmu) { |
359 | printk(KERN_INFO PFX | 355 | pr_info("ALi M7101 PMU not present - WDT not set\n"); |
360 | "ALi M7101 PMU not present - WDT not set\n"); | ||
361 | return -EBUSY; | 356 | return -EBUSY; |
362 | } | 357 | } |
363 | 358 | ||
@@ -367,56 +362,46 @@ static int __init alim7101_wdt_init(void) | |||
367 | ali1543_south = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, | 362 | ali1543_south = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, |
368 | NULL); | 363 | NULL); |
369 | if (!ali1543_south) { | 364 | if (!ali1543_south) { |
370 | printk(KERN_INFO PFX | 365 | pr_info("ALi 1543 South-Bridge not present - WDT not set\n"); |
371 | "ALi 1543 South-Bridge not present - WDT not set\n"); | ||
372 | goto err_out; | 366 | goto err_out; |
373 | } | 367 | } |
374 | pci_read_config_byte(ali1543_south, 0x5e, &tmp); | 368 | pci_read_config_byte(ali1543_south, 0x5e, &tmp); |
375 | pci_dev_put(ali1543_south); | 369 | pci_dev_put(ali1543_south); |
376 | if ((tmp & 0x1e) == 0x00) { | 370 | if ((tmp & 0x1e) == 0x00) { |
377 | if (!use_gpio) { | 371 | if (!use_gpio) { |
378 | printk(KERN_INFO PFX | 372 | pr_info("Detected old alim7101 revision 'a1d'. If this is a cobalt board, set the 'use_gpio' module parameter.\n"); |
379 | "Detected old alim7101 revision 'a1d'. " | ||
380 | "If this is a cobalt board, set the 'use_gpio' " | ||
381 | "module parameter.\n"); | ||
382 | goto err_out; | 373 | goto err_out; |
383 | } | 374 | } |
384 | nowayout = 1; | 375 | nowayout = 1; |
385 | } else if ((tmp & 0x1e) != 0x12 && (tmp & 0x1e) != 0x00) { | 376 | } else if ((tmp & 0x1e) != 0x12 && (tmp & 0x1e) != 0x00) { |
386 | printk(KERN_INFO PFX | 377 | pr_info("ALi 1543 South-Bridge does not have the correct revision number (???1001?) - WDT not set\n"); |
387 | "ALi 1543 South-Bridge does not have the correct " | ||
388 | "revision number (???1001?) - WDT not set\n"); | ||
389 | goto err_out; | 378 | goto err_out; |
390 | } | 379 | } |
391 | 380 | ||
392 | if (timeout < 1 || timeout > 3600) { | 381 | if (timeout < 1 || timeout > 3600) { |
393 | /* arbitrary upper limit */ | 382 | /* arbitrary upper limit */ |
394 | timeout = WATCHDOG_TIMEOUT; | 383 | timeout = WATCHDOG_TIMEOUT; |
395 | printk(KERN_INFO PFX | 384 | pr_info("timeout value must be 1 <= x <= 3600, using %d\n", |
396 | "timeout value must be 1 <= x <= 3600, using %d\n", | 385 | timeout); |
397 | timeout); | ||
398 | } | 386 | } |
399 | 387 | ||
400 | rc = register_reboot_notifier(&wdt_notifier); | 388 | rc = register_reboot_notifier(&wdt_notifier); |
401 | if (rc) { | 389 | if (rc) { |
402 | printk(KERN_ERR PFX | 390 | pr_err("cannot register reboot notifier (err=%d)\n", rc); |
403 | "cannot register reboot notifier (err=%d)\n", rc); | ||
404 | goto err_out; | 391 | goto err_out; |
405 | } | 392 | } |
406 | 393 | ||
407 | rc = misc_register(&wdt_miscdev); | 394 | rc = misc_register(&wdt_miscdev); |
408 | if (rc) { | 395 | if (rc) { |
409 | printk(KERN_ERR PFX | 396 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
410 | "cannot register miscdev on minor=%d (err=%d)\n", | 397 | wdt_miscdev.minor, rc); |
411 | wdt_miscdev.minor, rc); | ||
412 | goto err_out_reboot; | 398 | goto err_out_reboot; |
413 | } | 399 | } |
414 | 400 | ||
415 | if (nowayout) | 401 | if (nowayout) |
416 | __module_get(THIS_MODULE); | 402 | __module_get(THIS_MODULE); |
417 | 403 | ||
418 | printk(KERN_INFO PFX "WDT driver for ALi M7101 initialised. " | 404 | pr_info("WDT driver for ALi M7101 initialised. timeout=%d sec (nowayout=%d)\n", |
419 | "timeout=%d sec (nowayout=%d)\n", | ||
420 | timeout, nowayout); | 405 | timeout, nowayout); |
421 | return 0; | 406 | return 0; |
422 | 407 | ||
diff --git a/drivers/watchdog/ar7_wdt.c b/drivers/watchdog/ar7_wdt.c index 502773ad5acd..639ae9a23fbc 100644 --- a/drivers/watchdog/ar7_wdt.c +++ b/drivers/watchdog/ar7_wdt.c | |||
@@ -23,6 +23,8 @@ | |||
23 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | 23 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
27 | |||
26 | #include <linux/module.h> | 28 | #include <linux/module.h> |
27 | #include <linux/moduleparam.h> | 29 | #include <linux/moduleparam.h> |
28 | #include <linux/errno.h> | 30 | #include <linux/errno.h> |
@@ -39,7 +41,6 @@ | |||
39 | #include <asm/addrspace.h> | 41 | #include <asm/addrspace.h> |
40 | #include <asm/mach-ar7/ar7.h> | 42 | #include <asm/mach-ar7/ar7.h> |
41 | 43 | ||
42 | #define DRVNAME "ar7_wdt" | ||
43 | #define LONGNAME "TI AR7 Watchdog Timer" | 44 | #define LONGNAME "TI AR7 Watchdog Timer" |
44 | 45 | ||
45 | MODULE_AUTHOR("Nicolas Thill <nico@openwrt.org>"); | 46 | MODULE_AUTHOR("Nicolas Thill <nico@openwrt.org>"); |
@@ -51,8 +52,8 @@ static int margin = 60; | |||
51 | module_param(margin, int, 0); | 52 | module_param(margin, int, 0); |
52 | MODULE_PARM_DESC(margin, "Watchdog margin in seconds"); | 53 | MODULE_PARM_DESC(margin, "Watchdog margin in seconds"); |
53 | 54 | ||
54 | static int nowayout = WATCHDOG_NOWAYOUT; | 55 | static bool nowayout = WATCHDOG_NOWAYOUT; |
55 | module_param(nowayout, int, 0); | 56 | module_param(nowayout, bool, 0); |
56 | MODULE_PARM_DESC(nowayout, "Disable watchdog shutdown on close"); | 57 | MODULE_PARM_DESC(nowayout, "Disable watchdog shutdown on close"); |
57 | 58 | ||
58 | #define READ_REG(x) readl((void __iomem *)&(x)) | 59 | #define READ_REG(x) readl((void __iomem *)&(x)) |
@@ -93,7 +94,7 @@ static void ar7_wdt_kick(u32 value) | |||
93 | return; | 94 | return; |
94 | } | 95 | } |
95 | } | 96 | } |
96 | printk(KERN_ERR DRVNAME ": failed to unlock WDT kick reg\n"); | 97 | pr_err("failed to unlock WDT kick reg\n"); |
97 | } | 98 | } |
98 | 99 | ||
99 | static void ar7_wdt_prescale(u32 value) | 100 | static void ar7_wdt_prescale(u32 value) |
@@ -106,7 +107,7 @@ static void ar7_wdt_prescale(u32 value) | |||
106 | return; | 107 | return; |
107 | } | 108 | } |
108 | } | 109 | } |
109 | printk(KERN_ERR DRVNAME ": failed to unlock WDT prescale reg\n"); | 110 | pr_err("failed to unlock WDT prescale reg\n"); |
110 | } | 111 | } |
111 | 112 | ||
112 | static void ar7_wdt_change(u32 value) | 113 | static void ar7_wdt_change(u32 value) |
@@ -119,7 +120,7 @@ static void ar7_wdt_change(u32 value) | |||
119 | return; | 120 | return; |
120 | } | 121 | } |
121 | } | 122 | } |
122 | printk(KERN_ERR DRVNAME ": failed to unlock WDT change reg\n"); | 123 | pr_err("failed to unlock WDT change reg\n"); |
123 | } | 124 | } |
124 | 125 | ||
125 | static void ar7_wdt_disable(u32 value) | 126 | static void ar7_wdt_disable(u32 value) |
@@ -135,7 +136,7 @@ static void ar7_wdt_disable(u32 value) | |||
135 | } | 136 | } |
136 | } | 137 | } |
137 | } | 138 | } |
138 | printk(KERN_ERR DRVNAME ": failed to unlock WDT disable reg\n"); | 139 | pr_err("failed to unlock WDT disable reg\n"); |
139 | } | 140 | } |
140 | 141 | ||
141 | static void ar7_wdt_update_margin(int new_margin) | 142 | static void ar7_wdt_update_margin(int new_margin) |
@@ -151,21 +152,20 @@ static void ar7_wdt_update_margin(int new_margin) | |||
151 | change = 0xffff; | 152 | change = 0xffff; |
152 | ar7_wdt_change(change); | 153 | ar7_wdt_change(change); |
153 | margin = change * prescale_value / vbus_rate; | 154 | margin = change * prescale_value / vbus_rate; |
154 | printk(KERN_INFO DRVNAME | 155 | pr_info("timer margin %d seconds (prescale %d, change %d, freq %d)\n", |
155 | ": timer margin %d seconds (prescale %d, change %d, freq %d)\n", | 156 | margin, prescale_value, change, vbus_rate); |
156 | margin, prescale_value, change, vbus_rate); | ||
157 | } | 157 | } |
158 | 158 | ||
159 | static void ar7_wdt_enable_wdt(void) | 159 | static void ar7_wdt_enable_wdt(void) |
160 | { | 160 | { |
161 | printk(KERN_DEBUG DRVNAME ": enabling watchdog timer\n"); | 161 | pr_debug("enabling watchdog timer\n"); |
162 | ar7_wdt_disable(1); | 162 | ar7_wdt_disable(1); |
163 | ar7_wdt_kick(1); | 163 | ar7_wdt_kick(1); |
164 | } | 164 | } |
165 | 165 | ||
166 | static void ar7_wdt_disable_wdt(void) | 166 | static void ar7_wdt_disable_wdt(void) |
167 | { | 167 | { |
168 | printk(KERN_DEBUG DRVNAME ": disabling watchdog timer\n"); | 168 | pr_debug("disabling watchdog timer\n"); |
169 | ar7_wdt_disable(0); | 169 | ar7_wdt_disable(0); |
170 | } | 170 | } |
171 | 171 | ||
@@ -183,9 +183,7 @@ static int ar7_wdt_open(struct inode *inode, struct file *file) | |||
183 | static int ar7_wdt_release(struct inode *inode, struct file *file) | 183 | static int ar7_wdt_release(struct inode *inode, struct file *file) |
184 | { | 184 | { |
185 | if (!expect_close) | 185 | if (!expect_close) |
186 | printk(KERN_WARNING DRVNAME | 186 | pr_warn("watchdog device closed unexpectedly, will not disable the watchdog timer\n"); |
187 | ": watchdog device closed unexpectedly," | ||
188 | "will not disable the watchdog timer\n"); | ||
189 | else if (!nowayout) | 187 | else if (!nowayout) |
190 | ar7_wdt_disable_wdt(); | 188 | ar7_wdt_disable_wdt(); |
191 | clear_bit(0, &wdt_is_open); | 189 | clear_bit(0, &wdt_is_open); |
@@ -283,28 +281,28 @@ static int __devinit ar7_wdt_probe(struct platform_device *pdev) | |||
283 | ar7_regs_wdt = | 281 | ar7_regs_wdt = |
284 | platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs"); | 282 | platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs"); |
285 | if (!ar7_regs_wdt) { | 283 | if (!ar7_regs_wdt) { |
286 | printk(KERN_ERR DRVNAME ": could not get registers resource\n"); | 284 | pr_err("could not get registers resource\n"); |
287 | rc = -ENODEV; | 285 | rc = -ENODEV; |
288 | goto out; | 286 | goto out; |
289 | } | 287 | } |
290 | 288 | ||
291 | if (!request_mem_region(ar7_regs_wdt->start, | 289 | if (!request_mem_region(ar7_regs_wdt->start, |
292 | resource_size(ar7_regs_wdt), LONGNAME)) { | 290 | resource_size(ar7_regs_wdt), LONGNAME)) { |
293 | printk(KERN_WARNING DRVNAME ": watchdog I/O region busy\n"); | 291 | pr_warn("watchdog I/O region busy\n"); |
294 | rc = -EBUSY; | 292 | rc = -EBUSY; |
295 | goto out; | 293 | goto out; |
296 | } | 294 | } |
297 | 295 | ||
298 | ar7_wdt = ioremap(ar7_regs_wdt->start, resource_size(ar7_regs_wdt)); | 296 | ar7_wdt = ioremap(ar7_regs_wdt->start, resource_size(ar7_regs_wdt)); |
299 | if (!ar7_wdt) { | 297 | if (!ar7_wdt) { |
300 | printk(KERN_ERR DRVNAME ": could not ioremap registers\n"); | 298 | pr_err("could not ioremap registers\n"); |
301 | rc = -ENXIO; | 299 | rc = -ENXIO; |
302 | goto out_mem_region; | 300 | goto out_mem_region; |
303 | } | 301 | } |
304 | 302 | ||
305 | vbus_clk = clk_get(NULL, "vbus"); | 303 | vbus_clk = clk_get(NULL, "vbus"); |
306 | if (IS_ERR(vbus_clk)) { | 304 | if (IS_ERR(vbus_clk)) { |
307 | printk(KERN_ERR DRVNAME ": could not get vbus clock\n"); | 305 | pr_err("could not get vbus clock\n"); |
308 | rc = PTR_ERR(vbus_clk); | 306 | rc = PTR_ERR(vbus_clk); |
309 | goto out_mem_region; | 307 | goto out_mem_region; |
310 | } | 308 | } |
@@ -315,7 +313,7 @@ static int __devinit ar7_wdt_probe(struct platform_device *pdev) | |||
315 | 313 | ||
316 | rc = misc_register(&ar7_wdt_miscdev); | 314 | rc = misc_register(&ar7_wdt_miscdev); |
317 | if (rc) { | 315 | if (rc) { |
318 | printk(KERN_ERR DRVNAME ": unable to register misc device\n"); | 316 | pr_err("unable to register misc device\n"); |
319 | goto out_alloc; | 317 | goto out_alloc; |
320 | } | 318 | } |
321 | goto out; | 319 | goto out; |
diff --git a/drivers/watchdog/at32ap700x_wdt.c b/drivers/watchdog/at32ap700x_wdt.c index 4ca5d40304b2..2896430ce42c 100644 --- a/drivers/watchdog/at32ap700x_wdt.c +++ b/drivers/watchdog/at32ap700x_wdt.c | |||
@@ -45,8 +45,8 @@ MODULE_PARM_DESC(timeout, | |||
45 | "Timeout value. Limited to be 1 or 2 seconds. (default=" | 45 | "Timeout value. Limited to be 1 or 2 seconds. (default=" |
46 | __MODULE_STRING(TIMEOUT_DEFAULT) ")"); | 46 | __MODULE_STRING(TIMEOUT_DEFAULT) ")"); |
47 | 47 | ||
48 | static int nowayout = WATCHDOG_NOWAYOUT; | 48 | static bool nowayout = WATCHDOG_NOWAYOUT; |
49 | module_param(nowayout, int, 0); | 49 | module_param(nowayout, bool, 0); |
50 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" | 50 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" |
51 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 51 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
52 | 52 | ||
diff --git a/drivers/watchdog/at91rm9200_wdt.c b/drivers/watchdog/at91rm9200_wdt.c index 7ceefd29ae14..7ef99a169e3b 100644 --- a/drivers/watchdog/at91rm9200_wdt.c +++ b/drivers/watchdog/at91rm9200_wdt.c | |||
@@ -9,6 +9,8 @@ | |||
9 | * 2 of the License, or (at your option) any later version. | 9 | * 2 of the License, or (at your option) any later version. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
13 | |||
12 | #include <linux/bitops.h> | 14 | #include <linux/bitops.h> |
13 | #include <linux/errno.h> | 15 | #include <linux/errno.h> |
14 | #include <linux/fs.h> | 16 | #include <linux/fs.h> |
@@ -28,14 +30,14 @@ | |||
28 | #define WDT_MAX_TIME 256 /* seconds */ | 30 | #define WDT_MAX_TIME 256 /* seconds */ |
29 | 31 | ||
30 | static int wdt_time = WDT_DEFAULT_TIME; | 32 | static int wdt_time = WDT_DEFAULT_TIME; |
31 | static int nowayout = WATCHDOG_NOWAYOUT; | 33 | static bool nowayout = WATCHDOG_NOWAYOUT; |
32 | 34 | ||
33 | module_param(wdt_time, int, 0); | 35 | module_param(wdt_time, int, 0); |
34 | MODULE_PARM_DESC(wdt_time, "Watchdog time in seconds. (default=" | 36 | MODULE_PARM_DESC(wdt_time, "Watchdog time in seconds. (default=" |
35 | __MODULE_STRING(WDT_DEFAULT_TIME) ")"); | 37 | __MODULE_STRING(WDT_DEFAULT_TIME) ")"); |
36 | 38 | ||
37 | #ifdef CONFIG_WATCHDOG_NOWAYOUT | 39 | #ifdef CONFIG_WATCHDOG_NOWAYOUT |
38 | module_param(nowayout, int, 0); | 40 | module_param(nowayout, bool, 0); |
39 | MODULE_PARM_DESC(nowayout, | 41 | MODULE_PARM_DESC(nowayout, |
40 | "Watchdog cannot be stopped once started (default=" | 42 | "Watchdog cannot be stopped once started (default=" |
41 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 43 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
@@ -209,8 +211,8 @@ static int __devinit at91wdt_probe(struct platform_device *pdev) | |||
209 | if (res) | 211 | if (res) |
210 | return res; | 212 | return res; |
211 | 213 | ||
212 | printk(KERN_INFO "AT91 Watchdog Timer enabled (%d seconds%s)\n", | 214 | pr_info("AT91 Watchdog Timer enabled (%d seconds%s)\n", |
213 | wdt_time, nowayout ? ", nowayout" : ""); | 215 | wdt_time, nowayout ? ", nowayout" : ""); |
214 | return 0; | 216 | return 0; |
215 | } | 217 | } |
216 | 218 | ||
@@ -268,8 +270,8 @@ static int __init at91_wdt_init(void) | |||
268 | if not reset to the default */ | 270 | if not reset to the default */ |
269 | if (at91_wdt_settimeout(wdt_time)) { | 271 | if (at91_wdt_settimeout(wdt_time)) { |
270 | at91_wdt_settimeout(WDT_DEFAULT_TIME); | 272 | at91_wdt_settimeout(WDT_DEFAULT_TIME); |
271 | pr_info("at91_wdt: wdt_time value must be 1 <= wdt_time <= 256" | 273 | pr_info("wdt_time value must be 1 <= wdt_time <= 256, using %d\n", |
272 | ", using %d\n", wdt_time); | 274 | wdt_time); |
273 | } | 275 | } |
274 | 276 | ||
275 | return platform_driver_register(&at91wdt_driver); | 277 | return platform_driver_register(&at91wdt_driver); |
diff --git a/drivers/watchdog/at91sam9_wdt.c b/drivers/watchdog/at91sam9_wdt.c index 00562566ef5f..05e1be85fdee 100644 --- a/drivers/watchdog/at91sam9_wdt.c +++ b/drivers/watchdog/at91sam9_wdt.c | |||
@@ -15,6 +15,8 @@ | |||
15 | * bootloader doesn't write to this register. | 15 | * bootloader doesn't write to this register. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
19 | |||
18 | #include <linux/errno.h> | 20 | #include <linux/errno.h> |
19 | #include <linux/fs.h> | 21 | #include <linux/fs.h> |
20 | #include <linux/init.h> | 22 | #include <linux/init.h> |
@@ -60,8 +62,8 @@ module_param(heartbeat, int, 0); | |||
60 | MODULE_PARM_DESC(heartbeat, "Watchdog heartbeats in seconds. " | 62 | MODULE_PARM_DESC(heartbeat, "Watchdog heartbeats in seconds. " |
61 | "(default = " __MODULE_STRING(WDT_HEARTBEAT) ")"); | 63 | "(default = " __MODULE_STRING(WDT_HEARTBEAT) ")"); |
62 | 64 | ||
63 | static int nowayout = WATCHDOG_NOWAYOUT; | 65 | static bool nowayout = WATCHDOG_NOWAYOUT; |
64 | module_param(nowayout, int, 0); | 66 | module_param(nowayout, bool, 0); |
65 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started " | 67 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started " |
66 | "(default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 68 | "(default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
67 | 69 | ||
@@ -96,7 +98,7 @@ static void at91_ping(unsigned long data) | |||
96 | at91_wdt_reset(); | 98 | at91_wdt_reset(); |
97 | mod_timer(&at91wdt_private.timer, jiffies + WDT_TIMEOUT); | 99 | mod_timer(&at91wdt_private.timer, jiffies + WDT_TIMEOUT); |
98 | } else | 100 | } else |
99 | printk(KERN_CRIT DRV_NAME": I will reset your machine !\n"); | 101 | pr_crit("I will reset your machine !\n"); |
100 | } | 102 | } |
101 | 103 | ||
102 | /* | 104 | /* |
@@ -140,7 +142,7 @@ static int at91_wdt_settimeout(unsigned int timeout) | |||
140 | /* Check if disabled */ | 142 | /* Check if disabled */ |
141 | mr = wdt_read(AT91_WDT_MR); | 143 | mr = wdt_read(AT91_WDT_MR); |
142 | if (mr & AT91_WDT_WDDIS) { | 144 | if (mr & AT91_WDT_WDDIS) { |
143 | printk(KERN_ERR DRV_NAME": sorry, watchdog is disabled\n"); | 145 | pr_err("sorry, watchdog is disabled\n"); |
144 | return -EIO; | 146 | return -EIO; |
145 | } | 147 | } |
146 | 148 | ||
@@ -283,7 +285,7 @@ static int __init at91wdt_probe(struct platform_device *pdev) | |||
283 | setup_timer(&at91wdt_private.timer, at91_ping, 0); | 285 | setup_timer(&at91wdt_private.timer, at91_ping, 0); |
284 | mod_timer(&at91wdt_private.timer, jiffies + WDT_TIMEOUT); | 286 | mod_timer(&at91wdt_private.timer, jiffies + WDT_TIMEOUT); |
285 | 287 | ||
286 | printk(KERN_INFO DRV_NAME " enabled (heartbeat=%d sec, nowayout=%d)\n", | 288 | pr_info("enabled (heartbeat=%d sec, nowayout=%d)\n", |
287 | heartbeat, nowayout); | 289 | heartbeat, nowayout); |
288 | 290 | ||
289 | return 0; | 291 | return 0; |
diff --git a/drivers/watchdog/ath79_wdt.c b/drivers/watchdog/ath79_wdt.c index 9db808349f8b..1f9371f49c40 100644 --- a/drivers/watchdog/ath79_wdt.c +++ b/drivers/watchdog/ath79_wdt.c | |||
@@ -17,6 +17,8 @@ | |||
17 | * | 17 | * |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
21 | |||
20 | #include <linux/bitops.h> | 22 | #include <linux/bitops.h> |
21 | #include <linux/errno.h> | 23 | #include <linux/errno.h> |
22 | #include <linux/fs.h> | 24 | #include <linux/fs.h> |
@@ -45,8 +47,8 @@ | |||
45 | #define WDOG_CTRL_ACTION_NMI 2 /* NMI */ | 47 | #define WDOG_CTRL_ACTION_NMI 2 /* NMI */ |
46 | #define WDOG_CTRL_ACTION_FCR 3 /* full chip reset */ | 48 | #define WDOG_CTRL_ACTION_FCR 3 /* full chip reset */ |
47 | 49 | ||
48 | static int nowayout = WATCHDOG_NOWAYOUT; | 50 | static bool nowayout = WATCHDOG_NOWAYOUT; |
49 | module_param(nowayout, int, 0); | 51 | module_param(nowayout, bool, 0); |
50 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started " | 52 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started " |
51 | "(default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 53 | "(default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
52 | 54 | ||
@@ -114,8 +116,7 @@ static int ath79_wdt_release(struct inode *inode, struct file *file) | |||
114 | if (test_bit(WDT_FLAGS_EXPECT_CLOSE, &wdt_flags)) | 116 | if (test_bit(WDT_FLAGS_EXPECT_CLOSE, &wdt_flags)) |
115 | ath79_wdt_disable(); | 117 | ath79_wdt_disable(); |
116 | else { | 118 | else { |
117 | pr_crit(DRIVER_NAME ": device closed unexpectedly, " | 119 | pr_crit("device closed unexpectedly, watchdog timer will not stop!\n"); |
118 | "watchdog timer will not stop!\n"); | ||
119 | ath79_wdt_keepalive(); | 120 | ath79_wdt_keepalive(); |
120 | } | 121 | } |
121 | 122 | ||
diff --git a/drivers/watchdog/bcm47xx_wdt.c b/drivers/watchdog/bcm47xx_wdt.c index 5c5f4b14fd05..bc0e91e78e86 100644 --- a/drivers/watchdog/bcm47xx_wdt.c +++ b/drivers/watchdog/bcm47xx_wdt.c | |||
@@ -10,6 +10,8 @@ | |||
10 | * 2 of the License, or (at your option) any later version. | 10 | * 2 of the License, or (at your option) any later version. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
14 | |||
13 | #include <linux/bitops.h> | 15 | #include <linux/bitops.h> |
14 | #include <linux/errno.h> | 16 | #include <linux/errno.h> |
15 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
@@ -33,14 +35,14 @@ | |||
33 | #define WDT_MAX_TIME 255 /* seconds */ | 35 | #define WDT_MAX_TIME 255 /* seconds */ |
34 | 36 | ||
35 | static int wdt_time = WDT_DEFAULT_TIME; | 37 | static int wdt_time = WDT_DEFAULT_TIME; |
36 | static int nowayout = WATCHDOG_NOWAYOUT; | 38 | static bool nowayout = WATCHDOG_NOWAYOUT; |
37 | 39 | ||
38 | module_param(wdt_time, int, 0); | 40 | module_param(wdt_time, int, 0); |
39 | MODULE_PARM_DESC(wdt_time, "Watchdog time in seconds. (default=" | 41 | MODULE_PARM_DESC(wdt_time, "Watchdog time in seconds. (default=" |
40 | __MODULE_STRING(WDT_DEFAULT_TIME) ")"); | 42 | __MODULE_STRING(WDT_DEFAULT_TIME) ")"); |
41 | 43 | ||
42 | #ifdef CONFIG_WATCHDOG_NOWAYOUT | 44 | #ifdef CONFIG_WATCHDOG_NOWAYOUT |
43 | module_param(nowayout, int, 0); | 45 | module_param(nowayout, bool, 0); |
44 | MODULE_PARM_DESC(nowayout, | 46 | MODULE_PARM_DESC(nowayout, |
45 | "Watchdog cannot be stopped once started (default=" | 47 | "Watchdog cannot be stopped once started (default=" |
46 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 48 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
@@ -91,7 +93,7 @@ static void bcm47xx_timer_tick(unsigned long unused) | |||
91 | bcm47xx_wdt_hw_start(); | 93 | bcm47xx_wdt_hw_start(); |
92 | mod_timer(&wdt_timer, jiffies + HZ); | 94 | mod_timer(&wdt_timer, jiffies + HZ); |
93 | } else { | 95 | } else { |
94 | printk(KERN_CRIT DRV_NAME "Watchdog will fire soon!!!\n"); | 96 | pr_crit("Watchdog will fire soon!!!\n"); |
95 | } | 97 | } |
96 | } | 98 | } |
97 | 99 | ||
@@ -140,8 +142,7 @@ static int bcm47xx_wdt_release(struct inode *inode, struct file *file) | |||
140 | if (expect_release == 42) { | 142 | if (expect_release == 42) { |
141 | bcm47xx_wdt_stop(); | 143 | bcm47xx_wdt_stop(); |
142 | } else { | 144 | } else { |
143 | printk(KERN_CRIT DRV_NAME | 145 | pr_crit("Unexpected close, not stopping watchdog!\n"); |
144 | ": Unexpected close, not stopping watchdog!\n"); | ||
145 | bcm47xx_wdt_start(); | 146 | bcm47xx_wdt_start(); |
146 | } | 147 | } |
147 | 148 | ||
@@ -270,8 +271,7 @@ static int __init bcm47xx_wdt_init(void) | |||
270 | 271 | ||
271 | if (bcm47xx_wdt_settimeout(wdt_time)) { | 272 | if (bcm47xx_wdt_settimeout(wdt_time)) { |
272 | bcm47xx_wdt_settimeout(WDT_DEFAULT_TIME); | 273 | bcm47xx_wdt_settimeout(WDT_DEFAULT_TIME); |
273 | printk(KERN_INFO DRV_NAME ": " | 274 | pr_info("wdt_time value must be 0 < wdt_time < %d, using %d\n", |
274 | "wdt_time value must be 0 < wdt_time < %d, using %d\n", | ||
275 | (WDT_MAX_TIME + 1), wdt_time); | 275 | (WDT_MAX_TIME + 1), wdt_time); |
276 | } | 276 | } |
277 | 277 | ||
@@ -285,8 +285,8 @@ static int __init bcm47xx_wdt_init(void) | |||
285 | return ret; | 285 | return ret; |
286 | } | 286 | } |
287 | 287 | ||
288 | printk(KERN_INFO "BCM47xx Watchdog Timer enabled (%d seconds%s)\n", | 288 | pr_info("BCM47xx Watchdog Timer enabled (%d seconds%s)\n", |
289 | wdt_time, nowayout ? ", nowayout" : ""); | 289 | wdt_time, nowayout ? ", nowayout" : ""); |
290 | return 0; | 290 | return 0; |
291 | } | 291 | } |
292 | 292 | ||
diff --git a/drivers/watchdog/bcm63xx_wdt.c b/drivers/watchdog/bcm63xx_wdt.c index 8dc7de641e26..8379dc32fd90 100644 --- a/drivers/watchdog/bcm63xx_wdt.c +++ b/drivers/watchdog/bcm63xx_wdt.c | |||
@@ -10,6 +10,8 @@ | |||
10 | * 2 of the License, or (at your option) any later version. | 10 | * 2 of the License, or (at your option) any later version. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
14 | |||
13 | #include <linux/bitops.h> | 15 | #include <linux/bitops.h> |
14 | #include <linux/errno.h> | 16 | #include <linux/errno.h> |
15 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
@@ -50,8 +52,8 @@ static struct { | |||
50 | static int expect_close; | 52 | static int expect_close; |
51 | 53 | ||
52 | static int wdt_time = WDT_DEFAULT_TIME; | 54 | static int wdt_time = WDT_DEFAULT_TIME; |
53 | static int nowayout = WATCHDOG_NOWAYOUT; | 55 | static bool nowayout = WATCHDOG_NOWAYOUT; |
54 | module_param(nowayout, int, 0); | 56 | module_param(nowayout, bool, 0); |
55 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" | 57 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" |
56 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 58 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
57 | 59 | ||
@@ -82,7 +84,7 @@ static void bcm63xx_timer_tick(unsigned long unused) | |||
82 | bcm63xx_wdt_hw_start(); | 84 | bcm63xx_wdt_hw_start(); |
83 | mod_timer(&bcm63xx_wdt_device.timer, jiffies + HZ); | 85 | mod_timer(&bcm63xx_wdt_device.timer, jiffies + HZ); |
84 | } else | 86 | } else |
85 | printk(KERN_CRIT PFX ": watchdog will restart system\n"); | 87 | pr_crit("watchdog will restart system\n"); |
86 | } | 88 | } |
87 | 89 | ||
88 | static void bcm63xx_wdt_pet(void) | 90 | static void bcm63xx_wdt_pet(void) |
@@ -126,8 +128,7 @@ static int bcm63xx_wdt_release(struct inode *inode, struct file *file) | |||
126 | if (expect_close == 42) | 128 | if (expect_close == 42) |
127 | bcm63xx_wdt_pause(); | 129 | bcm63xx_wdt_pause(); |
128 | else { | 130 | else { |
129 | printk(KERN_CRIT PFX | 131 | pr_crit("Unexpected close, not stopping watchdog!\n"); |
130 | ": Unexpected close, not stopping watchdog!\n"); | ||
131 | bcm63xx_wdt_start(); | 132 | bcm63xx_wdt_start(); |
132 | } | 133 | } |
133 | clear_bit(0, &bcm63xx_wdt_device.inuse); | 134 | clear_bit(0, &bcm63xx_wdt_device.inuse); |
diff --git a/drivers/watchdog/bfin_wdt.c b/drivers/watchdog/bfin_wdt.c index b9fa9b71583a..38bc383e0677 100644 --- a/drivers/watchdog/bfin_wdt.c +++ b/drivers/watchdog/bfin_wdt.c | |||
@@ -11,6 +11,8 @@ | |||
11 | * Licensed under the GPL-2 or later. | 11 | * Licensed under the GPL-2 or later. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
15 | |||
14 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
15 | #include <linux/module.h> | 17 | #include <linux/module.h> |
16 | #include <linux/moduleparam.h> | 18 | #include <linux/moduleparam.h> |
@@ -28,15 +30,8 @@ | |||
28 | #define stamp(fmt, args...) \ | 30 | #define stamp(fmt, args...) \ |
29 | pr_debug("%s:%i: " fmt "\n", __func__, __LINE__, ## args) | 31 | pr_debug("%s:%i: " fmt "\n", __func__, __LINE__, ## args) |
30 | #define stampit() stamp("here i am") | 32 | #define stampit() stamp("here i am") |
31 | #define pr_devinit(fmt, args...) \ | ||
32 | ({ static const __devinitconst char __fmt[] = fmt; \ | ||
33 | printk(__fmt, ## args); }) | ||
34 | #define pr_init(fmt, args...) \ | ||
35 | ({ static const __initconst char __fmt[] = fmt; \ | ||
36 | printk(__fmt, ## args); }) | ||
37 | 33 | ||
38 | #define WATCHDOG_NAME "bfin-wdt" | 34 | #define WATCHDOG_NAME "bfin-wdt" |
39 | #define PFX WATCHDOG_NAME ": " | ||
40 | 35 | ||
41 | /* The BF561 has two watchdogs (one per core), but since Linux | 36 | /* The BF561 has two watchdogs (one per core), but since Linux |
42 | * only runs on core A, we'll just work with that one. | 37 | * only runs on core A, we'll just work with that one. |
@@ -54,7 +49,7 @@ | |||
54 | #define WATCHDOG_TIMEOUT 20 | 49 | #define WATCHDOG_TIMEOUT 20 |
55 | 50 | ||
56 | static unsigned int timeout = WATCHDOG_TIMEOUT; | 51 | static unsigned int timeout = WATCHDOG_TIMEOUT; |
57 | static int nowayout = WATCHDOG_NOWAYOUT; | 52 | static bool nowayout = WATCHDOG_NOWAYOUT; |
58 | static const struct watchdog_info bfin_wdt_info; | 53 | static const struct watchdog_info bfin_wdt_info; |
59 | static unsigned long open_check; | 54 | static unsigned long open_check; |
60 | static char expect_close; | 55 | static char expect_close; |
@@ -126,7 +121,7 @@ static int bfin_wdt_set_timeout(unsigned long t) | |||
126 | stamp("maxtimeout=%us newtimeout=%lus (cnt=%#x)", max_t, t, cnt); | 121 | stamp("maxtimeout=%us newtimeout=%lus (cnt=%#x)", max_t, t, cnt); |
127 | 122 | ||
128 | if (t > max_t) { | 123 | if (t > max_t) { |
129 | printk(KERN_WARNING PFX "timeout value is too large\n"); | 124 | pr_warn("timeout value is too large\n"); |
130 | return -EINVAL; | 125 | return -EINVAL; |
131 | } | 126 | } |
132 | 127 | ||
@@ -182,8 +177,7 @@ static int bfin_wdt_release(struct inode *inode, struct file *file) | |||
182 | if (expect_close == 42) | 177 | if (expect_close == 42) |
183 | bfin_wdt_stop(); | 178 | bfin_wdt_stop(); |
184 | else { | 179 | else { |
185 | printk(KERN_CRIT PFX | 180 | pr_crit("Unexpected close, not stopping watchdog!\n"); |
186 | "Unexpected close, not stopping watchdog!\n"); | ||
187 | bfin_wdt_keepalive(); | 181 | bfin_wdt_keepalive(); |
188 | } | 182 | } |
189 | expect_close = 0; | 183 | expect_close = 0; |
@@ -368,14 +362,13 @@ static int __devinit bfin_wdt_probe(struct platform_device *pdev) | |||
368 | 362 | ||
369 | ret = misc_register(&bfin_wdt_miscdev); | 363 | ret = misc_register(&bfin_wdt_miscdev); |
370 | if (ret) { | 364 | if (ret) { |
371 | pr_devinit(KERN_ERR PFX | 365 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
372 | "cannot register miscdev on minor=%d (err=%d)\n", | 366 | WATCHDOG_MINOR, ret); |
373 | WATCHDOG_MINOR, ret); | ||
374 | return ret; | 367 | return ret; |
375 | } | 368 | } |
376 | 369 | ||
377 | pr_devinit(KERN_INFO PFX "initialized: timeout=%d sec (nowayout=%d)\n", | 370 | pr_info("initialized: timeout=%d sec (nowayout=%d)\n", |
378 | timeout, nowayout); | 371 | timeout, nowayout); |
379 | 372 | ||
380 | return 0; | 373 | return 0; |
381 | } | 374 | } |
@@ -439,14 +432,14 @@ static int __init bfin_wdt_init(void) | |||
439 | */ | 432 | */ |
440 | ret = platform_driver_register(&bfin_wdt_driver); | 433 | ret = platform_driver_register(&bfin_wdt_driver); |
441 | if (ret) { | 434 | if (ret) { |
442 | pr_init(KERN_ERR PFX "unable to register driver\n"); | 435 | pr_err("unable to register driver\n"); |
443 | return ret; | 436 | return ret; |
444 | } | 437 | } |
445 | 438 | ||
446 | bfin_wdt_device = platform_device_register_simple(WATCHDOG_NAME, | 439 | bfin_wdt_device = platform_device_register_simple(WATCHDOG_NAME, |
447 | -1, NULL, 0); | 440 | -1, NULL, 0); |
448 | if (IS_ERR(bfin_wdt_device)) { | 441 | if (IS_ERR(bfin_wdt_device)) { |
449 | pr_init(KERN_ERR PFX "unable to register device\n"); | 442 | pr_err("unable to register device\n"); |
450 | platform_driver_unregister(&bfin_wdt_driver); | 443 | platform_driver_unregister(&bfin_wdt_driver); |
451 | return PTR_ERR(bfin_wdt_device); | 444 | return PTR_ERR(bfin_wdt_device); |
452 | } | 445 | } |
@@ -479,7 +472,7 @@ MODULE_PARM_DESC(timeout, | |||
479 | "Watchdog timeout in seconds. (1<=timeout<=((2^32)/SCLK), default=" | 472 | "Watchdog timeout in seconds. (1<=timeout<=((2^32)/SCLK), default=" |
480 | __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); | 473 | __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); |
481 | 474 | ||
482 | module_param(nowayout, int, 0); | 475 | module_param(nowayout, bool, 0); |
483 | MODULE_PARM_DESC(nowayout, | 476 | MODULE_PARM_DESC(nowayout, |
484 | "Watchdog cannot be stopped once started (default=" | 477 | "Watchdog cannot be stopped once started (default=" |
485 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 478 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
diff --git a/drivers/watchdog/booke_wdt.c b/drivers/watchdog/booke_wdt.c index 7c0fdfca2646..3990d82f935c 100644 --- a/drivers/watchdog/booke_wdt.c +++ b/drivers/watchdog/booke_wdt.c | |||
@@ -12,6 +12,8 @@ | |||
12 | * option) any later version. | 12 | * option) any later version. |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
16 | |||
15 | #include <linux/module.h> | 17 | #include <linux/module.h> |
16 | #include <linux/fs.h> | 18 | #include <linux/fs.h> |
17 | #include <linux/smp.h> | 19 | #include <linux/smp.h> |
@@ -225,8 +227,8 @@ static int booke_wdt_open(struct inode *inode, struct file *file) | |||
225 | if (booke_wdt_enabled == 0) { | 227 | if (booke_wdt_enabled == 0) { |
226 | booke_wdt_enabled = 1; | 228 | booke_wdt_enabled = 1; |
227 | on_each_cpu(__booke_wdt_enable, NULL, 0); | 229 | on_each_cpu(__booke_wdt_enable, NULL, 0); |
228 | pr_debug("booke_wdt: watchdog enabled (timeout = %llu sec)\n", | 230 | pr_debug("watchdog enabled (timeout = %llu sec)\n", |
229 | period_to_sec(booke_wdt_period)); | 231 | period_to_sec(booke_wdt_period)); |
230 | } | 232 | } |
231 | spin_unlock(&booke_wdt_lock); | 233 | spin_unlock(&booke_wdt_lock); |
232 | 234 | ||
@@ -243,7 +245,7 @@ static int booke_wdt_release(struct inode *inode, struct file *file) | |||
243 | */ | 245 | */ |
244 | on_each_cpu(__booke_wdt_disable, NULL, 0); | 246 | on_each_cpu(__booke_wdt_disable, NULL, 0); |
245 | booke_wdt_enabled = 0; | 247 | booke_wdt_enabled = 0; |
246 | pr_debug("booke_wdt: watchdog disabled\n"); | 248 | pr_debug("watchdog disabled\n"); |
247 | #endif | 249 | #endif |
248 | 250 | ||
249 | clear_bit(0, &wdt_is_active); | 251 | clear_bit(0, &wdt_is_active); |
@@ -275,19 +277,19 @@ static int __init booke_wdt_init(void) | |||
275 | { | 277 | { |
276 | int ret = 0; | 278 | int ret = 0; |
277 | 279 | ||
278 | pr_info("booke_wdt: powerpc book-e watchdog driver loaded\n"); | 280 | pr_info("powerpc book-e watchdog driver loaded\n"); |
279 | ident.firmware_version = cur_cpu_spec->pvr_value; | 281 | ident.firmware_version = cur_cpu_spec->pvr_value; |
280 | 282 | ||
281 | ret = misc_register(&booke_wdt_miscdev); | 283 | ret = misc_register(&booke_wdt_miscdev); |
282 | if (ret) { | 284 | if (ret) { |
283 | pr_err("booke_wdt: cannot register device (minor=%u, ret=%i)\n", | 285 | pr_err("cannot register device (minor=%u, ret=%i)\n", |
284 | WATCHDOG_MINOR, ret); | 286 | WATCHDOG_MINOR, ret); |
285 | return ret; | 287 | return ret; |
286 | } | 288 | } |
287 | 289 | ||
288 | spin_lock(&booke_wdt_lock); | 290 | spin_lock(&booke_wdt_lock); |
289 | if (booke_wdt_enabled == 1) { | 291 | if (booke_wdt_enabled == 1) { |
290 | pr_info("booke_wdt: watchdog enabled (timeout = %llu sec)\n", | 292 | pr_info("watchdog enabled (timeout = %llu sec)\n", |
291 | period_to_sec(booke_wdt_period)); | 293 | period_to_sec(booke_wdt_period)); |
292 | on_each_cpu(__booke_wdt_enable, NULL, 0); | 294 | on_each_cpu(__booke_wdt_enable, NULL, 0); |
293 | } | 295 | } |
diff --git a/drivers/watchdog/coh901327_wdt.c b/drivers/watchdog/coh901327_wdt.c index 5b89f7d6cd0f..6876430a9f5e 100644 --- a/drivers/watchdog/coh901327_wdt.c +++ b/drivers/watchdog/coh901327_wdt.c | |||
@@ -8,17 +8,15 @@ | |||
8 | */ | 8 | */ |
9 | #include <linux/module.h> | 9 | #include <linux/module.h> |
10 | #include <linux/types.h> | 10 | #include <linux/types.h> |
11 | #include <linux/fs.h> | ||
12 | #include <linux/miscdevice.h> | ||
13 | #include <linux/watchdog.h> | 11 | #include <linux/watchdog.h> |
14 | #include <linux/interrupt.h> | 12 | #include <linux/interrupt.h> |
15 | #include <linux/pm.h> | 13 | #include <linux/pm.h> |
16 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
17 | #include <linux/io.h> | 15 | #include <linux/io.h> |
18 | #include <linux/bitops.h> | 16 | #include <linux/bitops.h> |
19 | #include <linux/uaccess.h> | ||
20 | #include <linux/clk.h> | 17 | #include <linux/clk.h> |
21 | #include <linux/delay.h> | 18 | #include <linux/delay.h> |
19 | #include <linux/err.h> | ||
22 | 20 | ||
23 | #define DRV_NAME "WDOG COH 901 327" | 21 | #define DRV_NAME "WDOG COH 901 327" |
24 | 22 | ||
@@ -69,13 +67,11 @@ | |||
69 | #define U300_WDOG_IFR_WILL_BARK_IRQ_FORCE_ENABLE 0x0001U | 67 | #define U300_WDOG_IFR_WILL_BARK_IRQ_FORCE_ENABLE 0x0001U |
70 | 68 | ||
71 | /* Default timeout in seconds = 1 minute */ | 69 | /* Default timeout in seconds = 1 minute */ |
72 | static int margin = 60; | 70 | static unsigned int margin = 60; |
73 | static resource_size_t phybase; | 71 | static resource_size_t phybase; |
74 | static resource_size_t physize; | 72 | static resource_size_t physize; |
75 | static int irq; | 73 | static int irq; |
76 | static void __iomem *virtbase; | 74 | static void __iomem *virtbase; |
77 | static unsigned long coh901327_users; | ||
78 | static unsigned long boot_status; | ||
79 | static struct device *parent; | 75 | static struct device *parent; |
80 | 76 | ||
81 | /* | 77 | /* |
@@ -155,34 +151,35 @@ static void coh901327_disable(void) | |||
155 | __func__, val); | 151 | __func__, val); |
156 | } | 152 | } |
157 | 153 | ||
158 | static void coh901327_start(void) | 154 | static int coh901327_start(struct watchdog_device *wdt_dev) |
159 | { | 155 | { |
160 | coh901327_enable(margin * 100); | 156 | coh901327_enable(wdt_dev->timeout * 100); |
157 | return 0; | ||
158 | } | ||
159 | |||
160 | static int coh901327_stop(struct watchdog_device *wdt_dev) | ||
161 | { | ||
162 | coh901327_disable(); | ||
163 | return 0; | ||
161 | } | 164 | } |
162 | 165 | ||
163 | static void coh901327_keepalive(void) | 166 | static int coh901327_ping(struct watchdog_device *wdd) |
164 | { | 167 | { |
165 | clk_enable(clk); | 168 | clk_enable(clk); |
166 | /* Feed the watchdog */ | 169 | /* Feed the watchdog */ |
167 | writew(U300_WDOG_FR_FEED_RESTART_TIMER, | 170 | writew(U300_WDOG_FR_FEED_RESTART_TIMER, |
168 | virtbase + U300_WDOG_FR); | 171 | virtbase + U300_WDOG_FR); |
169 | clk_disable(clk); | 172 | clk_disable(clk); |
173 | return 0; | ||
170 | } | 174 | } |
171 | 175 | ||
172 | static int coh901327_settimeout(int time) | 176 | static int coh901327_settimeout(struct watchdog_device *wdt_dev, |
177 | unsigned int time) | ||
173 | { | 178 | { |
174 | /* | 179 | wdt_dev->timeout = time; |
175 | * Max margin is 327 since the 10ms | ||
176 | * timeout register is max | ||
177 | * 0x7FFF = 327670ms ~= 327s. | ||
178 | */ | ||
179 | if (time <= 0 || time > 327) | ||
180 | return -EINVAL; | ||
181 | |||
182 | margin = time; | ||
183 | clk_enable(clk); | 180 | clk_enable(clk); |
184 | /* Set new timeout value */ | 181 | /* Set new timeout value */ |
185 | writew(margin * 100, virtbase + U300_WDOG_TR); | 182 | writew(time * 100, virtbase + U300_WDOG_TR); |
186 | /* Feed the dog */ | 183 | /* Feed the dog */ |
187 | writew(U300_WDOG_FR_FEED_RESTART_TIMER, | 184 | writew(U300_WDOG_FR_FEED_RESTART_TIMER, |
188 | virtbase + U300_WDOG_FR); | 185 | virtbase + U300_WDOG_FR); |
@@ -190,6 +187,23 @@ static int coh901327_settimeout(int time) | |||
190 | return 0; | 187 | return 0; |
191 | } | 188 | } |
192 | 189 | ||
190 | static unsigned int coh901327_gettimeleft(struct watchdog_device *wdt_dev) | ||
191 | { | ||
192 | u16 val; | ||
193 | |||
194 | clk_enable(clk); | ||
195 | /* Read repeatedly until the value is stable! */ | ||
196 | val = readw(virtbase + U300_WDOG_CR); | ||
197 | while (val & U300_WDOG_CR_VALID_IND) | ||
198 | val = readw(virtbase + U300_WDOG_CR); | ||
199 | val &= U300_WDOG_CR_COUNT_VALUE_MASK; | ||
200 | clk_disable(clk); | ||
201 | if (val != 0) | ||
202 | val /= 100; | ||
203 | |||
204 | return val; | ||
205 | } | ||
206 | |||
193 | /* | 207 | /* |
194 | * This interrupt occurs 10 ms before the watchdog WILL bark. | 208 | * This interrupt occurs 10 ms before the watchdog WILL bark. |
195 | */ | 209 | */ |
@@ -218,130 +232,35 @@ static irqreturn_t coh901327_interrupt(int irq, void *data) | |||
218 | return IRQ_HANDLED; | 232 | return IRQ_HANDLED; |
219 | } | 233 | } |
220 | 234 | ||
221 | /* | 235 | static const struct watchdog_info coh901327_ident = { |
222 | * Allow only one user (daemon) to open the watchdog | 236 | .options = WDIOF_CARDRESET | WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, |
223 | */ | 237 | .identity = DRV_NAME, |
224 | static int coh901327_open(struct inode *inode, struct file *file) | 238 | }; |
225 | { | ||
226 | if (test_and_set_bit(1, &coh901327_users)) | ||
227 | return -EBUSY; | ||
228 | coh901327_start(); | ||
229 | return nonseekable_open(inode, file); | ||
230 | } | ||
231 | |||
232 | static int coh901327_release(struct inode *inode, struct file *file) | ||
233 | { | ||
234 | clear_bit(1, &coh901327_users); | ||
235 | coh901327_disable(); | ||
236 | return 0; | ||
237 | } | ||
238 | |||
239 | static ssize_t coh901327_write(struct file *file, const char __user *data, | ||
240 | size_t len, loff_t *ppos) | ||
241 | { | ||
242 | if (len) | ||
243 | coh901327_keepalive(); | ||
244 | return len; | ||
245 | } | ||
246 | |||
247 | static long coh901327_ioctl(struct file *file, unsigned int cmd, | ||
248 | unsigned long arg) | ||
249 | { | ||
250 | int ret = -ENOTTY; | ||
251 | u16 val; | ||
252 | int time; | ||
253 | int new_options; | ||
254 | union { | ||
255 | struct watchdog_info __user *ident; | ||
256 | int __user *i; | ||
257 | } uarg; | ||
258 | static const struct watchdog_info ident = { | ||
259 | .options = WDIOF_CARDRESET | | ||
260 | WDIOF_SETTIMEOUT | | ||
261 | WDIOF_KEEPALIVEPING, | ||
262 | .identity = "COH 901 327 Watchdog", | ||
263 | .firmware_version = 1, | ||
264 | }; | ||
265 | uarg.i = (int __user *)arg; | ||
266 | |||
267 | switch (cmd) { | ||
268 | case WDIOC_GETSUPPORT: | ||
269 | ret = copy_to_user(uarg.ident, &ident, | ||
270 | sizeof(ident)) ? -EFAULT : 0; | ||
271 | break; | ||
272 | |||
273 | case WDIOC_GETSTATUS: | ||
274 | ret = put_user(0, uarg.i); | ||
275 | break; | ||
276 | |||
277 | case WDIOC_GETBOOTSTATUS: | ||
278 | ret = put_user(boot_status, uarg.i); | ||
279 | break; | ||
280 | |||
281 | case WDIOC_SETOPTIONS: | ||
282 | ret = get_user(new_options, uarg.i); | ||
283 | if (ret) | ||
284 | break; | ||
285 | if (new_options & WDIOS_DISABLECARD) | ||
286 | coh901327_disable(); | ||
287 | if (new_options & WDIOS_ENABLECARD) | ||
288 | coh901327_start(); | ||
289 | ret = 0; | ||
290 | break; | ||
291 | |||
292 | case WDIOC_KEEPALIVE: | ||
293 | coh901327_keepalive(); | ||
294 | ret = 0; | ||
295 | break; | ||
296 | |||
297 | case WDIOC_SETTIMEOUT: | ||
298 | ret = get_user(time, uarg.i); | ||
299 | if (ret) | ||
300 | break; | ||
301 | |||
302 | ret = coh901327_settimeout(time); | ||
303 | if (ret) | ||
304 | break; | ||
305 | /* Then fall through to return set value */ | ||
306 | |||
307 | case WDIOC_GETTIMEOUT: | ||
308 | ret = put_user(margin, uarg.i); | ||
309 | break; | ||
310 | |||
311 | case WDIOC_GETTIMELEFT: | ||
312 | clk_enable(clk); | ||
313 | /* Read repeatedly until the value is stable! */ | ||
314 | val = readw(virtbase + U300_WDOG_CR); | ||
315 | while (val & U300_WDOG_CR_VALID_IND) | ||
316 | val = readw(virtbase + U300_WDOG_CR); | ||
317 | val &= U300_WDOG_CR_COUNT_VALUE_MASK; | ||
318 | clk_disable(clk); | ||
319 | if (val != 0) | ||
320 | val /= 100; | ||
321 | ret = put_user(val, uarg.i); | ||
322 | break; | ||
323 | } | ||
324 | return ret; | ||
325 | } | ||
326 | 239 | ||
327 | static const struct file_operations coh901327_fops = { | 240 | static struct watchdog_ops coh901327_ops = { |
328 | .owner = THIS_MODULE, | 241 | .owner = THIS_MODULE, |
329 | .llseek = no_llseek, | 242 | .start = coh901327_start, |
330 | .write = coh901327_write, | 243 | .stop = coh901327_stop, |
331 | .unlocked_ioctl = coh901327_ioctl, | 244 | .ping = coh901327_ping, |
332 | .open = coh901327_open, | 245 | .set_timeout = coh901327_settimeout, |
333 | .release = coh901327_release, | 246 | .get_timeleft = coh901327_gettimeleft, |
334 | }; | 247 | }; |
335 | 248 | ||
336 | static struct miscdevice coh901327_miscdev = { | 249 | static struct watchdog_device coh901327_wdt = { |
337 | .minor = WATCHDOG_MINOR, | 250 | .info = &coh901327_ident, |
338 | .name = "watchdog", | 251 | .ops = &coh901327_ops, |
339 | .fops = &coh901327_fops, | 252 | /* |
253 | * Max timeout is 327 since the 10ms | ||
254 | * timeout register is max | ||
255 | * 0x7FFF = 327670ms ~= 327s. | ||
256 | */ | ||
257 | .min_timeout = 0, | ||
258 | .max_timeout = 327, | ||
340 | }; | 259 | }; |
341 | 260 | ||
342 | static int __exit coh901327_remove(struct platform_device *pdev) | 261 | static int __exit coh901327_remove(struct platform_device *pdev) |
343 | { | 262 | { |
344 | misc_deregister(&coh901327_miscdev); | 263 | watchdog_unregister_device(&coh901327_wdt); |
345 | coh901327_disable(); | 264 | coh901327_disable(); |
346 | free_irq(irq, pdev); | 265 | free_irq(irq, pdev); |
347 | clk_put(clk); | 266 | clk_put(clk); |
@@ -350,7 +269,6 @@ static int __exit coh901327_remove(struct platform_device *pdev) | |||
350 | return 0; | 269 | return 0; |
351 | } | 270 | } |
352 | 271 | ||
353 | |||
354 | static int __init coh901327_probe(struct platform_device *pdev) | 272 | static int __init coh901327_probe(struct platform_device *pdev) |
355 | { | 273 | { |
356 | int ret; | 274 | int ret; |
@@ -393,7 +311,7 @@ static int __init coh901327_probe(struct platform_device *pdev) | |||
393 | case U300_WDOG_SR_STATUS_TIMED_OUT: | 311 | case U300_WDOG_SR_STATUS_TIMED_OUT: |
394 | dev_info(&pdev->dev, | 312 | dev_info(&pdev->dev, |
395 | "watchdog timed out since last chip reset!\n"); | 313 | "watchdog timed out since last chip reset!\n"); |
396 | boot_status = WDIOF_CARDRESET; | 314 | coh901327_wdt.bootstatus |= WDIOF_CARDRESET; |
397 | /* Status will be cleared below */ | 315 | /* Status will be cleared below */ |
398 | break; | 316 | break; |
399 | case U300_WDOG_SR_STATUS_NORMAL: | 317 | case U300_WDOG_SR_STATUS_NORMAL: |
@@ -435,7 +353,11 @@ static int __init coh901327_probe(struct platform_device *pdev) | |||
435 | 353 | ||
436 | clk_disable(clk); | 354 | clk_disable(clk); |
437 | 355 | ||
438 | ret = misc_register(&coh901327_miscdev); | 356 | if (margin < 1 || margin > 327) |
357 | margin = 60; | ||
358 | coh901327_wdt.timeout = margin; | ||
359 | |||
360 | ret = watchdog_register_device(&coh901327_wdt); | ||
439 | if (ret == 0) | 361 | if (ret == 0) |
440 | dev_info(&pdev->dev, | 362 | dev_info(&pdev->dev, |
441 | "initialized. timer margin=%d sec\n", margin); | 363 | "initialized. timer margin=%d sec\n", margin); |
@@ -543,8 +465,8 @@ module_exit(coh901327_exit); | |||
543 | MODULE_AUTHOR("Linus Walleij <linus.walleij@stericsson.com>"); | 465 | MODULE_AUTHOR("Linus Walleij <linus.walleij@stericsson.com>"); |
544 | MODULE_DESCRIPTION("COH 901 327 Watchdog"); | 466 | MODULE_DESCRIPTION("COH 901 327 Watchdog"); |
545 | 467 | ||
546 | module_param(margin, int, 0); | 468 | module_param(margin, uint, 0); |
547 | MODULE_PARM_DESC(margin, "Watchdog margin in seconds (default 60s)"); | 469 | MODULE_PARM_DESC(margin, "Watchdog margin in seconds (default 60s)"); |
548 | 470 | ||
549 | MODULE_LICENSE("GPL"); | 471 | MODULE_LICENSE("GPL"); |
550 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | 472 | MODULE_ALIAS("platform:coh901327-watchdog"); |
diff --git a/drivers/watchdog/cpu5wdt.c b/drivers/watchdog/cpu5wdt.c index 251c863d71dd..7e888393de1f 100644 --- a/drivers/watchdog/cpu5wdt.c +++ b/drivers/watchdog/cpu5wdt.c | |||
@@ -19,6 +19,8 @@ | |||
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
23 | |||
22 | #include <linux/module.h> | 24 | #include <linux/module.h> |
23 | #include <linux/moduleparam.h> | 25 | #include <linux/moduleparam.h> |
24 | #include <linux/types.h> | 26 | #include <linux/types.h> |
@@ -71,7 +73,7 @@ static struct { | |||
71 | static void cpu5wdt_trigger(unsigned long unused) | 73 | static void cpu5wdt_trigger(unsigned long unused) |
72 | { | 74 | { |
73 | if (verbose > 2) | 75 | if (verbose > 2) |
74 | printk(KERN_DEBUG PFX "trigger at %i ticks\n", ticks); | 76 | pr_debug("trigger at %i ticks\n", ticks); |
75 | 77 | ||
76 | if (cpu5wdt_device.running) | 78 | if (cpu5wdt_device.running) |
77 | ticks--; | 79 | ticks--; |
@@ -96,7 +98,7 @@ static void cpu5wdt_reset(void) | |||
96 | ticks = cpu5wdt_device.default_ticks; | 98 | ticks = cpu5wdt_device.default_ticks; |
97 | 99 | ||
98 | if (verbose) | 100 | if (verbose) |
99 | printk(KERN_DEBUG PFX "reset (%i ticks)\n", (int) ticks); | 101 | pr_debug("reset (%i ticks)\n", (int) ticks); |
100 | 102 | ||
101 | } | 103 | } |
102 | 104 | ||
@@ -129,7 +131,7 @@ static int cpu5wdt_stop(void) | |||
129 | ticks = cpu5wdt_device.default_ticks; | 131 | ticks = cpu5wdt_device.default_ticks; |
130 | spin_unlock_irqrestore(&cpu5wdt_lock, flags); | 132 | spin_unlock_irqrestore(&cpu5wdt_lock, flags); |
131 | if (verbose) | 133 | if (verbose) |
132 | printk(KERN_CRIT PFX "stop not possible\n"); | 134 | pr_crit("stop not possible\n"); |
133 | return -EIO; | 135 | return -EIO; |
134 | } | 136 | } |
135 | 137 | ||
@@ -219,8 +221,7 @@ static int __devinit cpu5wdt_init(void) | |||
219 | int err; | 221 | int err; |
220 | 222 | ||
221 | if (verbose) | 223 | if (verbose) |
222 | printk(KERN_DEBUG PFX | 224 | pr_debug("port=0x%x, verbose=%i\n", port, verbose); |
223 | "port=0x%x, verbose=%i\n", port, verbose); | ||
224 | 225 | ||
225 | init_completion(&cpu5wdt_device.stop); | 226 | init_completion(&cpu5wdt_device.stop); |
226 | cpu5wdt_device.queue = 0; | 227 | cpu5wdt_device.queue = 0; |
@@ -228,7 +229,7 @@ static int __devinit cpu5wdt_init(void) | |||
228 | cpu5wdt_device.default_ticks = ticks; | 229 | cpu5wdt_device.default_ticks = ticks; |
229 | 230 | ||
230 | if (!request_region(port, CPU5WDT_EXTENT, PFX)) { | 231 | if (!request_region(port, CPU5WDT_EXTENT, PFX)) { |
231 | printk(KERN_ERR PFX "request_region failed\n"); | 232 | pr_err("request_region failed\n"); |
232 | err = -EBUSY; | 233 | err = -EBUSY; |
233 | goto no_port; | 234 | goto no_port; |
234 | } | 235 | } |
@@ -237,16 +238,16 @@ static int __devinit cpu5wdt_init(void) | |||
237 | val = inb(port + CPU5WDT_STATUS_REG); | 238 | val = inb(port + CPU5WDT_STATUS_REG); |
238 | val = (val >> 2) & 1; | 239 | val = (val >> 2) & 1; |
239 | if (!val) | 240 | if (!val) |
240 | printk(KERN_INFO PFX "sorry, was my fault\n"); | 241 | pr_info("sorry, was my fault\n"); |
241 | 242 | ||
242 | err = misc_register(&cpu5wdt_misc); | 243 | err = misc_register(&cpu5wdt_misc); |
243 | if (err < 0) { | 244 | if (err < 0) { |
244 | printk(KERN_ERR PFX "misc_register failed\n"); | 245 | pr_err("misc_register failed\n"); |
245 | goto no_misc; | 246 | goto no_misc; |
246 | } | 247 | } |
247 | 248 | ||
248 | 249 | ||
249 | printk(KERN_INFO PFX "init success\n"); | 250 | pr_info("init success\n"); |
250 | return 0; | 251 | return 0; |
251 | 252 | ||
252 | no_misc: | 253 | no_misc: |
diff --git a/drivers/watchdog/cpwd.c b/drivers/watchdog/cpwd.c index 1b793dfd868f..95b1b954de1b 100644 --- a/drivers/watchdog/cpwd.c +++ b/drivers/watchdog/cpwd.c | |||
@@ -14,6 +14,8 @@ | |||
14 | * Copyright (C) 2008 David S. Miller <davem@davemloft.net> | 14 | * Copyright (C) 2008 David S. Miller <davem@davemloft.net> |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
18 | |||
17 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
18 | #include <linux/module.h> | 20 | #include <linux/module.h> |
19 | #include <linux/fs.h> | 21 | #include <linux/fs.h> |
@@ -35,7 +37,6 @@ | |||
35 | #include <asm/watchdog.h> | 37 | #include <asm/watchdog.h> |
36 | 38 | ||
37 | #define DRIVER_NAME "cpwd" | 39 | #define DRIVER_NAME "cpwd" |
38 | #define PFX DRIVER_NAME ": " | ||
39 | 40 | ||
40 | #define WD_OBPNAME "watchdog" | 41 | #define WD_OBPNAME "watchdog" |
41 | #define WD_BADMODEL "SUNW,501-5336" | 42 | #define WD_BADMODEL "SUNW,501-5336" |
@@ -385,8 +386,7 @@ static int cpwd_open(struct inode *inode, struct file *f) | |||
385 | if (!p->initialized) { | 386 | if (!p->initialized) { |
386 | if (request_irq(p->irq, &cpwd_interrupt, | 387 | if (request_irq(p->irq, &cpwd_interrupt, |
387 | IRQF_SHARED, DRIVER_NAME, p)) { | 388 | IRQF_SHARED, DRIVER_NAME, p)) { |
388 | printk(KERN_ERR PFX "Cannot register IRQ %d\n", | 389 | pr_err("Cannot register IRQ %d\n", p->irq); |
389 | p->irq); | ||
390 | mutex_unlock(&cpwd_mutex); | 390 | mutex_unlock(&cpwd_mutex); |
391 | return -EBUSY; | 391 | return -EBUSY; |
392 | } | 392 | } |
@@ -542,7 +542,7 @@ static int __devinit cpwd_probe(struct platform_device *op) | |||
542 | p = kzalloc(sizeof(*p), GFP_KERNEL); | 542 | p = kzalloc(sizeof(*p), GFP_KERNEL); |
543 | err = -ENOMEM; | 543 | err = -ENOMEM; |
544 | if (!p) { | 544 | if (!p) { |
545 | printk(KERN_ERR PFX "Unable to allocate struct cpwd.\n"); | 545 | pr_err("Unable to allocate struct cpwd\n"); |
546 | goto out; | 546 | goto out; |
547 | } | 547 | } |
548 | 548 | ||
@@ -553,14 +553,14 @@ static int __devinit cpwd_probe(struct platform_device *op) | |||
553 | p->regs = of_ioremap(&op->resource[0], 0, | 553 | p->regs = of_ioremap(&op->resource[0], 0, |
554 | 4 * WD_TIMER_REGSZ, DRIVER_NAME); | 554 | 4 * WD_TIMER_REGSZ, DRIVER_NAME); |
555 | if (!p->regs) { | 555 | if (!p->regs) { |
556 | printk(KERN_ERR PFX "Unable to map registers.\n"); | 556 | pr_err("Unable to map registers\n"); |
557 | goto out_free; | 557 | goto out_free; |
558 | } | 558 | } |
559 | 559 | ||
560 | options = of_find_node_by_path("/options"); | 560 | options = of_find_node_by_path("/options"); |
561 | err = -ENODEV; | 561 | err = -ENODEV; |
562 | if (!options) { | 562 | if (!options) { |
563 | printk(KERN_ERR PFX "Unable to find /options node.\n"); | 563 | pr_err("Unable to find /options node\n"); |
564 | goto out_iounmap; | 564 | goto out_iounmap; |
565 | } | 565 | } |
566 | 566 | ||
@@ -605,8 +605,8 @@ static int __devinit cpwd_probe(struct platform_device *op) | |||
605 | 605 | ||
606 | err = misc_register(&p->devs[i].misc); | 606 | err = misc_register(&p->devs[i].misc); |
607 | if (err) { | 607 | if (err) { |
608 | printk(KERN_ERR "Could not register misc device for " | 608 | pr_err("Could not register misc device for dev %d\n", |
609 | "dev %d\n", i); | 609 | i); |
610 | goto out_unregister; | 610 | goto out_unregister; |
611 | } | 611 | } |
612 | } | 612 | } |
@@ -617,8 +617,8 @@ static int __devinit cpwd_probe(struct platform_device *op) | |||
617 | cpwd_timer.data = (unsigned long) p; | 617 | cpwd_timer.data = (unsigned long) p; |
618 | cpwd_timer.expires = WD_BTIMEOUT; | 618 | cpwd_timer.expires = WD_BTIMEOUT; |
619 | 619 | ||
620 | printk(KERN_INFO PFX "PLD defect workaround enabled for " | 620 | pr_info("PLD defect workaround enabled for model %s\n", |
621 | "model " WD_BADMODEL ".\n"); | 621 | WD_BADMODEL); |
622 | } | 622 | } |
623 | 623 | ||
624 | dev_set_drvdata(&op->dev, p); | 624 | dev_set_drvdata(&op->dev, p); |
diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c index 63d7b58f1c7d..06de1211a444 100644 --- a/drivers/watchdog/dw_wdt.c +++ b/drivers/watchdog/dw_wdt.c | |||
@@ -16,7 +16,8 @@ | |||
16 | * If we receive an expected close for the watchdog then we keep the timer | 16 | * If we receive an expected close for the watchdog then we keep the timer |
17 | * running, otherwise the timer is stopped and the watchdog will expire. | 17 | * running, otherwise the timer is stopped and the watchdog will expire. |
18 | */ | 18 | */ |
19 | #define pr_fmt(fmt) "dw_wdt: " fmt | 19 | |
20 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
20 | 21 | ||
21 | #include <linux/bitops.h> | 22 | #include <linux/bitops.h> |
22 | #include <linux/clk.h> | 23 | #include <linux/clk.h> |
@@ -45,8 +46,8 @@ | |||
45 | /* The maximum TOP (timeout period) value that can be set in the watchdog. */ | 46 | /* The maximum TOP (timeout period) value that can be set in the watchdog. */ |
46 | #define DW_WDT_MAX_TOP 15 | 47 | #define DW_WDT_MAX_TOP 15 |
47 | 48 | ||
48 | static int nowayout = WATCHDOG_NOWAYOUT; | 49 | static bool nowayout = WATCHDOG_NOWAYOUT; |
49 | module_param(nowayout, int, 0); | 50 | module_param(nowayout, bool, 0); |
50 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started " | 51 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started " |
51 | "(default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 52 | "(default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
52 | 53 | ||
diff --git a/drivers/watchdog/ep93xx_wdt.c b/drivers/watchdog/ep93xx_wdt.c index 09cd888db619..77050037597a 100644 --- a/drivers/watchdog/ep93xx_wdt.c +++ b/drivers/watchdog/ep93xx_wdt.c | |||
@@ -8,6 +8,9 @@ | |||
8 | * Authors: Ray Lehtiniemi <rayl@mail.com>, | 8 | * Authors: Ray Lehtiniemi <rayl@mail.com>, |
9 | * Alessandro Zummo <a.zummo@towertech.it> | 9 | * Alessandro Zummo <a.zummo@towertech.it> |
10 | * | 10 | * |
11 | * Copyright (c) 2012 H Hartley Sweeten <hsweeten@visionengravers.com> | ||
12 | * Convert to a platform device and use the watchdog framework API | ||
13 | * | ||
11 | * This file is licensed under the terms of the GNU General Public | 14 | * This file is licensed under the terms of the GNU General Public |
12 | * License version 2. This program is licensed "as is" without any | 15 | * License version 2. This program is licensed "as is" without any |
13 | * warranty of any kind, whether express or implied. | 16 | * warranty of any kind, whether express or implied. |
@@ -25,187 +28,90 @@ | |||
25 | 28 | ||
26 | #include <linux/platform_device.h> | 29 | #include <linux/platform_device.h> |
27 | #include <linux/module.h> | 30 | #include <linux/module.h> |
28 | #include <linux/fs.h> | ||
29 | #include <linux/miscdevice.h> | 31 | #include <linux/miscdevice.h> |
30 | #include <linux/watchdog.h> | 32 | #include <linux/watchdog.h> |
31 | #include <linux/timer.h> | 33 | #include <linux/timer.h> |
32 | #include <linux/uaccess.h> | ||
33 | #include <linux/io.h> | 34 | #include <linux/io.h> |
34 | 35 | ||
35 | #define WDT_VERSION "0.3" | 36 | #define WDT_VERSION "0.4" |
36 | #define PFX "ep93xx_wdt: " | ||
37 | 37 | ||
38 | /* default timeout (secs) */ | 38 | /* default timeout (secs) */ |
39 | #define WDT_TIMEOUT 30 | 39 | #define WDT_TIMEOUT 30 |
40 | 40 | ||
41 | static int nowayout = WATCHDOG_NOWAYOUT; | 41 | static bool nowayout = WATCHDOG_NOWAYOUT; |
42 | static int timeout = WDT_TIMEOUT; | 42 | module_param(nowayout, bool, 0); |
43 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started"); | ||
44 | |||
45 | static unsigned int timeout = WDT_TIMEOUT; | ||
46 | module_param(timeout, uint, 0); | ||
47 | MODULE_PARM_DESC(timeout, | ||
48 | "Watchdog timeout in seconds. (1<=timeout<=3600, default=" | ||
49 | __MODULE_STRING(WDT_TIMEOUT) ")"); | ||
43 | 50 | ||
44 | static void __iomem *mmio_base; | 51 | static void __iomem *mmio_base; |
45 | static struct timer_list timer; | 52 | static struct timer_list timer; |
46 | static unsigned long next_heartbeat; | 53 | static unsigned long next_heartbeat; |
47 | static unsigned long wdt_status; | ||
48 | static unsigned long boot_status; | ||
49 | |||
50 | #define WDT_IN_USE 0 | ||
51 | #define WDT_OK_TO_CLOSE 1 | ||
52 | 54 | ||
53 | #define EP93XX_WATCHDOG 0x00 | 55 | #define EP93XX_WATCHDOG 0x00 |
54 | #define EP93XX_WDSTATUS 0x04 | 56 | #define EP93XX_WDSTATUS 0x04 |
55 | 57 | ||
56 | /* reset the wdt every ~200ms */ | 58 | /* reset the wdt every ~200ms - the heartbeat of the device is 0.250 seconds*/ |
57 | #define WDT_INTERVAL (HZ/5) | 59 | #define WDT_INTERVAL (HZ/5) |
58 | 60 | ||
59 | static void wdt_enable(void) | 61 | static void ep93xx_wdt_timer_ping(unsigned long data) |
60 | { | 62 | { |
61 | writel(0xaaaa, mmio_base + EP93XX_WATCHDOG); | 63 | if (time_before(jiffies, next_heartbeat)) |
62 | } | 64 | writel(0x5555, mmio_base + EP93XX_WATCHDOG); |
63 | |||
64 | static void wdt_disable(void) | ||
65 | { | ||
66 | writel(0xaa55, mmio_base + EP93XX_WATCHDOG); | ||
67 | } | ||
68 | 65 | ||
69 | static inline void wdt_ping(void) | 66 | /* Re-set the timer interval */ |
70 | { | 67 | mod_timer(&timer, jiffies + WDT_INTERVAL); |
71 | writel(0x5555, mmio_base + EP93XX_WATCHDOG); | ||
72 | } | 68 | } |
73 | 69 | ||
74 | static void wdt_startup(void) | 70 | static int ep93xx_wdt_start(struct watchdog_device *wdd) |
75 | { | 71 | { |
76 | next_heartbeat = jiffies + (timeout * HZ); | 72 | next_heartbeat = jiffies + (timeout * HZ); |
77 | 73 | ||
78 | wdt_enable(); | 74 | writel(0xaaaa, mmio_base + EP93XX_WATCHDOG); |
79 | mod_timer(&timer, jiffies + WDT_INTERVAL); | 75 | mod_timer(&timer, jiffies + WDT_INTERVAL); |
76 | |||
77 | return 0; | ||
80 | } | 78 | } |
81 | 79 | ||
82 | static void wdt_shutdown(void) | 80 | static int ep93xx_wdt_stop(struct watchdog_device *wdd) |
83 | { | 81 | { |
84 | del_timer_sync(&timer); | 82 | del_timer_sync(&timer); |
85 | wdt_disable(); | 83 | writel(0xaa55, mmio_base + EP93XX_WATCHDOG); |
84 | |||
85 | return 0; | ||
86 | } | 86 | } |
87 | 87 | ||
88 | static void wdt_keepalive(void) | 88 | static int ep93xx_wdt_keepalive(struct watchdog_device *wdd) |
89 | { | 89 | { |
90 | /* user land ping */ | 90 | /* user land ping */ |
91 | next_heartbeat = jiffies + (timeout * HZ); | 91 | next_heartbeat = jiffies + (timeout * HZ); |
92 | } | ||
93 | |||
94 | static int ep93xx_wdt_open(struct inode *inode, struct file *file) | ||
95 | { | ||
96 | if (test_and_set_bit(WDT_IN_USE, &wdt_status)) | ||
97 | return -EBUSY; | ||
98 | |||
99 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); | ||
100 | |||
101 | wdt_startup(); | ||
102 | |||
103 | return nonseekable_open(inode, file); | ||
104 | } | ||
105 | |||
106 | static ssize_t | ||
107 | ep93xx_wdt_write(struct file *file, const char __user *data, size_t len, | ||
108 | loff_t *ppos) | ||
109 | { | ||
110 | if (len) { | ||
111 | if (!nowayout) { | ||
112 | size_t i; | ||
113 | |||
114 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); | ||
115 | |||
116 | for (i = 0; i != len; i++) { | ||
117 | char c; | ||
118 | |||
119 | if (get_user(c, data + i)) | ||
120 | return -EFAULT; | ||
121 | |||
122 | if (c == 'V') | ||
123 | set_bit(WDT_OK_TO_CLOSE, &wdt_status); | ||
124 | else | ||
125 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); | ||
126 | } | ||
127 | } | ||
128 | wdt_keepalive(); | ||
129 | } | ||
130 | 92 | ||
131 | return len; | 93 | return 0; |
132 | } | 94 | } |
133 | 95 | ||
134 | static const struct watchdog_info ident = { | 96 | static const struct watchdog_info ep93xx_wdt_ident = { |
135 | .options = WDIOF_CARDRESET | WDIOF_MAGICCLOSE, | 97 | .options = WDIOF_CARDRESET | |
136 | .identity = "EP93xx Watchdog", | 98 | WDIOF_MAGICCLOSE | |
99 | WDIOF_KEEPALIVEPING, | ||
100 | .identity = "EP93xx Watchdog", | ||
137 | }; | 101 | }; |
138 | 102 | ||
139 | static long ep93xx_wdt_ioctl(struct file *file, | 103 | static struct watchdog_ops ep93xx_wdt_ops = { |
140 | unsigned int cmd, unsigned long arg) | ||
141 | { | ||
142 | int ret = -ENOTTY; | ||
143 | |||
144 | switch (cmd) { | ||
145 | case WDIOC_GETSUPPORT: | ||
146 | ret = copy_to_user((struct watchdog_info __user *)arg, &ident, | ||
147 | sizeof(ident)) ? -EFAULT : 0; | ||
148 | break; | ||
149 | |||
150 | case WDIOC_GETSTATUS: | ||
151 | ret = put_user(0, (int __user *)arg); | ||
152 | break; | ||
153 | |||
154 | case WDIOC_GETBOOTSTATUS: | ||
155 | ret = put_user(boot_status, (int __user *)arg); | ||
156 | break; | ||
157 | |||
158 | case WDIOC_KEEPALIVE: | ||
159 | wdt_keepalive(); | ||
160 | ret = 0; | ||
161 | break; | ||
162 | |||
163 | case WDIOC_GETTIMEOUT: | ||
164 | /* actually, it is 0.250 seconds.... */ | ||
165 | ret = put_user(1, (int __user *)arg); | ||
166 | break; | ||
167 | } | ||
168 | return ret; | ||
169 | } | ||
170 | |||
171 | static int ep93xx_wdt_release(struct inode *inode, struct file *file) | ||
172 | { | ||
173 | if (test_bit(WDT_OK_TO_CLOSE, &wdt_status)) | ||
174 | wdt_shutdown(); | ||
175 | else | ||
176 | printk(KERN_CRIT PFX | ||
177 | "Device closed unexpectedly - timer will not stop\n"); | ||
178 | |||
179 | clear_bit(WDT_IN_USE, &wdt_status); | ||
180 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); | ||
181 | |||
182 | return 0; | ||
183 | } | ||
184 | |||
185 | static const struct file_operations ep93xx_wdt_fops = { | ||
186 | .owner = THIS_MODULE, | 104 | .owner = THIS_MODULE, |
187 | .write = ep93xx_wdt_write, | 105 | .start = ep93xx_wdt_start, |
188 | .unlocked_ioctl = ep93xx_wdt_ioctl, | 106 | .stop = ep93xx_wdt_stop, |
189 | .open = ep93xx_wdt_open, | 107 | .ping = ep93xx_wdt_keepalive, |
190 | .release = ep93xx_wdt_release, | ||
191 | .llseek = no_llseek, | ||
192 | }; | 108 | }; |
193 | 109 | ||
194 | static struct miscdevice ep93xx_wdt_miscdev = { | 110 | static struct watchdog_device ep93xx_wdt_wdd = { |
195 | .minor = WATCHDOG_MINOR, | 111 | .info = &ep93xx_wdt_ident, |
196 | .name = "watchdog", | 112 | .ops = &ep93xx_wdt_ops, |
197 | .fops = &ep93xx_wdt_fops, | ||
198 | }; | 113 | }; |
199 | 114 | ||
200 | static void ep93xx_timer_ping(unsigned long data) | ||
201 | { | ||
202 | if (time_before(jiffies, next_heartbeat)) | ||
203 | wdt_ping(); | ||
204 | |||
205 | /* Re-set the timer interval */ | ||
206 | mod_timer(&timer, jiffies + WDT_INTERVAL); | ||
207 | } | ||
208 | |||
209 | static int __devinit ep93xx_wdt_probe(struct platform_device *pdev) | 115 | static int __devinit ep93xx_wdt_probe(struct platform_device *pdev) |
210 | { | 116 | { |
211 | struct resource *res; | 117 | struct resource *res; |
@@ -224,30 +130,35 @@ static int __devinit ep93xx_wdt_probe(struct platform_device *pdev) | |||
224 | if (!mmio_base) | 130 | if (!mmio_base) |
225 | return -ENXIO; | 131 | return -ENXIO; |
226 | 132 | ||
227 | err = misc_register(&ep93xx_wdt_miscdev); | ||
228 | |||
229 | val = readl(mmio_base + EP93XX_WATCHDOG); | ||
230 | boot_status = val & 0x01 ? 1 : 0; | ||
231 | |||
232 | printk(KERN_INFO PFX "EP93XX watchdog, driver version " | ||
233 | WDT_VERSION "%s\n", | ||
234 | (val & 0x08) ? " (nCS1 disable detected)" : ""); | ||
235 | |||
236 | if (timeout < 1 || timeout > 3600) { | 133 | if (timeout < 1 || timeout > 3600) { |
237 | timeout = WDT_TIMEOUT; | 134 | timeout = WDT_TIMEOUT; |
238 | printk(KERN_INFO PFX | 135 | dev_warn(&pdev->dev, |
239 | "timeout value must be 1<=x<=3600, using %d\n", | 136 | "timeout value must be 1<=x<=3600, using %d\n", |
240 | timeout); | 137 | timeout); |
241 | } | 138 | } |
242 | 139 | ||
243 | setup_timer(&timer, ep93xx_timer_ping, 1); | 140 | val = readl(mmio_base + EP93XX_WATCHDOG); |
244 | return err; | 141 | ep93xx_wdt_wdd.bootstatus = (val & 0x01) ? WDIOF_CARDRESET : 0; |
142 | ep93xx_wdt_wdd.timeout = timeout; | ||
143 | |||
144 | watchdog_set_nowayout(&ep93xx_wdt_wdd, nowayout); | ||
145 | |||
146 | setup_timer(&timer, ep93xx_wdt_timer_ping, 1); | ||
147 | |||
148 | err = watchdog_register_device(&ep93xx_wdt_wdd); | ||
149 | if (err) | ||
150 | return err; | ||
151 | |||
152 | dev_info(&pdev->dev, | ||
153 | "EP93XX watchdog, driver version " WDT_VERSION "%s\n", | ||
154 | (val & 0x08) ? " (nCS1 disable detected)" : ""); | ||
155 | |||
156 | return 0; | ||
245 | } | 157 | } |
246 | 158 | ||
247 | static int __devexit ep93xx_wdt_remove(struct platform_device *pdev) | 159 | static int __devexit ep93xx_wdt_remove(struct platform_device *pdev) |
248 | { | 160 | { |
249 | wdt_shutdown(); | 161 | watchdog_unregister_device(&ep93xx_wdt_wdd); |
250 | misc_deregister(&ep93xx_wdt_miscdev); | ||
251 | return 0; | 162 | return 0; |
252 | } | 163 | } |
253 | 164 | ||
@@ -262,16 +173,9 @@ static struct platform_driver ep93xx_wdt_driver = { | |||
262 | 173 | ||
263 | module_platform_driver(ep93xx_wdt_driver); | 174 | module_platform_driver(ep93xx_wdt_driver); |
264 | 175 | ||
265 | module_param(nowayout, int, 0); | ||
266 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started"); | ||
267 | |||
268 | module_param(timeout, int, 0); | ||
269 | MODULE_PARM_DESC(timeout, | ||
270 | "Watchdog timeout in seconds. (1<=timeout<=3600, default=" | ||
271 | __MODULE_STRING(WDT_TIMEOUT) ")"); | ||
272 | |||
273 | MODULE_AUTHOR("Ray Lehtiniemi <rayl@mail.com>," | 176 | MODULE_AUTHOR("Ray Lehtiniemi <rayl@mail.com>," |
274 | "Alessandro Zummo <a.zummo@towertech.it>"); | 177 | "Alessandro Zummo <a.zummo@towertech.it>," |
178 | "H Hartley Sweeten <hsweeten@visionengravers.com>"); | ||
275 | MODULE_DESCRIPTION("EP93xx Watchdog"); | 179 | MODULE_DESCRIPTION("EP93xx Watchdog"); |
276 | MODULE_LICENSE("GPL"); | 180 | MODULE_LICENSE("GPL"); |
277 | MODULE_VERSION(WDT_VERSION); | 181 | MODULE_VERSION(WDT_VERSION); |
diff --git a/drivers/watchdog/eurotechwdt.c b/drivers/watchdog/eurotechwdt.c index 3946c51099c0..0c60af14ac65 100644 --- a/drivers/watchdog/eurotechwdt.c +++ b/drivers/watchdog/eurotechwdt.c | |||
@@ -45,6 +45,8 @@ | |||
45 | * of the on-board SUPER I/O device SMSC FDC 37B782. | 45 | * of the on-board SUPER I/O device SMSC FDC 37B782. |
46 | */ | 46 | */ |
47 | 47 | ||
48 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
49 | |||
48 | #include <linux/interrupt.h> | 50 | #include <linux/interrupt.h> |
49 | #include <linux/module.h> | 51 | #include <linux/module.h> |
50 | #include <linux/moduleparam.h> | 52 | #include <linux/moduleparam.h> |
@@ -76,8 +78,8 @@ static char *ev = "int"; | |||
76 | 78 | ||
77 | #define WDT_TIMEOUT 60 /* 1 minute */ | 79 | #define WDT_TIMEOUT 60 /* 1 minute */ |
78 | 80 | ||
79 | static int nowayout = WATCHDOG_NOWAYOUT; | 81 | static bool nowayout = WATCHDOG_NOWAYOUT; |
80 | module_param(nowayout, int, 0); | 82 | module_param(nowayout, bool, 0); |
81 | MODULE_PARM_DESC(nowayout, | 83 | MODULE_PARM_DESC(nowayout, |
82 | "Watchdog cannot be stopped once started (default=" | 84 | "Watchdog cannot be stopped once started (default=" |
83 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 85 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
@@ -144,11 +146,11 @@ static void eurwdt_activate_timer(void) | |||
144 | 146 | ||
145 | /* Setting interrupt line */ | 147 | /* Setting interrupt line */ |
146 | if (irq == 2 || irq > 15 || irq < 0) { | 148 | if (irq == 2 || irq > 15 || irq < 0) { |
147 | printk(KERN_ERR ": invalid irq number\n"); | 149 | pr_err("invalid irq number\n"); |
148 | irq = 0; /* if invalid we disable interrupt */ | 150 | irq = 0; /* if invalid we disable interrupt */ |
149 | } | 151 | } |
150 | if (irq == 0) | 152 | if (irq == 0) |
151 | printk(KERN_INFO ": interrupt disabled\n"); | 153 | pr_info("interrupt disabled\n"); |
152 | 154 | ||
153 | eurwdt_write_reg(WDT_TIMER_CFG, irq << 4); | 155 | eurwdt_write_reg(WDT_TIMER_CFG, irq << 4); |
154 | 156 | ||
@@ -163,12 +165,12 @@ static void eurwdt_activate_timer(void) | |||
163 | 165 | ||
164 | static irqreturn_t eurwdt_interrupt(int irq, void *dev_id) | 166 | static irqreturn_t eurwdt_interrupt(int irq, void *dev_id) |
165 | { | 167 | { |
166 | printk(KERN_CRIT "timeout WDT timeout\n"); | 168 | pr_crit("timeout WDT timeout\n"); |
167 | 169 | ||
168 | #ifdef ONLY_TESTING | 170 | #ifdef ONLY_TESTING |
169 | printk(KERN_CRIT "Would Reboot.\n"); | 171 | pr_crit("Would Reboot\n"); |
170 | #else | 172 | #else |
171 | printk(KERN_CRIT "Initiating system reboot.\n"); | 173 | pr_crit("Initiating system reboot\n"); |
172 | emergency_restart(); | 174 | emergency_restart(); |
173 | #endif | 175 | #endif |
174 | return IRQ_HANDLED; | 176 | return IRQ_HANDLED; |
@@ -335,8 +337,7 @@ static int eurwdt_release(struct inode *inode, struct file *file) | |||
335 | if (eur_expect_close == 42) | 337 | if (eur_expect_close == 42) |
336 | eurwdt_disable_timer(); | 338 | eurwdt_disable_timer(); |
337 | else { | 339 | else { |
338 | printk(KERN_CRIT | 340 | pr_crit("Unexpected close, not stopping watchdog!\n"); |
339 | "eurwdt: Unexpected close, not stopping watchdog!\n"); | ||
340 | eurwdt_ping(); | 341 | eurwdt_ping(); |
341 | } | 342 | } |
342 | clear_bit(0, &eurwdt_is_open); | 343 | clear_bit(0, &eurwdt_is_open); |
@@ -429,35 +430,32 @@ static int __init eurwdt_init(void) | |||
429 | 430 | ||
430 | ret = request_irq(irq, eurwdt_interrupt, 0, "eurwdt", NULL); | 431 | ret = request_irq(irq, eurwdt_interrupt, 0, "eurwdt", NULL); |
431 | if (ret) { | 432 | if (ret) { |
432 | printk(KERN_ERR "eurwdt: IRQ %d is not free.\n", irq); | 433 | pr_err("IRQ %d is not free\n", irq); |
433 | goto out; | 434 | goto out; |
434 | } | 435 | } |
435 | 436 | ||
436 | if (!request_region(io, 2, "eurwdt")) { | 437 | if (!request_region(io, 2, "eurwdt")) { |
437 | printk(KERN_ERR "eurwdt: IO %X is not free.\n", io); | 438 | pr_err("IO %X is not free\n", io); |
438 | ret = -EBUSY; | 439 | ret = -EBUSY; |
439 | goto outirq; | 440 | goto outirq; |
440 | } | 441 | } |
441 | 442 | ||
442 | ret = register_reboot_notifier(&eurwdt_notifier); | 443 | ret = register_reboot_notifier(&eurwdt_notifier); |
443 | if (ret) { | 444 | if (ret) { |
444 | printk(KERN_ERR | 445 | pr_err("can't register reboot notifier (err=%d)\n", ret); |
445 | "eurwdt: can't register reboot notifier (err=%d)\n", ret); | ||
446 | goto outreg; | 446 | goto outreg; |
447 | } | 447 | } |
448 | 448 | ||
449 | ret = misc_register(&eurwdt_miscdev); | 449 | ret = misc_register(&eurwdt_miscdev); |
450 | if (ret) { | 450 | if (ret) { |
451 | printk(KERN_ERR "eurwdt: can't misc_register on minor=%d\n", | 451 | pr_err("can't misc_register on minor=%d\n", WATCHDOG_MINOR); |
452 | WATCHDOG_MINOR); | ||
453 | goto outreboot; | 452 | goto outreboot; |
454 | } | 453 | } |
455 | 454 | ||
456 | eurwdt_unlock_chip(); | 455 | eurwdt_unlock_chip(); |
457 | 456 | ||
458 | ret = 0; | 457 | ret = 0; |
459 | printk(KERN_INFO "Eurotech WDT driver 0.01 at %X (Interrupt %d)" | 458 | pr_info("Eurotech WDT driver 0.01 at %X (Interrupt %d) - timeout event: %s\n", |
460 | " - timeout event: %s\n", | ||
461 | io, irq, (!strcmp("int", ev) ? "int" : "reboot")); | 459 | io, irq, (!strcmp("int", ev) ? "int" : "reboot")); |
462 | 460 | ||
463 | out: | 461 | out: |
diff --git a/drivers/watchdog/f71808e_wdt.c b/drivers/watchdog/f71808e_wdt.c index e45ca2b4bfbe..c65b0a5a020c 100644 --- a/drivers/watchdog/f71808e_wdt.c +++ b/drivers/watchdog/f71808e_wdt.c | |||
@@ -19,6 +19,8 @@ | |||
19 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * | 19 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
20 | ***************************************************************************/ | 20 | ***************************************************************************/ |
21 | 21 | ||
22 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
23 | |||
22 | #include <linux/err.h> | 24 | #include <linux/err.h> |
23 | #include <linux/fs.h> | 25 | #include <linux/fs.h> |
24 | #include <linux/init.h> | 26 | #include <linux/init.h> |
@@ -189,8 +191,7 @@ static inline int superio_enter(int base) | |||
189 | { | 191 | { |
190 | /* Don't step on other drivers' I/O space by accident */ | 192 | /* Don't step on other drivers' I/O space by accident */ |
191 | if (!request_muxed_region(base, 2, DRVNAME)) { | 193 | if (!request_muxed_region(base, 2, DRVNAME)) { |
192 | printk(KERN_ERR DRVNAME ": I/O address 0x%04x already in use\n", | 194 | pr_err("I/O address 0x%04x already in use\n", (int)base); |
193 | (int)base); | ||
194 | return -EBUSY; | 195 | return -EBUSY; |
195 | } | 196 | } |
196 | 197 | ||
@@ -217,7 +218,7 @@ static int watchdog_set_timeout(int timeout) | |||
217 | { | 218 | { |
218 | if (timeout <= 0 | 219 | if (timeout <= 0 |
219 | || timeout > max_timeout) { | 220 | || timeout > max_timeout) { |
220 | printk(KERN_ERR DRVNAME ": watchdog timeout out of range\n"); | 221 | pr_err("watchdog timeout out of range\n"); |
221 | return -EINVAL; | 222 | return -EINVAL; |
222 | } | 223 | } |
223 | 224 | ||
@@ -252,7 +253,7 @@ static int watchdog_set_pulse_width(unsigned int pw) | |||
252 | } else if (pw <= 5000) { | 253 | } else if (pw <= 5000) { |
253 | watchdog.pulse_val = 3; | 254 | watchdog.pulse_val = 3; |
254 | } else { | 255 | } else { |
255 | printk(KERN_ERR DRVNAME ": pulse width out of range\n"); | 256 | pr_err("pulse width out of range\n"); |
256 | err = -EINVAL; | 257 | err = -EINVAL; |
257 | goto exit_unlock; | 258 | goto exit_unlock; |
258 | } | 259 | } |
@@ -309,8 +310,7 @@ static int f71862fg_pin_configure(unsigned short ioaddr) | |||
309 | if (ioaddr) | 310 | if (ioaddr) |
310 | superio_set_bit(ioaddr, SIO_REG_MFUNCT1, 1); | 311 | superio_set_bit(ioaddr, SIO_REG_MFUNCT1, 1); |
311 | } else { | 312 | } else { |
312 | printk(KERN_ERR DRVNAME ": Invalid argument f71862fg_pin=%d\n", | 313 | pr_err("Invalid argument f71862fg_pin=%d\n", f71862fg_pin); |
313 | f71862fg_pin); | ||
314 | return -EINVAL; | 314 | return -EINVAL; |
315 | } | 315 | } |
316 | return 0; | 316 | return 0; |
@@ -487,8 +487,7 @@ static int watchdog_release(struct inode *inode, struct file *file) | |||
487 | 487 | ||
488 | if (!watchdog.expect_close) { | 488 | if (!watchdog.expect_close) { |
489 | watchdog_keepalive(); | 489 | watchdog_keepalive(); |
490 | printk(KERN_CRIT DRVNAME | 490 | pr_crit("Unexpected close, not stopping watchdog!\n"); |
491 | ": Unexpected close, not stopping watchdog!\n"); | ||
492 | } else if (!nowayout) { | 491 | } else if (!nowayout) { |
493 | watchdog_stop(); | 492 | watchdog_stop(); |
494 | } | 493 | } |
@@ -672,25 +671,22 @@ static int __init watchdog_init(int sioaddr) | |||
672 | 671 | ||
673 | err = misc_register(&watchdog_miscdev); | 672 | err = misc_register(&watchdog_miscdev); |
674 | if (err) { | 673 | if (err) { |
675 | printk(KERN_ERR DRVNAME | 674 | pr_err("cannot register miscdev on minor=%d\n", |
676 | ": cannot register miscdev on minor=%d\n", | 675 | watchdog_miscdev.minor); |
677 | watchdog_miscdev.minor); | ||
678 | goto exit_reboot; | 676 | goto exit_reboot; |
679 | } | 677 | } |
680 | 678 | ||
681 | if (start_withtimeout) { | 679 | if (start_withtimeout) { |
682 | if (start_withtimeout <= 0 | 680 | if (start_withtimeout <= 0 |
683 | || start_withtimeout > max_timeout) { | 681 | || start_withtimeout > max_timeout) { |
684 | printk(KERN_ERR DRVNAME | 682 | pr_err("starting timeout out of range\n"); |
685 | ": starting timeout out of range\n"); | ||
686 | err = -EINVAL; | 683 | err = -EINVAL; |
687 | goto exit_miscdev; | 684 | goto exit_miscdev; |
688 | } | 685 | } |
689 | 686 | ||
690 | err = watchdog_start(); | 687 | err = watchdog_start(); |
691 | if (err) { | 688 | if (err) { |
692 | printk(KERN_ERR DRVNAME | 689 | pr_err("cannot start watchdog timer\n"); |
693 | ": cannot start watchdog timer\n"); | ||
694 | goto exit_miscdev; | 690 | goto exit_miscdev; |
695 | } | 691 | } |
696 | 692 | ||
@@ -720,8 +716,7 @@ static int __init watchdog_init(int sioaddr) | |||
720 | if (nowayout) | 716 | if (nowayout) |
721 | __module_get(THIS_MODULE); | 717 | __module_get(THIS_MODULE); |
722 | 718 | ||
723 | printk(KERN_INFO DRVNAME | 719 | pr_info("watchdog started with initial timeout of %u sec\n", |
724 | ": watchdog started with initial timeout of %u sec\n", | ||
725 | start_withtimeout); | 720 | start_withtimeout); |
726 | } | 721 | } |
727 | 722 | ||
@@ -746,7 +741,7 @@ static int __init f71808e_find(int sioaddr) | |||
746 | 741 | ||
747 | devid = superio_inw(sioaddr, SIO_REG_MANID); | 742 | devid = superio_inw(sioaddr, SIO_REG_MANID); |
748 | if (devid != SIO_FINTEK_ID) { | 743 | if (devid != SIO_FINTEK_ID) { |
749 | pr_debug(DRVNAME ": Not a Fintek device\n"); | 744 | pr_debug("Not a Fintek device\n"); |
750 | err = -ENODEV; | 745 | err = -ENODEV; |
751 | goto exit; | 746 | goto exit; |
752 | } | 747 | } |
@@ -774,13 +769,13 @@ static int __init f71808e_find(int sioaddr) | |||
774 | err = -ENODEV; | 769 | err = -ENODEV; |
775 | goto exit; | 770 | goto exit; |
776 | default: | 771 | default: |
777 | printk(KERN_INFO DRVNAME ": Unrecognized Fintek device: %04x\n", | 772 | pr_info("Unrecognized Fintek device: %04x\n", |
778 | (unsigned int)devid); | 773 | (unsigned int)devid); |
779 | err = -ENODEV; | 774 | err = -ENODEV; |
780 | goto exit; | 775 | goto exit; |
781 | } | 776 | } |
782 | 777 | ||
783 | printk(KERN_INFO DRVNAME ": Found %s watchdog chip, revision %d\n", | 778 | pr_info("Found %s watchdog chip, revision %d\n", |
784 | f71808e_names[watchdog.type], | 779 | f71808e_names[watchdog.type], |
785 | (int)superio_inb(sioaddr, SIO_REG_DEVREV)); | 780 | (int)superio_inb(sioaddr, SIO_REG_DEVREV)); |
786 | exit: | 781 | exit: |
@@ -808,8 +803,7 @@ static int __init f71808e_init(void) | |||
808 | static void __exit f71808e_exit(void) | 803 | static void __exit f71808e_exit(void) |
809 | { | 804 | { |
810 | if (watchdog_is_running()) { | 805 | if (watchdog_is_running()) { |
811 | printk(KERN_WARNING DRVNAME | 806 | pr_warn("Watchdog timer still running, stopping it\n"); |
812 | ": Watchdog timer still running, stopping it\n"); | ||
813 | watchdog_stop(); | 807 | watchdog_stop(); |
814 | } | 808 | } |
815 | misc_deregister(&watchdog_miscdev); | 809 | misc_deregister(&watchdog_miscdev); |
diff --git a/drivers/watchdog/gef_wdt.c b/drivers/watchdog/gef_wdt.c index b146082bd85a..17f4cae770c6 100644 --- a/drivers/watchdog/gef_wdt.c +++ b/drivers/watchdog/gef_wdt.c | |||
@@ -24,6 +24,8 @@ | |||
24 | * capabilities) a kernel-based watchdog. | 24 | * capabilities) a kernel-based watchdog. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
28 | |||
27 | #include <linux/kernel.h> | 29 | #include <linux/kernel.h> |
28 | #include <linux/compiler.h> | 30 | #include <linux/compiler.h> |
29 | #include <linux/init.h> | 31 | #include <linux/init.h> |
@@ -68,8 +70,8 @@ static unsigned int bus_clk; | |||
68 | static char expect_close; | 70 | static char expect_close; |
69 | static DEFINE_SPINLOCK(gef_wdt_spinlock); | 71 | static DEFINE_SPINLOCK(gef_wdt_spinlock); |
70 | 72 | ||
71 | static int nowayout = WATCHDOG_NOWAYOUT; | 73 | static bool nowayout = WATCHDOG_NOWAYOUT; |
72 | module_param(nowayout, int, 0); | 74 | module_param(nowayout, bool, 0); |
73 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" | 75 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" |
74 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 76 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
75 | 77 | ||
@@ -110,7 +112,7 @@ static void gef_wdt_handler_enable(void) | |||
110 | if (gef_wdt_toggle_wdc(GEF_WDC_ENABLED_FALSE, | 112 | if (gef_wdt_toggle_wdc(GEF_WDC_ENABLED_FALSE, |
111 | GEF_WDC_ENABLE_SHIFT)) { | 113 | GEF_WDC_ENABLE_SHIFT)) { |
112 | gef_wdt_service(); | 114 | gef_wdt_service(); |
113 | printk(KERN_NOTICE "gef_wdt: watchdog activated\n"); | 115 | pr_notice("watchdog activated\n"); |
114 | } | 116 | } |
115 | } | 117 | } |
116 | 118 | ||
@@ -118,7 +120,7 @@ static void gef_wdt_handler_disable(void) | |||
118 | { | 120 | { |
119 | if (gef_wdt_toggle_wdc(GEF_WDC_ENABLED_TRUE, | 121 | if (gef_wdt_toggle_wdc(GEF_WDC_ENABLED_TRUE, |
120 | GEF_WDC_ENABLE_SHIFT)) | 122 | GEF_WDC_ENABLE_SHIFT)) |
121 | printk(KERN_NOTICE "gef_wdt: watchdog deactivated\n"); | 123 | pr_notice("watchdog deactivated\n"); |
122 | } | 124 | } |
123 | 125 | ||
124 | static void gef_wdt_set_timeout(unsigned int timeout) | 126 | static void gef_wdt_set_timeout(unsigned int timeout) |
@@ -234,8 +236,7 @@ static int gef_wdt_release(struct inode *inode, struct file *file) | |||
234 | if (expect_close == 42) | 236 | if (expect_close == 42) |
235 | gef_wdt_handler_disable(); | 237 | gef_wdt_handler_disable(); |
236 | else { | 238 | else { |
237 | printk(KERN_CRIT | 239 | pr_crit("unexpected close, not stopping timer!\n"); |
238 | "gef_wdt: unexpected close, not stopping timer!\n"); | ||
239 | gef_wdt_service(); | 240 | gef_wdt_service(); |
240 | } | 241 | } |
241 | expect_close = 0; | 242 | expect_close = 0; |
@@ -313,7 +314,7 @@ static struct platform_driver gef_wdt_driver = { | |||
313 | 314 | ||
314 | static int __init gef_wdt_init(void) | 315 | static int __init gef_wdt_init(void) |
315 | { | 316 | { |
316 | printk(KERN_INFO "GE watchdog driver\n"); | 317 | pr_info("GE watchdog driver\n"); |
317 | return platform_driver_register(&gef_wdt_driver); | 318 | return platform_driver_register(&gef_wdt_driver); |
318 | } | 319 | } |
319 | 320 | ||
diff --git a/drivers/watchdog/geodewdt.c b/drivers/watchdog/geodewdt.c index 9b49b125ad5a..dc563b680abd 100644 --- a/drivers/watchdog/geodewdt.c +++ b/drivers/watchdog/geodewdt.c | |||
@@ -9,6 +9,7 @@ | |||
9 | * 2 of the License, or (at your option) any later version. | 9 | * 2 of the License, or (at your option) any later version. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
12 | 13 | ||
13 | #include <linux/module.h> | 14 | #include <linux/module.h> |
14 | #include <linux/moduleparam.h> | 15 | #include <linux/moduleparam.h> |
@@ -39,8 +40,8 @@ MODULE_PARM_DESC(timeout, | |||
39 | "Watchdog timeout in seconds. 1<= timeout <=131, default=" | 40 | "Watchdog timeout in seconds. 1<= timeout <=131, default=" |
40 | __MODULE_STRING(WATCHDOG_TIMEOUT) "."); | 41 | __MODULE_STRING(WATCHDOG_TIMEOUT) "."); |
41 | 42 | ||
42 | static int nowayout = WATCHDOG_NOWAYOUT; | 43 | static bool nowayout = WATCHDOG_NOWAYOUT; |
43 | module_param(nowayout, int, 0); | 44 | module_param(nowayout, bool, 0); |
44 | MODULE_PARM_DESC(nowayout, | 45 | MODULE_PARM_DESC(nowayout, |
45 | "Watchdog cannot be stopped once started (default=" | 46 | "Watchdog cannot be stopped once started (default=" |
46 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 47 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
@@ -100,7 +101,7 @@ static int geodewdt_release(struct inode *inode, struct file *file) | |||
100 | geodewdt_disable(); | 101 | geodewdt_disable(); |
101 | module_put(THIS_MODULE); | 102 | module_put(THIS_MODULE); |
102 | } else { | 103 | } else { |
103 | printk(KERN_CRIT "Unexpected close - watchdog is not stopping.\n"); | 104 | pr_crit("Unexpected close - watchdog is not stopping\n"); |
104 | geodewdt_ping(); | 105 | geodewdt_ping(); |
105 | 106 | ||
106 | set_bit(WDT_FLAGS_ORPHAN, &wdt_flags); | 107 | set_bit(WDT_FLAGS_ORPHAN, &wdt_flags); |
@@ -220,7 +221,7 @@ static int __devinit geodewdt_probe(struct platform_device *dev) | |||
220 | 221 | ||
221 | wdt_timer = cs5535_mfgpt_alloc_timer(MFGPT_TIMER_ANY, MFGPT_DOMAIN_WORKING); | 222 | wdt_timer = cs5535_mfgpt_alloc_timer(MFGPT_TIMER_ANY, MFGPT_DOMAIN_WORKING); |
222 | if (!wdt_timer) { | 223 | if (!wdt_timer) { |
223 | printk(KERN_ERR "geodewdt: No timers were available\n"); | 224 | pr_err("No timers were available\n"); |
224 | return -ENODEV; | 225 | return -ENODEV; |
225 | } | 226 | } |
226 | 227 | ||
diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c index 3c166d3f4e55..cbc7ceef2786 100644 --- a/drivers/watchdog/hpwdt.c +++ b/drivers/watchdog/hpwdt.c | |||
@@ -13,6 +13,8 @@ | |||
13 | * | 13 | * |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
17 | |||
16 | #include <linux/device.h> | 18 | #include <linux/device.h> |
17 | #include <linux/fs.h> | 19 | #include <linux/fs.h> |
18 | #include <linux/init.h> | 20 | #include <linux/init.h> |
@@ -45,7 +47,7 @@ | |||
45 | 47 | ||
46 | static unsigned int soft_margin = DEFAULT_MARGIN; /* in seconds */ | 48 | static unsigned int soft_margin = DEFAULT_MARGIN; /* in seconds */ |
47 | static unsigned int reload; /* the computed soft_margin */ | 49 | static unsigned int reload; /* the computed soft_margin */ |
48 | static int nowayout = WATCHDOG_NOWAYOUT; | 50 | static bool nowayout = WATCHDOG_NOWAYOUT; |
49 | static char expect_release; | 51 | static char expect_release; |
50 | static unsigned long hpwdt_is_open; | 52 | static unsigned long hpwdt_is_open; |
51 | 53 | ||
@@ -235,8 +237,7 @@ static int __devinit cru_detect(unsigned long map_entry, | |||
235 | asminline_call(&cmn_regs, bios32_entrypoint); | 237 | asminline_call(&cmn_regs, bios32_entrypoint); |
236 | 238 | ||
237 | if (cmn_regs.u1.ral != 0) { | 239 | if (cmn_regs.u1.ral != 0) { |
238 | printk(KERN_WARNING | 240 | pr_warn("Call succeeded but with an error: 0x%x\n", |
239 | "hpwdt: Call succeeded but with an error: 0x%x\n", | ||
240 | cmn_regs.u1.ral); | 241 | cmn_regs.u1.ral); |
241 | } else { | 242 | } else { |
242 | physical_bios_base = cmn_regs.u2.rebx; | 243 | physical_bios_base = cmn_regs.u2.rebx; |
@@ -256,14 +257,10 @@ static int __devinit cru_detect(unsigned long map_entry, | |||
256 | } | 257 | } |
257 | } | 258 | } |
258 | 259 | ||
259 | printk(KERN_DEBUG "hpwdt: CRU Base Address: 0x%lx\n", | 260 | pr_debug("CRU Base Address: 0x%lx\n", physical_bios_base); |
260 | physical_bios_base); | 261 | pr_debug("CRU Offset Address: 0x%lx\n", physical_bios_offset); |
261 | printk(KERN_DEBUG "hpwdt: CRU Offset Address: 0x%lx\n", | 262 | pr_debug("CRU Length: 0x%lx\n", cru_length); |
262 | physical_bios_offset); | 263 | pr_debug("CRU Mapped Address: %p\n", &cru_rom_addr); |
263 | printk(KERN_DEBUG "hpwdt: CRU Length: 0x%lx\n", | ||
264 | cru_length); | ||
265 | printk(KERN_DEBUG "hpwdt: CRU Mapped Address: %p\n", | ||
266 | &cru_rom_addr); | ||
267 | } | 264 | } |
268 | iounmap(bios32_map); | 265 | iounmap(bios32_map); |
269 | return retval; | 266 | return retval; |
@@ -458,16 +455,13 @@ static void hpwdt_ping(void) | |||
458 | static int hpwdt_change_timer(int new_margin) | 455 | static int hpwdt_change_timer(int new_margin) |
459 | { | 456 | { |
460 | if (new_margin < 1 || new_margin > HPWDT_MAX_TIMER) { | 457 | if (new_margin < 1 || new_margin > HPWDT_MAX_TIMER) { |
461 | printk(KERN_WARNING | 458 | pr_warn("New value passed in is invalid: %d seconds\n", |
462 | "hpwdt: New value passed in is invalid: %d seconds.\n", | ||
463 | new_margin); | 459 | new_margin); |
464 | return -EINVAL; | 460 | return -EINVAL; |
465 | } | 461 | } |
466 | 462 | ||
467 | soft_margin = new_margin; | 463 | soft_margin = new_margin; |
468 | printk(KERN_DEBUG | 464 | pr_debug("New timer passed in is %d seconds\n", new_margin); |
469 | "hpwdt: New timer passed in is %d seconds.\n", | ||
470 | new_margin); | ||
471 | reload = SECS_TO_TICKS(soft_margin); | 465 | reload = SECS_TO_TICKS(soft_margin); |
472 | 466 | ||
473 | return 0; | 467 | return 0; |
@@ -535,8 +529,7 @@ static int hpwdt_release(struct inode *inode, struct file *file) | |||
535 | if (expect_release == 42) { | 529 | if (expect_release == 42) { |
536 | hpwdt_stop(); | 530 | hpwdt_stop(); |
537 | } else { | 531 | } else { |
538 | printk(KERN_CRIT | 532 | pr_crit("Unexpected close, not stopping watchdog!\n"); |
539 | "hpwdt: Unexpected close, not stopping watchdog!\n"); | ||
540 | hpwdt_ping(); | 533 | hpwdt_ping(); |
541 | } | 534 | } |
542 | 535 | ||
@@ -881,7 +874,7 @@ MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | |||
881 | module_param(soft_margin, int, 0); | 874 | module_param(soft_margin, int, 0); |
882 | MODULE_PARM_DESC(soft_margin, "Watchdog timeout in seconds"); | 875 | MODULE_PARM_DESC(soft_margin, "Watchdog timeout in seconds"); |
883 | 876 | ||
884 | module_param(nowayout, int, 0); | 877 | module_param(nowayout, bool, 0); |
885 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" | 878 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" |
886 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 879 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
887 | 880 | ||
diff --git a/drivers/watchdog/i6300esb.c b/drivers/watchdog/i6300esb.c index db45091ef434..738032a36bcf 100644 --- a/drivers/watchdog/i6300esb.c +++ b/drivers/watchdog/i6300esb.c | |||
@@ -27,6 +27,8 @@ | |||
27 | * Includes, defines, variables, module parameters, ... | 27 | * Includes, defines, variables, module parameters, ... |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
31 | |||
30 | #include <linux/module.h> | 32 | #include <linux/module.h> |
31 | #include <linux/types.h> | 33 | #include <linux/types.h> |
32 | #include <linux/kernel.h> | 34 | #include <linux/kernel.h> |
@@ -44,7 +46,6 @@ | |||
44 | #define ESB_VERSION "0.05" | 46 | #define ESB_VERSION "0.05" |
45 | #define ESB_MODULE_NAME "i6300ESB timer" | 47 | #define ESB_MODULE_NAME "i6300ESB timer" |
46 | #define ESB_DRIVER_NAME ESB_MODULE_NAME ", v" ESB_VERSION | 48 | #define ESB_DRIVER_NAME ESB_MODULE_NAME ", v" ESB_VERSION |
47 | #define PFX ESB_MODULE_NAME ": " | ||
48 | 49 | ||
49 | /* PCI configuration registers */ | 50 | /* PCI configuration registers */ |
50 | #define ESB_CONFIG_REG 0x60 /* Config register */ | 51 | #define ESB_CONFIG_REG 0x60 /* Config register */ |
@@ -94,8 +95,8 @@ MODULE_PARM_DESC(heartbeat, | |||
94 | "Watchdog heartbeat in seconds. (1<heartbeat<2046, default=" | 95 | "Watchdog heartbeat in seconds. (1<heartbeat<2046, default=" |
95 | __MODULE_STRING(WATCHDOG_HEARTBEAT) ")"); | 96 | __MODULE_STRING(WATCHDOG_HEARTBEAT) ")"); |
96 | 97 | ||
97 | static int nowayout = WATCHDOG_NOWAYOUT; | 98 | static bool nowayout = WATCHDOG_NOWAYOUT; |
98 | module_param(nowayout, int, 0); | 99 | module_param(nowayout, bool, 0); |
99 | MODULE_PARM_DESC(nowayout, | 100 | MODULE_PARM_DESC(nowayout, |
100 | "Watchdog cannot be stopped once started (default=" | 101 | "Watchdog cannot be stopped once started (default=" |
101 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 102 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
@@ -213,8 +214,7 @@ static int esb_release(struct inode *inode, struct file *file) | |||
213 | if (esb_expect_close == 42) | 214 | if (esb_expect_close == 42) |
214 | esb_timer_stop(); | 215 | esb_timer_stop(); |
215 | else { | 216 | else { |
216 | printk(KERN_CRIT PFX | 217 | pr_crit("Unexpected close, not stopping watchdog!\n"); |
217 | "Unexpected close, not stopping watchdog!\n"); | ||
218 | esb_timer_keepalive(); | 218 | esb_timer_keepalive(); |
219 | } | 219 | } |
220 | clear_bit(0, &timer_alive); | 220 | clear_bit(0, &timer_alive); |
@@ -347,19 +347,19 @@ MODULE_DEVICE_TABLE(pci, esb_pci_tbl); | |||
347 | static unsigned char __devinit esb_getdevice(struct pci_dev *pdev) | 347 | static unsigned char __devinit esb_getdevice(struct pci_dev *pdev) |
348 | { | 348 | { |
349 | if (pci_enable_device(pdev)) { | 349 | if (pci_enable_device(pdev)) { |
350 | printk(KERN_ERR PFX "failed to enable device\n"); | 350 | pr_err("failed to enable device\n"); |
351 | goto err_devput; | 351 | goto err_devput; |
352 | } | 352 | } |
353 | 353 | ||
354 | if (pci_request_region(pdev, 0, ESB_MODULE_NAME)) { | 354 | if (pci_request_region(pdev, 0, ESB_MODULE_NAME)) { |
355 | printk(KERN_ERR PFX "failed to request region\n"); | 355 | pr_err("failed to request region\n"); |
356 | goto err_disable; | 356 | goto err_disable; |
357 | } | 357 | } |
358 | 358 | ||
359 | BASEADDR = pci_ioremap_bar(pdev, 0); | 359 | BASEADDR = pci_ioremap_bar(pdev, 0); |
360 | if (BASEADDR == NULL) { | 360 | if (BASEADDR == NULL) { |
361 | /* Something's wrong here, BASEADDR has to be set */ | 361 | /* Something's wrong here, BASEADDR has to be set */ |
362 | printk(KERN_ERR PFX "failed to get BASEADDR\n"); | 362 | pr_err("failed to get BASEADDR\n"); |
363 | goto err_release; | 363 | goto err_release; |
364 | } | 364 | } |
365 | 365 | ||
@@ -397,7 +397,7 @@ static void __devinit esb_initdevice(void) | |||
397 | /* Check that the WDT isn't already locked */ | 397 | /* Check that the WDT isn't already locked */ |
398 | pci_read_config_byte(esb_pci, ESB_LOCK_REG, &val1); | 398 | pci_read_config_byte(esb_pci, ESB_LOCK_REG, &val1); |
399 | if (val1 & ESB_WDT_LOCK) | 399 | if (val1 & ESB_WDT_LOCK) |
400 | printk(KERN_WARNING PFX "nowayout already set\n"); | 400 | pr_warn("nowayout already set\n"); |
401 | 401 | ||
402 | /* Set the timer to watchdog mode and disable it for now */ | 402 | /* Set the timer to watchdog mode and disable it for now */ |
403 | pci_write_config_byte(esb_pci, ESB_LOCK_REG, 0x00); | 403 | pci_write_config_byte(esb_pci, ESB_LOCK_REG, 0x00); |
@@ -423,11 +423,11 @@ static int __devinit esb_probe(struct pci_dev *pdev, | |||
423 | 423 | ||
424 | cards_found++; | 424 | cards_found++; |
425 | if (cards_found == 1) | 425 | if (cards_found == 1) |
426 | printk(KERN_INFO PFX "Intel 6300ESB WatchDog Timer Driver v%s\n", | 426 | pr_info("Intel 6300ESB WatchDog Timer Driver v%s\n", |
427 | ESB_VERSION); | 427 | ESB_VERSION); |
428 | 428 | ||
429 | if (cards_found > 1) { | 429 | if (cards_found > 1) { |
430 | printk(KERN_ERR PFX "This driver only supports 1 device\n"); | 430 | pr_err("This driver only supports 1 device\n"); |
431 | return -ENODEV; | 431 | return -ENODEV; |
432 | } | 432 | } |
433 | 433 | ||
@@ -439,9 +439,8 @@ static int __devinit esb_probe(struct pci_dev *pdev, | |||
439 | if not reset to the default */ | 439 | if not reset to the default */ |
440 | if (heartbeat < 0x1 || heartbeat > 2 * 0x03ff) { | 440 | if (heartbeat < 0x1 || heartbeat > 2 * 0x03ff) { |
441 | heartbeat = WATCHDOG_HEARTBEAT; | 441 | heartbeat = WATCHDOG_HEARTBEAT; |
442 | printk(KERN_INFO PFX | 442 | pr_info("heartbeat value must be 1<heartbeat<2046, using %d\n", |
443 | "heartbeat value must be 1<heartbeat<2046, using %d\n", | 443 | heartbeat); |
444 | heartbeat); | ||
445 | } | 444 | } |
446 | 445 | ||
447 | /* Initialize the watchdog and make sure it does not run */ | 446 | /* Initialize the watchdog and make sure it does not run */ |
@@ -450,14 +449,12 @@ static int __devinit esb_probe(struct pci_dev *pdev, | |||
450 | /* Register the watchdog so that userspace has access to it */ | 449 | /* Register the watchdog so that userspace has access to it */ |
451 | ret = misc_register(&esb_miscdev); | 450 | ret = misc_register(&esb_miscdev); |
452 | if (ret != 0) { | 451 | if (ret != 0) { |
453 | printk(KERN_ERR PFX | 452 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
454 | "cannot register miscdev on minor=%d (err=%d)\n", | 453 | WATCHDOG_MINOR, ret); |
455 | WATCHDOG_MINOR, ret); | ||
456 | goto err_unmap; | 454 | goto err_unmap; |
457 | } | 455 | } |
458 | printk(KERN_INFO PFX | 456 | pr_info("initialized (0x%p). heartbeat=%d sec (nowayout=%d)\n", |
459 | "initialized (0x%p). heartbeat=%d sec (nowayout=%d)\n", | 457 | BASEADDR, heartbeat, nowayout); |
460 | BASEADDR, heartbeat, nowayout); | ||
461 | return 0; | 458 | return 0; |
462 | 459 | ||
463 | err_unmap: | 460 | err_unmap: |
@@ -503,7 +500,7 @@ static int __init watchdog_init(void) | |||
503 | static void __exit watchdog_cleanup(void) | 500 | static void __exit watchdog_cleanup(void) |
504 | { | 501 | { |
505 | pci_unregister_driver(&esb_driver); | 502 | pci_unregister_driver(&esb_driver); |
506 | printk(KERN_INFO PFX "Watchdog Module Unloaded.\n"); | 503 | pr_info("Watchdog Module Unloaded\n"); |
507 | } | 504 | } |
508 | 505 | ||
509 | module_init(watchdog_init); | 506 | module_init(watchdog_init); |
diff --git a/drivers/watchdog/iTCO_vendor_support.c b/drivers/watchdog/iTCO_vendor_support.c index 481d1ad43464..2721d29ce243 100644 --- a/drivers/watchdog/iTCO_vendor_support.c +++ b/drivers/watchdog/iTCO_vendor_support.c | |||
@@ -17,10 +17,11 @@ | |||
17 | * Includes, defines, variables, module parameters, ... | 17 | * Includes, defines, variables, module parameters, ... |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
21 | |||
20 | /* Module and version information */ | 22 | /* Module and version information */ |
21 | #define DRV_NAME "iTCO_vendor_support" | 23 | #define DRV_NAME "iTCO_vendor_support" |
22 | #define DRV_VERSION "1.04" | 24 | #define DRV_VERSION "1.04" |
23 | #define PFX DRV_NAME ": " | ||
24 | 25 | ||
25 | /* Includes */ | 26 | /* Includes */ |
26 | #include <linux/module.h> /* For module specific items */ | 27 | #include <linux/module.h> /* For module specific items */ |
@@ -355,13 +356,13 @@ EXPORT_SYMBOL(iTCO_vendor_check_noreboot_on); | |||
355 | 356 | ||
356 | static int __init iTCO_vendor_init_module(void) | 357 | static int __init iTCO_vendor_init_module(void) |
357 | { | 358 | { |
358 | printk(KERN_INFO PFX "vendor-support=%d\n", vendorsupport); | 359 | pr_info("vendor-support=%d\n", vendorsupport); |
359 | return 0; | 360 | return 0; |
360 | } | 361 | } |
361 | 362 | ||
362 | static void __exit iTCO_vendor_exit_module(void) | 363 | static void __exit iTCO_vendor_exit_module(void) |
363 | { | 364 | { |
364 | printk(KERN_INFO PFX "Module Unloaded\n"); | 365 | pr_info("Module Unloaded\n"); |
365 | } | 366 | } |
366 | 367 | ||
367 | module_init(iTCO_vendor_init_module); | 368 | module_init(iTCO_vendor_init_module); |
diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c index bdf401b240b5..9fecb95645a3 100644 --- a/drivers/watchdog/iTCO_wdt.c +++ b/drivers/watchdog/iTCO_wdt.c | |||
@@ -43,10 +43,11 @@ | |||
43 | * Includes, defines, variables, module parameters, ... | 43 | * Includes, defines, variables, module parameters, ... |
44 | */ | 44 | */ |
45 | 45 | ||
46 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
47 | |||
46 | /* Module and version information */ | 48 | /* Module and version information */ |
47 | #define DRV_NAME "iTCO_wdt" | 49 | #define DRV_NAME "iTCO_wdt" |
48 | #define DRV_VERSION "1.07" | 50 | #define DRV_VERSION "1.07" |
49 | #define PFX DRV_NAME ": " | ||
50 | 51 | ||
51 | /* Includes */ | 52 | /* Includes */ |
52 | #include <linux/module.h> /* For module specific items */ | 53 | #include <linux/module.h> /* For module specific items */ |
@@ -413,8 +414,8 @@ MODULE_PARM_DESC(heartbeat, "Watchdog timeout in seconds. " | |||
413 | "5..76 (TCO v1) or 3..614 (TCO v2), default=" | 414 | "5..76 (TCO v1) or 3..614 (TCO v2), default=" |
414 | __MODULE_STRING(WATCHDOG_HEARTBEAT) ")"); | 415 | __MODULE_STRING(WATCHDOG_HEARTBEAT) ")"); |
415 | 416 | ||
416 | static int nowayout = WATCHDOG_NOWAYOUT; | 417 | static bool nowayout = WATCHDOG_NOWAYOUT; |
417 | module_param(nowayout, int, 0); | 418 | module_param(nowayout, bool, 0); |
418 | MODULE_PARM_DESC(nowayout, | 419 | MODULE_PARM_DESC(nowayout, |
419 | "Watchdog cannot be stopped once started (default=" | 420 | "Watchdog cannot be stopped once started (default=" |
420 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 421 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
@@ -489,8 +490,7 @@ static int iTCO_wdt_start(void) | |||
489 | /* disable chipset's NO_REBOOT bit */ | 490 | /* disable chipset's NO_REBOOT bit */ |
490 | if (iTCO_wdt_unset_NO_REBOOT_bit()) { | 491 | if (iTCO_wdt_unset_NO_REBOOT_bit()) { |
491 | spin_unlock(&iTCO_wdt_private.io_lock); | 492 | spin_unlock(&iTCO_wdt_private.io_lock); |
492 | printk(KERN_ERR PFX "failed to reset NO_REBOOT flag, " | 493 | pr_err("failed to reset NO_REBOOT flag, reboot disabled by hardware/BIOS\n"); |
493 | "reboot disabled by hardware/BIOS\n"); | ||
494 | return -EIO; | 494 | return -EIO; |
495 | } | 495 | } |
496 | 496 | ||
@@ -661,8 +661,7 @@ static int iTCO_wdt_release(struct inode *inode, struct file *file) | |||
661 | if (expect_release == 42) { | 661 | if (expect_release == 42) { |
662 | iTCO_wdt_stop(); | 662 | iTCO_wdt_stop(); |
663 | } else { | 663 | } else { |
664 | printk(KERN_CRIT PFX | 664 | pr_crit("Unexpected close, not stopping watchdog!\n"); |
665 | "Unexpected close, not stopping watchdog!\n"); | ||
666 | iTCO_wdt_keepalive(); | 665 | iTCO_wdt_keepalive(); |
667 | } | 666 | } |
668 | clear_bit(0, &is_active); | 667 | clear_bit(0, &is_active); |
@@ -804,8 +803,7 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev, | |||
804 | base_address &= 0x0000ff80; | 803 | base_address &= 0x0000ff80; |
805 | if (base_address == 0x00000000) { | 804 | if (base_address == 0x00000000) { |
806 | /* Something's wrong here, ACPIBASE has to be set */ | 805 | /* Something's wrong here, ACPIBASE has to be set */ |
807 | printk(KERN_ERR PFX "failed to get TCOBASE address, " | 806 | pr_err("failed to get TCOBASE address, device disabled by hardware/BIOS\n"); |
808 | "device disabled by hardware/BIOS\n"); | ||
809 | return -ENODEV; | 807 | return -ENODEV; |
810 | } | 808 | } |
811 | iTCO_wdt_private.iTCO_version = | 809 | iTCO_wdt_private.iTCO_version = |
@@ -820,8 +818,7 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev, | |||
820 | if (iTCO_wdt_private.iTCO_version == 2) { | 818 | if (iTCO_wdt_private.iTCO_version == 2) { |
821 | pci_read_config_dword(pdev, 0xf0, &base_address); | 819 | pci_read_config_dword(pdev, 0xf0, &base_address); |
822 | if ((base_address & 1) == 0) { | 820 | if ((base_address & 1) == 0) { |
823 | printk(KERN_ERR PFX "RCBA is disabled by hardware" | 821 | pr_err("RCBA is disabled by hardware/BIOS, device disabled\n"); |
824 | "/BIOS, device disabled\n"); | ||
825 | ret = -ENODEV; | 822 | ret = -ENODEV; |
826 | goto out; | 823 | goto out; |
827 | } | 824 | } |
@@ -831,8 +828,7 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev, | |||
831 | 828 | ||
832 | /* Check chipset's NO_REBOOT bit */ | 829 | /* Check chipset's NO_REBOOT bit */ |
833 | if (iTCO_wdt_unset_NO_REBOOT_bit() && iTCO_vendor_check_noreboot_on()) { | 830 | if (iTCO_wdt_unset_NO_REBOOT_bit() && iTCO_vendor_check_noreboot_on()) { |
834 | printk(KERN_INFO PFX "unable to reset NO_REBOOT flag, " | 831 | pr_info("unable to reset NO_REBOOT flag, device disabled by hardware/BIOS\n"); |
835 | "device disabled by hardware/BIOS\n"); | ||
836 | ret = -ENODEV; /* Cannot reset NO_REBOOT bit */ | 832 | ret = -ENODEV; /* Cannot reset NO_REBOOT bit */ |
837 | goto out_unmap; | 833 | goto out_unmap; |
838 | } | 834 | } |
@@ -842,9 +838,8 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev, | |||
842 | 838 | ||
843 | /* The TCO logic uses the TCO_EN bit in the SMI_EN register */ | 839 | /* The TCO logic uses the TCO_EN bit in the SMI_EN register */ |
844 | if (!request_region(SMI_EN, 4, "iTCO_wdt")) { | 840 | if (!request_region(SMI_EN, 4, "iTCO_wdt")) { |
845 | printk(KERN_ERR PFX | 841 | pr_err("I/O address 0x%04lx already in use, device disabled\n", |
846 | "I/O address 0x%04lx already in use, " | 842 | SMI_EN); |
847 | "device disabled\n", SMI_EN); | ||
848 | ret = -EIO; | 843 | ret = -EIO; |
849 | goto out_unmap; | 844 | goto out_unmap; |
850 | } | 845 | } |
@@ -858,17 +853,16 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev, | |||
858 | /* The TCO I/O registers reside in a 32-byte range pointed to | 853 | /* The TCO I/O registers reside in a 32-byte range pointed to |
859 | by the TCOBASE value */ | 854 | by the TCOBASE value */ |
860 | if (!request_region(TCOBASE, 0x20, "iTCO_wdt")) { | 855 | if (!request_region(TCOBASE, 0x20, "iTCO_wdt")) { |
861 | printk(KERN_ERR PFX "I/O address 0x%04lx already in use " | 856 | pr_err("I/O address 0x%04lx already in use, device disabled\n", |
862 | "device disabled\n", TCOBASE); | 857 | TCOBASE); |
863 | ret = -EIO; | 858 | ret = -EIO; |
864 | goto unreg_smi_en; | 859 | goto unreg_smi_en; |
865 | } | 860 | } |
866 | 861 | ||
867 | printk(KERN_INFO PFX | 862 | pr_info("Found a %s TCO device (Version=%d, TCOBASE=0x%04lx)\n", |
868 | "Found a %s TCO device (Version=%d, TCOBASE=0x%04lx)\n", | 863 | iTCO_chipset_info[ent->driver_data].name, |
869 | iTCO_chipset_info[ent->driver_data].name, | 864 | iTCO_chipset_info[ent->driver_data].iTCO_version, |
870 | iTCO_chipset_info[ent->driver_data].iTCO_version, | 865 | TCOBASE); |
871 | TCOBASE); | ||
872 | 866 | ||
873 | /* Clear out the (probably old) status */ | 867 | /* Clear out the (probably old) status */ |
874 | outw(0x0008, TCO1_STS); /* Clear the Time Out Status bit */ | 868 | outw(0x0008, TCO1_STS); /* Clear the Time Out Status bit */ |
@@ -882,20 +876,18 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev, | |||
882 | if not reset to the default */ | 876 | if not reset to the default */ |
883 | if (iTCO_wdt_set_heartbeat(heartbeat)) { | 877 | if (iTCO_wdt_set_heartbeat(heartbeat)) { |
884 | iTCO_wdt_set_heartbeat(WATCHDOG_HEARTBEAT); | 878 | iTCO_wdt_set_heartbeat(WATCHDOG_HEARTBEAT); |
885 | printk(KERN_INFO PFX | 879 | pr_info("timeout value out of range, using %d\n", heartbeat); |
886 | "timeout value out of range, using %d\n", heartbeat); | ||
887 | } | 880 | } |
888 | 881 | ||
889 | ret = misc_register(&iTCO_wdt_miscdev); | 882 | ret = misc_register(&iTCO_wdt_miscdev); |
890 | if (ret != 0) { | 883 | if (ret != 0) { |
891 | printk(KERN_ERR PFX | 884 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
892 | "cannot register miscdev on minor=%d (err=%d)\n", | 885 | WATCHDOG_MINOR, ret); |
893 | WATCHDOG_MINOR, ret); | ||
894 | goto unreg_region; | 886 | goto unreg_region; |
895 | } | 887 | } |
896 | 888 | ||
897 | printk(KERN_INFO PFX "initialized. heartbeat=%d sec (nowayout=%d)\n", | 889 | pr_info("initialized. heartbeat=%d sec (nowayout=%d)\n", |
898 | heartbeat, nowayout); | 890 | heartbeat, nowayout); |
899 | 891 | ||
900 | return 0; | 892 | return 0; |
901 | 893 | ||
@@ -947,7 +939,7 @@ static int __devinit iTCO_wdt_probe(struct platform_device *dev) | |||
947 | } | 939 | } |
948 | 940 | ||
949 | if (!found) | 941 | if (!found) |
950 | printk(KERN_INFO PFX "No device detected.\n"); | 942 | pr_info("No device detected\n"); |
951 | 943 | ||
952 | return ret; | 944 | return ret; |
953 | } | 945 | } |
@@ -979,8 +971,7 @@ static int __init iTCO_wdt_init_module(void) | |||
979 | { | 971 | { |
980 | int err; | 972 | int err; |
981 | 973 | ||
982 | printk(KERN_INFO PFX "Intel TCO WatchDog Timer Driver v%s\n", | 974 | pr_info("Intel TCO WatchDog Timer Driver v%s\n", DRV_VERSION); |
983 | DRV_VERSION); | ||
984 | 975 | ||
985 | err = platform_driver_register(&iTCO_wdt_driver); | 976 | err = platform_driver_register(&iTCO_wdt_driver); |
986 | if (err) | 977 | if (err) |
@@ -1004,7 +995,7 @@ static void __exit iTCO_wdt_cleanup_module(void) | |||
1004 | { | 995 | { |
1005 | platform_device_unregister(iTCO_wdt_platform_device); | 996 | platform_device_unregister(iTCO_wdt_platform_device); |
1006 | platform_driver_unregister(&iTCO_wdt_driver); | 997 | platform_driver_unregister(&iTCO_wdt_driver); |
1007 | printk(KERN_INFO PFX "Watchdog Module Unloaded.\n"); | 998 | pr_info("Watchdog Module Unloaded\n"); |
1008 | } | 999 | } |
1009 | 1000 | ||
1010 | module_init(iTCO_wdt_init_module); | 1001 | module_init(iTCO_wdt_init_module); |
diff --git a/drivers/watchdog/ib700wdt.c b/drivers/watchdog/ib700wdt.c index 0149d8dfc81d..e187664eaca4 100644 --- a/drivers/watchdog/ib700wdt.c +++ b/drivers/watchdog/ib700wdt.c | |||
@@ -31,6 +31,8 @@ | |||
31 | * | 31 | * |
32 | */ | 32 | */ |
33 | 33 | ||
34 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
35 | |||
34 | #include <linux/module.h> | 36 | #include <linux/module.h> |
35 | #include <linux/types.h> | 37 | #include <linux/types.h> |
36 | #include <linux/miscdevice.h> | 38 | #include <linux/miscdevice.h> |
@@ -53,7 +55,6 @@ static char expect_close; | |||
53 | 55 | ||
54 | /* Module information */ | 56 | /* Module information */ |
55 | #define DRV_NAME "ib700wdt" | 57 | #define DRV_NAME "ib700wdt" |
56 | #define PFX DRV_NAME ": " | ||
57 | 58 | ||
58 | /* | 59 | /* |
59 | * | 60 | * |
@@ -102,8 +103,8 @@ MODULE_PARM_DESC(timeout, | |||
102 | "Watchdog timeout in seconds. 0<= timeout <=30, default=" | 103 | "Watchdog timeout in seconds. 0<= timeout <=30, default=" |
103 | __MODULE_STRING(WATCHDOG_TIMEOUT) "."); | 104 | __MODULE_STRING(WATCHDOG_TIMEOUT) "."); |
104 | 105 | ||
105 | static int nowayout = WATCHDOG_NOWAYOUT; | 106 | static bool nowayout = WATCHDOG_NOWAYOUT; |
106 | module_param(nowayout, int, 0); | 107 | module_param(nowayout, bool, 0); |
107 | MODULE_PARM_DESC(nowayout, | 108 | MODULE_PARM_DESC(nowayout, |
108 | "Watchdog cannot be stopped once started (default=" | 109 | "Watchdog cannot be stopped once started (default=" |
109 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 110 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
@@ -246,8 +247,7 @@ static int ibwdt_close(struct inode *inode, struct file *file) | |||
246 | if (expect_close == 42) { | 247 | if (expect_close == 42) { |
247 | ibwdt_disable(); | 248 | ibwdt_disable(); |
248 | } else { | 249 | } else { |
249 | printk(KERN_CRIT PFX | 250 | pr_crit("WDT device closed unexpectedly. WDT will not stop!\n"); |
250 | "WDT device closed unexpectedly. WDT will not stop!\n"); | ||
251 | ibwdt_ping(); | 251 | ibwdt_ping(); |
252 | } | 252 | } |
253 | clear_bit(0, &ibwdt_is_open); | 253 | clear_bit(0, &ibwdt_is_open); |
@@ -284,16 +284,14 @@ static int __devinit ibwdt_probe(struct platform_device *dev) | |||
284 | 284 | ||
285 | #if WDT_START != WDT_STOP | 285 | #if WDT_START != WDT_STOP |
286 | if (!request_region(WDT_STOP, 1, "IB700 WDT")) { | 286 | if (!request_region(WDT_STOP, 1, "IB700 WDT")) { |
287 | printk(KERN_ERR PFX "STOP method I/O %X is not available.\n", | 287 | pr_err("STOP method I/O %X is not available\n", WDT_STOP); |
288 | WDT_STOP); | ||
289 | res = -EIO; | 288 | res = -EIO; |
290 | goto out_nostopreg; | 289 | goto out_nostopreg; |
291 | } | 290 | } |
292 | #endif | 291 | #endif |
293 | 292 | ||
294 | if (!request_region(WDT_START, 1, "IB700 WDT")) { | 293 | if (!request_region(WDT_START, 1, "IB700 WDT")) { |
295 | printk(KERN_ERR PFX "START method I/O %X is not available.\n", | 294 | pr_err("START method I/O %X is not available\n", WDT_START); |
296 | WDT_START); | ||
297 | res = -EIO; | 295 | res = -EIO; |
298 | goto out_nostartreg; | 296 | goto out_nostartreg; |
299 | } | 297 | } |
@@ -302,13 +300,12 @@ static int __devinit ibwdt_probe(struct platform_device *dev) | |||
302 | * if not reset to the default */ | 300 | * if not reset to the default */ |
303 | if (ibwdt_set_heartbeat(timeout)) { | 301 | if (ibwdt_set_heartbeat(timeout)) { |
304 | ibwdt_set_heartbeat(WATCHDOG_TIMEOUT); | 302 | ibwdt_set_heartbeat(WATCHDOG_TIMEOUT); |
305 | printk(KERN_INFO PFX | 303 | pr_info("timeout value must be 0<=x<=30, using %d\n", timeout); |
306 | "timeout value must be 0<=x<=30, using %d\n", timeout); | ||
307 | } | 304 | } |
308 | 305 | ||
309 | res = misc_register(&ibwdt_miscdev); | 306 | res = misc_register(&ibwdt_miscdev); |
310 | if (res) { | 307 | if (res) { |
311 | printk(KERN_ERR PFX "failed to register misc device\n"); | 308 | pr_err("failed to register misc device\n"); |
312 | goto out_nomisc; | 309 | goto out_nomisc; |
313 | } | 310 | } |
314 | return 0; | 311 | return 0; |
@@ -353,8 +350,7 @@ static int __init ibwdt_init(void) | |||
353 | { | 350 | { |
354 | int err; | 351 | int err; |
355 | 352 | ||
356 | printk(KERN_INFO PFX | 353 | pr_info("WDT driver for IB700 single board computer initialising\n"); |
357 | "WDT driver for IB700 single board computer initialising.\n"); | ||
358 | 354 | ||
359 | err = platform_driver_register(&ibwdt_driver); | 355 | err = platform_driver_register(&ibwdt_driver); |
360 | if (err) | 356 | if (err) |
@@ -378,7 +374,7 @@ static void __exit ibwdt_exit(void) | |||
378 | { | 374 | { |
379 | platform_device_unregister(ibwdt_platform_device); | 375 | platform_device_unregister(ibwdt_platform_device); |
380 | platform_driver_unregister(&ibwdt_driver); | 376 | platform_driver_unregister(&ibwdt_driver); |
381 | printk(KERN_INFO PFX "Watchdog Module Unloaded.\n"); | 377 | pr_info("Watchdog Module Unloaded\n"); |
382 | } | 378 | } |
383 | 379 | ||
384 | module_init(ibwdt_init); | 380 | module_init(ibwdt_init); |
diff --git a/drivers/watchdog/ibmasr.c b/drivers/watchdog/ibmasr.c index c7481ad51629..bc3fb8fe89ab 100644 --- a/drivers/watchdog/ibmasr.c +++ b/drivers/watchdog/ibmasr.c | |||
@@ -10,6 +10,8 @@ | |||
10 | * of the GNU Public License, incorporated herein by reference. | 10 | * of the GNU Public License, incorporated herein by reference. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
14 | |||
13 | #include <linux/fs.h> | 15 | #include <linux/fs.h> |
14 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
15 | #include <linux/module.h> | 17 | #include <linux/module.h> |
@@ -31,8 +33,6 @@ enum { | |||
31 | ASMTYPE_SPRUCE, | 33 | ASMTYPE_SPRUCE, |
32 | }; | 34 | }; |
33 | 35 | ||
34 | #define PFX "ibmasr: " | ||
35 | |||
36 | #define TOPAZ_ASR_REG_OFFSET 4 | 36 | #define TOPAZ_ASR_REG_OFFSET 4 |
37 | #define TOPAZ_ASR_TOGGLE 0x40 | 37 | #define TOPAZ_ASR_TOGGLE 0x40 |
38 | #define TOPAZ_ASR_DISABLE 0x80 | 38 | #define TOPAZ_ASR_DISABLE 0x80 |
@@ -60,7 +60,7 @@ enum { | |||
60 | #define SPRUCE_ASR_TOGGLE_MASK 0x02 /* bit 0: 0, then 1, then 0 */ | 60 | #define SPRUCE_ASR_TOGGLE_MASK 0x02 /* bit 0: 0, then 1, then 0 */ |
61 | 61 | ||
62 | 62 | ||
63 | static int nowayout = WATCHDOG_NOWAYOUT; | 63 | static bool nowayout = WATCHDOG_NOWAYOUT; |
64 | 64 | ||
65 | static unsigned long asr_is_open; | 65 | static unsigned long asr_is_open; |
66 | static char asr_expect_close; | 66 | static char asr_expect_close; |
@@ -234,12 +234,11 @@ static int __init asr_get_base_address(void) | |||
234 | } | 234 | } |
235 | 235 | ||
236 | if (!request_region(asr_base, asr_length, "ibmasr")) { | 236 | if (!request_region(asr_base, asr_length, "ibmasr")) { |
237 | printk(KERN_ERR PFX "address %#x already in use\n", | 237 | pr_err("address %#x already in use\n", asr_base); |
238 | asr_base); | ||
239 | return -EBUSY; | 238 | return -EBUSY; |
240 | } | 239 | } |
241 | 240 | ||
242 | printk(KERN_INFO PFX "found %sASR @ addr %#x\n", type, asr_base); | 241 | pr_info("found %sASR @ addr %#x\n", type, asr_base); |
243 | 242 | ||
244 | return 0; | 243 | return 0; |
245 | } | 244 | } |
@@ -332,8 +331,7 @@ static int asr_release(struct inode *inode, struct file *file) | |||
332 | if (asr_expect_close == 42) | 331 | if (asr_expect_close == 42) |
333 | asr_disable(); | 332 | asr_disable(); |
334 | else { | 333 | else { |
335 | printk(KERN_CRIT PFX | 334 | pr_crit("unexpected close, not stopping watchdog!\n"); |
336 | "unexpected close, not stopping watchdog!\n"); | ||
337 | asr_toggle(); | 335 | asr_toggle(); |
338 | } | 336 | } |
339 | clear_bit(0, &asr_is_open); | 337 | clear_bit(0, &asr_is_open); |
@@ -393,7 +391,7 @@ static int __init ibmasr_init(void) | |||
393 | rc = misc_register(&asr_miscdev); | 391 | rc = misc_register(&asr_miscdev); |
394 | if (rc < 0) { | 392 | if (rc < 0) { |
395 | release_region(asr_base, asr_length); | 393 | release_region(asr_base, asr_length); |
396 | printk(KERN_ERR PFX "failed to register misc device\n"); | 394 | pr_err("failed to register misc device\n"); |
397 | return rc; | 395 | return rc; |
398 | } | 396 | } |
399 | 397 | ||
@@ -413,7 +411,7 @@ static void __exit ibmasr_exit(void) | |||
413 | module_init(ibmasr_init); | 411 | module_init(ibmasr_init); |
414 | module_exit(ibmasr_exit); | 412 | module_exit(ibmasr_exit); |
415 | 413 | ||
416 | module_param(nowayout, int, 0); | 414 | module_param(nowayout, bool, 0); |
417 | MODULE_PARM_DESC(nowayout, | 415 | MODULE_PARM_DESC(nowayout, |
418 | "Watchdog cannot be stopped once started (default=" | 416 | "Watchdog cannot be stopped once started (default=" |
419 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 417 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c index c44c3334003a..7a2b734fcdc7 100644 --- a/drivers/watchdog/imx2_wdt.c +++ b/drivers/watchdog/imx2_wdt.c | |||
@@ -46,6 +46,9 @@ | |||
46 | #define IMX2_WDT_SEQ1 0x5555 /* -> service sequence 1 */ | 46 | #define IMX2_WDT_SEQ1 0x5555 /* -> service sequence 1 */ |
47 | #define IMX2_WDT_SEQ2 0xAAAA /* -> service sequence 2 */ | 47 | #define IMX2_WDT_SEQ2 0xAAAA /* -> service sequence 2 */ |
48 | 48 | ||
49 | #define IMX2_WDT_WRSR 0x04 /* Reset Status Register */ | ||
50 | #define IMX2_WDT_WRSR_TOUT (1 << 1) /* -> Reset due to Timeout */ | ||
51 | |||
49 | #define IMX2_WDT_MAX_TIME 128 | 52 | #define IMX2_WDT_MAX_TIME 128 |
50 | #define IMX2_WDT_DEFAULT_TIME 60 /* in seconds */ | 53 | #define IMX2_WDT_DEFAULT_TIME 60 /* in seconds */ |
51 | 54 | ||
@@ -65,8 +68,8 @@ static struct { | |||
65 | 68 | ||
66 | static struct miscdevice imx2_wdt_miscdev; | 69 | static struct miscdevice imx2_wdt_miscdev; |
67 | 70 | ||
68 | static int nowayout = WATCHDOG_NOWAYOUT; | 71 | static bool nowayout = WATCHDOG_NOWAYOUT; |
69 | module_param(nowayout, int, 0); | 72 | module_param(nowayout, bool, 0); |
70 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" | 73 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" |
71 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 74 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
72 | 75 | ||
@@ -175,6 +178,7 @@ static long imx2_wdt_ioctl(struct file *file, unsigned int cmd, | |||
175 | void __user *argp = (void __user *)arg; | 178 | void __user *argp = (void __user *)arg; |
176 | int __user *p = argp; | 179 | int __user *p = argp; |
177 | int new_value; | 180 | int new_value; |
181 | u16 val; | ||
178 | 182 | ||
179 | switch (cmd) { | 183 | switch (cmd) { |
180 | case WDIOC_GETSUPPORT: | 184 | case WDIOC_GETSUPPORT: |
@@ -182,9 +186,13 @@ static long imx2_wdt_ioctl(struct file *file, unsigned int cmd, | |||
182 | sizeof(struct watchdog_info)) ? -EFAULT : 0; | 186 | sizeof(struct watchdog_info)) ? -EFAULT : 0; |
183 | 187 | ||
184 | case WDIOC_GETSTATUS: | 188 | case WDIOC_GETSTATUS: |
185 | case WDIOC_GETBOOTSTATUS: | ||
186 | return put_user(0, p); | 189 | return put_user(0, p); |
187 | 190 | ||
191 | case WDIOC_GETBOOTSTATUS: | ||
192 | val = __raw_readw(imx2_wdt.base + IMX2_WDT_WRSR); | ||
193 | new_value = val & IMX2_WDT_WRSR_TOUT ? WDIOF_CARDRESET : 0; | ||
194 | return put_user(new_value, p); | ||
195 | |||
188 | case WDIOC_KEEPALIVE: | 196 | case WDIOC_KEEPALIVE: |
189 | imx2_wdt_ping(); | 197 | imx2_wdt_ping(); |
190 | return 0; | 198 | return 0; |
diff --git a/drivers/watchdog/indydog.c b/drivers/watchdog/indydog.c index 1475e09f9af2..6d90f7a2ce22 100644 --- a/drivers/watchdog/indydog.c +++ b/drivers/watchdog/indydog.c | |||
@@ -12,6 +12,8 @@ | |||
12 | * based on softdog.c by Alan Cox <alan@lxorguk.ukuu.org.uk> | 12 | * based on softdog.c by Alan Cox <alan@lxorguk.ukuu.org.uk> |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
16 | |||
15 | #include <linux/module.h> | 17 | #include <linux/module.h> |
16 | #include <linux/moduleparam.h> | 18 | #include <linux/moduleparam.h> |
17 | #include <linux/types.h> | 19 | #include <linux/types.h> |
@@ -26,14 +28,13 @@ | |||
26 | #include <linux/uaccess.h> | 28 | #include <linux/uaccess.h> |
27 | #include <asm/sgi/mc.h> | 29 | #include <asm/sgi/mc.h> |
28 | 30 | ||
29 | #define PFX "indydog: " | ||
30 | static unsigned long indydog_alive; | 31 | static unsigned long indydog_alive; |
31 | static DEFINE_SPINLOCK(indydog_lock); | 32 | static DEFINE_SPINLOCK(indydog_lock); |
32 | 33 | ||
33 | #define WATCHDOG_TIMEOUT 30 /* 30 sec default timeout */ | 34 | #define WATCHDOG_TIMEOUT 30 /* 30 sec default timeout */ |
34 | 35 | ||
35 | static int nowayout = WATCHDOG_NOWAYOUT; | 36 | static bool nowayout = WATCHDOG_NOWAYOUT; |
36 | module_param(nowayout, int, 0); | 37 | module_param(nowayout, bool, 0); |
37 | MODULE_PARM_DESC(nowayout, | 38 | MODULE_PARM_DESC(nowayout, |
38 | "Watchdog cannot be stopped once started (default=" | 39 | "Watchdog cannot be stopped once started (default=" |
39 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 40 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
@@ -60,7 +61,7 @@ static void indydog_stop(void) | |||
60 | sgimc->cpuctrl0 = mc_ctrl0; | 61 | sgimc->cpuctrl0 = mc_ctrl0; |
61 | spin_unlock(&indydog_lock); | 62 | spin_unlock(&indydog_lock); |
62 | 63 | ||
63 | printk(KERN_INFO PFX "Stopped watchdog timer.\n"); | 64 | pr_info("Stopped watchdog timer\n"); |
64 | } | 65 | } |
65 | 66 | ||
66 | static void indydog_ping(void) | 67 | static void indydog_ping(void) |
@@ -83,7 +84,7 @@ static int indydog_open(struct inode *inode, struct file *file) | |||
83 | indydog_start(); | 84 | indydog_start(); |
84 | indydog_ping(); | 85 | indydog_ping(); |
85 | 86 | ||
86 | printk(KERN_INFO "Started watchdog timer.\n"); | 87 | pr_info("Started watchdog timer\n"); |
87 | 88 | ||
88 | return nonseekable_open(inode, file); | 89 | return nonseekable_open(inode, file); |
89 | } | 90 | } |
@@ -178,30 +179,25 @@ static struct notifier_block indydog_notifier = { | |||
178 | .notifier_call = indydog_notify_sys, | 179 | .notifier_call = indydog_notify_sys, |
179 | }; | 180 | }; |
180 | 181 | ||
181 | static char banner[] __initdata = | ||
182 | KERN_INFO PFX "Hardware Watchdog Timer for SGI IP22: 0.3\n"; | ||
183 | |||
184 | static int __init watchdog_init(void) | 182 | static int __init watchdog_init(void) |
185 | { | 183 | { |
186 | int ret; | 184 | int ret; |
187 | 185 | ||
188 | ret = register_reboot_notifier(&indydog_notifier); | 186 | ret = register_reboot_notifier(&indydog_notifier); |
189 | if (ret) { | 187 | if (ret) { |
190 | printk(KERN_ERR PFX | 188 | pr_err("cannot register reboot notifier (err=%d)\n", ret); |
191 | "cannot register reboot notifier (err=%d)\n", ret); | ||
192 | return ret; | 189 | return ret; |
193 | } | 190 | } |
194 | 191 | ||
195 | ret = misc_register(&indydog_miscdev); | 192 | ret = misc_register(&indydog_miscdev); |
196 | if (ret) { | 193 | if (ret) { |
197 | printk(KERN_ERR PFX | 194 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
198 | "cannot register miscdev on minor=%d (err=%d)\n", | 195 | WATCHDOG_MINOR, ret); |
199 | WATCHDOG_MINOR, ret); | ||
200 | unregister_reboot_notifier(&indydog_notifier); | 196 | unregister_reboot_notifier(&indydog_notifier); |
201 | return ret; | 197 | return ret; |
202 | } | 198 | } |
203 | 199 | ||
204 | printk(banner); | 200 | pr_info("Hardware Watchdog Timer for SGI IP22: 0.3\n"); |
205 | 201 | ||
206 | return 0; | 202 | return 0; |
207 | } | 203 | } |
diff --git a/drivers/watchdog/intel_scu_watchdog.c b/drivers/watchdog/intel_scu_watchdog.c index 1abdc0454c54..9dda2d08af91 100644 --- a/drivers/watchdog/intel_scu_watchdog.c +++ b/drivers/watchdog/intel_scu_watchdog.c | |||
@@ -22,6 +22,8 @@ | |||
22 | * | 22 | * |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
26 | |||
25 | #include <linux/compiler.h> | 27 | #include <linux/compiler.h> |
26 | #include <linux/module.h> | 28 | #include <linux/module.h> |
27 | #include <linux/kernel.h> | 29 | #include <linux/kernel.h> |
@@ -96,15 +98,14 @@ static struct intel_scu_watchdog_dev watchdog_device; | |||
96 | static void watchdog_fire(void) | 98 | static void watchdog_fire(void) |
97 | { | 99 | { |
98 | if (force_boot) { | 100 | if (force_boot) { |
99 | printk(KERN_CRIT PFX "Initiating system reboot.\n"); | 101 | pr_crit("Initiating system reboot\n"); |
100 | emergency_restart(); | 102 | emergency_restart(); |
101 | printk(KERN_CRIT PFX "Reboot didn't ?????\n"); | 103 | pr_crit("Reboot didn't ?????\n"); |
102 | } | 104 | } |
103 | 105 | ||
104 | else { | 106 | else { |
105 | printk(KERN_CRIT PFX "Immediate Reboot Disabled\n"); | 107 | pr_crit("Immediate Reboot Disabled\n"); |
106 | printk(KERN_CRIT PFX | 108 | pr_crit("System will reset when watchdog timer times out!\n"); |
107 | "System will reset when watchdog timer times out!\n"); | ||
108 | } | 109 | } |
109 | } | 110 | } |
110 | 111 | ||
@@ -112,8 +113,8 @@ static int check_timer_margin(int new_margin) | |||
112 | { | 113 | { |
113 | if ((new_margin < MIN_TIME_CYCLE) || | 114 | if ((new_margin < MIN_TIME_CYCLE) || |
114 | (new_margin > MAX_TIME - timer_set)) { | 115 | (new_margin > MAX_TIME - timer_set)) { |
115 | pr_debug("Watchdog timer: value of new_margin %d is out of the range %d to %d\n", | 116 | pr_debug("value of new_margin %d is out of the range %d to %d\n", |
116 | new_margin, MIN_TIME_CYCLE, MAX_TIME - timer_set); | 117 | new_margin, MIN_TIME_CYCLE, MAX_TIME - timer_set); |
117 | return -EINVAL; | 118 | return -EINVAL; |
118 | } | 119 | } |
119 | return 0; | 120 | return 0; |
@@ -156,14 +157,14 @@ static irqreturn_t watchdog_timer_interrupt(int irq, void *dev_id) | |||
156 | int int_status; | 157 | int int_status; |
157 | int_status = ioread32(watchdog_device.timer_interrupt_status_addr); | 158 | int_status = ioread32(watchdog_device.timer_interrupt_status_addr); |
158 | 159 | ||
159 | pr_debug("Watchdog timer: irq, int_status: %x\n", int_status); | 160 | pr_debug("irq, int_status: %x\n", int_status); |
160 | 161 | ||
161 | if (int_status != 0) | 162 | if (int_status != 0) |
162 | return IRQ_NONE; | 163 | return IRQ_NONE; |
163 | 164 | ||
164 | /* has the timer been started? If not, then this is spurious */ | 165 | /* has the timer been started? If not, then this is spurious */ |
165 | if (watchdog_device.timer_started == 0) { | 166 | if (watchdog_device.timer_started == 0) { |
166 | pr_debug("Watchdog timer: spurious interrupt received\n"); | 167 | pr_debug("spurious interrupt received\n"); |
167 | return IRQ_HANDLED; | 168 | return IRQ_HANDLED; |
168 | } | 169 | } |
169 | 170 | ||
@@ -220,16 +221,15 @@ static int intel_scu_set_heartbeat(u32 t) | |||
220 | (watchdog_device.timer_set - timer_margin) | 221 | (watchdog_device.timer_set - timer_margin) |
221 | * watchdog_device.timer_tbl_ptr->freq_hz; | 222 | * watchdog_device.timer_tbl_ptr->freq_hz; |
222 | 223 | ||
223 | pr_debug("Watchdog timer: set_heartbeat: timer freq is %d\n", | 224 | pr_debug("set_heartbeat: timer freq is %d\n", |
224 | watchdog_device.timer_tbl_ptr->freq_hz); | 225 | watchdog_device.timer_tbl_ptr->freq_hz); |
225 | pr_debug("Watchdog timer: set_heartbeat: timer_set is %x (hex)\n", | 226 | pr_debug("set_heartbeat: timer_set is %x (hex)\n", |
226 | watchdog_device.timer_set); | 227 | watchdog_device.timer_set); |
227 | pr_debug("Watchdog timer: set_hearbeat: timer_margin is %x (hex)\n", | 228 | pr_debug("set_hearbeat: timer_margin is %x (hex)\n", timer_margin); |
228 | timer_margin); | 229 | pr_debug("set_heartbeat: threshold is %x (hex)\n", |
229 | pr_debug("Watchdog timer: set_heartbeat: threshold is %x (hex)\n", | 230 | watchdog_device.threshold); |
230 | watchdog_device.threshold); | 231 | pr_debug("set_heartbeat: soft_threshold is %x (hex)\n", |
231 | pr_debug("Watchdog timer: set_heartbeat: soft_threshold is %x (hex)\n", | 232 | watchdog_device.soft_threshold); |
232 | watchdog_device.soft_threshold); | ||
233 | 233 | ||
234 | /* Adjust thresholds by FREQ_ADJUSTMENT factor, to make the */ | 234 | /* Adjust thresholds by FREQ_ADJUSTMENT factor, to make the */ |
235 | /* watchdog timing come out right. */ | 235 | /* watchdog timing come out right. */ |
@@ -264,7 +264,7 @@ static int intel_scu_set_heartbeat(u32 t) | |||
264 | 264 | ||
265 | if (MAX_RETRY < retry_count++) { | 265 | if (MAX_RETRY < retry_count++) { |
266 | /* Unable to set timer value */ | 266 | /* Unable to set timer value */ |
267 | pr_err("Watchdog timer: Unable to set timer\n"); | 267 | pr_err("Unable to set timer\n"); |
268 | return -ENODEV; | 268 | return -ENODEV; |
269 | } | 269 | } |
270 | 270 | ||
@@ -321,18 +321,17 @@ static int intel_scu_release(struct inode *inode, struct file *file) | |||
321 | */ | 321 | */ |
322 | 322 | ||
323 | if (!test_and_clear_bit(0, &watchdog_device.driver_open)) { | 323 | if (!test_and_clear_bit(0, &watchdog_device.driver_open)) { |
324 | pr_debug("Watchdog timer: intel_scu_release, without open\n"); | 324 | pr_debug("intel_scu_release, without open\n"); |
325 | return -ENOTTY; | 325 | return -ENOTTY; |
326 | } | 326 | } |
327 | 327 | ||
328 | if (!watchdog_device.timer_started) { | 328 | if (!watchdog_device.timer_started) { |
329 | /* Just close, since timer has not been started */ | 329 | /* Just close, since timer has not been started */ |
330 | pr_debug("Watchdog timer: closed, without starting timer\n"); | 330 | pr_debug("closed, without starting timer\n"); |
331 | return 0; | 331 | return 0; |
332 | } | 332 | } |
333 | 333 | ||
334 | printk(KERN_CRIT PFX | 334 | pr_crit("Unexpected close of /dev/watchdog!\n"); |
335 | "Unexpected close of /dev/watchdog!\n"); | ||
336 | 335 | ||
337 | /* Since the timer was started, prevent future reopens */ | 336 | /* Since the timer was started, prevent future reopens */ |
338 | watchdog_device.driver_closed = 1; | 337 | watchdog_device.driver_closed = 1; |
@@ -454,9 +453,8 @@ static int __init intel_scu_watchdog_init(void) | |||
454 | /* Check value of timer_set boot parameter */ | 453 | /* Check value of timer_set boot parameter */ |
455 | if ((timer_set < MIN_TIME_CYCLE) || | 454 | if ((timer_set < MIN_TIME_CYCLE) || |
456 | (timer_set > MAX_TIME - MIN_TIME_CYCLE)) { | 455 | (timer_set > MAX_TIME - MIN_TIME_CYCLE)) { |
457 | pr_err("Watchdog timer: value of timer_set %x (hex) " | 456 | pr_err("value of timer_set %x (hex) is out of range from %x to %x (hex)\n", |
458 | "is out of range from %x to %x (hex)\n", | 457 | timer_set, MIN_TIME_CYCLE, MAX_TIME - MIN_TIME_CYCLE); |
459 | timer_set, MIN_TIME_CYCLE, MAX_TIME - MIN_TIME_CYCLE); | ||
460 | return -EINVAL; | 458 | return -EINVAL; |
461 | } | 459 | } |
462 | 460 | ||
@@ -467,19 +465,18 @@ static int __init intel_scu_watchdog_init(void) | |||
467 | watchdog_device.timer_tbl_ptr = sfi_get_mtmr(sfi_mtimer_num-1); | 465 | watchdog_device.timer_tbl_ptr = sfi_get_mtmr(sfi_mtimer_num-1); |
468 | 466 | ||
469 | if (watchdog_device.timer_tbl_ptr == NULL) { | 467 | if (watchdog_device.timer_tbl_ptr == NULL) { |
470 | pr_debug("Watchdog timer - Intel SCU watchdog: timer is not available\n"); | 468 | pr_debug("timer is not available\n"); |
471 | return -ENODEV; | 469 | return -ENODEV; |
472 | } | 470 | } |
473 | /* make sure the timer exists */ | 471 | /* make sure the timer exists */ |
474 | if (watchdog_device.timer_tbl_ptr->phys_addr == 0) { | 472 | if (watchdog_device.timer_tbl_ptr->phys_addr == 0) { |
475 | pr_debug("Watchdog timer - Intel SCU watchdog - timer %d does not have valid physical memory\n", | 473 | pr_debug("timer %d does not have valid physical memory\n", |
476 | sfi_mtimer_num); | 474 | sfi_mtimer_num); |
477 | return -ENODEV; | 475 | return -ENODEV; |
478 | } | 476 | } |
479 | 477 | ||
480 | if (watchdog_device.timer_tbl_ptr->irq == 0) { | 478 | if (watchdog_device.timer_tbl_ptr->irq == 0) { |
481 | pr_debug("Watchdog timer: timer %d invalid irq\n", | 479 | pr_debug("timer %d invalid irq\n", sfi_mtimer_num); |
482 | sfi_mtimer_num); | ||
483 | return -ENODEV; | 480 | return -ENODEV; |
484 | } | 481 | } |
485 | 482 | ||
@@ -487,7 +484,7 @@ static int __init intel_scu_watchdog_init(void) | |||
487 | 20); | 484 | 20); |
488 | 485 | ||
489 | if (tmp_addr == NULL) { | 486 | if (tmp_addr == NULL) { |
490 | pr_debug("Watchdog timer: timer unable to ioremap\n"); | 487 | pr_debug("timer unable to ioremap\n"); |
491 | return -ENOMEM; | 488 | return -ENOMEM; |
492 | } | 489 | } |
493 | 490 | ||
@@ -512,7 +509,7 @@ static int __init intel_scu_watchdog_init(void) | |||
512 | 509 | ||
513 | ret = register_reboot_notifier(&watchdog_device.intel_scu_notifier); | 510 | ret = register_reboot_notifier(&watchdog_device.intel_scu_notifier); |
514 | if (ret) { | 511 | if (ret) { |
515 | pr_err("Watchdog timer: cannot register notifier %d)\n", ret); | 512 | pr_err("cannot register notifier %d)\n", ret); |
516 | goto register_reboot_error; | 513 | goto register_reboot_error; |
517 | } | 514 | } |
518 | 515 | ||
@@ -522,8 +519,8 @@ static int __init intel_scu_watchdog_init(void) | |||
522 | 519 | ||
523 | ret = misc_register(&watchdog_device.miscdev); | 520 | ret = misc_register(&watchdog_device.miscdev); |
524 | if (ret) { | 521 | if (ret) { |
525 | pr_err("Watchdog timer: cannot register miscdev %d err =%d\n", | 522 | pr_err("cannot register miscdev %d err =%d\n", |
526 | WATCHDOG_MINOR, ret); | 523 | WATCHDOG_MINOR, ret); |
527 | goto misc_register_error; | 524 | goto misc_register_error; |
528 | } | 525 | } |
529 | 526 | ||
@@ -532,7 +529,7 @@ static int __init intel_scu_watchdog_init(void) | |||
532 | IRQF_SHARED, "watchdog", | 529 | IRQF_SHARED, "watchdog", |
533 | &watchdog_device.timer_load_count_addr); | 530 | &watchdog_device.timer_load_count_addr); |
534 | if (ret) { | 531 | if (ret) { |
535 | pr_err("Watchdog timer: error requesting irq %d\n", ret); | 532 | pr_err("error requesting irq %d\n", ret); |
536 | goto request_irq_error; | 533 | goto request_irq_error; |
537 | } | 534 | } |
538 | /* Make sure timer is disabled before returning */ | 535 | /* Make sure timer is disabled before returning */ |
diff --git a/drivers/watchdog/intel_scu_watchdog.h b/drivers/watchdog/intel_scu_watchdog.h index d2b074a82db6..f3ac608deb6a 100644 --- a/drivers/watchdog/intel_scu_watchdog.h +++ b/drivers/watchdog/intel_scu_watchdog.h | |||
@@ -25,7 +25,6 @@ | |||
25 | #ifndef __INTEL_SCU_WATCHDOG_H | 25 | #ifndef __INTEL_SCU_WATCHDOG_H |
26 | #define __INTEL_SCU_WATCHDOG_H | 26 | #define __INTEL_SCU_WATCHDOG_H |
27 | 27 | ||
28 | #define PFX "Intel_SCU: " | ||
29 | #define WDT_VER "0.3" | 28 | #define WDT_VER "0.3" |
30 | 29 | ||
31 | /* minimum time between interrupts */ | 30 | /* minimum time between interrupts */ |
diff --git a/drivers/watchdog/iop_wdt.c b/drivers/watchdog/iop_wdt.c index 82fa7a92a8d2..d964faf1a250 100644 --- a/drivers/watchdog/iop_wdt.c +++ b/drivers/watchdog/iop_wdt.c | |||
@@ -24,6 +24,8 @@ | |||
24 | * Dan Williams <dan.j.williams@intel.com> | 24 | * Dan Williams <dan.j.williams@intel.com> |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
28 | |||
27 | #include <linux/module.h> | 29 | #include <linux/module.h> |
28 | #include <linux/kernel.h> | 30 | #include <linux/kernel.h> |
29 | #include <linux/fs.h> | 31 | #include <linux/fs.h> |
@@ -34,7 +36,7 @@ | |||
34 | #include <linux/uaccess.h> | 36 | #include <linux/uaccess.h> |
35 | #include <mach/hardware.h> | 37 | #include <mach/hardware.h> |
36 | 38 | ||
37 | static int nowayout = WATCHDOG_NOWAYOUT; | 39 | static bool nowayout = WATCHDOG_NOWAYOUT; |
38 | static unsigned long wdt_status; | 40 | static unsigned long wdt_status; |
39 | static unsigned long boot_status; | 41 | static unsigned long boot_status; |
40 | static DEFINE_SPINLOCK(wdt_lock); | 42 | static DEFINE_SPINLOCK(wdt_lock); |
@@ -85,7 +87,7 @@ static int wdt_disable(void) | |||
85 | write_wdtcr(IOP_WDTCR_DIS); | 87 | write_wdtcr(IOP_WDTCR_DIS); |
86 | clear_bit(WDT_ENABLED, &wdt_status); | 88 | clear_bit(WDT_ENABLED, &wdt_status); |
87 | spin_unlock(&wdt_lock); | 89 | spin_unlock(&wdt_lock); |
88 | printk(KERN_INFO "WATCHDOG: Disabled\n"); | 90 | pr_info("Disabled\n"); |
89 | return 0; | 91 | return 0; |
90 | } else | 92 | } else |
91 | return 1; | 93 | return 1; |
@@ -197,8 +199,8 @@ static int iop_wdt_release(struct inode *inode, struct file *file) | |||
197 | */ | 199 | */ |
198 | if (state != 0) { | 200 | if (state != 0) { |
199 | wdt_enable(); | 201 | wdt_enable(); |
200 | printk(KERN_CRIT "WATCHDOG: Device closed unexpectedly - " | 202 | pr_crit("Device closed unexpectedly - reset in %lu seconds\n", |
201 | "reset in %lu seconds\n", iop_watchdog_timeout()); | 203 | iop_watchdog_timeout()); |
202 | } | 204 | } |
203 | 205 | ||
204 | clear_bit(WDT_IN_USE, &wdt_status); | 206 | clear_bit(WDT_IN_USE, &wdt_status); |
@@ -238,8 +240,7 @@ static int __init iop_wdt_init(void) | |||
238 | with an open */ | 240 | with an open */ |
239 | ret = misc_register(&iop_wdt_miscdev); | 241 | ret = misc_register(&iop_wdt_miscdev); |
240 | if (ret == 0) | 242 | if (ret == 0) |
241 | printk(KERN_INFO "iop watchdog timer: timeout %lu sec\n", | 243 | pr_info("timeout %lu sec\n", iop_watchdog_timeout()); |
242 | iop_watchdog_timeout()); | ||
243 | 244 | ||
244 | return ret; | 245 | return ret; |
245 | } | 246 | } |
@@ -252,7 +253,7 @@ static void __exit iop_wdt_exit(void) | |||
252 | module_init(iop_wdt_init); | 253 | module_init(iop_wdt_init); |
253 | module_exit(iop_wdt_exit); | 254 | module_exit(iop_wdt_exit); |
254 | 255 | ||
255 | module_param(nowayout, int, 0); | 256 | module_param(nowayout, bool, 0); |
256 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started"); | 257 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started"); |
257 | 258 | ||
258 | MODULE_AUTHOR("Curt E Bruns <curt.e.bruns@intel.com>"); | 259 | MODULE_AUTHOR("Curt E Bruns <curt.e.bruns@intel.com>"); |
diff --git a/drivers/watchdog/it8712f_wdt.c b/drivers/watchdog/it8712f_wdt.c index 8d2d8502d3e8..f4cce6d66a55 100644 --- a/drivers/watchdog/it8712f_wdt.c +++ b/drivers/watchdog/it8712f_wdt.c | |||
@@ -20,6 +20,8 @@ | |||
20 | * software is provided AS-IS with no warranties. | 20 | * software is provided AS-IS with no warranties. |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
24 | |||
23 | #include <linux/module.h> | 25 | #include <linux/module.h> |
24 | #include <linux/moduleparam.h> | 26 | #include <linux/moduleparam.h> |
25 | #include <linux/init.h> | 27 | #include <linux/init.h> |
@@ -33,6 +35,7 @@ | |||
33 | #include <linux/io.h> | 35 | #include <linux/io.h> |
34 | #include <linux/ioport.h> | 36 | #include <linux/ioport.h> |
35 | 37 | ||
38 | #define DEBUG | ||
36 | #define NAME "it8712f_wdt" | 39 | #define NAME "it8712f_wdt" |
37 | 40 | ||
38 | MODULE_AUTHOR("Jorge Boncompte - DTI2 <jorge@dti2.net>"); | 41 | MODULE_AUTHOR("Jorge Boncompte - DTI2 <jorge@dti2.net>"); |
@@ -45,8 +48,8 @@ static int margin = 60; /* in seconds */ | |||
45 | module_param(margin, int, 0); | 48 | module_param(margin, int, 0); |
46 | MODULE_PARM_DESC(margin, "Watchdog margin in seconds"); | 49 | MODULE_PARM_DESC(margin, "Watchdog margin in seconds"); |
47 | 50 | ||
48 | static int nowayout = WATCHDOG_NOWAYOUT; | 51 | static bool nowayout = WATCHDOG_NOWAYOUT; |
49 | module_param(nowayout, int, 0); | 52 | module_param(nowayout, bool, 0); |
50 | MODULE_PARM_DESC(nowayout, "Disable watchdog shutdown on close"); | 53 | MODULE_PARM_DESC(nowayout, "Disable watchdog shutdown on close"); |
51 | 54 | ||
52 | static unsigned long wdt_open; | 55 | static unsigned long wdt_open; |
@@ -158,10 +161,10 @@ static void it8712f_wdt_update_margin(void) | |||
158 | */ | 161 | */ |
159 | if (units <= max_units) { | 162 | if (units <= max_units) { |
160 | config |= WDT_UNIT_SEC; /* else UNIT is MINUTES */ | 163 | config |= WDT_UNIT_SEC; /* else UNIT is MINUTES */ |
161 | printk(KERN_INFO NAME ": timer margin %d seconds\n", units); | 164 | pr_info("timer margin %d seconds\n", units); |
162 | } else { | 165 | } else { |
163 | units /= 60; | 166 | units /= 60; |
164 | printk(KERN_INFO NAME ": timer margin %d minutes\n", units); | 167 | pr_info("timer margin %d minutes\n", units); |
165 | } | 168 | } |
166 | superio_outb(config, WDT_CONFIG); | 169 | superio_outb(config, WDT_CONFIG); |
167 | 170 | ||
@@ -184,7 +187,7 @@ static int it8712f_wdt_enable(void) | |||
184 | if (ret) | 187 | if (ret) |
185 | return ret; | 188 | return ret; |
186 | 189 | ||
187 | printk(KERN_DEBUG NAME ": enabling watchdog timer\n"); | 190 | pr_debug("enabling watchdog timer\n"); |
188 | superio_select(LDN_GPIO); | 191 | superio_select(LDN_GPIO); |
189 | 192 | ||
190 | superio_outb(wdt_control_reg, WDT_CONTROL); | 193 | superio_outb(wdt_control_reg, WDT_CONTROL); |
@@ -204,7 +207,7 @@ static int it8712f_wdt_disable(void) | |||
204 | if (ret) | 207 | if (ret) |
205 | return ret; | 208 | return ret; |
206 | 209 | ||
207 | printk(KERN_DEBUG NAME ": disabling watchdog timer\n"); | 210 | pr_debug("disabling watchdog timer\n"); |
208 | superio_select(LDN_GPIO); | 211 | superio_select(LDN_GPIO); |
209 | 212 | ||
210 | superio_outb(0, WDT_CONFIG); | 213 | superio_outb(0, WDT_CONFIG); |
@@ -331,12 +334,10 @@ static int it8712f_wdt_open(struct inode *inode, struct file *file) | |||
331 | static int it8712f_wdt_release(struct inode *inode, struct file *file) | 334 | static int it8712f_wdt_release(struct inode *inode, struct file *file) |
332 | { | 335 | { |
333 | if (expect_close != 42) { | 336 | if (expect_close != 42) { |
334 | printk(KERN_WARNING NAME | 337 | pr_warn("watchdog device closed unexpectedly, will not disable the watchdog timer\n"); |
335 | ": watchdog device closed unexpectedly, will not" | ||
336 | " disable the watchdog timer\n"); | ||
337 | } else if (!nowayout) { | 338 | } else if (!nowayout) { |
338 | if (it8712f_wdt_disable()) | 339 | if (it8712f_wdt_disable()) |
339 | printk(KERN_WARNING NAME "Watchdog disable failed\n"); | 340 | pr_warn("Watchdog disable failed\n"); |
340 | } | 341 | } |
341 | expect_close = 0; | 342 | expect_close = 0; |
342 | clear_bit(0, &wdt_open); | 343 | clear_bit(0, &wdt_open); |
@@ -374,13 +375,13 @@ static int __init it8712f_wdt_find(unsigned short *address) | |||
374 | superio_select(LDN_GAME); | 375 | superio_select(LDN_GAME); |
375 | superio_outb(1, ACT_REG); | 376 | superio_outb(1, ACT_REG); |
376 | if (!(superio_inb(ACT_REG) & 0x01)) { | 377 | if (!(superio_inb(ACT_REG) & 0x01)) { |
377 | printk(KERN_ERR NAME ": Device not activated, skipping\n"); | 378 | pr_err("Device not activated, skipping\n"); |
378 | goto exit; | 379 | goto exit; |
379 | } | 380 | } |
380 | 381 | ||
381 | *address = superio_inw(BASE_REG); | 382 | *address = superio_inw(BASE_REG); |
382 | if (*address == 0) { | 383 | if (*address == 0) { |
383 | printk(KERN_ERR NAME ": Base address not set, skipping\n"); | 384 | pr_err("Base address not set, skipping\n"); |
384 | goto exit; | 385 | goto exit; |
385 | } | 386 | } |
386 | 387 | ||
@@ -394,8 +395,7 @@ static int __init it8712f_wdt_find(unsigned short *address) | |||
394 | if (margin > (max_units * 60)) | 395 | if (margin > (max_units * 60)) |
395 | margin = (max_units * 60); | 396 | margin = (max_units * 60); |
396 | 397 | ||
397 | printk(KERN_INFO NAME ": Found IT%04xF chip revision %d - " | 398 | pr_info("Found IT%04xF chip revision %d - using DogFood address 0x%x\n", |
398 | "using DogFood address 0x%x\n", | ||
399 | chip_type, revision, *address); | 399 | chip_type, revision, *address); |
400 | 400 | ||
401 | exit: | 401 | exit: |
@@ -411,27 +411,26 @@ static int __init it8712f_wdt_init(void) | |||
411 | return -ENODEV; | 411 | return -ENODEV; |
412 | 412 | ||
413 | if (!request_region(address, 1, "IT8712F Watchdog")) { | 413 | if (!request_region(address, 1, "IT8712F Watchdog")) { |
414 | printk(KERN_WARNING NAME ": watchdog I/O region busy\n"); | 414 | pr_warn("watchdog I/O region busy\n"); |
415 | return -EBUSY; | 415 | return -EBUSY; |
416 | } | 416 | } |
417 | 417 | ||
418 | err = it8712f_wdt_disable(); | 418 | err = it8712f_wdt_disable(); |
419 | if (err) { | 419 | if (err) { |
420 | printk(KERN_ERR NAME ": unable to disable watchdog timer.\n"); | 420 | pr_err("unable to disable watchdog timer\n"); |
421 | goto out; | 421 | goto out; |
422 | } | 422 | } |
423 | 423 | ||
424 | err = register_reboot_notifier(&it8712f_wdt_notifier); | 424 | err = register_reboot_notifier(&it8712f_wdt_notifier); |
425 | if (err) { | 425 | if (err) { |
426 | printk(KERN_ERR NAME ": unable to register reboot notifier\n"); | 426 | pr_err("unable to register reboot notifier\n"); |
427 | goto out; | 427 | goto out; |
428 | } | 428 | } |
429 | 429 | ||
430 | err = misc_register(&it8712f_wdt_miscdev); | 430 | err = misc_register(&it8712f_wdt_miscdev); |
431 | if (err) { | 431 | if (err) { |
432 | printk(KERN_ERR NAME | 432 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
433 | ": cannot register miscdev on minor=%d (err=%d)\n", | 433 | WATCHDOG_MINOR, err); |
434 | WATCHDOG_MINOR, err); | ||
435 | goto reboot_out; | 434 | goto reboot_out; |
436 | } | 435 | } |
437 | 436 | ||
diff --git a/drivers/watchdog/it87_wdt.c b/drivers/watchdog/it87_wdt.c index a2d9a1266a23..405ae7be7c6f 100644 --- a/drivers/watchdog/it87_wdt.c +++ b/drivers/watchdog/it87_wdt.c | |||
@@ -29,6 +29,8 @@ | |||
29 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 29 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
30 | */ | 30 | */ |
31 | 31 | ||
32 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
33 | |||
32 | #include <linux/module.h> | 34 | #include <linux/module.h> |
33 | #include <linux/moduleparam.h> | 35 | #include <linux/moduleparam.h> |
34 | #include <linux/types.h> | 36 | #include <linux/types.h> |
@@ -47,7 +49,6 @@ | |||
47 | 49 | ||
48 | #define WATCHDOG_VERSION "1.14" | 50 | #define WATCHDOG_VERSION "1.14" |
49 | #define WATCHDOG_NAME "IT87 WDT" | 51 | #define WATCHDOG_NAME "IT87 WDT" |
50 | #define PFX WATCHDOG_NAME ": " | ||
51 | #define DRIVER_VERSION WATCHDOG_NAME " driver, v" WATCHDOG_VERSION "\n" | 52 | #define DRIVER_VERSION WATCHDOG_NAME " driver, v" WATCHDOG_VERSION "\n" |
52 | #define WD_MAGIC 'V' | 53 | #define WD_MAGIC 'V' |
53 | 54 | ||
@@ -142,7 +143,7 @@ static int nogameport = DEFAULT_NOGAMEPORT; | |||
142 | static int exclusive = DEFAULT_EXCLUSIVE; | 143 | static int exclusive = DEFAULT_EXCLUSIVE; |
143 | static int timeout = DEFAULT_TIMEOUT; | 144 | static int timeout = DEFAULT_TIMEOUT; |
144 | static int testmode = DEFAULT_TESTMODE; | 145 | static int testmode = DEFAULT_TESTMODE; |
145 | static int nowayout = DEFAULT_NOWAYOUT; | 146 | static bool nowayout = DEFAULT_NOWAYOUT; |
146 | 147 | ||
147 | module_param(nogameport, int, 0); | 148 | module_param(nogameport, int, 0); |
148 | MODULE_PARM_DESC(nogameport, "Forbid the activation of game port, default=" | 149 | MODULE_PARM_DESC(nogameport, "Forbid the activation of game port, default=" |
@@ -156,7 +157,7 @@ MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds, default=" | |||
156 | module_param(testmode, int, 0); | 157 | module_param(testmode, int, 0); |
157 | MODULE_PARM_DESC(testmode, "Watchdog test mode (1 = no reboot), default=" | 158 | MODULE_PARM_DESC(testmode, "Watchdog test mode (1 = no reboot), default=" |
158 | __MODULE_STRING(DEFAULT_TESTMODE)); | 159 | __MODULE_STRING(DEFAULT_TESTMODE)); |
159 | module_param(nowayout, int, 0); | 160 | module_param(nowayout, bool, 0); |
160 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started, default=" | 161 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started, default=" |
161 | __MODULE_STRING(WATCHDOG_NOWAYOUT)); | 162 | __MODULE_STRING(WATCHDOG_NOWAYOUT)); |
162 | 163 | ||
@@ -428,8 +429,7 @@ static int wdt_release(struct inode *inode, struct file *file) | |||
428 | clear_bit(WDTS_TIMER_RUN, &wdt_status); | 429 | clear_bit(WDTS_TIMER_RUN, &wdt_status); |
429 | } else { | 430 | } else { |
430 | wdt_keepalive(); | 431 | wdt_keepalive(); |
431 | printk(KERN_CRIT PFX | 432 | pr_crit("unexpected close, not stopping watchdog!\n"); |
432 | "unexpected close, not stopping watchdog!\n"); | ||
433 | } | 433 | } |
434 | } | 434 | } |
435 | clear_bit(WDTS_DEV_OPEN, &wdt_status); | 435 | clear_bit(WDTS_DEV_OPEN, &wdt_status); |
@@ -621,16 +621,14 @@ static int __init it87_wdt_init(void) | |||
621 | try_gameport = 0; | 621 | try_gameport = 0; |
622 | break; | 622 | break; |
623 | case IT8705_ID: | 623 | case IT8705_ID: |
624 | printk(KERN_ERR PFX | 624 | pr_err("Unsupported Chip found, Chip %04x Revision %02x\n", |
625 | "Unsupported Chip found, Chip %04x Revision %02x\n", | ||
626 | chip_type, chip_rev); | 625 | chip_type, chip_rev); |
627 | return -ENODEV; | 626 | return -ENODEV; |
628 | case NO_DEV_ID: | 627 | case NO_DEV_ID: |
629 | printk(KERN_ERR PFX "no device\n"); | 628 | pr_err("no device\n"); |
630 | return -ENODEV; | 629 | return -ENODEV; |
631 | default: | 630 | default: |
632 | printk(KERN_ERR PFX | 631 | pr_err("Unknown Chip found, Chip %04x Revision %04x\n", |
633 | "Unknown Chip found, Chip %04x Revision %04x\n", | ||
634 | chip_type, chip_rev); | 632 | chip_type, chip_rev); |
635 | return -ENODEV; | 633 | return -ENODEV; |
636 | } | 634 | } |
@@ -663,13 +661,11 @@ static int __init it87_wdt_init(void) | |||
663 | if (!test_bit(WDTS_USE_GP, &wdt_status)) { | 661 | if (!test_bit(WDTS_USE_GP, &wdt_status)) { |
664 | if (!request_region(CIR_BASE, 8, WATCHDOG_NAME)) { | 662 | if (!request_region(CIR_BASE, 8, WATCHDOG_NAME)) { |
665 | if (gp_rreq_fail) | 663 | if (gp_rreq_fail) |
666 | printk(KERN_ERR PFX | 664 | pr_err("I/O Address 0x%04x and 0x%04x already in use\n", |
667 | "I/O Address 0x%04x and 0x%04x" | 665 | base, CIR_BASE); |
668 | " already in use\n", base, CIR_BASE); | ||
669 | else | 666 | else |
670 | printk(KERN_ERR PFX | 667 | pr_err("I/O Address 0x%04x already in use\n", |
671 | "I/O Address 0x%04x already in use\n", | 668 | CIR_BASE); |
672 | CIR_BASE); | ||
673 | rc = -EIO; | 669 | rc = -EIO; |
674 | goto err_out; | 670 | goto err_out; |
675 | } | 671 | } |
@@ -688,9 +684,8 @@ static int __init it87_wdt_init(void) | |||
688 | 684 | ||
689 | if (timeout < 1 || timeout > max_units * 60) { | 685 | if (timeout < 1 || timeout > max_units * 60) { |
690 | timeout = DEFAULT_TIMEOUT; | 686 | timeout = DEFAULT_TIMEOUT; |
691 | printk(KERN_WARNING PFX | 687 | pr_warn("Timeout value out of range, use default %d sec\n", |
692 | "Timeout value out of range, use default %d sec\n", | 688 | DEFAULT_TIMEOUT); |
693 | DEFAULT_TIMEOUT); | ||
694 | } | 689 | } |
695 | 690 | ||
696 | if (timeout > max_units) | 691 | if (timeout > max_units) |
@@ -698,16 +693,14 @@ static int __init it87_wdt_init(void) | |||
698 | 693 | ||
699 | rc = register_reboot_notifier(&wdt_notifier); | 694 | rc = register_reboot_notifier(&wdt_notifier); |
700 | if (rc) { | 695 | if (rc) { |
701 | printk(KERN_ERR PFX | 696 | pr_err("Cannot register reboot notifier (err=%d)\n", rc); |
702 | "Cannot register reboot notifier (err=%d)\n", rc); | ||
703 | goto err_out_region; | 697 | goto err_out_region; |
704 | } | 698 | } |
705 | 699 | ||
706 | rc = misc_register(&wdt_miscdev); | 700 | rc = misc_register(&wdt_miscdev); |
707 | if (rc) { | 701 | if (rc) { |
708 | printk(KERN_ERR PFX | 702 | pr_err("Cannot register miscdev on minor=%d (err=%d)\n", |
709 | "Cannot register miscdev on minor=%d (err=%d)\n", | 703 | wdt_miscdev.minor, rc); |
710 | wdt_miscdev.minor, rc); | ||
711 | goto err_out_reboot; | 704 | goto err_out_reboot; |
712 | } | 705 | } |
713 | 706 | ||
@@ -722,9 +715,8 @@ static int __init it87_wdt_init(void) | |||
722 | outb(0x09, CIR_IER(base)); | 715 | outb(0x09, CIR_IER(base)); |
723 | } | 716 | } |
724 | 717 | ||
725 | printk(KERN_INFO PFX "Chip IT%04x revision %d initialized. " | 718 | pr_info("Chip IT%04x revision %d initialized. timeout=%d sec (nowayout=%d testmode=%d exclusive=%d nogameport=%d)\n", |
726 | "timeout=%d sec (nowayout=%d testmode=%d exclusive=%d " | 719 | chip_type, chip_rev, timeout, |
727 | "nogameport=%d)\n", chip_type, chip_rev, timeout, | ||
728 | nowayout, testmode, exclusive, nogameport); | 720 | nowayout, testmode, exclusive, nogameport); |
729 | 721 | ||
730 | superio_exit(); | 722 | superio_exit(); |
diff --git a/drivers/watchdog/ixp2000_wdt.c b/drivers/watchdog/ixp2000_wdt.c index 084f71aa855a..3f047a58d3ae 100644 --- a/drivers/watchdog/ixp2000_wdt.c +++ b/drivers/watchdog/ixp2000_wdt.c | |||
@@ -16,6 +16,8 @@ | |||
16 | * warranty of any kind, whether express or implied. | 16 | * warranty of any kind, whether express or implied. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
20 | |||
19 | #include <linux/module.h> | 21 | #include <linux/module.h> |
20 | #include <linux/moduleparam.h> | 22 | #include <linux/moduleparam.h> |
21 | #include <linux/types.h> | 23 | #include <linux/types.h> |
@@ -29,7 +31,7 @@ | |||
29 | #include <linux/uaccess.h> | 31 | #include <linux/uaccess.h> |
30 | #include <mach/hardware.h> | 32 | #include <mach/hardware.h> |
31 | 33 | ||
32 | static int nowayout = WATCHDOG_NOWAYOUT; | 34 | static bool nowayout = WATCHDOG_NOWAYOUT; |
33 | static unsigned int heartbeat = 60; /* (secs) Default is 1 minute */ | 35 | static unsigned int heartbeat = 60; /* (secs) Default is 1 minute */ |
34 | static unsigned long wdt_status; | 36 | static unsigned long wdt_status; |
35 | static DEFINE_SPINLOCK(wdt_lock); | 37 | static DEFINE_SPINLOCK(wdt_lock); |
@@ -158,8 +160,7 @@ static int ixp2000_wdt_release(struct inode *inode, struct file *file) | |||
158 | if (test_bit(WDT_OK_TO_CLOSE, &wdt_status)) | 160 | if (test_bit(WDT_OK_TO_CLOSE, &wdt_status)) |
159 | wdt_disable(); | 161 | wdt_disable(); |
160 | else | 162 | else |
161 | printk(KERN_CRIT "WATCHDOG: Device closed unexpectedly - " | 163 | pr_crit("Device closed unexpectedly - timer will not stop\n"); |
162 | "timer will not stop\n"); | ||
163 | clear_bit(WDT_IN_USE, &wdt_status); | 164 | clear_bit(WDT_IN_USE, &wdt_status); |
164 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); | 165 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); |
165 | 166 | ||
@@ -185,7 +186,7 @@ static struct miscdevice ixp2000_wdt_miscdev = { | |||
185 | static int __init ixp2000_wdt_init(void) | 186 | static int __init ixp2000_wdt_init(void) |
186 | { | 187 | { |
187 | if ((*IXP2000_PRODUCT_ID & 0x001ffef0) == 0x00000000) { | 188 | if ((*IXP2000_PRODUCT_ID & 0x001ffef0) == 0x00000000) { |
188 | printk(KERN_INFO "Unable to use IXP2000 watchdog due to IXP2800 erratum #25.\n"); | 189 | pr_info("Unable to use IXP2000 watchdog due to IXP2800 erratum #25\n"); |
189 | return -EIO; | 190 | return -EIO; |
190 | } | 191 | } |
191 | wdt_tick_rate = (*IXP2000_T1_CLD * HZ) / 256; | 192 | wdt_tick_rate = (*IXP2000_T1_CLD * HZ) / 256; |
@@ -206,7 +207,7 @@ MODULE_DESCRIPTION("IXP2000 Network Processor Watchdog"); | |||
206 | module_param(heartbeat, int, 0); | 207 | module_param(heartbeat, int, 0); |
207 | MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds (default 60s)"); | 208 | MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds (default 60s)"); |
208 | 209 | ||
209 | module_param(nowayout, int, 0); | 210 | module_param(nowayout, bool, 0); |
210 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started"); | 211 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started"); |
211 | 212 | ||
212 | MODULE_LICENSE("GPL"); | 213 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/watchdog/ixp4xx_wdt.c b/drivers/watchdog/ixp4xx_wdt.c index 4fc2e9ac26f7..5580b4fff7fe 100644 --- a/drivers/watchdog/ixp4xx_wdt.c +++ b/drivers/watchdog/ixp4xx_wdt.c | |||
@@ -13,6 +13,8 @@ | |||
13 | * warranty of any kind, whether express or implied. | 13 | * warranty of any kind, whether express or implied. |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
17 | |||
16 | #include <linux/module.h> | 18 | #include <linux/module.h> |
17 | #include <linux/moduleparam.h> | 19 | #include <linux/moduleparam.h> |
18 | #include <linux/types.h> | 20 | #include <linux/types.h> |
@@ -25,7 +27,7 @@ | |||
25 | #include <linux/uaccess.h> | 27 | #include <linux/uaccess.h> |
26 | #include <mach/hardware.h> | 28 | #include <mach/hardware.h> |
27 | 29 | ||
28 | static int nowayout = WATCHDOG_NOWAYOUT; | 30 | static bool nowayout = WATCHDOG_NOWAYOUT; |
29 | static int heartbeat = 60; /* (secs) Default is 1 minute */ | 31 | static int heartbeat = 60; /* (secs) Default is 1 minute */ |
30 | static unsigned long wdt_status; | 32 | static unsigned long wdt_status; |
31 | static unsigned long boot_status; | 33 | static unsigned long boot_status; |
@@ -147,8 +149,7 @@ static int ixp4xx_wdt_release(struct inode *inode, struct file *file) | |||
147 | if (test_bit(WDT_OK_TO_CLOSE, &wdt_status)) | 149 | if (test_bit(WDT_OK_TO_CLOSE, &wdt_status)) |
148 | wdt_disable(); | 150 | wdt_disable(); |
149 | else | 151 | else |
150 | printk(KERN_CRIT "WATCHDOG: Device closed unexpectedly - " | 152 | pr_crit("Device closed unexpectedly - timer will not stop\n"); |
151 | "timer will not stop\n"); | ||
152 | clear_bit(WDT_IN_USE, &wdt_status); | 153 | clear_bit(WDT_IN_USE, &wdt_status); |
153 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); | 154 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); |
154 | 155 | ||
@@ -176,8 +177,7 @@ static int __init ixp4xx_wdt_init(void) | |||
176 | int ret; | 177 | int ret; |
177 | 178 | ||
178 | if (!(read_cpuid_id() & 0xf) && !cpu_is_ixp46x()) { | 179 | if (!(read_cpuid_id() & 0xf) && !cpu_is_ixp46x()) { |
179 | printk(KERN_ERR "IXP4XXX Watchdog: Rev. A0 IXP42x CPU detected" | 180 | pr_err("Rev. A0 IXP42x CPU detected - watchdog disabled\n"); |
180 | " - watchdog disabled\n"); | ||
181 | 181 | ||
182 | return -ENODEV; | 182 | return -ENODEV; |
183 | } | 183 | } |
@@ -185,8 +185,7 @@ static int __init ixp4xx_wdt_init(void) | |||
185 | WDIOF_CARDRESET : 0; | 185 | WDIOF_CARDRESET : 0; |
186 | ret = misc_register(&ixp4xx_wdt_miscdev); | 186 | ret = misc_register(&ixp4xx_wdt_miscdev); |
187 | if (ret == 0) | 187 | if (ret == 0) |
188 | printk(KERN_INFO "IXP4xx Watchdog Timer: heartbeat %d sec\n", | 188 | pr_info("timer heartbeat %d sec\n", heartbeat); |
189 | heartbeat); | ||
190 | return ret; | 189 | return ret; |
191 | } | 190 | } |
192 | 191 | ||
@@ -205,7 +204,7 @@ MODULE_DESCRIPTION("IXP4xx Network Processor Watchdog"); | |||
205 | module_param(heartbeat, int, 0); | 204 | module_param(heartbeat, int, 0); |
206 | MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds (default 60s)"); | 205 | MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds (default 60s)"); |
207 | 206 | ||
208 | module_param(nowayout, int, 0); | 207 | module_param(nowayout, bool, 0); |
209 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started"); | 208 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started"); |
210 | 209 | ||
211 | MODULE_LICENSE("GPL"); | 210 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/watchdog/jz4740_wdt.c b/drivers/watchdog/jz4740_wdt.c index 17ef300bccc5..978615ef899d 100644 --- a/drivers/watchdog/jz4740_wdt.c +++ b/drivers/watchdog/jz4740_wdt.c | |||
@@ -17,18 +17,15 @@ | |||
17 | #include <linux/moduleparam.h> | 17 | #include <linux/moduleparam.h> |
18 | #include <linux/types.h> | 18 | #include <linux/types.h> |
19 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
20 | #include <linux/fs.h> | ||
21 | #include <linux/miscdevice.h> | 20 | #include <linux/miscdevice.h> |
22 | #include <linux/watchdog.h> | 21 | #include <linux/watchdog.h> |
23 | #include <linux/init.h> | 22 | #include <linux/init.h> |
24 | #include <linux/bitops.h> | ||
25 | #include <linux/platform_device.h> | 23 | #include <linux/platform_device.h> |
26 | #include <linux/spinlock.h> | ||
27 | #include <linux/uaccess.h> | ||
28 | #include <linux/io.h> | 24 | #include <linux/io.h> |
29 | #include <linux/device.h> | 25 | #include <linux/device.h> |
30 | #include <linux/clk.h> | 26 | #include <linux/clk.h> |
31 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/err.h> | ||
32 | 29 | ||
33 | #include <asm/mach-jz4740/timer.h> | 30 | #include <asm/mach-jz4740/timer.h> |
34 | 31 | ||
@@ -41,9 +38,6 @@ | |||
41 | #define JZ_WDT_CLOCK_RTC 0x2 | 38 | #define JZ_WDT_CLOCK_RTC 0x2 |
42 | #define JZ_WDT_CLOCK_EXT 0x4 | 39 | #define JZ_WDT_CLOCK_EXT 0x4 |
43 | 40 | ||
44 | #define WDT_IN_USE 0 | ||
45 | #define WDT_OK_TO_CLOSE 1 | ||
46 | |||
47 | #define JZ_WDT_CLOCK_DIV_SHIFT 3 | 41 | #define JZ_WDT_CLOCK_DIV_SHIFT 3 |
48 | 42 | ||
49 | #define JZ_WDT_CLOCK_DIV_1 (0 << JZ_WDT_CLOCK_DIV_SHIFT) | 43 | #define JZ_WDT_CLOCK_DIV_1 (0 << JZ_WDT_CLOCK_DIV_SHIFT) |
@@ -56,32 +50,44 @@ | |||
56 | #define DEFAULT_HEARTBEAT 5 | 50 | #define DEFAULT_HEARTBEAT 5 |
57 | #define MAX_HEARTBEAT 2048 | 51 | #define MAX_HEARTBEAT 2048 |
58 | 52 | ||
59 | static struct { | 53 | static bool nowayout = WATCHDOG_NOWAYOUT; |
60 | void __iomem *base; | 54 | module_param(nowayout, bool, 0); |
61 | struct resource *mem; | 55 | MODULE_PARM_DESC(nowayout, |
62 | struct clk *rtc_clk; | 56 | "Watchdog cannot be stopped once started (default=" |
63 | unsigned long status; | 57 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
64 | } jz4740_wdt; | ||
65 | 58 | ||
66 | static int heartbeat = DEFAULT_HEARTBEAT; | 59 | static unsigned int heartbeat = DEFAULT_HEARTBEAT; |
60 | module_param(heartbeat, uint, 0); | ||
61 | MODULE_PARM_DESC(heartbeat, | ||
62 | "Watchdog heartbeat period in seconds from 1 to " | ||
63 | __MODULE_STRING(MAX_HEARTBEAT) ", default " | ||
64 | __MODULE_STRING(DEFAULT_HEARTBEAT)); | ||
67 | 65 | ||
66 | struct jz4740_wdt_drvdata { | ||
67 | struct watchdog_device wdt; | ||
68 | void __iomem *base; | ||
69 | struct clk *rtc_clk; | ||
70 | }; | ||
68 | 71 | ||
69 | static void jz4740_wdt_service(void) | 72 | static int jz4740_wdt_ping(struct watchdog_device *wdt_dev) |
70 | { | 73 | { |
71 | writew(0x0, jz4740_wdt.base + JZ_REG_WDT_TIMER_COUNTER); | 74 | struct jz4740_wdt_drvdata *drvdata = watchdog_get_drvdata(wdt_dev); |
75 | |||
76 | writew(0x0, drvdata->base + JZ_REG_WDT_TIMER_COUNTER); | ||
77 | return 0; | ||
72 | } | 78 | } |
73 | 79 | ||
74 | static void jz4740_wdt_set_heartbeat(int new_heartbeat) | 80 | static int jz4740_wdt_set_timeout(struct watchdog_device *wdt_dev, |
81 | unsigned int new_timeout) | ||
75 | { | 82 | { |
83 | struct jz4740_wdt_drvdata *drvdata = watchdog_get_drvdata(wdt_dev); | ||
76 | unsigned int rtc_clk_rate; | 84 | unsigned int rtc_clk_rate; |
77 | unsigned int timeout_value; | 85 | unsigned int timeout_value; |
78 | unsigned short clock_div = JZ_WDT_CLOCK_DIV_1; | 86 | unsigned short clock_div = JZ_WDT_CLOCK_DIV_1; |
79 | 87 | ||
80 | heartbeat = new_heartbeat; | 88 | rtc_clk_rate = clk_get_rate(drvdata->rtc_clk); |
81 | |||
82 | rtc_clk_rate = clk_get_rate(jz4740_wdt.rtc_clk); | ||
83 | 89 | ||
84 | timeout_value = rtc_clk_rate * heartbeat; | 90 | timeout_value = rtc_clk_rate * new_timeout; |
85 | while (timeout_value > 0xffff) { | 91 | while (timeout_value > 0xffff) { |
86 | if (clock_div == JZ_WDT_CLOCK_DIV_1024) { | 92 | if (clock_div == JZ_WDT_CLOCK_DIV_1024) { |
87 | /* Requested timeout too high; | 93 | /* Requested timeout too high; |
@@ -93,199 +99,115 @@ static void jz4740_wdt_set_heartbeat(int new_heartbeat) | |||
93 | clock_div += (1 << JZ_WDT_CLOCK_DIV_SHIFT); | 99 | clock_div += (1 << JZ_WDT_CLOCK_DIV_SHIFT); |
94 | } | 100 | } |
95 | 101 | ||
96 | writeb(0x0, jz4740_wdt.base + JZ_REG_WDT_COUNTER_ENABLE); | 102 | writeb(0x0, drvdata->base + JZ_REG_WDT_COUNTER_ENABLE); |
97 | writew(clock_div, jz4740_wdt.base + JZ_REG_WDT_TIMER_CONTROL); | 103 | writew(clock_div, drvdata->base + JZ_REG_WDT_TIMER_CONTROL); |
98 | 104 | ||
99 | writew((u16)timeout_value, jz4740_wdt.base + JZ_REG_WDT_TIMER_DATA); | 105 | writew((u16)timeout_value, drvdata->base + JZ_REG_WDT_TIMER_DATA); |
100 | writew(0x0, jz4740_wdt.base + JZ_REG_WDT_TIMER_COUNTER); | 106 | writew(0x0, drvdata->base + JZ_REG_WDT_TIMER_COUNTER); |
101 | writew(clock_div | JZ_WDT_CLOCK_RTC, | 107 | writew(clock_div | JZ_WDT_CLOCK_RTC, |
102 | jz4740_wdt.base + JZ_REG_WDT_TIMER_CONTROL); | 108 | drvdata->base + JZ_REG_WDT_TIMER_CONTROL); |
103 | 109 | ||
104 | writeb(0x1, jz4740_wdt.base + JZ_REG_WDT_COUNTER_ENABLE); | 110 | writeb(0x1, drvdata->base + JZ_REG_WDT_COUNTER_ENABLE); |
105 | } | ||
106 | 111 | ||
107 | static void jz4740_wdt_enable(void) | 112 | wdt_dev->timeout = new_timeout; |
108 | { | 113 | return 0; |
109 | jz4740_timer_enable_watchdog(); | ||
110 | jz4740_wdt_set_heartbeat(heartbeat); | ||
111 | } | ||
112 | |||
113 | static void jz4740_wdt_disable(void) | ||
114 | { | ||
115 | jz4740_timer_disable_watchdog(); | ||
116 | writeb(0x0, jz4740_wdt.base + JZ_REG_WDT_COUNTER_ENABLE); | ||
117 | } | 114 | } |
118 | 115 | ||
119 | static int jz4740_wdt_open(struct inode *inode, struct file *file) | 116 | static int jz4740_wdt_start(struct watchdog_device *wdt_dev) |
120 | { | 117 | { |
121 | if (test_and_set_bit(WDT_IN_USE, &jz4740_wdt.status)) | 118 | jz4740_timer_enable_watchdog(); |
122 | return -EBUSY; | 119 | jz4740_wdt_set_timeout(wdt_dev, wdt_dev->timeout); |
123 | |||
124 | jz4740_wdt_enable(); | ||
125 | 120 | ||
126 | return nonseekable_open(inode, file); | 121 | return 0; |
127 | } | 122 | } |
128 | 123 | ||
129 | static ssize_t jz4740_wdt_write(struct file *file, const char *data, | 124 | static int jz4740_wdt_stop(struct watchdog_device *wdt_dev) |
130 | size_t len, loff_t *ppos) | ||
131 | { | 125 | { |
132 | if (len) { | 126 | struct jz4740_wdt_drvdata *drvdata = watchdog_get_drvdata(wdt_dev); |
133 | size_t i; | ||
134 | |||
135 | clear_bit(WDT_OK_TO_CLOSE, &jz4740_wdt.status); | ||
136 | for (i = 0; i != len; i++) { | ||
137 | char c; | ||
138 | 127 | ||
139 | if (get_user(c, data + i)) | 128 | jz4740_timer_disable_watchdog(); |
140 | return -EFAULT; | 129 | writeb(0x0, drvdata->base + JZ_REG_WDT_COUNTER_ENABLE); |
141 | |||
142 | if (c == 'V') | ||
143 | set_bit(WDT_OK_TO_CLOSE, &jz4740_wdt.status); | ||
144 | } | ||
145 | jz4740_wdt_service(); | ||
146 | } | ||
147 | 130 | ||
148 | return len; | 131 | return 0; |
149 | } | 132 | } |
150 | 133 | ||
151 | static const struct watchdog_info ident = { | 134 | static const struct watchdog_info jz4740_wdt_info = { |
152 | .options = WDIOF_KEEPALIVEPING, | 135 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, |
153 | .identity = "jz4740 Watchdog", | 136 | .identity = "jz4740 Watchdog", |
154 | }; | 137 | }; |
155 | 138 | ||
156 | static long jz4740_wdt_ioctl(struct file *file, | 139 | static const struct watchdog_ops jz4740_wdt_ops = { |
157 | unsigned int cmd, unsigned long arg) | ||
158 | { | ||
159 | int ret = -ENOTTY; | ||
160 | int heartbeat_seconds; | ||
161 | |||
162 | switch (cmd) { | ||
163 | case WDIOC_GETSUPPORT: | ||
164 | ret = copy_to_user((struct watchdog_info *)arg, &ident, | ||
165 | sizeof(ident)) ? -EFAULT : 0; | ||
166 | break; | ||
167 | |||
168 | case WDIOC_GETSTATUS: | ||
169 | case WDIOC_GETBOOTSTATUS: | ||
170 | ret = put_user(0, (int *)arg); | ||
171 | break; | ||
172 | |||
173 | case WDIOC_KEEPALIVE: | ||
174 | jz4740_wdt_service(); | ||
175 | return 0; | ||
176 | |||
177 | case WDIOC_SETTIMEOUT: | ||
178 | if (get_user(heartbeat_seconds, (int __user *)arg)) | ||
179 | return -EFAULT; | ||
180 | |||
181 | jz4740_wdt_set_heartbeat(heartbeat_seconds); | ||
182 | return 0; | ||
183 | |||
184 | case WDIOC_GETTIMEOUT: | ||
185 | return put_user(heartbeat, (int *)arg); | ||
186 | |||
187 | default: | ||
188 | break; | ||
189 | } | ||
190 | |||
191 | return ret; | ||
192 | } | ||
193 | |||
194 | static int jz4740_wdt_release(struct inode *inode, struct file *file) | ||
195 | { | ||
196 | jz4740_wdt_service(); | ||
197 | |||
198 | if (test_and_clear_bit(WDT_OK_TO_CLOSE, &jz4740_wdt.status)) | ||
199 | jz4740_wdt_disable(); | ||
200 | |||
201 | clear_bit(WDT_IN_USE, &jz4740_wdt.status); | ||
202 | return 0; | ||
203 | } | ||
204 | |||
205 | static const struct file_operations jz4740_wdt_fops = { | ||
206 | .owner = THIS_MODULE, | 140 | .owner = THIS_MODULE, |
207 | .llseek = no_llseek, | 141 | .start = jz4740_wdt_start, |
208 | .write = jz4740_wdt_write, | 142 | .stop = jz4740_wdt_stop, |
209 | .unlocked_ioctl = jz4740_wdt_ioctl, | 143 | .ping = jz4740_wdt_ping, |
210 | .open = jz4740_wdt_open, | 144 | .set_timeout = jz4740_wdt_set_timeout, |
211 | .release = jz4740_wdt_release, | ||
212 | }; | ||
213 | |||
214 | static struct miscdevice jz4740_wdt_miscdev = { | ||
215 | .minor = WATCHDOG_MINOR, | ||
216 | .name = "watchdog", | ||
217 | .fops = &jz4740_wdt_fops, | ||
218 | }; | 145 | }; |
219 | 146 | ||
220 | static int __devinit jz4740_wdt_probe(struct platform_device *pdev) | 147 | static int __devinit jz4740_wdt_probe(struct platform_device *pdev) |
221 | { | 148 | { |
222 | int ret = 0, size; | 149 | struct jz4740_wdt_drvdata *drvdata; |
223 | struct resource *res; | 150 | struct watchdog_device *jz4740_wdt; |
224 | struct device *dev = &pdev->dev; | 151 | struct resource *res; |
225 | 152 | int ret; | |
226 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 153 | |
227 | if (res == NULL) { | 154 | drvdata = devm_kzalloc(&pdev->dev, sizeof(struct jz4740_wdt_drvdata), |
228 | dev_err(dev, "failed to get memory region resource\n"); | 155 | GFP_KERNEL); |
229 | return -ENXIO; | 156 | if (!drvdata) { |
157 | dev_err(&pdev->dev, "Unable to alloacate watchdog device\n"); | ||
158 | return -ENOMEM; | ||
230 | } | 159 | } |
231 | 160 | ||
232 | size = resource_size(res); | 161 | if (heartbeat < 1 || heartbeat > MAX_HEARTBEAT) |
233 | jz4740_wdt.mem = request_mem_region(res->start, size, pdev->name); | 162 | heartbeat = DEFAULT_HEARTBEAT; |
234 | if (jz4740_wdt.mem == NULL) { | ||
235 | dev_err(dev, "failed to get memory region\n"); | ||
236 | return -EBUSY; | ||
237 | } | ||
238 | 163 | ||
239 | jz4740_wdt.base = ioremap_nocache(res->start, size); | 164 | jz4740_wdt = &drvdata->wdt; |
240 | if (jz4740_wdt.base == NULL) { | 165 | jz4740_wdt->info = &jz4740_wdt_info; |
241 | dev_err(dev, "failed to map memory region\n"); | 166 | jz4740_wdt->ops = &jz4740_wdt_ops; |
167 | jz4740_wdt->timeout = heartbeat; | ||
168 | jz4740_wdt->min_timeout = 1; | ||
169 | jz4740_wdt->max_timeout = MAX_HEARTBEAT; | ||
170 | watchdog_set_nowayout(jz4740_wdt, nowayout); | ||
171 | watchdog_set_drvdata(jz4740_wdt, drvdata); | ||
172 | |||
173 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
174 | drvdata->base = devm_request_and_ioremap(&pdev->dev, res); | ||
175 | if (drvdata->base == NULL) { | ||
242 | ret = -EBUSY; | 176 | ret = -EBUSY; |
243 | goto err_release_region; | 177 | goto err_out; |
244 | } | 178 | } |
245 | 179 | ||
246 | jz4740_wdt.rtc_clk = clk_get(NULL, "rtc"); | 180 | drvdata->rtc_clk = clk_get(NULL, "rtc"); |
247 | if (IS_ERR(jz4740_wdt.rtc_clk)) { | 181 | if (IS_ERR(drvdata->rtc_clk)) { |
248 | dev_err(dev, "cannot find RTC clock\n"); | 182 | dev_err(&pdev->dev, "cannot find RTC clock\n"); |
249 | ret = PTR_ERR(jz4740_wdt.rtc_clk); | 183 | ret = PTR_ERR(drvdata->rtc_clk); |
250 | goto err_iounmap; | 184 | goto err_out; |
251 | } | 185 | } |
252 | 186 | ||
253 | ret = misc_register(&jz4740_wdt_miscdev); | 187 | ret = watchdog_register_device(&drvdata->wdt); |
254 | if (ret < 0) { | 188 | if (ret < 0) |
255 | dev_err(dev, "cannot register misc device\n"); | ||
256 | goto err_disable_clk; | 189 | goto err_disable_clk; |
257 | } | ||
258 | 190 | ||
191 | platform_set_drvdata(pdev, drvdata); | ||
259 | return 0; | 192 | return 0; |
260 | 193 | ||
261 | err_disable_clk: | 194 | err_disable_clk: |
262 | clk_put(jz4740_wdt.rtc_clk); | 195 | clk_put(drvdata->rtc_clk); |
263 | err_iounmap: | 196 | err_out: |
264 | iounmap(jz4740_wdt.base); | ||
265 | err_release_region: | ||
266 | release_mem_region(jz4740_wdt.mem->start, | ||
267 | resource_size(jz4740_wdt.mem)); | ||
268 | return ret; | 197 | return ret; |
269 | } | 198 | } |
270 | 199 | ||
271 | |||
272 | static int __devexit jz4740_wdt_remove(struct platform_device *pdev) | 200 | static int __devexit jz4740_wdt_remove(struct platform_device *pdev) |
273 | { | 201 | { |
274 | jz4740_wdt_disable(); | 202 | struct jz4740_wdt_drvdata *drvdata = platform_get_drvdata(pdev); |
275 | misc_deregister(&jz4740_wdt_miscdev); | ||
276 | clk_put(jz4740_wdt.rtc_clk); | ||
277 | 203 | ||
278 | iounmap(jz4740_wdt.base); | 204 | jz4740_wdt_stop(&drvdata->wdt); |
279 | jz4740_wdt.base = NULL; | 205 | watchdog_unregister_device(&drvdata->wdt); |
280 | 206 | clk_put(drvdata->rtc_clk); | |
281 | release_mem_region(jz4740_wdt.mem->start, | ||
282 | resource_size(jz4740_wdt.mem)); | ||
283 | jz4740_wdt.mem = NULL; | ||
284 | 207 | ||
285 | return 0; | 208 | return 0; |
286 | } | 209 | } |
287 | 210 | ||
288 | |||
289 | static struct platform_driver jz4740_wdt_driver = { | 211 | static struct platform_driver jz4740_wdt_driver = { |
290 | .probe = jz4740_wdt_probe, | 212 | .probe = jz4740_wdt_probe, |
291 | .remove = __devexit_p(jz4740_wdt_remove), | 213 | .remove = __devexit_p(jz4740_wdt_remove), |
@@ -299,13 +221,6 @@ module_platform_driver(jz4740_wdt_driver); | |||
299 | 221 | ||
300 | MODULE_AUTHOR("Paul Cercueil <paul@crapouillou.net>"); | 222 | MODULE_AUTHOR("Paul Cercueil <paul@crapouillou.net>"); |
301 | MODULE_DESCRIPTION("jz4740 Watchdog Driver"); | 223 | MODULE_DESCRIPTION("jz4740 Watchdog Driver"); |
302 | |||
303 | module_param(heartbeat, int, 0); | ||
304 | MODULE_PARM_DESC(heartbeat, | ||
305 | "Watchdog heartbeat period in seconds from 1 to " | ||
306 | __MODULE_STRING(MAX_HEARTBEAT) ", default " | ||
307 | __MODULE_STRING(DEFAULT_HEARTBEAT)); | ||
308 | |||
309 | MODULE_LICENSE("GPL"); | 224 | MODULE_LICENSE("GPL"); |
310 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | 225 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); |
311 | MODULE_ALIAS("platform:jz4740-wdt"); | 226 | MODULE_ALIAS("platform:jz4740-wdt"); |
diff --git a/drivers/watchdog/ks8695_wdt.c b/drivers/watchdog/ks8695_wdt.c index 51757a520e8f..59e75d9a6b7f 100644 --- a/drivers/watchdog/ks8695_wdt.c +++ b/drivers/watchdog/ks8695_wdt.c | |||
@@ -8,6 +8,8 @@ | |||
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
12 | |||
11 | #include <linux/bitops.h> | 13 | #include <linux/bitops.h> |
12 | #include <linux/errno.h> | 14 | #include <linux/errno.h> |
13 | #include <linux/fs.h> | 15 | #include <linux/fs.h> |
@@ -28,14 +30,14 @@ | |||
28 | #define WDT_MAX_TIME 171 /* seconds */ | 30 | #define WDT_MAX_TIME 171 /* seconds */ |
29 | 31 | ||
30 | static int wdt_time = WDT_DEFAULT_TIME; | 32 | static int wdt_time = WDT_DEFAULT_TIME; |
31 | static int nowayout = WATCHDOG_NOWAYOUT; | 33 | static bool nowayout = WATCHDOG_NOWAYOUT; |
32 | 34 | ||
33 | module_param(wdt_time, int, 0); | 35 | module_param(wdt_time, int, 0); |
34 | MODULE_PARM_DESC(wdt_time, "Watchdog time in seconds. (default=" | 36 | MODULE_PARM_DESC(wdt_time, "Watchdog time in seconds. (default=" |
35 | __MODULE_STRING(WDT_DEFAULT_TIME) ")"); | 37 | __MODULE_STRING(WDT_DEFAULT_TIME) ")"); |
36 | 38 | ||
37 | #ifdef CONFIG_WATCHDOG_NOWAYOUT | 39 | #ifdef CONFIG_WATCHDOG_NOWAYOUT |
38 | module_param(nowayout, int, 0); | 40 | module_param(nowayout, bool, 0); |
39 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" | 41 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" |
40 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 42 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
41 | #endif | 43 | #endif |
@@ -233,8 +235,8 @@ static int __devinit ks8695wdt_probe(struct platform_device *pdev) | |||
233 | if (res) | 235 | if (res) |
234 | return res; | 236 | return res; |
235 | 237 | ||
236 | printk(KERN_INFO "KS8695 Watchdog Timer enabled (%d seconds%s)\n", | 238 | pr_info("KS8695 Watchdog Timer enabled (%d seconds%s)\n", |
237 | wdt_time, nowayout ? ", nowayout" : ""); | 239 | wdt_time, nowayout ? ", nowayout" : ""); |
238 | return 0; | 240 | return 0; |
239 | } | 241 | } |
240 | 242 | ||
diff --git a/drivers/watchdog/lantiq_wdt.c b/drivers/watchdog/lantiq_wdt.c index d3a63be2e28d..a9593a3a32a0 100644 --- a/drivers/watchdog/lantiq_wdt.c +++ b/drivers/watchdog/lantiq_wdt.c | |||
@@ -7,6 +7,8 @@ | |||
7 | * Based on EP93xx wdt driver | 7 | * Based on EP93xx wdt driver |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
11 | |||
10 | #include <linux/module.h> | 12 | #include <linux/module.h> |
11 | #include <linux/fs.h> | 13 | #include <linux/fs.h> |
12 | #include <linux/miscdevice.h> | 14 | #include <linux/miscdevice.h> |
@@ -38,7 +40,7 @@ | |||
38 | #define LTQ_WDT_DIVIDER 0x40000 | 40 | #define LTQ_WDT_DIVIDER 0x40000 |
39 | #define LTQ_MAX_TIMEOUT ((1 << 16) - 1) /* the reload field is 16 bit */ | 41 | #define LTQ_MAX_TIMEOUT ((1 << 16) - 1) /* the reload field is 16 bit */ |
40 | 42 | ||
41 | static int nowayout = WATCHDOG_NOWAYOUT; | 43 | static bool nowayout = WATCHDOG_NOWAYOUT; |
42 | 44 | ||
43 | static void __iomem *ltq_wdt_membase; | 45 | static void __iomem *ltq_wdt_membase; |
44 | static unsigned long ltq_io_region_clk_rate; | 46 | static unsigned long ltq_io_region_clk_rate; |
@@ -160,7 +162,7 @@ ltq_wdt_release(struct inode *inode, struct file *file) | |||
160 | if (ltq_wdt_ok_to_close) | 162 | if (ltq_wdt_ok_to_close) |
161 | ltq_wdt_disable(); | 163 | ltq_wdt_disable(); |
162 | else | 164 | else |
163 | pr_err("ltq_wdt: watchdog closed without warning\n"); | 165 | pr_err("watchdog closed without warning\n"); |
164 | ltq_wdt_ok_to_close = 0; | 166 | ltq_wdt_ok_to_close = 0; |
165 | clear_bit(0, <q_wdt_in_use); | 167 | clear_bit(0, <q_wdt_in_use); |
166 | 168 | ||
@@ -249,7 +251,7 @@ exit_ltq_wdt(void) | |||
249 | module_init(init_ltq_wdt); | 251 | module_init(init_ltq_wdt); |
250 | module_exit(exit_ltq_wdt); | 252 | module_exit(exit_ltq_wdt); |
251 | 253 | ||
252 | module_param(nowayout, int, 0); | 254 | module_param(nowayout, bool, 0); |
253 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started"); | 255 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started"); |
254 | 256 | ||
255 | MODULE_AUTHOR("John Crispin <blogic@openwrt.org>"); | 257 | MODULE_AUTHOR("John Crispin <blogic@openwrt.org>"); |
diff --git a/drivers/watchdog/m54xx_wdt.c b/drivers/watchdog/m54xx_wdt.c index 4d43286074aa..663cad86c633 100644 --- a/drivers/watchdog/m54xx_wdt.c +++ b/drivers/watchdog/m54xx_wdt.c | |||
@@ -16,6 +16,8 @@ | |||
16 | * warranty of any kind, whether express or implied. | 16 | * warranty of any kind, whether express or implied. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
20 | |||
19 | #include <linux/module.h> | 21 | #include <linux/module.h> |
20 | #include <linux/moduleparam.h> | 22 | #include <linux/moduleparam.h> |
21 | #include <linux/types.h> | 23 | #include <linux/types.h> |
@@ -32,7 +34,7 @@ | |||
32 | #include <asm/m54xxsim.h> | 34 | #include <asm/m54xxsim.h> |
33 | #include <asm/m54xxgpt.h> | 35 | #include <asm/m54xxgpt.h> |
34 | 36 | ||
35 | static int nowayout = WATCHDOG_NOWAYOUT; | 37 | static bool nowayout = WATCHDOG_NOWAYOUT; |
36 | static unsigned int heartbeat = 30; /* (secs) Default is 0.5 minute */ | 38 | static unsigned int heartbeat = 30; /* (secs) Default is 0.5 minute */ |
37 | static unsigned long wdt_status; | 39 | static unsigned long wdt_status; |
38 | 40 | ||
@@ -166,8 +168,7 @@ static int m54xx_wdt_release(struct inode *inode, struct file *file) | |||
166 | if (test_bit(WDT_OK_TO_CLOSE, &wdt_status)) | 168 | if (test_bit(WDT_OK_TO_CLOSE, &wdt_status)) |
167 | wdt_disable(); | 169 | wdt_disable(); |
168 | else { | 170 | else { |
169 | printk(KERN_CRIT "WATCHDOG: Device closed unexpectedly - " | 171 | pr_crit("Device closed unexpectedly - timer will not stop\n"); |
170 | "timer will not stop\n"); | ||
171 | wdt_keepalive(); | 172 | wdt_keepalive(); |
172 | } | 173 | } |
173 | clear_bit(WDT_IN_USE, &wdt_status); | 174 | clear_bit(WDT_IN_USE, &wdt_status); |
@@ -196,11 +197,10 @@ static int __init m54xx_wdt_init(void) | |||
196 | { | 197 | { |
197 | if (!request_mem_region(MCF_MBAR + MCF_GPT_GCIR0, 4, | 198 | if (!request_mem_region(MCF_MBAR + MCF_GPT_GCIR0, 4, |
198 | "Coldfire M54xx Watchdog")) { | 199 | "Coldfire M54xx Watchdog")) { |
199 | printk(KERN_WARNING | 200 | pr_warn("I/O region busy\n"); |
200 | "Coldfire M54xx Watchdog : I/O region busy\n"); | ||
201 | return -EBUSY; | 201 | return -EBUSY; |
202 | } | 202 | } |
203 | printk(KERN_INFO "ColdFire watchdog driver is loaded.\n"); | 203 | pr_info("driver is loaded\n"); |
204 | 204 | ||
205 | return misc_register(&m54xx_wdt_miscdev); | 205 | return misc_register(&m54xx_wdt_miscdev); |
206 | } | 206 | } |
@@ -220,7 +220,7 @@ MODULE_DESCRIPTION("Coldfire M54xx Watchdog"); | |||
220 | module_param(heartbeat, int, 0); | 220 | module_param(heartbeat, int, 0); |
221 | MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds (default 30s)"); | 221 | MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds (default 30s)"); |
222 | 222 | ||
223 | module_param(nowayout, int, 0); | 223 | module_param(nowayout, bool, 0); |
224 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started"); | 224 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started"); |
225 | 225 | ||
226 | MODULE_LICENSE("GPL"); | 226 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/watchdog/machzwd.c b/drivers/watchdog/machzwd.c index 1332b838cc58..52ed8834cedb 100644 --- a/drivers/watchdog/machzwd.c +++ b/drivers/watchdog/machzwd.c | |||
@@ -28,6 +28,8 @@ | |||
28 | * Added nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT | 28 | * Added nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
32 | |||
31 | #include <linux/module.h> | 33 | #include <linux/module.h> |
32 | #include <linux/moduleparam.h> | 34 | #include <linux/moduleparam.h> |
33 | #include <linux/types.h> | 35 | #include <linux/types.h> |
@@ -93,8 +95,8 @@ MODULE_DESCRIPTION("MachZ ZF-Logic Watchdog driver"); | |||
93 | MODULE_LICENSE("GPL"); | 95 | MODULE_LICENSE("GPL"); |
94 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | 96 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); |
95 | 97 | ||
96 | static int nowayout = WATCHDOG_NOWAYOUT; | 98 | static bool nowayout = WATCHDOG_NOWAYOUT; |
97 | module_param(nowayout, int, 0); | 99 | module_param(nowayout, bool, 0); |
98 | MODULE_PARM_DESC(nowayout, | 100 | MODULE_PARM_DESC(nowayout, |
99 | "Watchdog cannot be stopped once started (default=" | 101 | "Watchdog cannot be stopped once started (default=" |
100 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 102 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
@@ -141,10 +143,10 @@ static unsigned long next_heartbeat; | |||
141 | #define ZF_CTIMEOUT 0xffff | 143 | #define ZF_CTIMEOUT 0xffff |
142 | 144 | ||
143 | #ifndef ZF_DEBUG | 145 | #ifndef ZF_DEBUG |
144 | # define dprintk(format, args...) | 146 | #define dprintk(format, args...) |
145 | #else | 147 | #else |
146 | # define dprintk(format, args...) printk(KERN_DEBUG PFX \ | 148 | #define dprintk(format, args...) \ |
147 | ":%s:%d: " format, __func__, __LINE__ , ## args) | 149 | pr_debug(":%s:%d: " format, __func__, __LINE__ , ## args) |
148 | #endif | 150 | #endif |
149 | 151 | ||
150 | 152 | ||
@@ -203,7 +205,7 @@ static void zf_timer_off(void) | |||
203 | zf_set_control(ctrl_reg); | 205 | zf_set_control(ctrl_reg); |
204 | spin_unlock_irqrestore(&zf_port_lock, flags); | 206 | spin_unlock_irqrestore(&zf_port_lock, flags); |
205 | 207 | ||
206 | printk(KERN_INFO PFX ": Watchdog timer is now disabled\n"); | 208 | pr_info("Watchdog timer is now disabled\n"); |
207 | } | 209 | } |
208 | 210 | ||
209 | 211 | ||
@@ -233,7 +235,7 @@ static void zf_timer_on(void) | |||
233 | zf_set_control(ctrl_reg); | 235 | zf_set_control(ctrl_reg); |
234 | spin_unlock_irqrestore(&zf_port_lock, flags); | 236 | spin_unlock_irqrestore(&zf_port_lock, flags); |
235 | 237 | ||
236 | printk(KERN_INFO PFX ": Watchdog timer is now enabled\n"); | 238 | pr_info("Watchdog timer is now enabled\n"); |
237 | } | 239 | } |
238 | 240 | ||
239 | 241 | ||
@@ -263,7 +265,7 @@ static void zf_ping(unsigned long data) | |||
263 | 265 | ||
264 | mod_timer(&zf_timer, jiffies + ZF_HW_TIMEO); | 266 | mod_timer(&zf_timer, jiffies + ZF_HW_TIMEO); |
265 | } else | 267 | } else |
266 | printk(KERN_CRIT PFX ": I will reset your machine\n"); | 268 | pr_crit("I will reset your machine\n"); |
267 | } | 269 | } |
268 | 270 | ||
269 | static ssize_t zf_write(struct file *file, const char __user *buf, size_t count, | 271 | static ssize_t zf_write(struct file *file, const char __user *buf, size_t count, |
@@ -342,8 +344,7 @@ static int zf_close(struct inode *inode, struct file *file) | |||
342 | zf_timer_off(); | 344 | zf_timer_off(); |
343 | else { | 345 | else { |
344 | del_timer(&zf_timer); | 346 | del_timer(&zf_timer); |
345 | printk(KERN_ERR PFX ": device file closed unexpectedly. " | 347 | pr_err("device file closed unexpectedly. Will not stop the WDT!\n"); |
346 | "Will not stop the WDT!\n"); | ||
347 | } | 348 | } |
348 | clear_bit(0, &zf_is_open); | 349 | clear_bit(0, &zf_is_open); |
349 | zf_expect_close = 0; | 350 | zf_expect_close = 0; |
@@ -390,19 +391,18 @@ static void __init zf_show_action(int act) | |||
390 | { | 391 | { |
391 | static const char * const str[] = { "RESET", "SMI", "NMI", "SCI" }; | 392 | static const char * const str[] = { "RESET", "SMI", "NMI", "SCI" }; |
392 | 393 | ||
393 | printk(KERN_INFO PFX ": Watchdog using action = %s\n", str[act]); | 394 | pr_info("Watchdog using action = %s\n", str[act]); |
394 | } | 395 | } |
395 | 396 | ||
396 | static int __init zf_init(void) | 397 | static int __init zf_init(void) |
397 | { | 398 | { |
398 | int ret; | 399 | int ret; |
399 | 400 | ||
400 | printk(KERN_INFO PFX | 401 | pr_info("MachZ ZF-Logic Watchdog driver initializing\n"); |
401 | ": MachZ ZF-Logic Watchdog driver initializing.\n"); | ||
402 | 402 | ||
403 | ret = zf_get_ZFL_version(); | 403 | ret = zf_get_ZFL_version(); |
404 | if (!ret || ret == 0xffff) { | 404 | if (!ret || ret == 0xffff) { |
405 | printk(KERN_WARNING PFX ": no ZF-Logic found\n"); | 405 | pr_warn("no ZF-Logic found\n"); |
406 | return -ENODEV; | 406 | return -ENODEV; |
407 | } | 407 | } |
408 | 408 | ||
@@ -414,23 +414,20 @@ static int __init zf_init(void) | |||
414 | zf_show_action(action); | 414 | zf_show_action(action); |
415 | 415 | ||
416 | if (!request_region(ZF_IOBASE, 3, "MachZ ZFL WDT")) { | 416 | if (!request_region(ZF_IOBASE, 3, "MachZ ZFL WDT")) { |
417 | printk(KERN_ERR "cannot reserve I/O ports at %d\n", | 417 | pr_err("cannot reserve I/O ports at %d\n", ZF_IOBASE); |
418 | ZF_IOBASE); | ||
419 | ret = -EBUSY; | 418 | ret = -EBUSY; |
420 | goto no_region; | 419 | goto no_region; |
421 | } | 420 | } |
422 | 421 | ||
423 | ret = register_reboot_notifier(&zf_notifier); | 422 | ret = register_reboot_notifier(&zf_notifier); |
424 | if (ret) { | 423 | if (ret) { |
425 | printk(KERN_ERR "can't register reboot notifier (err=%d)\n", | 424 | pr_err("can't register reboot notifier (err=%d)\n", ret); |
426 | ret); | ||
427 | goto no_reboot; | 425 | goto no_reboot; |
428 | } | 426 | } |
429 | 427 | ||
430 | ret = misc_register(&zf_miscdev); | 428 | ret = misc_register(&zf_miscdev); |
431 | if (ret) { | 429 | if (ret) { |
432 | printk(KERN_ERR "can't misc_register on minor=%d\n", | 430 | pr_err("can't misc_register on minor=%d\n", WATCHDOG_MINOR); |
433 | WATCHDOG_MINOR); | ||
434 | goto no_misc; | 431 | goto no_misc; |
435 | } | 432 | } |
436 | 433 | ||
diff --git a/drivers/watchdog/max63xx_wdt.c b/drivers/watchdog/max63xx_wdt.c index af63ecfbfa6f..8f4a74e91619 100644 --- a/drivers/watchdog/max63xx_wdt.c +++ b/drivers/watchdog/max63xx_wdt.c | |||
@@ -18,23 +18,20 @@ | |||
18 | #include <linux/moduleparam.h> | 18 | #include <linux/moduleparam.h> |
19 | #include <linux/types.h> | 19 | #include <linux/types.h> |
20 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
21 | #include <linux/fs.h> | ||
22 | #include <linux/miscdevice.h> | 21 | #include <linux/miscdevice.h> |
23 | #include <linux/watchdog.h> | 22 | #include <linux/watchdog.h> |
24 | #include <linux/init.h> | 23 | #include <linux/init.h> |
25 | #include <linux/bitops.h> | 24 | #include <linux/bitops.h> |
26 | #include <linux/platform_device.h> | 25 | #include <linux/platform_device.h> |
27 | #include <linux/spinlock.h> | 26 | #include <linux/spinlock.h> |
28 | #include <linux/uaccess.h> | ||
29 | #include <linux/io.h> | 27 | #include <linux/io.h> |
30 | #include <linux/device.h> | ||
31 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
32 | 29 | ||
33 | #define DEFAULT_HEARTBEAT 60 | 30 | #define DEFAULT_HEARTBEAT 60 |
34 | #define MAX_HEARTBEAT 60 | 31 | #define MAX_HEARTBEAT 60 |
35 | 32 | ||
36 | static int heartbeat = DEFAULT_HEARTBEAT; | 33 | static unsigned int heartbeat = DEFAULT_HEARTBEAT; |
37 | static int nowayout = WATCHDOG_NOWAYOUT; | 34 | static bool nowayout = WATCHDOG_NOWAYOUT; |
38 | 35 | ||
39 | /* | 36 | /* |
40 | * Memory mapping: a single byte, 3 first lower bits to select bit 3 | 37 | * Memory mapping: a single byte, 3 first lower bits to select bit 3 |
@@ -45,15 +42,8 @@ static int nowayout = WATCHDOG_NOWAYOUT; | |||
45 | 42 | ||
46 | static DEFINE_SPINLOCK(io_lock); | 43 | static DEFINE_SPINLOCK(io_lock); |
47 | 44 | ||
48 | static unsigned long wdt_status; | ||
49 | #define WDT_IN_USE 0 | ||
50 | #define WDT_RUNNING 1 | ||
51 | #define WDT_OK_TO_CLOSE 2 | ||
52 | |||
53 | static int nodelay; | 45 | static int nodelay; |
54 | static struct resource *wdt_mem; | ||
55 | static void __iomem *wdt_base; | 46 | static void __iomem *wdt_base; |
56 | static struct platform_device *max63xx_pdev; | ||
57 | 47 | ||
58 | /* | 48 | /* |
59 | * The timeout values used are actually the absolute minimum the chip | 49 | * The timeout values used are actually the absolute minimum the chip |
@@ -117,7 +107,7 @@ max63xx_select_timeout(struct max63xx_timeout *table, int value) | |||
117 | return NULL; | 107 | return NULL; |
118 | } | 108 | } |
119 | 109 | ||
120 | static void max63xx_wdt_ping(void) | 110 | static int max63xx_wdt_ping(struct watchdog_device *wdd) |
121 | { | 111 | { |
122 | u8 val; | 112 | u8 val; |
123 | 113 | ||
@@ -129,15 +119,14 @@ static void max63xx_wdt_ping(void) | |||
129 | __raw_writeb(val & ~MAX6369_WDI, wdt_base); | 119 | __raw_writeb(val & ~MAX6369_WDI, wdt_base); |
130 | 120 | ||
131 | spin_unlock(&io_lock); | 121 | spin_unlock(&io_lock); |
122 | return 0; | ||
132 | } | 123 | } |
133 | 124 | ||
134 | static void max63xx_wdt_enable(struct max63xx_timeout *entry) | 125 | static int max63xx_wdt_start(struct watchdog_device *wdd) |
135 | { | 126 | { |
127 | struct max63xx_timeout *entry = watchdog_get_drvdata(wdd); | ||
136 | u8 val; | 128 | u8 val; |
137 | 129 | ||
138 | if (test_and_set_bit(WDT_RUNNING, &wdt_status)) | ||
139 | return; | ||
140 | |||
141 | spin_lock(&io_lock); | 130 | spin_lock(&io_lock); |
142 | 131 | ||
143 | val = __raw_readb(wdt_base); | 132 | val = __raw_readb(wdt_base); |
@@ -149,10 +138,11 @@ static void max63xx_wdt_enable(struct max63xx_timeout *entry) | |||
149 | 138 | ||
150 | /* check for a edge triggered startup */ | 139 | /* check for a edge triggered startup */ |
151 | if (entry->tdelay == 0) | 140 | if (entry->tdelay == 0) |
152 | max63xx_wdt_ping(); | 141 | max63xx_wdt_ping(wdd); |
142 | return 0; | ||
153 | } | 143 | } |
154 | 144 | ||
155 | static void max63xx_wdt_disable(void) | 145 | static int max63xx_wdt_stop(struct watchdog_device *wdd) |
156 | { | 146 | { |
157 | u8 val; | 147 | u8 val; |
158 | 148 | ||
@@ -164,113 +154,29 @@ static void max63xx_wdt_disable(void) | |||
164 | __raw_writeb(val, wdt_base); | 154 | __raw_writeb(val, wdt_base); |
165 | 155 | ||
166 | spin_unlock(&io_lock); | 156 | spin_unlock(&io_lock); |
167 | 157 | return 0; | |
168 | clear_bit(WDT_RUNNING, &wdt_status); | ||
169 | } | ||
170 | |||
171 | static int max63xx_wdt_open(struct inode *inode, struct file *file) | ||
172 | { | ||
173 | if (test_and_set_bit(WDT_IN_USE, &wdt_status)) | ||
174 | return -EBUSY; | ||
175 | |||
176 | max63xx_wdt_enable(current_timeout); | ||
177 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); | ||
178 | |||
179 | return nonseekable_open(inode, file); | ||
180 | } | ||
181 | |||
182 | static ssize_t max63xx_wdt_write(struct file *file, const char *data, | ||
183 | size_t len, loff_t *ppos) | ||
184 | { | ||
185 | if (len) { | ||
186 | if (!nowayout) { | ||
187 | size_t i; | ||
188 | |||
189 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); | ||
190 | for (i = 0; i != len; i++) { | ||
191 | char c; | ||
192 | |||
193 | if (get_user(c, data + i)) | ||
194 | return -EFAULT; | ||
195 | |||
196 | if (c == 'V') | ||
197 | set_bit(WDT_OK_TO_CLOSE, &wdt_status); | ||
198 | } | ||
199 | } | ||
200 | |||
201 | max63xx_wdt_ping(); | ||
202 | } | ||
203 | |||
204 | return len; | ||
205 | } | 158 | } |
206 | 159 | ||
207 | static const struct watchdog_info ident = { | 160 | static const struct watchdog_info max63xx_wdt_info = { |
208 | .options = WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING, | 161 | .options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, |
209 | .identity = "max63xx Watchdog", | 162 | .identity = "max63xx Watchdog", |
210 | }; | 163 | }; |
211 | 164 | ||
212 | static long max63xx_wdt_ioctl(struct file *file, unsigned int cmd, | 165 | static const struct watchdog_ops max63xx_wdt_ops = { |
213 | unsigned long arg) | 166 | .owner = THIS_MODULE, |
214 | { | 167 | .start = max63xx_wdt_start, |
215 | int ret = -ENOTTY; | 168 | .stop = max63xx_wdt_stop, |
216 | 169 | .ping = max63xx_wdt_ping, | |
217 | switch (cmd) { | ||
218 | case WDIOC_GETSUPPORT: | ||
219 | ret = copy_to_user((struct watchdog_info *)arg, &ident, | ||
220 | sizeof(ident)) ? -EFAULT : 0; | ||
221 | break; | ||
222 | |||
223 | case WDIOC_GETSTATUS: | ||
224 | case WDIOC_GETBOOTSTATUS: | ||
225 | ret = put_user(0, (int *)arg); | ||
226 | break; | ||
227 | |||
228 | case WDIOC_KEEPALIVE: | ||
229 | max63xx_wdt_ping(); | ||
230 | ret = 0; | ||
231 | break; | ||
232 | |||
233 | case WDIOC_GETTIMEOUT: | ||
234 | ret = put_user(heartbeat, (int *)arg); | ||
235 | break; | ||
236 | } | ||
237 | return ret; | ||
238 | } | ||
239 | |||
240 | static int max63xx_wdt_release(struct inode *inode, struct file *file) | ||
241 | { | ||
242 | if (test_bit(WDT_OK_TO_CLOSE, &wdt_status)) | ||
243 | max63xx_wdt_disable(); | ||
244 | else | ||
245 | dev_crit(&max63xx_pdev->dev, | ||
246 | "device closed unexpectedly - timer will not stop\n"); | ||
247 | |||
248 | clear_bit(WDT_IN_USE, &wdt_status); | ||
249 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); | ||
250 | |||
251 | return 0; | ||
252 | } | ||
253 | |||
254 | static const struct file_operations max63xx_wdt_fops = { | ||
255 | .owner = THIS_MODULE, | ||
256 | .llseek = no_llseek, | ||
257 | .write = max63xx_wdt_write, | ||
258 | .unlocked_ioctl = max63xx_wdt_ioctl, | ||
259 | .open = max63xx_wdt_open, | ||
260 | .release = max63xx_wdt_release, | ||
261 | }; | 170 | }; |
262 | 171 | ||
263 | static struct miscdevice max63xx_wdt_miscdev = { | 172 | static struct watchdog_device max63xx_wdt_dev = { |
264 | .minor = WATCHDOG_MINOR, | 173 | .info = &max63xx_wdt_info, |
265 | .name = "watchdog", | 174 | .ops = &max63xx_wdt_ops, |
266 | .fops = &max63xx_wdt_fops, | ||
267 | }; | 175 | }; |
268 | 176 | ||
269 | static int __devinit max63xx_wdt_probe(struct platform_device *pdev) | 177 | static int __devinit max63xx_wdt_probe(struct platform_device *pdev) |
270 | { | 178 | { |
271 | int ret = 0; | 179 | struct resource *wdt_mem; |
272 | int size; | ||
273 | struct device *dev = &pdev->dev; | ||
274 | struct max63xx_timeout *table; | 180 | struct max63xx_timeout *table; |
275 | 181 | ||
276 | table = (struct max63xx_timeout *)pdev->id_entry->driver_data; | 182 | table = (struct max63xx_timeout *)pdev->id_entry->driver_data; |
@@ -278,68 +184,34 @@ static int __devinit max63xx_wdt_probe(struct platform_device *pdev) | |||
278 | if (heartbeat < 1 || heartbeat > MAX_HEARTBEAT) | 184 | if (heartbeat < 1 || heartbeat > MAX_HEARTBEAT) |
279 | heartbeat = DEFAULT_HEARTBEAT; | 185 | heartbeat = DEFAULT_HEARTBEAT; |
280 | 186 | ||
281 | dev_info(dev, "requesting %ds heartbeat\n", heartbeat); | 187 | dev_info(&pdev->dev, "requesting %ds heartbeat\n", heartbeat); |
282 | current_timeout = max63xx_select_timeout(table, heartbeat); | 188 | current_timeout = max63xx_select_timeout(table, heartbeat); |
283 | 189 | ||
284 | if (!current_timeout) { | 190 | if (!current_timeout) { |
285 | dev_err(dev, "unable to satisfy heartbeat request\n"); | 191 | dev_err(&pdev->dev, "unable to satisfy heartbeat request\n"); |
286 | return -EINVAL; | 192 | return -EINVAL; |
287 | } | 193 | } |
288 | 194 | ||
289 | dev_info(dev, "using %ds heartbeat with %ds initial delay\n", | 195 | dev_info(&pdev->dev, "using %ds heartbeat with %ds initial delay\n", |
290 | current_timeout->twd, current_timeout->tdelay); | 196 | current_timeout->twd, current_timeout->tdelay); |
291 | 197 | ||
292 | heartbeat = current_timeout->twd; | 198 | heartbeat = current_timeout->twd; |
293 | 199 | ||
294 | max63xx_pdev = pdev; | ||
295 | |||
296 | wdt_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 200 | wdt_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
297 | if (wdt_mem == NULL) { | 201 | wdt_base = devm_request_and_ioremap(&pdev->dev, wdt_mem); |
298 | dev_err(dev, "failed to get memory region resource\n"); | 202 | if (!wdt_base) |
299 | return -ENOENT; | 203 | return -ENOMEM; |
300 | } | ||
301 | 204 | ||
302 | size = resource_size(wdt_mem); | 205 | max63xx_wdt_dev.timeout = heartbeat; |
303 | if (!request_mem_region(wdt_mem->start, size, pdev->name)) { | 206 | watchdog_set_nowayout(&max63xx_wdt_dev, nowayout); |
304 | dev_err(dev, "failed to get memory region\n"); | 207 | watchdog_set_drvdata(&max63xx_wdt_dev, current_timeout); |
305 | return -ENOENT; | ||
306 | } | ||
307 | |||
308 | wdt_base = ioremap(wdt_mem->start, size); | ||
309 | if (!wdt_base) { | ||
310 | dev_err(dev, "failed to map memory region\n"); | ||
311 | ret = -ENOMEM; | ||
312 | goto out_request; | ||
313 | } | ||
314 | 208 | ||
315 | ret = misc_register(&max63xx_wdt_miscdev); | 209 | return watchdog_register_device(&max63xx_wdt_dev); |
316 | if (ret < 0) { | ||
317 | dev_err(dev, "cannot register misc device\n"); | ||
318 | goto out_unmap; | ||
319 | } | ||
320 | |||
321 | return 0; | ||
322 | |||
323 | out_unmap: | ||
324 | iounmap(wdt_base); | ||
325 | out_request: | ||
326 | release_mem_region(wdt_mem->start, size); | ||
327 | wdt_mem = NULL; | ||
328 | |||
329 | return ret; | ||
330 | } | 210 | } |
331 | 211 | ||
332 | static int __devexit max63xx_wdt_remove(struct platform_device *pdev) | 212 | static int __devexit max63xx_wdt_remove(struct platform_device *pdev) |
333 | { | 213 | { |
334 | misc_deregister(&max63xx_wdt_miscdev); | 214 | watchdog_unregister_device(&max63xx_wdt_dev); |
335 | if (wdt_mem) { | ||
336 | release_mem_region(wdt_mem->start, resource_size(wdt_mem)); | ||
337 | wdt_mem = NULL; | ||
338 | } | ||
339 | |||
340 | if (wdt_base) | ||
341 | iounmap(wdt_base); | ||
342 | |||
343 | return 0; | 215 | return 0; |
344 | } | 216 | } |
345 | 217 | ||
@@ -375,7 +247,7 @@ MODULE_PARM_DESC(heartbeat, | |||
375 | __MODULE_STRING(MAX_HEARTBEAT) ", default " | 247 | __MODULE_STRING(MAX_HEARTBEAT) ", default " |
376 | __MODULE_STRING(DEFAULT_HEARTBEAT)); | 248 | __MODULE_STRING(DEFAULT_HEARTBEAT)); |
377 | 249 | ||
378 | module_param(nowayout, int, 0); | 250 | module_param(nowayout, bool, 0); |
379 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" | 251 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" |
380 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 252 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
381 | 253 | ||
diff --git a/drivers/watchdog/mixcomwd.c b/drivers/watchdog/mixcomwd.c index bc820d16699a..37e4b52dbce9 100644 --- a/drivers/watchdog/mixcomwd.c +++ b/drivers/watchdog/mixcomwd.c | |||
@@ -39,9 +39,10 @@ | |||
39 | * | 39 | * |
40 | */ | 40 | */ |
41 | 41 | ||
42 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
43 | |||
42 | #define VERSION "0.6" | 44 | #define VERSION "0.6" |
43 | #define WATCHDOG_NAME "mixcomwd" | 45 | #define WATCHDOG_NAME "mixcomwd" |
44 | #define PFX WATCHDOG_NAME ": " | ||
45 | 46 | ||
46 | #include <linux/module.h> | 47 | #include <linux/module.h> |
47 | #include <linux/moduleparam.h> | 48 | #include <linux/moduleparam.h> |
@@ -107,8 +108,8 @@ static int mixcomwd_timer_alive; | |||
107 | static DEFINE_TIMER(mixcomwd_timer, mixcomwd_timerfun, 0, 0); | 108 | static DEFINE_TIMER(mixcomwd_timer, mixcomwd_timerfun, 0, 0); |
108 | static char expect_close; | 109 | static char expect_close; |
109 | 110 | ||
110 | static int nowayout = WATCHDOG_NOWAYOUT; | 111 | static bool nowayout = WATCHDOG_NOWAYOUT; |
111 | module_param(nowayout, int, 0); | 112 | module_param(nowayout, bool, 0); |
112 | MODULE_PARM_DESC(nowayout, | 113 | MODULE_PARM_DESC(nowayout, |
113 | "Watchdog cannot be stopped once started (default=" | 114 | "Watchdog cannot be stopped once started (default=" |
114 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 115 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
@@ -156,15 +157,13 @@ static int mixcomwd_release(struct inode *inode, struct file *file) | |||
156 | { | 157 | { |
157 | if (expect_close == 42) { | 158 | if (expect_close == 42) { |
158 | if (mixcomwd_timer_alive) { | 159 | if (mixcomwd_timer_alive) { |
159 | printk(KERN_ERR PFX | 160 | pr_err("release called while internal timer alive\n"); |
160 | "release called while internal timer alive"); | ||
161 | return -EBUSY; | 161 | return -EBUSY; |
162 | } | 162 | } |
163 | mixcomwd_timer_alive = 1; | 163 | mixcomwd_timer_alive = 1; |
164 | mod_timer(&mixcomwd_timer, jiffies + 5 * HZ); | 164 | mod_timer(&mixcomwd_timer, jiffies + 5 * HZ); |
165 | } else | 165 | } else |
166 | printk(KERN_CRIT PFX | 166 | pr_crit("WDT device closed unexpectedly. WDT will not stop!\n"); |
167 | "WDT device closed unexpectedly. WDT will not stop!\n"); | ||
168 | 167 | ||
169 | clear_bit(0, &mixcomwd_opened); | 168 | clear_bit(0, &mixcomwd_opened); |
170 | expect_close = 0; | 169 | expect_close = 0; |
@@ -274,22 +273,19 @@ static int __init mixcomwd_init(void) | |||
274 | } | 273 | } |
275 | 274 | ||
276 | if (!found) { | 275 | if (!found) { |
277 | printk(KERN_ERR PFX | 276 | pr_err("No card detected, or port not available\n"); |
278 | "No card detected, or port not available.\n"); | ||
279 | return -ENODEV; | 277 | return -ENODEV; |
280 | } | 278 | } |
281 | 279 | ||
282 | ret = misc_register(&mixcomwd_miscdev); | 280 | ret = misc_register(&mixcomwd_miscdev); |
283 | if (ret) { | 281 | if (ret) { |
284 | printk(KERN_ERR PFX | 282 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
285 | "cannot register miscdev on minor=%d (err=%d)\n", | 283 | WATCHDOG_MINOR, ret); |
286 | WATCHDOG_MINOR, ret); | ||
287 | goto error_misc_register_watchdog; | 284 | goto error_misc_register_watchdog; |
288 | } | 285 | } |
289 | 286 | ||
290 | printk(KERN_INFO | 287 | pr_info("MixCOM watchdog driver v%s, watchdog port at 0x%3x\n", |
291 | "MixCOM watchdog driver v%s, watchdog port at 0x%3x\n", | 288 | VERSION, watchdog_port); |
292 | VERSION, watchdog_port); | ||
293 | 289 | ||
294 | return 0; | 290 | return 0; |
295 | 291 | ||
@@ -303,8 +299,7 @@ static void __exit mixcomwd_exit(void) | |||
303 | { | 299 | { |
304 | if (!nowayout) { | 300 | if (!nowayout) { |
305 | if (mixcomwd_timer_alive) { | 301 | if (mixcomwd_timer_alive) { |
306 | printk(KERN_WARNING PFX "I quit now, hardware will" | 302 | pr_warn("I quit now, hardware will probably reboot!\n"); |
307 | " probably reboot!\n"); | ||
308 | del_timer_sync(&mixcomwd_timer); | 303 | del_timer_sync(&mixcomwd_timer); |
309 | mixcomwd_timer_alive = 0; | 304 | mixcomwd_timer_alive = 0; |
310 | } | 305 | } |
diff --git a/drivers/watchdog/mpc8xxx_wdt.c b/drivers/watchdog/mpc8xxx_wdt.c index 20feb4d3d791..40f7bf1f8654 100644 --- a/drivers/watchdog/mpc8xxx_wdt.c +++ b/drivers/watchdog/mpc8xxx_wdt.c | |||
@@ -17,6 +17,8 @@ | |||
17 | * option) any later version. | 17 | * option) any later version. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
21 | |||
20 | #include <linux/fs.h> | 22 | #include <linux/fs.h> |
21 | #include <linux/init.h> | 23 | #include <linux/init.h> |
22 | #include <linux/kernel.h> | 24 | #include <linux/kernel.h> |
@@ -60,8 +62,8 @@ module_param(reset, bool, 0); | |||
60 | MODULE_PARM_DESC(reset, | 62 | MODULE_PARM_DESC(reset, |
61 | "Watchdog Interrupt/Reset Mode. 0 = interrupt, 1 = reset"); | 63 | "Watchdog Interrupt/Reset Mode. 0 = interrupt, 1 = reset"); |
62 | 64 | ||
63 | static int nowayout = WATCHDOG_NOWAYOUT; | 65 | static bool nowayout = WATCHDOG_NOWAYOUT; |
64 | module_param(nowayout, int, 0); | 66 | module_param(nowayout, bool, 0); |
65 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started " | 67 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started " |
66 | "(default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 68 | "(default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
67 | 69 | ||
@@ -96,7 +98,7 @@ static void mpc8xxx_wdt_timer_ping(unsigned long arg) | |||
96 | 98 | ||
97 | static void mpc8xxx_wdt_pr_warn(const char *msg) | 99 | static void mpc8xxx_wdt_pr_warn(const char *msg) |
98 | { | 100 | { |
99 | pr_crit("mpc8xxx_wdt: %s, expect the %s soon!\n", msg, | 101 | pr_crit("%s, expect the %s soon!\n", msg, |
100 | reset ? "reset" : "machine check exception"); | 102 | reset ? "reset" : "machine check exception"); |
101 | } | 103 | } |
102 | 104 | ||
@@ -209,7 +211,7 @@ static int __devinit mpc8xxx_wdt_probe(struct platform_device *ofdev) | |||
209 | 211 | ||
210 | enabled = in_be32(&wd_base->swcrr) & SWCRR_SWEN; | 212 | enabled = in_be32(&wd_base->swcrr) & SWCRR_SWEN; |
211 | if (!enabled && wdt_type->hw_enabled) { | 213 | if (!enabled && wdt_type->hw_enabled) { |
212 | pr_info("mpc8xxx_wdt: could not be enabled in software\n"); | 214 | pr_info("could not be enabled in software\n"); |
213 | ret = -ENOSYS; | 215 | ret = -ENOSYS; |
214 | goto err_unmap; | 216 | goto err_unmap; |
215 | } | 217 | } |
@@ -226,9 +228,8 @@ static int __devinit mpc8xxx_wdt_probe(struct platform_device *ofdev) | |||
226 | goto err_unmap; | 228 | goto err_unmap; |
227 | #endif | 229 | #endif |
228 | 230 | ||
229 | pr_info("WDT driver for MPC8xxx initialized. mode:%s timeout=%d " | 231 | pr_info("WDT driver for MPC8xxx initialized. mode:%s timeout=%d (%d seconds)\n", |
230 | "(%d seconds)\n", reset ? "reset" : "interrupt", timeout, | 232 | reset ? "reset" : "interrupt", timeout, timeout_sec); |
231 | timeout_sec); | ||
232 | 233 | ||
233 | /* | 234 | /* |
234 | * If the watchdog was previously enabled or we're running on | 235 | * If the watchdog was previously enabled or we're running on |
@@ -303,7 +304,7 @@ static int mpc8xxx_wdt_init_late(void) | |||
303 | ret = misc_register(&mpc8xxx_wdt_miscdev); | 304 | ret = misc_register(&mpc8xxx_wdt_miscdev); |
304 | if (ret) { | 305 | if (ret) { |
305 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", | 306 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
306 | WATCHDOG_MINOR, ret); | 307 | WATCHDOG_MINOR, ret); |
307 | return ret; | 308 | return ret; |
308 | } | 309 | } |
309 | return 0; | 310 | return 0; |
diff --git a/drivers/watchdog/mpcore_wdt.c b/drivers/watchdog/mpcore_wdt.c index 82ccd36e2c90..7c741dc987bd 100644 --- a/drivers/watchdog/mpcore_wdt.c +++ b/drivers/watchdog/mpcore_wdt.c | |||
@@ -19,6 +19,9 @@ | |||
19 | * (c) Copyright 1995 Alan Cox <alan@lxorguk.ukuu.org.uk> | 19 | * (c) Copyright 1995 Alan Cox <alan@lxorguk.ukuu.org.uk> |
20 | * | 20 | * |
21 | */ | 21 | */ |
22 | |||
23 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
24 | |||
22 | #include <linux/module.h> | 25 | #include <linux/module.h> |
23 | #include <linux/moduleparam.h> | 26 | #include <linux/moduleparam.h> |
24 | #include <linux/types.h> | 27 | #include <linux/types.h> |
@@ -44,7 +47,7 @@ struct mpcore_wdt { | |||
44 | char expect_close; | 47 | char expect_close; |
45 | }; | 48 | }; |
46 | 49 | ||
47 | static struct platform_device *mpcore_wdt_dev; | 50 | static struct platform_device *mpcore_wdt_pdev; |
48 | static DEFINE_SPINLOCK(wdt_lock); | 51 | static DEFINE_SPINLOCK(wdt_lock); |
49 | 52 | ||
50 | #define TIMER_MARGIN 60 | 53 | #define TIMER_MARGIN 60 |
@@ -54,8 +57,8 @@ MODULE_PARM_DESC(mpcore_margin, | |||
54 | "MPcore timer margin in seconds. (0 < mpcore_margin < 65536, default=" | 57 | "MPcore timer margin in seconds. (0 < mpcore_margin < 65536, default=" |
55 | __MODULE_STRING(TIMER_MARGIN) ")"); | 58 | __MODULE_STRING(TIMER_MARGIN) ")"); |
56 | 59 | ||
57 | static int nowayout = WATCHDOG_NOWAYOUT; | 60 | static bool nowayout = WATCHDOG_NOWAYOUT; |
58 | module_param(nowayout, int, 0); | 61 | module_param(nowayout, bool, 0); |
59 | MODULE_PARM_DESC(nowayout, | 62 | MODULE_PARM_DESC(nowayout, |
60 | "Watchdog cannot be stopped once started (default=" | 63 | "Watchdog cannot be stopped once started (default=" |
61 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 64 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
@@ -148,7 +151,7 @@ static int mpcore_wdt_set_heartbeat(int t) | |||
148 | */ | 151 | */ |
149 | static int mpcore_wdt_open(struct inode *inode, struct file *file) | 152 | static int mpcore_wdt_open(struct inode *inode, struct file *file) |
150 | { | 153 | { |
151 | struct mpcore_wdt *wdt = platform_get_drvdata(mpcore_wdt_dev); | 154 | struct mpcore_wdt *wdt = platform_get_drvdata(mpcore_wdt_pdev); |
152 | 155 | ||
153 | if (test_and_set_bit(0, &wdt->timer_alive)) | 156 | if (test_and_set_bit(0, &wdt->timer_alive)) |
154 | return -EBUSY; | 157 | return -EBUSY; |
@@ -298,9 +301,9 @@ static long mpcore_wdt_ioctl(struct file *file, unsigned int cmd, | |||
298 | * System shutdown handler. Turn off the watchdog if we're | 301 | * System shutdown handler. Turn off the watchdog if we're |
299 | * restarting or halting the system. | 302 | * restarting or halting the system. |
300 | */ | 303 | */ |
301 | static void mpcore_wdt_shutdown(struct platform_device *dev) | 304 | static void mpcore_wdt_shutdown(struct platform_device *pdev) |
302 | { | 305 | { |
303 | struct mpcore_wdt *wdt = platform_get_drvdata(dev); | 306 | struct mpcore_wdt *wdt = platform_get_drvdata(pdev); |
304 | 307 | ||
305 | if (system_state == SYSTEM_RESTART || system_state == SYSTEM_HALT) | 308 | if (system_state == SYSTEM_RESTART || system_state == SYSTEM_HALT) |
306 | mpcore_wdt_stop(wdt); | 309 | mpcore_wdt_stop(wdt); |
@@ -324,99 +327,79 @@ static struct miscdevice mpcore_wdt_miscdev = { | |||
324 | .fops = &mpcore_wdt_fops, | 327 | .fops = &mpcore_wdt_fops, |
325 | }; | 328 | }; |
326 | 329 | ||
327 | static int __devinit mpcore_wdt_probe(struct platform_device *dev) | 330 | static int __devinit mpcore_wdt_probe(struct platform_device *pdev) |
328 | { | 331 | { |
329 | struct mpcore_wdt *wdt; | 332 | struct mpcore_wdt *wdt; |
330 | struct resource *res; | 333 | struct resource *res; |
331 | int ret; | 334 | int ret; |
332 | 335 | ||
333 | /* We only accept one device, and it must have an id of -1 */ | 336 | /* We only accept one device, and it must have an id of -1 */ |
334 | if (dev->id != -1) | 337 | if (pdev->id != -1) |
335 | return -ENODEV; | 338 | return -ENODEV; |
336 | 339 | ||
337 | res = platform_get_resource(dev, IORESOURCE_MEM, 0); | 340 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
338 | if (!res) { | 341 | if (!res) |
339 | ret = -ENODEV; | 342 | return -ENODEV; |
340 | goto err_out; | ||
341 | } | ||
342 | 343 | ||
343 | wdt = kzalloc(sizeof(struct mpcore_wdt), GFP_KERNEL); | 344 | wdt = devm_kzalloc(&pdev->dev, sizeof(struct mpcore_wdt), GFP_KERNEL); |
344 | if (!wdt) { | 345 | if (!wdt) |
345 | ret = -ENOMEM; | 346 | return -ENOMEM; |
346 | goto err_out; | 347 | |
348 | wdt->dev = &pdev->dev; | ||
349 | wdt->irq = platform_get_irq(pdev, 0); | ||
350 | if (wdt->irq >= 0) { | ||
351 | ret = devm_request_irq(wdt->dev, wdt->irq, mpcore_wdt_fire, 0, | ||
352 | "mpcore_wdt", wdt); | ||
353 | if (ret) { | ||
354 | dev_printk(KERN_ERR, wdt->dev, | ||
355 | "cannot register IRQ%d for watchdog\n", | ||
356 | wdt->irq); | ||
357 | return ret; | ||
358 | } | ||
347 | } | 359 | } |
348 | 360 | ||
349 | wdt->dev = &dev->dev; | 361 | wdt->base = devm_ioremap(wdt->dev, res->start, resource_size(res)); |
350 | wdt->irq = platform_get_irq(dev, 0); | 362 | if (!wdt->base) |
351 | if (wdt->irq < 0) { | 363 | return -ENOMEM; |
352 | ret = -ENXIO; | ||
353 | goto err_free; | ||
354 | } | ||
355 | wdt->base = ioremap(res->start, resource_size(res)); | ||
356 | if (!wdt->base) { | ||
357 | ret = -ENOMEM; | ||
358 | goto err_free; | ||
359 | } | ||
360 | 364 | ||
361 | mpcore_wdt_miscdev.parent = &dev->dev; | 365 | mpcore_wdt_miscdev.parent = &pdev->dev; |
362 | ret = misc_register(&mpcore_wdt_miscdev); | 366 | ret = misc_register(&mpcore_wdt_miscdev); |
363 | if (ret) { | 367 | if (ret) { |
364 | dev_printk(KERN_ERR, wdt->dev, | 368 | dev_printk(KERN_ERR, wdt->dev, |
365 | "cannot register miscdev on minor=%d (err=%d)\n", | 369 | "cannot register miscdev on minor=%d (err=%d)\n", |
366 | WATCHDOG_MINOR, ret); | 370 | WATCHDOG_MINOR, ret); |
367 | goto err_misc; | 371 | return ret; |
368 | } | ||
369 | |||
370 | ret = request_irq(wdt->irq, mpcore_wdt_fire, 0, "mpcore_wdt", wdt); | ||
371 | if (ret) { | ||
372 | dev_printk(KERN_ERR, wdt->dev, | ||
373 | "cannot register IRQ%d for watchdog\n", wdt->irq); | ||
374 | goto err_irq; | ||
375 | } | 372 | } |
376 | 373 | ||
377 | mpcore_wdt_stop(wdt); | 374 | mpcore_wdt_stop(wdt); |
378 | platform_set_drvdata(dev, wdt); | 375 | platform_set_drvdata(pdev, wdt); |
379 | mpcore_wdt_dev = dev; | 376 | mpcore_wdt_pdev = pdev; |
380 | 377 | ||
381 | return 0; | 378 | return 0; |
382 | |||
383 | err_irq: | ||
384 | misc_deregister(&mpcore_wdt_miscdev); | ||
385 | err_misc: | ||
386 | iounmap(wdt->base); | ||
387 | err_free: | ||
388 | kfree(wdt); | ||
389 | err_out: | ||
390 | return ret; | ||
391 | } | 379 | } |
392 | 380 | ||
393 | static int __devexit mpcore_wdt_remove(struct platform_device *dev) | 381 | static int __devexit mpcore_wdt_remove(struct platform_device *pdev) |
394 | { | 382 | { |
395 | struct mpcore_wdt *wdt = platform_get_drvdata(dev); | 383 | platform_set_drvdata(pdev, NULL); |
396 | |||
397 | platform_set_drvdata(dev, NULL); | ||
398 | 384 | ||
399 | misc_deregister(&mpcore_wdt_miscdev); | 385 | misc_deregister(&mpcore_wdt_miscdev); |
400 | 386 | ||
401 | mpcore_wdt_dev = NULL; | 387 | mpcore_wdt_pdev = NULL; |
402 | 388 | ||
403 | free_irq(wdt->irq, wdt); | ||
404 | iounmap(wdt->base); | ||
405 | kfree(wdt); | ||
406 | return 0; | 389 | return 0; |
407 | } | 390 | } |
408 | 391 | ||
409 | #ifdef CONFIG_PM | 392 | #ifdef CONFIG_PM |
410 | static int mpcore_wdt_suspend(struct platform_device *dev, pm_message_t msg) | 393 | static int mpcore_wdt_suspend(struct platform_device *pdev, pm_message_t msg) |
411 | { | 394 | { |
412 | struct mpcore_wdt *wdt = platform_get_drvdata(dev); | 395 | struct mpcore_wdt *wdt = platform_get_drvdata(pdev); |
413 | mpcore_wdt_stop(wdt); /* Turn the WDT off */ | 396 | mpcore_wdt_stop(wdt); /* Turn the WDT off */ |
414 | return 0; | 397 | return 0; |
415 | } | 398 | } |
416 | 399 | ||
417 | static int mpcore_wdt_resume(struct platform_device *dev) | 400 | static int mpcore_wdt_resume(struct platform_device *pdev) |
418 | { | 401 | { |
419 | struct mpcore_wdt *wdt = platform_get_drvdata(dev); | 402 | struct mpcore_wdt *wdt = platform_get_drvdata(pdev); |
420 | /* re-activate timer */ | 403 | /* re-activate timer */ |
421 | if (test_bit(0, &wdt->timer_alive)) | 404 | if (test_bit(0, &wdt->timer_alive)) |
422 | mpcore_wdt_start(wdt); | 405 | mpcore_wdt_start(wdt); |
@@ -442,9 +425,6 @@ static struct platform_driver mpcore_wdt_driver = { | |||
442 | }, | 425 | }, |
443 | }; | 426 | }; |
444 | 427 | ||
445 | static char banner[] __initdata = KERN_INFO "MPcore Watchdog Timer: 0.1. " | ||
446 | "mpcore_noboot=%d mpcore_margin=%d sec (nowayout= %d)\n"; | ||
447 | |||
448 | static int __init mpcore_wdt_init(void) | 428 | static int __init mpcore_wdt_init(void) |
449 | { | 429 | { |
450 | /* | 430 | /* |
@@ -453,11 +433,12 @@ static int __init mpcore_wdt_init(void) | |||
453 | */ | 433 | */ |
454 | if (mpcore_wdt_set_heartbeat(mpcore_margin)) { | 434 | if (mpcore_wdt_set_heartbeat(mpcore_margin)) { |
455 | mpcore_wdt_set_heartbeat(TIMER_MARGIN); | 435 | mpcore_wdt_set_heartbeat(TIMER_MARGIN); |
456 | printk(KERN_INFO "mpcore_margin value must be 0 < mpcore_margin < 65536, using %d\n", | 436 | pr_info("mpcore_margin value must be 0 < mpcore_margin < 65536, using %d\n", |
457 | TIMER_MARGIN); | 437 | TIMER_MARGIN); |
458 | } | 438 | } |
459 | 439 | ||
460 | printk(banner, mpcore_noboot, mpcore_margin, nowayout); | 440 | pr_info("MPcore Watchdog Timer: 0.1. mpcore_noboot=%d mpcore_margin=%d sec (nowayout= %d)\n", |
441 | mpcore_noboot, mpcore_margin, nowayout); | ||
461 | 442 | ||
462 | return platform_driver_register(&mpcore_wdt_driver); | 443 | return platform_driver_register(&mpcore_wdt_driver); |
463 | } | 444 | } |
diff --git a/drivers/watchdog/mv64x60_wdt.c b/drivers/watchdog/mv64x60_wdt.c index 97f8a48d8b78..c53d025e70df 100644 --- a/drivers/watchdog/mv64x60_wdt.c +++ b/drivers/watchdog/mv64x60_wdt.c | |||
@@ -15,6 +15,8 @@ | |||
15 | * or implied. | 15 | * or implied. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
19 | |||
18 | #include <linux/fs.h> | 20 | #include <linux/fs.h> |
19 | #include <linux/init.h> | 21 | #include <linux/init.h> |
20 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
@@ -58,8 +60,8 @@ static unsigned int bus_clk; | |||
58 | static char expect_close; | 60 | static char expect_close; |
59 | static DEFINE_SPINLOCK(mv64x60_wdt_spinlock); | 61 | static DEFINE_SPINLOCK(mv64x60_wdt_spinlock); |
60 | 62 | ||
61 | static int nowayout = WATCHDOG_NOWAYOUT; | 63 | static bool nowayout = WATCHDOG_NOWAYOUT; |
62 | module_param(nowayout, int, 0); | 64 | module_param(nowayout, bool, 0); |
63 | MODULE_PARM_DESC(nowayout, | 65 | MODULE_PARM_DESC(nowayout, |
64 | "Watchdog cannot be stopped once started (default=" | 66 | "Watchdog cannot be stopped once started (default=" |
65 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 67 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
@@ -100,7 +102,7 @@ static void mv64x60_wdt_handler_enable(void) | |||
100 | if (mv64x60_wdt_toggle_wdc(MV64x60_WDC_ENABLED_FALSE, | 102 | if (mv64x60_wdt_toggle_wdc(MV64x60_WDC_ENABLED_FALSE, |
101 | MV64x60_WDC_ENABLE_SHIFT)) { | 103 | MV64x60_WDC_ENABLE_SHIFT)) { |
102 | mv64x60_wdt_service(); | 104 | mv64x60_wdt_service(); |
103 | printk(KERN_NOTICE "mv64x60_wdt: watchdog activated\n"); | 105 | pr_notice("watchdog activated\n"); |
104 | } | 106 | } |
105 | } | 107 | } |
106 | 108 | ||
@@ -108,7 +110,7 @@ static void mv64x60_wdt_handler_disable(void) | |||
108 | { | 110 | { |
109 | if (mv64x60_wdt_toggle_wdc(MV64x60_WDC_ENABLED_TRUE, | 111 | if (mv64x60_wdt_toggle_wdc(MV64x60_WDC_ENABLED_TRUE, |
110 | MV64x60_WDC_ENABLE_SHIFT)) | 112 | MV64x60_WDC_ENABLE_SHIFT)) |
111 | printk(KERN_NOTICE "mv64x60_wdt: watchdog deactivated\n"); | 113 | pr_notice("watchdog deactivated\n"); |
112 | } | 114 | } |
113 | 115 | ||
114 | static void mv64x60_wdt_set_timeout(unsigned int timeout) | 116 | static void mv64x60_wdt_set_timeout(unsigned int timeout) |
@@ -139,8 +141,7 @@ static int mv64x60_wdt_release(struct inode *inode, struct file *file) | |||
139 | if (expect_close == 42) | 141 | if (expect_close == 42) |
140 | mv64x60_wdt_handler_disable(); | 142 | mv64x60_wdt_handler_disable(); |
141 | else { | 143 | else { |
142 | printk(KERN_CRIT | 144 | pr_crit("unexpected close, not stopping timer!\n"); |
143 | "mv64x60_wdt: unexpected close, not stopping timer!\n"); | ||
144 | mv64x60_wdt_service(); | 145 | mv64x60_wdt_service(); |
145 | } | 146 | } |
146 | expect_close = 0; | 147 | expect_close = 0; |
@@ -308,7 +309,7 @@ static struct platform_driver mv64x60_wdt_driver = { | |||
308 | 309 | ||
309 | static int __init mv64x60_wdt_init(void) | 310 | static int __init mv64x60_wdt_init(void) |
310 | { | 311 | { |
311 | printk(KERN_INFO "MV64x60 watchdog driver\n"); | 312 | pr_info("MV64x60 watchdog driver\n"); |
312 | 313 | ||
313 | return platform_driver_register(&mv64x60_wdt_driver); | 314 | return platform_driver_register(&mv64x60_wdt_driver); |
314 | } | 315 | } |
diff --git a/drivers/watchdog/nuc900_wdt.c b/drivers/watchdog/nuc900_wdt.c index 529085b8b8fb..ea4c7448b754 100644 --- a/drivers/watchdog/nuc900_wdt.c +++ b/drivers/watchdog/nuc900_wdt.c | |||
@@ -55,8 +55,8 @@ module_param(heartbeat, int, 0); | |||
55 | MODULE_PARM_DESC(heartbeat, "Watchdog heartbeats in seconds. " | 55 | MODULE_PARM_DESC(heartbeat, "Watchdog heartbeats in seconds. " |
56 | "(default = " __MODULE_STRING(WDT_HEARTBEAT) ")"); | 56 | "(default = " __MODULE_STRING(WDT_HEARTBEAT) ")"); |
57 | 57 | ||
58 | static int nowayout = WATCHDOG_NOWAYOUT; | 58 | static bool nowayout = WATCHDOG_NOWAYOUT; |
59 | module_param(nowayout, int, 0); | 59 | module_param(nowayout, bool, 0); |
60 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started " | 60 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started " |
61 | "(default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 61 | "(default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
62 | 62 | ||
diff --git a/drivers/watchdog/nv_tco.c b/drivers/watchdog/nv_tco.c index 809f41c30c44..6bbb9efc6125 100644 --- a/drivers/watchdog/nv_tco.c +++ b/drivers/watchdog/nv_tco.c | |||
@@ -21,6 +21,8 @@ | |||
21 | * Includes, defines, variables, module parameters, ... | 21 | * Includes, defines, variables, module parameters, ... |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
25 | |||
24 | #include <linux/module.h> | 26 | #include <linux/module.h> |
25 | #include <linux/moduleparam.h> | 27 | #include <linux/moduleparam.h> |
26 | #include <linux/types.h> | 28 | #include <linux/types.h> |
@@ -41,7 +43,6 @@ | |||
41 | #define TCO_VERSION "0.01" | 43 | #define TCO_VERSION "0.01" |
42 | #define TCO_MODULE_NAME "NV_TCO" | 44 | #define TCO_MODULE_NAME "NV_TCO" |
43 | #define TCO_DRIVER_NAME TCO_MODULE_NAME ", v" TCO_VERSION | 45 | #define TCO_DRIVER_NAME TCO_MODULE_NAME ", v" TCO_VERSION |
44 | #define PFX TCO_MODULE_NAME ": " | ||
45 | 46 | ||
46 | /* internal variables */ | 47 | /* internal variables */ |
47 | static unsigned int tcobase; | 48 | static unsigned int tcobase; |
@@ -60,8 +61,8 @@ module_param(heartbeat, int, 0); | |||
60 | MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (2<heartbeat<39, " | 61 | MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (2<heartbeat<39, " |
61 | "default=" __MODULE_STRING(WATCHDOG_HEARTBEAT) ")"); | 62 | "default=" __MODULE_STRING(WATCHDOG_HEARTBEAT) ")"); |
62 | 63 | ||
63 | static int nowayout = WATCHDOG_NOWAYOUT; | 64 | static bool nowayout = WATCHDOG_NOWAYOUT; |
64 | module_param(nowayout, int, 0); | 65 | module_param(nowayout, bool, 0); |
65 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started" | 66 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started" |
66 | " (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 67 | " (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
67 | 68 | ||
@@ -169,8 +170,7 @@ static int nv_tco_release(struct inode *inode, struct file *file) | |||
169 | if (tco_expect_close == 42) { | 170 | if (tco_expect_close == 42) { |
170 | tco_timer_stop(); | 171 | tco_timer_stop(); |
171 | } else { | 172 | } else { |
172 | printk(KERN_CRIT PFX "Unexpected close, not stopping " | 173 | pr_crit("Unexpected close, not stopping watchdog!\n"); |
173 | "watchdog!\n"); | ||
174 | tco_timer_keepalive(); | 174 | tco_timer_keepalive(); |
175 | } | 175 | } |
176 | clear_bit(0, &timer_alive); | 176 | clear_bit(0, &timer_alive); |
@@ -323,15 +323,14 @@ static unsigned char __devinit nv_tco_getdevice(void) | |||
323 | val &= 0xffff; | 323 | val &= 0xffff; |
324 | if (val == 0x0001 || val == 0x0000) { | 324 | if (val == 0x0001 || val == 0x0000) { |
325 | /* Something is wrong here, bar isn't setup */ | 325 | /* Something is wrong here, bar isn't setup */ |
326 | printk(KERN_ERR PFX "failed to get tcobase address\n"); | 326 | pr_err("failed to get tcobase address\n"); |
327 | return 0; | 327 | return 0; |
328 | } | 328 | } |
329 | val &= 0xff00; | 329 | val &= 0xff00; |
330 | tcobase = val + 0x40; | 330 | tcobase = val + 0x40; |
331 | 331 | ||
332 | if (!request_region(tcobase, 0x10, "NV TCO")) { | 332 | if (!request_region(tcobase, 0x10, "NV TCO")) { |
333 | printk(KERN_ERR PFX "I/O address 0x%04x already in use\n", | 333 | pr_err("I/O address 0x%04x already in use\n", tcobase); |
334 | tcobase); | ||
335 | return 0; | 334 | return 0; |
336 | } | 335 | } |
337 | 336 | ||
@@ -347,7 +346,7 @@ static unsigned char __devinit nv_tco_getdevice(void) | |||
347 | 346 | ||
348 | /* Disable SMI caused by TCO */ | 347 | /* Disable SMI caused by TCO */ |
349 | if (!request_region(MCP51_SMI_EN(tcobase), 4, "NV TCO")) { | 348 | if (!request_region(MCP51_SMI_EN(tcobase), 4, "NV TCO")) { |
350 | printk(KERN_ERR PFX "I/O address 0x%04x already in use\n", | 349 | pr_err("I/O address 0x%04x already in use\n", |
351 | MCP51_SMI_EN(tcobase)); | 350 | MCP51_SMI_EN(tcobase)); |
352 | goto out; | 351 | goto out; |
353 | } | 352 | } |
@@ -357,7 +356,7 @@ static unsigned char __devinit nv_tco_getdevice(void) | |||
357 | val = inl(MCP51_SMI_EN(tcobase)); | 356 | val = inl(MCP51_SMI_EN(tcobase)); |
358 | release_region(MCP51_SMI_EN(tcobase), 4); | 357 | release_region(MCP51_SMI_EN(tcobase), 4); |
359 | if (val & MCP51_SMI_EN_TCO) { | 358 | if (val & MCP51_SMI_EN_TCO) { |
360 | printk(KERN_ERR PFX "Could not disable SMI caused by TCO\n"); | 359 | pr_err("Could not disable SMI caused by TCO\n"); |
361 | goto out; | 360 | goto out; |
362 | } | 361 | } |
363 | 362 | ||
@@ -367,8 +366,7 @@ static unsigned char __devinit nv_tco_getdevice(void) | |||
367 | pci_write_config_dword(tco_pci, MCP51_SMBUS_SETUP_B, val); | 366 | pci_write_config_dword(tco_pci, MCP51_SMBUS_SETUP_B, val); |
368 | pci_read_config_dword(tco_pci, MCP51_SMBUS_SETUP_B, &val); | 367 | pci_read_config_dword(tco_pci, MCP51_SMBUS_SETUP_B, &val); |
369 | if (!(val & MCP51_SMBUS_SETUP_B_TCO_REBOOT)) { | 368 | if (!(val & MCP51_SMBUS_SETUP_B_TCO_REBOOT)) { |
370 | printk(KERN_ERR PFX "failed to reset NO_REBOOT flag, reboot " | 369 | pr_err("failed to reset NO_REBOOT flag, reboot disabled by hardware\n"); |
371 | "disabled by hardware\n"); | ||
372 | goto out; | 370 | goto out; |
373 | } | 371 | } |
374 | 372 | ||
@@ -387,8 +385,8 @@ static int __devinit nv_tco_init(struct platform_device *dev) | |||
387 | return -ENODEV; | 385 | return -ENODEV; |
388 | 386 | ||
389 | /* Check to see if last reboot was due to watchdog timeout */ | 387 | /* Check to see if last reboot was due to watchdog timeout */ |
390 | printk(KERN_INFO PFX "Watchdog reboot %sdetected.\n", | 388 | pr_info("Watchdog reboot %sdetected\n", |
391 | inl(TCO_STS(tcobase)) & TCO_STS_TCO2TO_STS ? "" : "not "); | 389 | inl(TCO_STS(tcobase)) & TCO_STS_TCO2TO_STS ? "" : "not "); |
392 | 390 | ||
393 | /* Clear out the old status */ | 391 | /* Clear out the old status */ |
394 | outl(TCO_STS_RESET, TCO_STS(tcobase)); | 392 | outl(TCO_STS_RESET, TCO_STS(tcobase)); |
@@ -400,14 +398,14 @@ static int __devinit nv_tco_init(struct platform_device *dev) | |||
400 | if (tco_timer_set_heartbeat(heartbeat)) { | 398 | if (tco_timer_set_heartbeat(heartbeat)) { |
401 | heartbeat = WATCHDOG_HEARTBEAT; | 399 | heartbeat = WATCHDOG_HEARTBEAT; |
402 | tco_timer_set_heartbeat(heartbeat); | 400 | tco_timer_set_heartbeat(heartbeat); |
403 | printk(KERN_INFO PFX "heartbeat value must be 2<heartbeat<39, " | 401 | pr_info("heartbeat value must be 2<heartbeat<39, using %d\n", |
404 | "using %d\n", heartbeat); | 402 | heartbeat); |
405 | } | 403 | } |
406 | 404 | ||
407 | ret = misc_register(&nv_tco_miscdev); | 405 | ret = misc_register(&nv_tco_miscdev); |
408 | if (ret != 0) { | 406 | if (ret != 0) { |
409 | printk(KERN_ERR PFX "cannot register miscdev on minor=%d " | 407 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
410 | "(err=%d)\n", WATCHDOG_MINOR, ret); | 408 | WATCHDOG_MINOR, ret); |
411 | goto unreg_region; | 409 | goto unreg_region; |
412 | } | 410 | } |
413 | 411 | ||
@@ -415,8 +413,8 @@ static int __devinit nv_tco_init(struct platform_device *dev) | |||
415 | 413 | ||
416 | tco_timer_stop(); | 414 | tco_timer_stop(); |
417 | 415 | ||
418 | printk(KERN_INFO PFX "initialized (0x%04x). heartbeat=%d sec " | 416 | pr_info("initialized (0x%04x). heartbeat=%d sec (nowayout=%d)\n", |
419 | "(nowayout=%d)\n", tcobase, heartbeat, nowayout); | 417 | tcobase, heartbeat, nowayout); |
420 | 418 | ||
421 | return 0; | 419 | return 0; |
422 | 420 | ||
@@ -439,8 +437,7 @@ static void __devexit nv_tco_cleanup(void) | |||
439 | pci_write_config_dword(tco_pci, MCP51_SMBUS_SETUP_B, val); | 437 | pci_write_config_dword(tco_pci, MCP51_SMBUS_SETUP_B, val); |
440 | pci_read_config_dword(tco_pci, MCP51_SMBUS_SETUP_B, &val); | 438 | pci_read_config_dword(tco_pci, MCP51_SMBUS_SETUP_B, &val); |
441 | if (val & MCP51_SMBUS_SETUP_B_TCO_REBOOT) { | 439 | if (val & MCP51_SMBUS_SETUP_B_TCO_REBOOT) { |
442 | printk(KERN_CRIT PFX "Couldn't unset REBOOT bit. Machine may " | 440 | pr_crit("Couldn't unset REBOOT bit. Machine may soon reset\n"); |
443 | "soon reset\n"); | ||
444 | } | 441 | } |
445 | 442 | ||
446 | /* Deregister */ | 443 | /* Deregister */ |
@@ -483,8 +480,7 @@ static int __init nv_tco_init_module(void) | |||
483 | { | 480 | { |
484 | int err; | 481 | int err; |
485 | 482 | ||
486 | printk(KERN_INFO PFX "NV TCO WatchDog Timer Driver v%s\n", | 483 | pr_info("NV TCO WatchDog Timer Driver v%s\n", TCO_VERSION); |
487 | TCO_VERSION); | ||
488 | 484 | ||
489 | err = platform_driver_register(&nv_tco_driver); | 485 | err = platform_driver_register(&nv_tco_driver); |
490 | if (err) | 486 | if (err) |
@@ -508,7 +504,7 @@ static void __exit nv_tco_cleanup_module(void) | |||
508 | { | 504 | { |
509 | platform_device_unregister(nv_tco_platform_device); | 505 | platform_device_unregister(nv_tco_platform_device); |
510 | platform_driver_unregister(&nv_tco_driver); | 506 | platform_driver_unregister(&nv_tco_driver); |
511 | printk(KERN_INFO PFX "NV TCO Watchdog Module Unloaded.\n"); | 507 | pr_info("NV TCO Watchdog Module Unloaded\n"); |
512 | } | 508 | } |
513 | 509 | ||
514 | module_init(nv_tco_init_module); | 510 | module_init(nv_tco_init_module); |
diff --git a/drivers/watchdog/octeon-wdt-main.c b/drivers/watchdog/octeon-wdt-main.c index 7c0d8630e641..461208831428 100644 --- a/drivers/watchdog/octeon-wdt-main.c +++ b/drivers/watchdog/octeon-wdt-main.c | |||
@@ -52,6 +52,8 @@ | |||
52 | * | 52 | * |
53 | */ | 53 | */ |
54 | 54 | ||
55 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
56 | |||
55 | #include <linux/miscdevice.h> | 57 | #include <linux/miscdevice.h> |
56 | #include <linux/interrupt.h> | 58 | #include <linux/interrupt.h> |
57 | #include <linux/watchdog.h> | 59 | #include <linux/watchdog.h> |
@@ -95,8 +97,8 @@ MODULE_PARM_DESC(heartbeat, | |||
95 | "Watchdog heartbeat in seconds. (0 < heartbeat, default=" | 97 | "Watchdog heartbeat in seconds. (0 < heartbeat, default=" |
96 | __MODULE_STRING(WD_TIMO) ")"); | 98 | __MODULE_STRING(WD_TIMO) ")"); |
97 | 99 | ||
98 | static int nowayout = WATCHDOG_NOWAYOUT; | 100 | static bool nowayout = WATCHDOG_NOWAYOUT; |
99 | module_param(nowayout, int, S_IRUGO); | 101 | module_param(nowayout, bool, S_IRUGO); |
100 | MODULE_PARM_DESC(nowayout, | 102 | MODULE_PARM_DESC(nowayout, |
101 | "Watchdog cannot be stopped once started (default=" | 103 | "Watchdog cannot be stopped once started (default=" |
102 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 104 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
@@ -201,7 +203,7 @@ static void __init octeon_wdt_build_stage1(void) | |||
201 | uasm_resolve_relocs(relocs, labels); | 203 | uasm_resolve_relocs(relocs, labels); |
202 | 204 | ||
203 | len = (int)(p - nmi_stage1_insns); | 205 | len = (int)(p - nmi_stage1_insns); |
204 | pr_debug("Synthesized NMI stage 1 handler (%d instructions).\n", len); | 206 | pr_debug("Synthesized NMI stage 1 handler (%d instructions)\n", len); |
205 | 207 | ||
206 | pr_debug("\t.set push\n"); | 208 | pr_debug("\t.set push\n"); |
207 | pr_debug("\t.set noreorder\n"); | 209 | pr_debug("\t.set noreorder\n"); |
@@ -627,7 +629,7 @@ static int octeon_wdt_release(struct inode *inode, struct file *file) | |||
627 | do_coundown = 0; | 629 | do_coundown = 0; |
628 | octeon_wdt_ping(); | 630 | octeon_wdt_ping(); |
629 | } else { | 631 | } else { |
630 | pr_crit("octeon_wdt: WDT device closed unexpectedly. WDT will not stop!\n"); | 632 | pr_crit("WDT device closed unexpectedly. WDT will not stop!\n"); |
631 | } | 633 | } |
632 | clear_bit(0, &octeon_wdt_is_open); | 634 | clear_bit(0, &octeon_wdt_is_open); |
633 | expect_close = 0; | 635 | expect_close = 0; |
@@ -684,12 +686,12 @@ static int __init octeon_wdt_init(void) | |||
684 | 686 | ||
685 | octeon_wdt_calc_parameters(heartbeat); | 687 | octeon_wdt_calc_parameters(heartbeat); |
686 | 688 | ||
687 | pr_info("octeon_wdt: Initial granularity %d Sec.\n", timeout_sec); | 689 | pr_info("Initial granularity %d Sec\n", timeout_sec); |
688 | 690 | ||
689 | ret = misc_register(&octeon_wdt_miscdev); | 691 | ret = misc_register(&octeon_wdt_miscdev); |
690 | if (ret) { | 692 | if (ret) { |
691 | pr_err("octeon_wdt: cannot register miscdev on minor=%d (err=%d)\n", | 693 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
692 | WATCHDOG_MINOR, ret); | 694 | WATCHDOG_MINOR, ret); |
693 | goto out; | 695 | goto out; |
694 | } | 696 | } |
695 | 697 | ||
diff --git a/drivers/watchdog/of_xilinx_wdt.c b/drivers/watchdog/of_xilinx_wdt.c index f359ab85c3bc..55d2f66dbeae 100644 --- a/drivers/watchdog/of_xilinx_wdt.c +++ b/drivers/watchdog/of_xilinx_wdt.c | |||
@@ -19,6 +19,8 @@ | |||
19 | * know the wdt reset interval | 19 | * know the wdt reset interval |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
23 | |||
22 | #include <linux/module.h> | 24 | #include <linux/module.h> |
23 | #include <linux/types.h> | 25 | #include <linux/types.h> |
24 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
@@ -99,7 +101,7 @@ static void xwdt_stop(void) | |||
99 | iowrite32(0, xdev.base + XWT_TWCSR1_OFFSET); | 101 | iowrite32(0, xdev.base + XWT_TWCSR1_OFFSET); |
100 | 102 | ||
101 | spin_unlock(&spinlock); | 103 | spin_unlock(&spinlock); |
102 | printk(KERN_INFO PFX "Stopped!\n"); | 104 | pr_info("Stopped!\n"); |
103 | } | 105 | } |
104 | 106 | ||
105 | static void xwdt_keepalive(void) | 107 | static void xwdt_keepalive(void) |
@@ -165,7 +167,7 @@ static int xwdt_open(struct inode *inode, struct file *file) | |||
165 | __module_get(THIS_MODULE); | 167 | __module_get(THIS_MODULE); |
166 | 168 | ||
167 | xwdt_start(); | 169 | xwdt_start(); |
168 | printk(KERN_INFO PFX "Started...\n"); | 170 | pr_info("Started...\n"); |
169 | 171 | ||
170 | return nonseekable_open(inode, file); | 172 | return nonseekable_open(inode, file); |
171 | } | 173 | } |
@@ -175,8 +177,7 @@ static int xwdt_release(struct inode *inode, struct file *file) | |||
175 | if (expect_close == 42) { | 177 | if (expect_close == 42) { |
176 | xwdt_stop(); | 178 | xwdt_stop(); |
177 | } else { | 179 | } else { |
178 | printk(KERN_CRIT PFX | 180 | pr_crit("Unexpected close, not stopping watchdog!\n"); |
179 | "Unexpected close, not stopping watchdog!\n"); | ||
180 | xwdt_keepalive(); | 181 | xwdt_keepalive(); |
181 | } | 182 | } |
182 | 183 | ||
@@ -300,22 +301,20 @@ static int __devinit xwdt_probe(struct platform_device *pdev) | |||
300 | "clock-frequency", NULL); | 301 | "clock-frequency", NULL); |
301 | 302 | ||
302 | if (pfreq == NULL) { | 303 | if (pfreq == NULL) { |
303 | printk(KERN_WARNING PFX | 304 | pr_warn("The watchdog clock frequency cannot be obtained!\n"); |
304 | "The watchdog clock frequency cannot be obtained!\n"); | ||
305 | no_timeout = 1; | 305 | no_timeout = 1; |
306 | } | 306 | } |
307 | 307 | ||
308 | rc = of_address_to_resource(pdev->dev.of_node, 0, &xdev.res); | 308 | rc = of_address_to_resource(pdev->dev.of_node, 0, &xdev.res); |
309 | if (rc) { | 309 | if (rc) { |
310 | printk(KERN_WARNING PFX "invalid address!\n"); | 310 | pr_warn("invalid address!\n"); |
311 | return rc; | 311 | return rc; |
312 | } | 312 | } |
313 | 313 | ||
314 | tmptr = (u32 *)of_get_property(pdev->dev.of_node, | 314 | tmptr = (u32 *)of_get_property(pdev->dev.of_node, |
315 | "xlnx,wdt-interval", NULL); | 315 | "xlnx,wdt-interval", NULL); |
316 | if (tmptr == NULL) { | 316 | if (tmptr == NULL) { |
317 | printk(KERN_WARNING PFX "Parameter \"xlnx,wdt-interval\"" | 317 | pr_warn("Parameter \"xlnx,wdt-interval\" not found in device tree!\n"); |
318 | " not found in device tree!\n"); | ||
319 | no_timeout = 1; | 318 | no_timeout = 1; |
320 | } else { | 319 | } else { |
321 | xdev.wdt_interval = *tmptr; | 320 | xdev.wdt_interval = *tmptr; |
@@ -324,8 +323,7 @@ static int __devinit xwdt_probe(struct platform_device *pdev) | |||
324 | tmptr = (u32 *)of_get_property(pdev->dev.of_node, | 323 | tmptr = (u32 *)of_get_property(pdev->dev.of_node, |
325 | "xlnx,wdt-enable-once", NULL); | 324 | "xlnx,wdt-enable-once", NULL); |
326 | if (tmptr == NULL) { | 325 | if (tmptr == NULL) { |
327 | printk(KERN_WARNING PFX "Parameter \"xlnx,wdt-enable-once\"" | 326 | pr_warn("Parameter \"xlnx,wdt-enable-once\" not found in device tree!\n"); |
328 | " not found in device tree!\n"); | ||
329 | xdev.nowayout = WATCHDOG_NOWAYOUT; | 327 | xdev.nowayout = WATCHDOG_NOWAYOUT; |
330 | } | 328 | } |
331 | 329 | ||
@@ -339,20 +337,20 @@ static int __devinit xwdt_probe(struct platform_device *pdev) | |||
339 | if (!request_mem_region(xdev.res.start, | 337 | if (!request_mem_region(xdev.res.start, |
340 | xdev.res.end - xdev.res.start + 1, WATCHDOG_NAME)) { | 338 | xdev.res.end - xdev.res.start + 1, WATCHDOG_NAME)) { |
341 | rc = -ENXIO; | 339 | rc = -ENXIO; |
342 | printk(KERN_ERR PFX "memory request failure!\n"); | 340 | pr_err("memory request failure!\n"); |
343 | goto err_out; | 341 | goto err_out; |
344 | } | 342 | } |
345 | 343 | ||
346 | xdev.base = ioremap(xdev.res.start, xdev.res.end - xdev.res.start + 1); | 344 | xdev.base = ioremap(xdev.res.start, xdev.res.end - xdev.res.start + 1); |
347 | if (xdev.base == NULL) { | 345 | if (xdev.base == NULL) { |
348 | rc = -ENOMEM; | 346 | rc = -ENOMEM; |
349 | printk(KERN_ERR PFX "ioremap failure!\n"); | 347 | pr_err("ioremap failure!\n"); |
350 | goto release_mem; | 348 | goto release_mem; |
351 | } | 349 | } |
352 | 350 | ||
353 | rc = xwdt_selftest(); | 351 | rc = xwdt_selftest(); |
354 | if (rc == XWT_TIMER_FAILED) { | 352 | if (rc == XWT_TIMER_FAILED) { |
355 | printk(KERN_ERR PFX "SelfTest routine error!\n"); | 353 | pr_err("SelfTest routine error!\n"); |
356 | goto unmap_io; | 354 | goto unmap_io; |
357 | } | 355 | } |
358 | 356 | ||
@@ -360,20 +358,17 @@ static int __devinit xwdt_probe(struct platform_device *pdev) | |||
360 | 358 | ||
361 | rc = misc_register(&xwdt_miscdev); | 359 | rc = misc_register(&xwdt_miscdev); |
362 | if (rc) { | 360 | if (rc) { |
363 | printk(KERN_ERR PFX | 361 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
364 | "cannot register miscdev on minor=%d (err=%d)\n", | 362 | xwdt_miscdev.minor, rc); |
365 | xwdt_miscdev.minor, rc); | ||
366 | goto unmap_io; | 363 | goto unmap_io; |
367 | } | 364 | } |
368 | 365 | ||
369 | if (no_timeout) | 366 | if (no_timeout) |
370 | printk(KERN_INFO PFX | 367 | pr_info("driver loaded (timeout=? sec, nowayout=%d)\n", |
371 | "driver loaded (timeout=? sec, nowayout=%d)\n", | 368 | xdev.nowayout); |
372 | xdev.nowayout); | ||
373 | else | 369 | else |
374 | printk(KERN_INFO PFX | 370 | pr_info("driver loaded (timeout=%d sec, nowayout=%d)\n", |
375 | "driver loaded (timeout=%d sec, nowayout=%d)\n", | 371 | timeout, xdev.nowayout); |
376 | timeout, xdev.nowayout); | ||
377 | 372 | ||
378 | expect_close = 0; | 373 | expect_close = 0; |
379 | clear_bit(0, &driver_open); | 374 | clear_bit(0, &driver_open); |
diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c index d19ff5145e82..8285d65cd207 100644 --- a/drivers/watchdog/omap_wdt.c +++ b/drivers/watchdog/omap_wdt.c | |||
@@ -26,6 +26,8 @@ | |||
26 | * Use the driver model and standard identifiers; handle bigger timeouts. | 26 | * Use the driver model and standard identifiers; handle bigger timeouts. |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
30 | |||
29 | #include <linux/module.h> | 31 | #include <linux/module.h> |
30 | #include <linux/types.h> | 32 | #include <linux/types.h> |
31 | #include <linux/kernel.h> | 33 | #include <linux/kernel.h> |
@@ -183,7 +185,7 @@ static int omap_wdt_release(struct inode *inode, struct file *file) | |||
183 | 185 | ||
184 | pm_runtime_put_sync(wdev->dev); | 186 | pm_runtime_put_sync(wdev->dev); |
185 | #else | 187 | #else |
186 | printk(KERN_CRIT "omap_wdt: Unexpected close, not stopping!\n"); | 188 | pr_crit("Unexpected close, not stopping!\n"); |
187 | #endif | 189 | #endif |
188 | wdev->omap_wdt_users = 0; | 190 | wdev->omap_wdt_users = 0; |
189 | 191 | ||
diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c index 1368e4ca3100..788aa158e78c 100644 --- a/drivers/watchdog/orion_wdt.c +++ b/drivers/watchdog/orion_wdt.c | |||
@@ -10,6 +10,8 @@ | |||
10 | * warranty of any kind, whether express or implied. | 10 | * warranty of any kind, whether express or implied. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
14 | |||
13 | #include <linux/module.h> | 15 | #include <linux/module.h> |
14 | #include <linux/moduleparam.h> | 16 | #include <linux/moduleparam.h> |
15 | #include <linux/types.h> | 17 | #include <linux/types.h> |
@@ -36,7 +38,7 @@ | |||
36 | #define WDT_IN_USE 0 | 38 | #define WDT_IN_USE 0 |
37 | #define WDT_OK_TO_CLOSE 1 | 39 | #define WDT_OK_TO_CLOSE 1 |
38 | 40 | ||
39 | static int nowayout = WATCHDOG_NOWAYOUT; | 41 | static bool nowayout = WATCHDOG_NOWAYOUT; |
40 | static int heartbeat = -1; /* module parameter (seconds) */ | 42 | static int heartbeat = -1; /* module parameter (seconds) */ |
41 | static unsigned int wdt_max_duration; /* (seconds) */ | 43 | static unsigned int wdt_max_duration; /* (seconds) */ |
42 | static unsigned int wdt_tclk; | 44 | static unsigned int wdt_tclk; |
@@ -210,8 +212,7 @@ static int orion_wdt_release(struct inode *inode, struct file *file) | |||
210 | if (test_bit(WDT_OK_TO_CLOSE, &wdt_status)) | 212 | if (test_bit(WDT_OK_TO_CLOSE, &wdt_status)) |
211 | orion_wdt_disable(); | 213 | orion_wdt_disable(); |
212 | else | 214 | else |
213 | printk(KERN_CRIT "WATCHDOG: Device closed unexpectedly - " | 215 | pr_crit("Device closed unexpectedly - timer will not stop\n"); |
214 | "timer will not stop\n"); | ||
215 | clear_bit(WDT_IN_USE, &wdt_status); | 216 | clear_bit(WDT_IN_USE, &wdt_status); |
216 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); | 217 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); |
217 | 218 | ||
@@ -243,7 +244,7 @@ static int __devinit orion_wdt_probe(struct platform_device *pdev) | |||
243 | if (pdata) { | 244 | if (pdata) { |
244 | wdt_tclk = pdata->tclk; | 245 | wdt_tclk = pdata->tclk; |
245 | } else { | 246 | } else { |
246 | printk(KERN_ERR "Orion Watchdog misses platform data\n"); | 247 | pr_err("misses platform data\n"); |
247 | return -ENODEV; | 248 | return -ENODEV; |
248 | } | 249 | } |
249 | 250 | ||
@@ -263,8 +264,8 @@ static int __devinit orion_wdt_probe(struct platform_device *pdev) | |||
263 | if (ret) | 264 | if (ret) |
264 | return ret; | 265 | return ret; |
265 | 266 | ||
266 | printk(KERN_INFO "Orion Watchdog Timer: Initial timeout %d sec%s\n", | 267 | pr_info("Initial timeout %d sec%s\n", |
267 | heartbeat, nowayout ? ", nowayout" : ""); | 268 | heartbeat, nowayout ? ", nowayout" : ""); |
268 | return 0; | 269 | return 0; |
269 | } | 270 | } |
270 | 271 | ||
@@ -308,7 +309,7 @@ MODULE_DESCRIPTION("Orion Processor Watchdog"); | |||
308 | module_param(heartbeat, int, 0); | 309 | module_param(heartbeat, int, 0); |
309 | MODULE_PARM_DESC(heartbeat, "Initial watchdog heartbeat in seconds"); | 310 | MODULE_PARM_DESC(heartbeat, "Initial watchdog heartbeat in seconds"); |
310 | 311 | ||
311 | module_param(nowayout, int, 0); | 312 | module_param(nowayout, bool, 0); |
312 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" | 313 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" |
313 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 314 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
314 | 315 | ||
diff --git a/drivers/watchdog/pc87413_wdt.c b/drivers/watchdog/pc87413_wdt.c index e78d89986768..d5bf112e0077 100644 --- a/drivers/watchdog/pc87413_wdt.c +++ b/drivers/watchdog/pc87413_wdt.c | |||
@@ -18,6 +18,8 @@ | |||
18 | * Release 1.1 | 18 | * Release 1.1 |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
22 | |||
21 | #include <linux/module.h> | 23 | #include <linux/module.h> |
22 | #include <linux/types.h> | 24 | #include <linux/types.h> |
23 | #include <linux/miscdevice.h> | 25 | #include <linux/miscdevice.h> |
@@ -42,7 +44,6 @@ | |||
42 | 44 | ||
43 | #define VERSION "1.1" | 45 | #define VERSION "1.1" |
44 | #define MODNAME "pc87413 WDT" | 46 | #define MODNAME "pc87413 WDT" |
45 | #define PFX MODNAME ": " | ||
46 | #define DPFX MODNAME " - DEBUG: " | 47 | #define DPFX MODNAME " - DEBUG: " |
47 | 48 | ||
48 | #define WDT_INDEX_IO_PORT (io+0) /* I/O port base (index register) */ | 49 | #define WDT_INDEX_IO_PORT (io+0) /* I/O port base (index register) */ |
@@ -65,7 +66,7 @@ static char expect_close; /* is the close expected? */ | |||
65 | 66 | ||
66 | static DEFINE_SPINLOCK(io_lock); /* to guard us from io races */ | 67 | static DEFINE_SPINLOCK(io_lock); /* to guard us from io races */ |
67 | 68 | ||
68 | static int nowayout = WATCHDOG_NOWAYOUT; | 69 | static bool nowayout = WATCHDOG_NOWAYOUT; |
69 | 70 | ||
70 | /* -- Low level function ----------------------------------------*/ | 71 | /* -- Low level function ----------------------------------------*/ |
71 | 72 | ||
@@ -87,7 +88,7 @@ static inline void pc87413_select_wdt_out(void) | |||
87 | outb_p(cr_data, WDT_DATA_IO_PORT); | 88 | outb_p(cr_data, WDT_DATA_IO_PORT); |
88 | 89 | ||
89 | #ifdef DEBUG | 90 | #ifdef DEBUG |
90 | printk(KERN_INFO DPFX | 91 | pr_info(DPFX |
91 | "Select multiple pin,pin55,as WDT output: Bit7 to 1: %d\n", | 92 | "Select multiple pin,pin55,as WDT output: Bit7 to 1: %d\n", |
92 | cr_data); | 93 | cr_data); |
93 | #endif | 94 | #endif |
@@ -111,7 +112,7 @@ static inline void pc87413_enable_swc(void) | |||
111 | outb_p(cr_data, WDT_DATA_IO_PORT); /* Index0x30_bit0P1 */ | 112 | outb_p(cr_data, WDT_DATA_IO_PORT); /* Index0x30_bit0P1 */ |
112 | 113 | ||
113 | #ifdef DEBUG | 114 | #ifdef DEBUG |
114 | printk(KERN_INFO DPFX "pc87413 - Enable SWC functions\n"); | 115 | pr_info(DPFX "pc87413 - Enable SWC functions\n"); |
115 | #endif | 116 | #endif |
116 | } | 117 | } |
117 | 118 | ||
@@ -132,7 +133,7 @@ static void pc87413_get_swc_base_addr(void) | |||
132 | 133 | ||
133 | swc_base_addr = (addr_h << 8) + addr_l; | 134 | swc_base_addr = (addr_h << 8) + addr_l; |
134 | #ifdef DEBUG | 135 | #ifdef DEBUG |
135 | printk(KERN_INFO DPFX | 136 | pr_info(DPFX |
136 | "Read SWC I/O Base Address: low %d, high %d, res %d\n", | 137 | "Read SWC I/O Base Address: low %d, high %d, res %d\n", |
137 | addr_l, addr_h, swc_base_addr); | 138 | addr_l, addr_h, swc_base_addr); |
138 | #endif | 139 | #endif |
@@ -145,7 +146,7 @@ static inline void pc87413_swc_bank3(void) | |||
145 | /* Step 4: Select Bank3 of SWC */ | 146 | /* Step 4: Select Bank3 of SWC */ |
146 | outb_p(inb(swc_base_addr + 0x0f) | 0x03, swc_base_addr + 0x0f); | 147 | outb_p(inb(swc_base_addr + 0x0f) | 0x03, swc_base_addr + 0x0f); |
147 | #ifdef DEBUG | 148 | #ifdef DEBUG |
148 | printk(KERN_INFO DPFX "Select Bank3 of SWC\n"); | 149 | pr_info(DPFX "Select Bank3 of SWC\n"); |
149 | #endif | 150 | #endif |
150 | } | 151 | } |
151 | 152 | ||
@@ -156,7 +157,7 @@ static inline void pc87413_programm_wdto(char pc87413_time) | |||
156 | /* Step 5: Programm WDTO, Twd. */ | 157 | /* Step 5: Programm WDTO, Twd. */ |
157 | outb_p(pc87413_time, swc_base_addr + WDTO); | 158 | outb_p(pc87413_time, swc_base_addr + WDTO); |
158 | #ifdef DEBUG | 159 | #ifdef DEBUG |
159 | printk(KERN_INFO DPFX "Set WDTO to %d minutes\n", pc87413_time); | 160 | pr_info(DPFX "Set WDTO to %d minutes\n", pc87413_time); |
160 | #endif | 161 | #endif |
161 | } | 162 | } |
162 | 163 | ||
@@ -167,7 +168,7 @@ static inline void pc87413_enable_wden(void) | |||
167 | /* Step 6: Enable WDEN */ | 168 | /* Step 6: Enable WDEN */ |
168 | outb_p(inb(swc_base_addr + WDCTL) | 0x01, swc_base_addr + WDCTL); | 169 | outb_p(inb(swc_base_addr + WDCTL) | 0x01, swc_base_addr + WDCTL); |
169 | #ifdef DEBUG | 170 | #ifdef DEBUG |
170 | printk(KERN_INFO DPFX "Enable WDEN\n"); | 171 | pr_info(DPFX "Enable WDEN\n"); |
171 | #endif | 172 | #endif |
172 | } | 173 | } |
173 | 174 | ||
@@ -177,7 +178,7 @@ static inline void pc87413_enable_sw_wd_tren(void) | |||
177 | /* Enable SW_WD_TREN */ | 178 | /* Enable SW_WD_TREN */ |
178 | outb_p(inb(swc_base_addr + WDCFG) | 0x80, swc_base_addr + WDCFG); | 179 | outb_p(inb(swc_base_addr + WDCFG) | 0x80, swc_base_addr + WDCFG); |
179 | #ifdef DEBUG | 180 | #ifdef DEBUG |
180 | printk(KERN_INFO DPFX "Enable SW_WD_TREN\n"); | 181 | pr_info(DPFX "Enable SW_WD_TREN\n"); |
181 | #endif | 182 | #endif |
182 | } | 183 | } |
183 | 184 | ||
@@ -188,7 +189,7 @@ static inline void pc87413_disable_sw_wd_tren(void) | |||
188 | /* Disable SW_WD_TREN */ | 189 | /* Disable SW_WD_TREN */ |
189 | outb_p(inb(swc_base_addr + WDCFG) & 0x7f, swc_base_addr + WDCFG); | 190 | outb_p(inb(swc_base_addr + WDCFG) & 0x7f, swc_base_addr + WDCFG); |
190 | #ifdef DEBUG | 191 | #ifdef DEBUG |
191 | printk(KERN_INFO DPFX "pc87413 - Disable SW_WD_TREN\n"); | 192 | pr_info(DPFX "pc87413 - Disable SW_WD_TREN\n"); |
192 | #endif | 193 | #endif |
193 | } | 194 | } |
194 | 195 | ||
@@ -199,7 +200,7 @@ static inline void pc87413_enable_sw_wd_trg(void) | |||
199 | /* Enable SW_WD_TRG */ | 200 | /* Enable SW_WD_TRG */ |
200 | outb_p(inb(swc_base_addr + WDCTL) | 0x80, swc_base_addr + WDCTL); | 201 | outb_p(inb(swc_base_addr + WDCTL) | 0x80, swc_base_addr + WDCTL); |
201 | #ifdef DEBUG | 202 | #ifdef DEBUG |
202 | printk(KERN_INFO DPFX "pc87413 - Enable SW_WD_TRG\n"); | 203 | pr_info(DPFX "pc87413 - Enable SW_WD_TRG\n"); |
203 | #endif | 204 | #endif |
204 | } | 205 | } |
205 | 206 | ||
@@ -210,7 +211,7 @@ static inline void pc87413_disable_sw_wd_trg(void) | |||
210 | /* Disable SW_WD_TRG */ | 211 | /* Disable SW_WD_TRG */ |
211 | outb_p(inb(swc_base_addr + WDCTL) & 0x7f, swc_base_addr + WDCTL); | 212 | outb_p(inb(swc_base_addr + WDCTL) & 0x7f, swc_base_addr + WDCTL); |
212 | #ifdef DEBUG | 213 | #ifdef DEBUG |
213 | printk(KERN_INFO DPFX "Disable SW_WD_TRG\n"); | 214 | pr_info(DPFX "Disable SW_WD_TRG\n"); |
214 | #endif | 215 | #endif |
215 | } | 216 | } |
216 | 217 | ||
@@ -284,8 +285,7 @@ static int pc87413_open(struct inode *inode, struct file *file) | |||
284 | /* Reload and activate timer */ | 285 | /* Reload and activate timer */ |
285 | pc87413_refresh(); | 286 | pc87413_refresh(); |
286 | 287 | ||
287 | printk(KERN_INFO MODNAME | 288 | pr_info("Watchdog enabled. Timeout set to %d minute(s).\n", timeout); |
288 | "Watchdog enabled. Timeout set to %d minute(s).\n", timeout); | ||
289 | 289 | ||
290 | return nonseekable_open(inode, file); | 290 | return nonseekable_open(inode, file); |
291 | } | 291 | } |
@@ -308,11 +308,9 @@ static int pc87413_release(struct inode *inode, struct file *file) | |||
308 | 308 | ||
309 | if (expect_close == 42) { | 309 | if (expect_close == 42) { |
310 | pc87413_disable(); | 310 | pc87413_disable(); |
311 | printk(KERN_INFO MODNAME | 311 | pr_info("Watchdog disabled, sleeping again...\n"); |
312 | "Watchdog disabled, sleeping again...\n"); | ||
313 | } else { | 312 | } else { |
314 | printk(KERN_CRIT MODNAME | 313 | pr_crit("Unexpected close, not stopping watchdog!\n"); |
315 | "Unexpected close, not stopping watchdog!\n"); | ||
316 | pc87413_refresh(); | 314 | pc87413_refresh(); |
317 | } | 315 | } |
318 | clear_bit(0, &timer_enabled); | 316 | clear_bit(0, &timer_enabled); |
@@ -428,7 +426,7 @@ static long pc87413_ioctl(struct file *file, unsigned int cmd, | |||
428 | case WDIOC_KEEPALIVE: | 426 | case WDIOC_KEEPALIVE: |
429 | pc87413_refresh(); | 427 | pc87413_refresh(); |
430 | #ifdef DEBUG | 428 | #ifdef DEBUG |
431 | printk(KERN_INFO DPFX "keepalive\n"); | 429 | pr_info(DPFX "keepalive\n"); |
432 | #endif | 430 | #endif |
433 | return 0; | 431 | return 0; |
434 | case WDIOC_SETTIMEOUT: | 432 | case WDIOC_SETTIMEOUT: |
@@ -508,7 +506,7 @@ static int __init pc87413_init(void) | |||
508 | { | 506 | { |
509 | int ret; | 507 | int ret; |
510 | 508 | ||
511 | printk(KERN_INFO PFX "Version " VERSION " at io 0x%X\n", | 509 | pr_info("Version " VERSION " at io 0x%X\n", |
512 | WDT_INDEX_IO_PORT); | 510 | WDT_INDEX_IO_PORT); |
513 | 511 | ||
514 | if (!request_muxed_region(io, 2, MODNAME)) | 512 | if (!request_muxed_region(io, 2, MODNAME)) |
@@ -516,26 +514,23 @@ static int __init pc87413_init(void) | |||
516 | 514 | ||
517 | ret = register_reboot_notifier(&pc87413_notifier); | 515 | ret = register_reboot_notifier(&pc87413_notifier); |
518 | if (ret != 0) { | 516 | if (ret != 0) { |
519 | printk(KERN_ERR PFX | 517 | pr_err("cannot register reboot notifier (err=%d)\n", ret); |
520 | "cannot register reboot notifier (err=%d)\n", ret); | ||
521 | } | 518 | } |
522 | 519 | ||
523 | ret = misc_register(&pc87413_miscdev); | 520 | ret = misc_register(&pc87413_miscdev); |
524 | if (ret != 0) { | 521 | if (ret != 0) { |
525 | printk(KERN_ERR PFX | 522 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
526 | "cannot register miscdev on minor=%d (err=%d)\n", | 523 | WATCHDOG_MINOR, ret); |
527 | WATCHDOG_MINOR, ret); | ||
528 | goto reboot_unreg; | 524 | goto reboot_unreg; |
529 | } | 525 | } |
530 | printk(KERN_INFO PFX "initialized. timeout=%d min \n", timeout); | 526 | pr_info("initialized. timeout=%d min\n", timeout); |
531 | 527 | ||
532 | pc87413_select_wdt_out(); | 528 | pc87413_select_wdt_out(); |
533 | pc87413_enable_swc(); | 529 | pc87413_enable_swc(); |
534 | pc87413_get_swc_base_addr(); | 530 | pc87413_get_swc_base_addr(); |
535 | 531 | ||
536 | if (!request_region(swc_base_addr, 0x20, MODNAME)) { | 532 | if (!request_region(swc_base_addr, 0x20, MODNAME)) { |
537 | printk(KERN_ERR PFX | 533 | pr_err("cannot request SWC region at 0x%x\n", swc_base_addr); |
538 | "cannot request SWC region at 0x%x\n", swc_base_addr); | ||
539 | ret = -EBUSY; | 534 | ret = -EBUSY; |
540 | goto misc_unreg; | 535 | goto misc_unreg; |
541 | } | 536 | } |
@@ -568,14 +563,14 @@ static void __exit pc87413_exit(void) | |||
568 | /* Stop the timer before we leave */ | 563 | /* Stop the timer before we leave */ |
569 | if (!nowayout) { | 564 | if (!nowayout) { |
570 | pc87413_disable(); | 565 | pc87413_disable(); |
571 | printk(KERN_INFO MODNAME "Watchdog disabled.\n"); | 566 | pr_info("Watchdog disabled\n"); |
572 | } | 567 | } |
573 | 568 | ||
574 | misc_deregister(&pc87413_miscdev); | 569 | misc_deregister(&pc87413_miscdev); |
575 | unregister_reboot_notifier(&pc87413_notifier); | 570 | unregister_reboot_notifier(&pc87413_notifier); |
576 | release_region(swc_base_addr, 0x20); | 571 | release_region(swc_base_addr, 0x20); |
577 | 572 | ||
578 | printk(KERN_INFO MODNAME " watchdog component driver removed.\n"); | 573 | pr_info("watchdog component driver removed\n"); |
579 | } | 574 | } |
580 | 575 | ||
581 | module_init(pc87413_init); | 576 | module_init(pc87413_init); |
@@ -597,7 +592,7 @@ MODULE_PARM_DESC(timeout, | |||
597 | "Watchdog timeout in minutes (default=" | 592 | "Watchdog timeout in minutes (default=" |
598 | __MODULE_STRING(DEFAULT_TIMEOUT) ")."); | 593 | __MODULE_STRING(DEFAULT_TIMEOUT) ")."); |
599 | 594 | ||
600 | module_param(nowayout, int, 0); | 595 | module_param(nowayout, bool, 0); |
601 | MODULE_PARM_DESC(nowayout, | 596 | MODULE_PARM_DESC(nowayout, |
602 | "Watchdog cannot be stopped once started (default=" | 597 | "Watchdog cannot be stopped once started (default=" |
603 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 598 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
diff --git a/drivers/watchdog/pcwd.c b/drivers/watchdog/pcwd.c index 06f7922606c0..75694cf24f86 100644 --- a/drivers/watchdog/pcwd.c +++ b/drivers/watchdog/pcwd.c | |||
@@ -51,6 +51,8 @@ | |||
51 | * http://www.pcwatchdog.com/ | 51 | * http://www.pcwatchdog.com/ |
52 | */ | 52 | */ |
53 | 53 | ||
54 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
55 | |||
54 | #include <linux/module.h> /* For module specific items */ | 56 | #include <linux/module.h> /* For module specific items */ |
55 | #include <linux/moduleparam.h> /* For new moduleparam's */ | 57 | #include <linux/moduleparam.h> /* For new moduleparam's */ |
56 | #include <linux/types.h> /* For standard types (like size_t) */ | 58 | #include <linux/types.h> /* For standard types (like size_t) */ |
@@ -75,7 +77,6 @@ | |||
75 | #define WATCHDOG_DATE "18 Feb 2007" | 77 | #define WATCHDOG_DATE "18 Feb 2007" |
76 | #define WATCHDOG_DRIVER_NAME "ISA-PC Watchdog" | 78 | #define WATCHDOG_DRIVER_NAME "ISA-PC Watchdog" |
77 | #define WATCHDOG_NAME "pcwd" | 79 | #define WATCHDOG_NAME "pcwd" |
78 | #define PFX WATCHDOG_NAME ": " | ||
79 | #define DRIVER_VERSION WATCHDOG_DRIVER_NAME " driver, v" WATCHDOG_VERSION "\n" | 80 | #define DRIVER_VERSION WATCHDOG_DRIVER_NAME " driver, v" WATCHDOG_VERSION "\n" |
80 | 81 | ||
81 | /* | 82 | /* |
@@ -203,8 +204,8 @@ MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. " | |||
203 | "(2 <= heartbeat <= 7200 or 0=delay-time from dip-switches, default=" | 204 | "(2 <= heartbeat <= 7200 or 0=delay-time from dip-switches, default=" |
204 | __MODULE_STRING(WATCHDOG_HEARTBEAT) ")"); | 205 | __MODULE_STRING(WATCHDOG_HEARTBEAT) ")"); |
205 | 206 | ||
206 | static int nowayout = WATCHDOG_NOWAYOUT; | 207 | static bool nowayout = WATCHDOG_NOWAYOUT; |
207 | module_param(nowayout, int, 0); | 208 | module_param(nowayout, bool, 0); |
208 | MODULE_PARM_DESC(nowayout, | 209 | MODULE_PARM_DESC(nowayout, |
209 | "Watchdog cannot be stopped once started (default=" | 210 | "Watchdog cannot be stopped once started (default=" |
210 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 211 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
@@ -220,8 +221,7 @@ static int send_isa_command(int cmd) | |||
220 | int port0, last_port0; /* Double read for stabilising */ | 221 | int port0, last_port0; /* Double read for stabilising */ |
221 | 222 | ||
222 | if (debug >= DEBUG) | 223 | if (debug >= DEBUG) |
223 | printk(KERN_DEBUG PFX "sending following data cmd=0x%02x\n", | 224 | pr_debug("sending following data cmd=0x%02x\n", cmd); |
224 | cmd); | ||
225 | 225 | ||
226 | /* The WCMD bit must be 1 and the command is only 4 bits in size */ | 226 | /* The WCMD bit must be 1 and the command is only 4 bits in size */ |
227 | control_status = (cmd & 0x0F) | WD_WCMD; | 227 | control_status = (cmd & 0x0F) | WD_WCMD; |
@@ -240,9 +240,8 @@ static int send_isa_command(int cmd) | |||
240 | } | 240 | } |
241 | 241 | ||
242 | if (debug >= DEBUG) | 242 | if (debug >= DEBUG) |
243 | printk(KERN_DEBUG PFX "received following data for " | 243 | pr_debug("received following data for cmd=0x%02x: port0=0x%02x last_port0=0x%02x\n", |
244 | "cmd=0x%02x: port0=0x%02x last_port0=0x%02x\n", | 244 | cmd, port0, last_port0); |
245 | cmd, port0, last_port0); | ||
246 | 245 | ||
247 | return port0; | 246 | return port0; |
248 | } | 247 | } |
@@ -271,8 +270,7 @@ static int set_command_mode(void) | |||
271 | pcwd_private.command_mode = found; | 270 | pcwd_private.command_mode = found; |
272 | 271 | ||
273 | if (debug >= DEBUG) | 272 | if (debug >= DEBUG) |
274 | printk(KERN_DEBUG PFX "command_mode=%d\n", | 273 | pr_debug("command_mode=%d\n", pcwd_private.command_mode); |
275 | pcwd_private.command_mode); | ||
276 | 274 | ||
277 | return found; | 275 | return found; |
278 | } | 276 | } |
@@ -288,8 +286,7 @@ static void unset_command_mode(void) | |||
288 | pcwd_private.command_mode = 0; | 286 | pcwd_private.command_mode = 0; |
289 | 287 | ||
290 | if (debug >= DEBUG) | 288 | if (debug >= DEBUG) |
291 | printk(KERN_DEBUG PFX "command_mode=%d\n", | 289 | pr_debug("command_mode=%d\n", pcwd_private.command_mode); |
292 | pcwd_private.command_mode); | ||
293 | } | 290 | } |
294 | 291 | ||
295 | static inline void pcwd_check_temperature_support(void) | 292 | static inline void pcwd_check_temperature_support(void) |
@@ -336,17 +333,14 @@ static void pcwd_show_card_info(void) | |||
336 | 333 | ||
337 | /* Get some extra info from the hardware (in command/debug/diag mode) */ | 334 | /* Get some extra info from the hardware (in command/debug/diag mode) */ |
338 | if (pcwd_private.revision == PCWD_REVISION_A) | 335 | if (pcwd_private.revision == PCWD_REVISION_A) |
339 | printk(KERN_INFO PFX | 336 | pr_info("ISA-PC Watchdog (REV.A) detected at port 0x%04x\n", |
340 | "ISA-PC Watchdog (REV.A) detected at port 0x%04x\n", | 337 | pcwd_private.io_addr); |
341 | pcwd_private.io_addr); | ||
342 | else if (pcwd_private.revision == PCWD_REVISION_C) { | 338 | else if (pcwd_private.revision == PCWD_REVISION_C) { |
343 | pcwd_get_firmware(); | 339 | pcwd_get_firmware(); |
344 | printk(KERN_INFO PFX "ISA-PC Watchdog (REV.C) detected at port " | 340 | pr_info("ISA-PC Watchdog (REV.C) detected at port 0x%04x (Firmware version: %s)\n", |
345 | "0x%04x (Firmware version: %s)\n", | ||
346 | pcwd_private.io_addr, pcwd_private.fw_ver_str); | 341 | pcwd_private.io_addr, pcwd_private.fw_ver_str); |
347 | option_switches = pcwd_get_option_switches(); | 342 | option_switches = pcwd_get_option_switches(); |
348 | printk(KERN_INFO PFX "Option switches (0x%02x): " | 343 | pr_info("Option switches (0x%02x): Temperature Reset Enable=%s, Power On Delay=%s\n", |
349 | "Temperature Reset Enable=%s, Power On Delay=%s\n", | ||
350 | option_switches, | 344 | option_switches, |
351 | ((option_switches & 0x10) ? "ON" : "OFF"), | 345 | ((option_switches & 0x10) ? "ON" : "OFF"), |
352 | ((option_switches & 0x08) ? "ON" : "OFF")); | 346 | ((option_switches & 0x08) ? "ON" : "OFF")); |
@@ -359,22 +353,18 @@ static void pcwd_show_card_info(void) | |||
359 | } | 353 | } |
360 | 354 | ||
361 | if (pcwd_private.supports_temp) | 355 | if (pcwd_private.supports_temp) |
362 | printk(KERN_INFO PFX "Temperature Option Detected\n"); | 356 | pr_info("Temperature Option Detected\n"); |
363 | 357 | ||
364 | if (pcwd_private.boot_status & WDIOF_CARDRESET) | 358 | if (pcwd_private.boot_status & WDIOF_CARDRESET) |
365 | printk(KERN_INFO PFX | 359 | pr_info("Previous reboot was caused by the card\n"); |
366 | "Previous reboot was caused by the card\n"); | ||
367 | 360 | ||
368 | if (pcwd_private.boot_status & WDIOF_OVERHEAT) { | 361 | if (pcwd_private.boot_status & WDIOF_OVERHEAT) { |
369 | printk(KERN_EMERG PFX | 362 | pr_emerg("Card senses a CPU Overheat. Panicking!\n"); |
370 | "Card senses a CPU Overheat. Panicking!\n"); | 363 | pr_emerg("CPU Overheat\n"); |
371 | printk(KERN_EMERG PFX | ||
372 | "CPU Overheat\n"); | ||
373 | } | 364 | } |
374 | 365 | ||
375 | if (pcwd_private.boot_status == 0) | 366 | if (pcwd_private.boot_status == 0) |
376 | printk(KERN_INFO PFX | 367 | pr_info("No previous trip detected - Cold boot or reset\n"); |
377 | "No previous trip detected - Cold boot or reset\n"); | ||
378 | } | 368 | } |
379 | 369 | ||
380 | static void pcwd_timer_ping(unsigned long data) | 370 | static void pcwd_timer_ping(unsigned long data) |
@@ -404,8 +394,7 @@ static void pcwd_timer_ping(unsigned long data) | |||
404 | 394 | ||
405 | spin_unlock(&pcwd_private.io_lock); | 395 | spin_unlock(&pcwd_private.io_lock); |
406 | } else { | 396 | } else { |
407 | printk(KERN_WARNING PFX | 397 | pr_warn("Heartbeat lost! Will not ping the watchdog\n"); |
408 | "Heartbeat lost! Will not ping the watchdog\n"); | ||
409 | } | 398 | } |
410 | } | 399 | } |
411 | 400 | ||
@@ -426,13 +415,13 @@ static int pcwd_start(void) | |||
426 | stat_reg = inb_p(pcwd_private.io_addr + 2); | 415 | stat_reg = inb_p(pcwd_private.io_addr + 2); |
427 | spin_unlock(&pcwd_private.io_lock); | 416 | spin_unlock(&pcwd_private.io_lock); |
428 | if (stat_reg & WD_WDIS) { | 417 | if (stat_reg & WD_WDIS) { |
429 | printk(KERN_INFO PFX "Could not start watchdog\n"); | 418 | pr_info("Could not start watchdog\n"); |
430 | return -EIO; | 419 | return -EIO; |
431 | } | 420 | } |
432 | } | 421 | } |
433 | 422 | ||
434 | if (debug >= VERBOSE) | 423 | if (debug >= VERBOSE) |
435 | printk(KERN_DEBUG PFX "Watchdog started\n"); | 424 | pr_debug("Watchdog started\n"); |
436 | 425 | ||
437 | return 0; | 426 | return 0; |
438 | } | 427 | } |
@@ -454,13 +443,13 @@ static int pcwd_stop(void) | |||
454 | stat_reg = inb_p(pcwd_private.io_addr + 2); | 443 | stat_reg = inb_p(pcwd_private.io_addr + 2); |
455 | spin_unlock(&pcwd_private.io_lock); | 444 | spin_unlock(&pcwd_private.io_lock); |
456 | if ((stat_reg & WD_WDIS) == 0) { | 445 | if ((stat_reg & WD_WDIS) == 0) { |
457 | printk(KERN_INFO PFX "Could not stop watchdog\n"); | 446 | pr_info("Could not stop watchdog\n"); |
458 | return -EIO; | 447 | return -EIO; |
459 | } | 448 | } |
460 | } | 449 | } |
461 | 450 | ||
462 | if (debug >= VERBOSE) | 451 | if (debug >= VERBOSE) |
463 | printk(KERN_DEBUG PFX "Watchdog stopped\n"); | 452 | pr_debug("Watchdog stopped\n"); |
464 | 453 | ||
465 | return 0; | 454 | return 0; |
466 | } | 455 | } |
@@ -471,7 +460,7 @@ static int pcwd_keepalive(void) | |||
471 | pcwd_private.next_heartbeat = jiffies + (heartbeat * HZ); | 460 | pcwd_private.next_heartbeat = jiffies + (heartbeat * HZ); |
472 | 461 | ||
473 | if (debug >= DEBUG) | 462 | if (debug >= DEBUG) |
474 | printk(KERN_DEBUG PFX "Watchdog keepalive signal send\n"); | 463 | pr_debug("Watchdog keepalive signal send\n"); |
475 | 464 | ||
476 | return 0; | 465 | return 0; |
477 | } | 466 | } |
@@ -484,8 +473,7 @@ static int pcwd_set_heartbeat(int t) | |||
484 | heartbeat = t; | 473 | heartbeat = t; |
485 | 474 | ||
486 | if (debug >= VERBOSE) | 475 | if (debug >= VERBOSE) |
487 | printk(KERN_DEBUG PFX "New heartbeat: %d\n", | 476 | pr_debug("New heartbeat: %d\n", heartbeat); |
488 | heartbeat); | ||
489 | 477 | ||
490 | return 0; | 478 | return 0; |
491 | } | 479 | } |
@@ -518,8 +506,7 @@ static int pcwd_get_status(int *status) | |||
518 | if (control_status & WD_T110) { | 506 | if (control_status & WD_T110) { |
519 | *status |= WDIOF_OVERHEAT; | 507 | *status |= WDIOF_OVERHEAT; |
520 | if (temp_panic) { | 508 | if (temp_panic) { |
521 | printk(KERN_INFO PFX | 509 | pr_info("Temperature overheat trip!\n"); |
522 | "Temperature overheat trip!\n"); | ||
523 | kernel_power_off(); | 510 | kernel_power_off(); |
524 | } | 511 | } |
525 | } | 512 | } |
@@ -530,8 +517,7 @@ static int pcwd_get_status(int *status) | |||
530 | if (control_status & WD_REVC_TTRP) { | 517 | if (control_status & WD_REVC_TTRP) { |
531 | *status |= WDIOF_OVERHEAT; | 518 | *status |= WDIOF_OVERHEAT; |
532 | if (temp_panic) { | 519 | if (temp_panic) { |
533 | printk(KERN_INFO PFX | 520 | pr_info("Temperature overheat trip!\n"); |
534 | "Temperature overheat trip!\n"); | ||
535 | kernel_power_off(); | 521 | kernel_power_off(); |
536 | } | 522 | } |
537 | } | 523 | } |
@@ -548,16 +534,14 @@ static int pcwd_clear_status(void) | |||
548 | spin_lock(&pcwd_private.io_lock); | 534 | spin_lock(&pcwd_private.io_lock); |
549 | 535 | ||
550 | if (debug >= VERBOSE) | 536 | if (debug >= VERBOSE) |
551 | printk(KERN_INFO PFX | 537 | pr_info("clearing watchdog trip status\n"); |
552 | "clearing watchdog trip status\n"); | ||
553 | 538 | ||
554 | control_status = inb_p(pcwd_private.io_addr + 1); | 539 | control_status = inb_p(pcwd_private.io_addr + 1); |
555 | 540 | ||
556 | if (debug >= DEBUG) { | 541 | if (debug >= DEBUG) { |
557 | printk(KERN_DEBUG PFX "status was: 0x%02x\n", | 542 | pr_debug("status was: 0x%02x\n", control_status); |
558 | control_status); | 543 | pr_debug("sending: 0x%02x\n", |
559 | printk(KERN_DEBUG PFX "sending: 0x%02x\n", | 544 | (control_status & WD_REVC_R2DS)); |
560 | (control_status & WD_REVC_R2DS)); | ||
561 | } | 545 | } |
562 | 546 | ||
563 | /* clear reset status & Keep Relay 2 disable state as it is */ | 547 | /* clear reset status & Keep Relay 2 disable state as it is */ |
@@ -588,8 +572,7 @@ static int pcwd_get_temperature(int *temperature) | |||
588 | spin_unlock(&pcwd_private.io_lock); | 572 | spin_unlock(&pcwd_private.io_lock); |
589 | 573 | ||
590 | if (debug >= DEBUG) { | 574 | if (debug >= DEBUG) { |
591 | printk(KERN_DEBUG PFX "temperature is: %d F\n", | 575 | pr_debug("temperature is: %d F\n", *temperature); |
592 | *temperature); | ||
593 | } | 576 | } |
594 | 577 | ||
595 | return 0; | 578 | return 0; |
@@ -720,8 +703,7 @@ static int pcwd_close(struct inode *inode, struct file *file) | |||
720 | if (expect_close == 42) | 703 | if (expect_close == 42) |
721 | pcwd_stop(); | 704 | pcwd_stop(); |
722 | else { | 705 | else { |
723 | printk(KERN_CRIT PFX | 706 | pr_crit("Unexpected close, not stopping watchdog!\n"); |
724 | "Unexpected close, not stopping watchdog!\n"); | ||
725 | pcwd_keepalive(); | 707 | pcwd_keepalive(); |
726 | } | 708 | } |
727 | expect_close = 0; | 709 | expect_close = 0; |
@@ -828,11 +810,10 @@ static int __devinit pcwd_isa_match(struct device *dev, unsigned int id) | |||
828 | int retval; | 810 | int retval; |
829 | 811 | ||
830 | if (debug >= DEBUG) | 812 | if (debug >= DEBUG) |
831 | printk(KERN_DEBUG PFX "pcwd_isa_match id=%d\n", | 813 | pr_debug("pcwd_isa_match id=%d\n", id); |
832 | id); | ||
833 | 814 | ||
834 | if (!request_region(base_addr, 4, "PCWD")) { | 815 | if (!request_region(base_addr, 4, "PCWD")) { |
835 | printk(KERN_INFO PFX "Port 0x%04x unavailable\n", base_addr); | 816 | pr_info("Port 0x%04x unavailable\n", base_addr); |
836 | return 0; | 817 | return 0; |
837 | } | 818 | } |
838 | 819 | ||
@@ -870,21 +851,20 @@ static int __devinit pcwd_isa_probe(struct device *dev, unsigned int id) | |||
870 | int ret; | 851 | int ret; |
871 | 852 | ||
872 | if (debug >= DEBUG) | 853 | if (debug >= DEBUG) |
873 | printk(KERN_DEBUG PFX "pcwd_isa_probe id=%d\n", | 854 | pr_debug("pcwd_isa_probe id=%d\n", id); |
874 | id); | ||
875 | 855 | ||
876 | cards_found++; | 856 | cards_found++; |
877 | if (cards_found == 1) | 857 | if (cards_found == 1) |
878 | printk(KERN_INFO PFX "v%s Ken Hollis (kenji@bitgate.com)\n", | 858 | pr_info("v%s Ken Hollis (kenji@bitgate.com)\n", |
879 | WATCHDOG_VERSION); | 859 | WATCHDOG_VERSION); |
880 | 860 | ||
881 | if (cards_found > 1) { | 861 | if (cards_found > 1) { |
882 | printk(KERN_ERR PFX "This driver only supports 1 device\n"); | 862 | pr_err("This driver only supports 1 device\n"); |
883 | return -ENODEV; | 863 | return -ENODEV; |
884 | } | 864 | } |
885 | 865 | ||
886 | if (pcwd_ioports[id] == 0x0000) { | 866 | if (pcwd_ioports[id] == 0x0000) { |
887 | printk(KERN_ERR PFX "No I/O-Address for card detected\n"); | 867 | pr_err("No I/O-Address for card detected\n"); |
888 | return -ENODEV; | 868 | return -ENODEV; |
889 | } | 869 | } |
890 | pcwd_private.io_addr = pcwd_ioports[id]; | 870 | pcwd_private.io_addr = pcwd_ioports[id]; |
@@ -896,8 +876,8 @@ static int __devinit pcwd_isa_probe(struct device *dev, unsigned int id) | |||
896 | 876 | ||
897 | if (!request_region(pcwd_private.io_addr, | 877 | if (!request_region(pcwd_private.io_addr, |
898 | (pcwd_private.revision == PCWD_REVISION_A) ? 2 : 4, "PCWD")) { | 878 | (pcwd_private.revision == PCWD_REVISION_A) ? 2 : 4, "PCWD")) { |
899 | printk(KERN_ERR PFX "I/O address 0x%04x already in use\n", | 879 | pr_err("I/O address 0x%04x already in use\n", |
900 | pcwd_private.io_addr); | 880 | pcwd_private.io_addr); |
901 | ret = -EIO; | 881 | ret = -EIO; |
902 | goto error_request_region; | 882 | goto error_request_region; |
903 | } | 883 | } |
@@ -932,30 +912,27 @@ static int __devinit pcwd_isa_probe(struct device *dev, unsigned int id) | |||
932 | if not reset to the default */ | 912 | if not reset to the default */ |
933 | if (pcwd_set_heartbeat(heartbeat)) { | 913 | if (pcwd_set_heartbeat(heartbeat)) { |
934 | pcwd_set_heartbeat(WATCHDOG_HEARTBEAT); | 914 | pcwd_set_heartbeat(WATCHDOG_HEARTBEAT); |
935 | printk(KERN_INFO PFX | 915 | pr_info("heartbeat value must be 2 <= heartbeat <= 7200, using %d\n", |
936 | "heartbeat value must be 2 <= heartbeat <= 7200, using %d\n", | 916 | WATCHDOG_HEARTBEAT); |
937 | WATCHDOG_HEARTBEAT); | ||
938 | } | 917 | } |
939 | 918 | ||
940 | if (pcwd_private.supports_temp) { | 919 | if (pcwd_private.supports_temp) { |
941 | ret = misc_register(&temp_miscdev); | 920 | ret = misc_register(&temp_miscdev); |
942 | if (ret) { | 921 | if (ret) { |
943 | printk(KERN_ERR PFX | 922 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
944 | "cannot register miscdev on minor=%d (err=%d)\n", | 923 | TEMP_MINOR, ret); |
945 | TEMP_MINOR, ret); | ||
946 | goto error_misc_register_temp; | 924 | goto error_misc_register_temp; |
947 | } | 925 | } |
948 | } | 926 | } |
949 | 927 | ||
950 | ret = misc_register(&pcwd_miscdev); | 928 | ret = misc_register(&pcwd_miscdev); |
951 | if (ret) { | 929 | if (ret) { |
952 | printk(KERN_ERR PFX | 930 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
953 | "cannot register miscdev on minor=%d (err=%d)\n", | 931 | WATCHDOG_MINOR, ret); |
954 | WATCHDOG_MINOR, ret); | ||
955 | goto error_misc_register_watchdog; | 932 | goto error_misc_register_watchdog; |
956 | } | 933 | } |
957 | 934 | ||
958 | printk(KERN_INFO PFX "initialized. heartbeat=%d sec (nowayout=%d)\n", | 935 | pr_info("initialized. heartbeat=%d sec (nowayout=%d)\n", |
959 | heartbeat, nowayout); | 936 | heartbeat, nowayout); |
960 | 937 | ||
961 | return 0; | 938 | return 0; |
@@ -975,8 +952,7 @@ error_request_region: | |||
975 | static int __devexit pcwd_isa_remove(struct device *dev, unsigned int id) | 952 | static int __devexit pcwd_isa_remove(struct device *dev, unsigned int id) |
976 | { | 953 | { |
977 | if (debug >= DEBUG) | 954 | if (debug >= DEBUG) |
978 | printk(KERN_DEBUG PFX "pcwd_isa_remove id=%d\n", | 955 | pr_debug("pcwd_isa_remove id=%d\n", id); |
979 | id); | ||
980 | 956 | ||
981 | if (!pcwd_private.io_addr) | 957 | if (!pcwd_private.io_addr) |
982 | return 1; | 958 | return 1; |
@@ -1000,8 +976,7 @@ static int __devexit pcwd_isa_remove(struct device *dev, unsigned int id) | |||
1000 | static void pcwd_isa_shutdown(struct device *dev, unsigned int id) | 976 | static void pcwd_isa_shutdown(struct device *dev, unsigned int id) |
1001 | { | 977 | { |
1002 | if (debug >= DEBUG) | 978 | if (debug >= DEBUG) |
1003 | printk(KERN_DEBUG PFX "pcwd_isa_shutdown id=%d\n", | 979 | pr_debug("pcwd_isa_shutdown id=%d\n", id); |
1004 | id); | ||
1005 | 980 | ||
1006 | pcwd_stop(); | 981 | pcwd_stop(); |
1007 | } | 982 | } |
@@ -1025,7 +1000,7 @@ static int __init pcwd_init_module(void) | |||
1025 | static void __exit pcwd_cleanup_module(void) | 1000 | static void __exit pcwd_cleanup_module(void) |
1026 | { | 1001 | { |
1027 | isa_unregister_driver(&pcwd_isa_driver); | 1002 | isa_unregister_driver(&pcwd_isa_driver); |
1028 | printk(KERN_INFO PFX "Watchdog Module Unloaded.\n"); | 1003 | pr_info("Watchdog Module Unloaded\n"); |
1029 | } | 1004 | } |
1030 | 1005 | ||
1031 | module_init(pcwd_init_module); | 1006 | module_init(pcwd_init_module); |
diff --git a/drivers/watchdog/pcwd_pci.c b/drivers/watchdog/pcwd_pci.c index b8d14f88f0b5..c891399bed6a 100644 --- a/drivers/watchdog/pcwd_pci.c +++ b/drivers/watchdog/pcwd_pci.c | |||
@@ -32,6 +32,8 @@ | |||
32 | * Includes, defines, variables, module parameters, ... | 32 | * Includes, defines, variables, module parameters, ... |
33 | */ | 33 | */ |
34 | 34 | ||
35 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
36 | |||
35 | #include <linux/module.h> /* For module specific items */ | 37 | #include <linux/module.h> /* For module specific items */ |
36 | #include <linux/moduleparam.h> /* For new moduleparam's */ | 38 | #include <linux/moduleparam.h> /* For new moduleparam's */ |
37 | #include <linux/types.h> /* For standard types (like size_t) */ | 39 | #include <linux/types.h> /* For standard types (like size_t) */ |
@@ -54,8 +56,7 @@ | |||
54 | #define WATCHDOG_VERSION "1.03" | 56 | #define WATCHDOG_VERSION "1.03" |
55 | #define WATCHDOG_DRIVER_NAME "PCI-PC Watchdog" | 57 | #define WATCHDOG_DRIVER_NAME "PCI-PC Watchdog" |
56 | #define WATCHDOG_NAME "pcwd_pci" | 58 | #define WATCHDOG_NAME "pcwd_pci" |
57 | #define PFX WATCHDOG_NAME ": " | 59 | #define DRIVER_VERSION WATCHDOG_DRIVER_NAME " driver, v" WATCHDOG_VERSION |
58 | #define DRIVER_VERSION WATCHDOG_DRIVER_NAME " driver, v" WATCHDOG_VERSION "\n" | ||
59 | 60 | ||
60 | /* Stuff for the PCI ID's */ | 61 | /* Stuff for the PCI ID's */ |
61 | #ifndef PCI_VENDOR_ID_QUICKLOGIC | 62 | #ifndef PCI_VENDOR_ID_QUICKLOGIC |
@@ -145,8 +146,8 @@ MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. " | |||
145 | "(0<heartbeat<65536 or 0=delay-time from dip-switches, default=" | 146 | "(0<heartbeat<65536 or 0=delay-time from dip-switches, default=" |
146 | __MODULE_STRING(WATCHDOG_HEARTBEAT) ")"); | 147 | __MODULE_STRING(WATCHDOG_HEARTBEAT) ")"); |
147 | 148 | ||
148 | static int nowayout = WATCHDOG_NOWAYOUT; | 149 | static bool nowayout = WATCHDOG_NOWAYOUT; |
149 | module_param(nowayout, int, 0); | 150 | module_param(nowayout, bool, 0); |
150 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" | 151 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" |
151 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 152 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
152 | 153 | ||
@@ -159,8 +160,8 @@ static int send_command(int cmd, int *msb, int *lsb) | |||
159 | int got_response, count; | 160 | int got_response, count; |
160 | 161 | ||
161 | if (debug >= DEBUG) | 162 | if (debug >= DEBUG) |
162 | printk(KERN_DEBUG PFX "sending following data " | 163 | pr_debug("sending following data cmd=0x%02x msb=0x%02x lsb=0x%02x\n", |
163 | "cmd=0x%02x msb=0x%02x lsb=0x%02x\n", cmd, *msb, *lsb); | 164 | cmd, *msb, *lsb); |
164 | 165 | ||
165 | spin_lock(&pcipcwd_private.io_lock); | 166 | spin_lock(&pcipcwd_private.io_lock); |
166 | /* If a command requires data it should be written first. | 167 | /* If a command requires data it should be written first. |
@@ -185,12 +186,10 @@ static int send_command(int cmd, int *msb, int *lsb) | |||
185 | 186 | ||
186 | if (debug >= DEBUG) { | 187 | if (debug >= DEBUG) { |
187 | if (got_response) { | 188 | if (got_response) { |
188 | printk(KERN_DEBUG PFX | 189 | pr_debug("time to process command was: %d ms\n", |
189 | "time to process command was: %d ms\n", | 190 | count); |
190 | count); | ||
191 | } else { | 191 | } else { |
192 | printk(KERN_DEBUG PFX | 192 | pr_debug("card did not respond on command!\n"); |
193 | "card did not respond on command!\n"); | ||
194 | } | 193 | } |
195 | } | 194 | } |
196 | 195 | ||
@@ -203,9 +202,8 @@ static int send_command(int cmd, int *msb, int *lsb) | |||
203 | inb_p(pcipcwd_private.io_addr + 6); | 202 | inb_p(pcipcwd_private.io_addr + 6); |
204 | 203 | ||
205 | if (debug >= DEBUG) | 204 | if (debug >= DEBUG) |
206 | printk(KERN_DEBUG PFX "received following data for " | 205 | pr_debug("received following data for cmd=0x%02x: msb=0x%02x lsb=0x%02x\n", |
207 | "cmd=0x%02x: msb=0x%02x lsb=0x%02x\n", | 206 | cmd, *msb, *lsb); |
208 | cmd, *msb, *lsb); | ||
209 | } | 207 | } |
210 | 208 | ||
211 | spin_unlock(&pcipcwd_private.io_lock); | 209 | spin_unlock(&pcipcwd_private.io_lock); |
@@ -243,27 +241,23 @@ static void pcipcwd_show_card_info(void) | |||
243 | /* Get switch settings */ | 241 | /* Get switch settings */ |
244 | option_switches = pcipcwd_get_option_switches(); | 242 | option_switches = pcipcwd_get_option_switches(); |
245 | 243 | ||
246 | printk(KERN_INFO PFX "Found card at port " | 244 | pr_info("Found card at port 0x%04x (Firmware: %s) %s temp option\n", |
247 | "0x%04x (Firmware: %s) %s temp option\n", | ||
248 | (int) pcipcwd_private.io_addr, fw_ver_str, | 245 | (int) pcipcwd_private.io_addr, fw_ver_str, |
249 | (pcipcwd_private.supports_temp ? "with" : "without")); | 246 | (pcipcwd_private.supports_temp ? "with" : "without")); |
250 | 247 | ||
251 | printk(KERN_INFO PFX "Option switches (0x%02x): " | 248 | pr_info("Option switches (0x%02x): Temperature Reset Enable=%s, Power On Delay=%s\n", |
252 | "Temperature Reset Enable=%s, Power On Delay=%s\n", | ||
253 | option_switches, | 249 | option_switches, |
254 | ((option_switches & 0x10) ? "ON" : "OFF"), | 250 | ((option_switches & 0x10) ? "ON" : "OFF"), |
255 | ((option_switches & 0x08) ? "ON" : "OFF")); | 251 | ((option_switches & 0x08) ? "ON" : "OFF")); |
256 | 252 | ||
257 | if (pcipcwd_private.boot_status & WDIOF_CARDRESET) | 253 | if (pcipcwd_private.boot_status & WDIOF_CARDRESET) |
258 | printk(KERN_INFO PFX | 254 | pr_info("Previous reset was caused by the Watchdog card\n"); |
259 | "Previous reset was caused by the Watchdog card\n"); | ||
260 | 255 | ||
261 | if (pcipcwd_private.boot_status & WDIOF_OVERHEAT) | 256 | if (pcipcwd_private.boot_status & WDIOF_OVERHEAT) |
262 | printk(KERN_INFO PFX "Card sensed a CPU Overheat\n"); | 257 | pr_info("Card sensed a CPU Overheat\n"); |
263 | 258 | ||
264 | if (pcipcwd_private.boot_status == 0) | 259 | if (pcipcwd_private.boot_status == 0) |
265 | printk(KERN_INFO PFX | 260 | pr_info("No previous trip detected - Cold boot or reset\n"); |
266 | "No previous trip detected - Cold boot or reset\n"); | ||
267 | } | 261 | } |
268 | 262 | ||
269 | static int pcipcwd_start(void) | 263 | static int pcipcwd_start(void) |
@@ -278,12 +272,12 @@ static int pcipcwd_start(void) | |||
278 | spin_unlock(&pcipcwd_private.io_lock); | 272 | spin_unlock(&pcipcwd_private.io_lock); |
279 | 273 | ||
280 | if (stat_reg & WD_PCI_WDIS) { | 274 | if (stat_reg & WD_PCI_WDIS) { |
281 | printk(KERN_ERR PFX "Card timer not enabled\n"); | 275 | pr_err("Card timer not enabled\n"); |
282 | return -1; | 276 | return -1; |
283 | } | 277 | } |
284 | 278 | ||
285 | if (debug >= VERBOSE) | 279 | if (debug >= VERBOSE) |
286 | printk(KERN_DEBUG PFX "Watchdog started\n"); | 280 | pr_debug("Watchdog started\n"); |
287 | 281 | ||
288 | return 0; | 282 | return 0; |
289 | } | 283 | } |
@@ -303,13 +297,12 @@ static int pcipcwd_stop(void) | |||
303 | spin_unlock(&pcipcwd_private.io_lock); | 297 | spin_unlock(&pcipcwd_private.io_lock); |
304 | 298 | ||
305 | if (!(stat_reg & WD_PCI_WDIS)) { | 299 | if (!(stat_reg & WD_PCI_WDIS)) { |
306 | printk(KERN_ERR PFX | 300 | pr_err("Card did not acknowledge disable attempt\n"); |
307 | "Card did not acknowledge disable attempt\n"); | ||
308 | return -1; | 301 | return -1; |
309 | } | 302 | } |
310 | 303 | ||
311 | if (debug >= VERBOSE) | 304 | if (debug >= VERBOSE) |
312 | printk(KERN_DEBUG PFX "Watchdog stopped\n"); | 305 | pr_debug("Watchdog stopped\n"); |
313 | 306 | ||
314 | return 0; | 307 | return 0; |
315 | } | 308 | } |
@@ -322,7 +315,7 @@ static int pcipcwd_keepalive(void) | |||
322 | spin_unlock(&pcipcwd_private.io_lock); | 315 | spin_unlock(&pcipcwd_private.io_lock); |
323 | 316 | ||
324 | if (debug >= DEBUG) | 317 | if (debug >= DEBUG) |
325 | printk(KERN_DEBUG PFX "Watchdog keepalive signal send\n"); | 318 | pr_debug("Watchdog keepalive signal send\n"); |
326 | 319 | ||
327 | return 0; | 320 | return 0; |
328 | } | 321 | } |
@@ -340,8 +333,7 @@ static int pcipcwd_set_heartbeat(int t) | |||
340 | 333 | ||
341 | heartbeat = t; | 334 | heartbeat = t; |
342 | if (debug >= VERBOSE) | 335 | if (debug >= VERBOSE) |
343 | printk(KERN_DEBUG PFX "New heartbeat: %d\n", | 336 | pr_debug("New heartbeat: %d\n", heartbeat); |
344 | heartbeat); | ||
345 | 337 | ||
346 | return 0; | 338 | return 0; |
347 | } | 339 | } |
@@ -357,12 +349,11 @@ static int pcipcwd_get_status(int *status) | |||
357 | if (control_status & WD_PCI_TTRP) { | 349 | if (control_status & WD_PCI_TTRP) { |
358 | *status |= WDIOF_OVERHEAT; | 350 | *status |= WDIOF_OVERHEAT; |
359 | if (temp_panic) | 351 | if (temp_panic) |
360 | panic(PFX "Temperature overheat trip!\n"); | 352 | panic(KBUILD_MODNAME ": Temperature overheat trip!\n"); |
361 | } | 353 | } |
362 | 354 | ||
363 | if (debug >= DEBUG) | 355 | if (debug >= DEBUG) |
364 | printk(KERN_DEBUG PFX "Control Status #1: 0x%02x\n", | 356 | pr_debug("Control Status #1: 0x%02x\n", control_status); |
365 | control_status); | ||
366 | 357 | ||
367 | return 0; | 358 | return 0; |
368 | } | 359 | } |
@@ -374,14 +365,14 @@ static int pcipcwd_clear_status(void) | |||
374 | int reset_counter; | 365 | int reset_counter; |
375 | 366 | ||
376 | if (debug >= VERBOSE) | 367 | if (debug >= VERBOSE) |
377 | printk(KERN_INFO PFX "clearing watchdog trip status & LED\n"); | 368 | pr_info("clearing watchdog trip status & LED\n"); |
378 | 369 | ||
379 | control_status = inb_p(pcipcwd_private.io_addr + 1); | 370 | control_status = inb_p(pcipcwd_private.io_addr + 1); |
380 | 371 | ||
381 | if (debug >= DEBUG) { | 372 | if (debug >= DEBUG) { |
382 | printk(KERN_DEBUG PFX "status was: 0x%02x\n", control_status); | 373 | pr_debug("status was: 0x%02x\n", control_status); |
383 | printk(KERN_DEBUG PFX "sending: 0x%02x\n", | 374 | pr_debug("sending: 0x%02x\n", |
384 | (control_status & WD_PCI_R2DS) | WD_PCI_WTRP); | 375 | (control_status & WD_PCI_R2DS) | WD_PCI_WTRP); |
385 | } | 376 | } |
386 | 377 | ||
387 | /* clear trip status & LED and keep mode of relay 2 */ | 378 | /* clear trip status & LED and keep mode of relay 2 */ |
@@ -394,8 +385,7 @@ static int pcipcwd_clear_status(void) | |||
394 | send_command(CMD_GET_CLEAR_RESET_COUNT, &msb, &reset_counter); | 385 | send_command(CMD_GET_CLEAR_RESET_COUNT, &msb, &reset_counter); |
395 | 386 | ||
396 | if (debug >= DEBUG) { | 387 | if (debug >= DEBUG) { |
397 | printk(KERN_DEBUG PFX "reset count was: 0x%02x\n", | 388 | pr_debug("reset count was: 0x%02x\n", reset_counter); |
398 | reset_counter); | ||
399 | } | 389 | } |
400 | 390 | ||
401 | return 0; | 391 | return 0; |
@@ -418,8 +408,7 @@ static int pcipcwd_get_temperature(int *temperature) | |||
418 | *temperature = (*temperature * 9 / 5) + 32; | 408 | *temperature = (*temperature * 9 / 5) + 32; |
419 | 409 | ||
420 | if (debug >= DEBUG) { | 410 | if (debug >= DEBUG) { |
421 | printk(KERN_DEBUG PFX "temperature is: %d F\n", | 411 | pr_debug("temperature is: %d F\n", *temperature); |
422 | *temperature); | ||
423 | } | 412 | } |
424 | 413 | ||
425 | return 0; | 414 | return 0; |
@@ -437,8 +426,7 @@ static int pcipcwd_get_timeleft(int *time_left) | |||
437 | *time_left = (msb << 8) + lsb; | 426 | *time_left = (msb << 8) + lsb; |
438 | 427 | ||
439 | if (debug >= VERBOSE) | 428 | if (debug >= VERBOSE) |
440 | printk(KERN_DEBUG PFX "Time left before next reboot: %d\n", | 429 | pr_debug("Time left before next reboot: %d\n", *time_left); |
441 | *time_left); | ||
442 | 430 | ||
443 | return 0; | 431 | return 0; |
444 | } | 432 | } |
@@ -583,8 +571,7 @@ static int pcipcwd_open(struct inode *inode, struct file *file) | |||
583 | /* /dev/watchdog can only be opened once */ | 571 | /* /dev/watchdog can only be opened once */ |
584 | if (test_and_set_bit(0, &is_active)) { | 572 | if (test_and_set_bit(0, &is_active)) { |
585 | if (debug >= VERBOSE) | 573 | if (debug >= VERBOSE) |
586 | printk(KERN_ERR PFX | 574 | pr_err("Attempt to open already opened device\n"); |
587 | "Attempt to open already opened device.\n"); | ||
588 | return -EBUSY; | 575 | return -EBUSY; |
589 | } | 576 | } |
590 | 577 | ||
@@ -602,8 +589,7 @@ static int pcipcwd_release(struct inode *inode, struct file *file) | |||
602 | if (expect_release == 42) { | 589 | if (expect_release == 42) { |
603 | pcipcwd_stop(); | 590 | pcipcwd_stop(); |
604 | } else { | 591 | } else { |
605 | printk(KERN_CRIT PFX | 592 | pr_crit("Unexpected close, not stopping watchdog!\n"); |
606 | "Unexpected close, not stopping watchdog!\n"); | ||
607 | pcipcwd_keepalive(); | 593 | pcipcwd_keepalive(); |
608 | } | 594 | } |
609 | expect_release = 0; | 595 | expect_release = 0; |
@@ -703,20 +689,20 @@ static int __devinit pcipcwd_card_init(struct pci_dev *pdev, | |||
703 | 689 | ||
704 | cards_found++; | 690 | cards_found++; |
705 | if (cards_found == 1) | 691 | if (cards_found == 1) |
706 | printk(KERN_INFO PFX DRIVER_VERSION); | 692 | pr_info("%s\n", DRIVER_VERSION); |
707 | 693 | ||
708 | if (cards_found > 1) { | 694 | if (cards_found > 1) { |
709 | printk(KERN_ERR PFX "This driver only supports 1 device\n"); | 695 | pr_err("This driver only supports 1 device\n"); |
710 | return -ENODEV; | 696 | return -ENODEV; |
711 | } | 697 | } |
712 | 698 | ||
713 | if (pci_enable_device(pdev)) { | 699 | if (pci_enable_device(pdev)) { |
714 | printk(KERN_ERR PFX "Not possible to enable PCI Device\n"); | 700 | pr_err("Not possible to enable PCI Device\n"); |
715 | return -ENODEV; | 701 | return -ENODEV; |
716 | } | 702 | } |
717 | 703 | ||
718 | if (pci_resource_start(pdev, 0) == 0x0000) { | 704 | if (pci_resource_start(pdev, 0) == 0x0000) { |
719 | printk(KERN_ERR PFX "No I/O-Address for card detected\n"); | 705 | pr_err("No I/O-Address for card detected\n"); |
720 | ret = -ENODEV; | 706 | ret = -ENODEV; |
721 | goto err_out_disable_device; | 707 | goto err_out_disable_device; |
722 | } | 708 | } |
@@ -725,8 +711,8 @@ static int __devinit pcipcwd_card_init(struct pci_dev *pdev, | |||
725 | pcipcwd_private.io_addr = pci_resource_start(pdev, 0); | 711 | pcipcwd_private.io_addr = pci_resource_start(pdev, 0); |
726 | 712 | ||
727 | if (pci_request_regions(pdev, WATCHDOG_NAME)) { | 713 | if (pci_request_regions(pdev, WATCHDOG_NAME)) { |
728 | printk(KERN_ERR PFX "I/O address 0x%04x already in use\n", | 714 | pr_err("I/O address 0x%04x already in use\n", |
729 | (int) pcipcwd_private.io_addr); | 715 | (int) pcipcwd_private.io_addr); |
730 | ret = -EIO; | 716 | ret = -EIO; |
731 | goto err_out_disable_device; | 717 | goto err_out_disable_device; |
732 | } | 718 | } |
@@ -755,36 +741,33 @@ static int __devinit pcipcwd_card_init(struct pci_dev *pdev, | |||
755 | * if not reset to the default */ | 741 | * if not reset to the default */ |
756 | if (pcipcwd_set_heartbeat(heartbeat)) { | 742 | if (pcipcwd_set_heartbeat(heartbeat)) { |
757 | pcipcwd_set_heartbeat(WATCHDOG_HEARTBEAT); | 743 | pcipcwd_set_heartbeat(WATCHDOG_HEARTBEAT); |
758 | printk(KERN_INFO PFX | 744 | pr_info("heartbeat value must be 0<heartbeat<65536, using %d\n", |
759 | "heartbeat value must be 0<heartbeat<65536, using %d\n", | ||
760 | WATCHDOG_HEARTBEAT); | 745 | WATCHDOG_HEARTBEAT); |
761 | } | 746 | } |
762 | 747 | ||
763 | ret = register_reboot_notifier(&pcipcwd_notifier); | 748 | ret = register_reboot_notifier(&pcipcwd_notifier); |
764 | if (ret != 0) { | 749 | if (ret != 0) { |
765 | printk(KERN_ERR PFX | 750 | pr_err("cannot register reboot notifier (err=%d)\n", ret); |
766 | "cannot register reboot notifier (err=%d)\n", ret); | ||
767 | goto err_out_release_region; | 751 | goto err_out_release_region; |
768 | } | 752 | } |
769 | 753 | ||
770 | if (pcipcwd_private.supports_temp) { | 754 | if (pcipcwd_private.supports_temp) { |
771 | ret = misc_register(&pcipcwd_temp_miscdev); | 755 | ret = misc_register(&pcipcwd_temp_miscdev); |
772 | if (ret != 0) { | 756 | if (ret != 0) { |
773 | printk(KERN_ERR PFX "cannot register miscdev on " | 757 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
774 | "minor=%d (err=%d)\n", TEMP_MINOR, ret); | 758 | TEMP_MINOR, ret); |
775 | goto err_out_unregister_reboot; | 759 | goto err_out_unregister_reboot; |
776 | } | 760 | } |
777 | } | 761 | } |
778 | 762 | ||
779 | ret = misc_register(&pcipcwd_miscdev); | 763 | ret = misc_register(&pcipcwd_miscdev); |
780 | if (ret != 0) { | 764 | if (ret != 0) { |
781 | printk(KERN_ERR PFX | 765 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
782 | "cannot register miscdev on minor=%d (err=%d)\n", | 766 | WATCHDOG_MINOR, ret); |
783 | WATCHDOG_MINOR, ret); | ||
784 | goto err_out_misc_deregister; | 767 | goto err_out_misc_deregister; |
785 | } | 768 | } |
786 | 769 | ||
787 | printk(KERN_INFO PFX "initialized. heartbeat=%d sec (nowayout=%d)\n", | 770 | pr_info("initialized. heartbeat=%d sec (nowayout=%d)\n", |
788 | heartbeat, nowayout); | 771 | heartbeat, nowayout); |
789 | 772 | ||
790 | return 0; | 773 | return 0; |
@@ -842,7 +825,7 @@ static void __exit pcipcwd_cleanup_module(void) | |||
842 | { | 825 | { |
843 | pci_unregister_driver(&pcipcwd_driver); | 826 | pci_unregister_driver(&pcipcwd_driver); |
844 | 827 | ||
845 | printk(KERN_INFO PFX "Watchdog Module Unloaded.\n"); | 828 | pr_info("Watchdog Module Unloaded\n"); |
846 | } | 829 | } |
847 | 830 | ||
848 | module_init(pcipcwd_init_module); | 831 | module_init(pcipcwd_init_module); |
diff --git a/drivers/watchdog/pcwd_usb.c b/drivers/watchdog/pcwd_usb.c index d8de1ddd176a..7b14d1847927 100644 --- a/drivers/watchdog/pcwd_usb.c +++ b/drivers/watchdog/pcwd_usb.c | |||
@@ -24,6 +24,8 @@ | |||
24 | * http://www.berkprod.com/ or http://www.pcwatchdog.com/ | 24 | * http://www.berkprod.com/ or http://www.pcwatchdog.com/ |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
28 | |||
27 | #include <linux/module.h> /* For module specific items */ | 29 | #include <linux/module.h> /* For module specific items */ |
28 | #include <linux/moduleparam.h> /* For new moduleparam's */ | 30 | #include <linux/moduleparam.h> /* For new moduleparam's */ |
29 | #include <linux/types.h> /* For standard types (like size_t) */ | 31 | #include <linux/types.h> /* For standard types (like size_t) */ |
@@ -42,17 +44,23 @@ | |||
42 | #include <linux/hid.h> /* For HID_REQ_SET_REPORT & HID_DT_REPORT */ | 44 | #include <linux/hid.h> /* For HID_REQ_SET_REPORT & HID_DT_REPORT */ |
43 | #include <linux/uaccess.h> /* For copy_to_user/put_user/... */ | 45 | #include <linux/uaccess.h> /* For copy_to_user/put_user/... */ |
44 | 46 | ||
45 | |||
46 | #ifdef CONFIG_USB_DEBUG | 47 | #ifdef CONFIG_USB_DEBUG |
47 | static int debug = 1; | 48 | static int debug = 1; |
48 | #else | 49 | #else |
49 | static int debug; | 50 | static int debug; |
50 | #endif | 51 | #endif |
51 | 52 | ||
52 | /* Use our own dbg macro */ | 53 | /* Use our own dbg macro */ |
54 | |||
53 | #undef dbg | 55 | #undef dbg |
54 | #define dbg(format, arg...) \ | 56 | #ifndef DEBUG |
55 | do { if (debug) printk(KERN_DEBUG PFX format "\n" , ## arg); } while (0) | 57 | #define DEBUG |
58 | #endif | ||
59 | #define dbg(format, ...) \ | ||
60 | do { \ | ||
61 | if (debug) \ | ||
62 | pr_debug(format "\n", ##__VA_ARGS__); \ | ||
63 | } while (0) | ||
56 | 64 | ||
57 | /* Module and Version Information */ | 65 | /* Module and Version Information */ |
58 | #define DRIVER_VERSION "1.02" | 66 | #define DRIVER_VERSION "1.02" |
@@ -60,7 +68,6 @@ | |||
60 | #define DRIVER_DESC "Berkshire USB-PC Watchdog driver" | 68 | #define DRIVER_DESC "Berkshire USB-PC Watchdog driver" |
61 | #define DRIVER_LICENSE "GPL" | 69 | #define DRIVER_LICENSE "GPL" |
62 | #define DRIVER_NAME "pcwd_usb" | 70 | #define DRIVER_NAME "pcwd_usb" |
63 | #define PFX DRIVER_NAME ": " | ||
64 | 71 | ||
65 | MODULE_AUTHOR(DRIVER_AUTHOR); | 72 | MODULE_AUTHOR(DRIVER_AUTHOR); |
66 | MODULE_DESCRIPTION(DRIVER_DESC); | 73 | MODULE_DESCRIPTION(DRIVER_DESC); |
@@ -80,8 +87,8 @@ MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. " | |||
80 | "(0<heartbeat<65536 or 0=delay-time from dip-switches, default=" | 87 | "(0<heartbeat<65536 or 0=delay-time from dip-switches, default=" |
81 | __MODULE_STRING(WATCHDOG_HEARTBEAT) ")"); | 88 | __MODULE_STRING(WATCHDOG_HEARTBEAT) ")"); |
82 | 89 | ||
83 | static int nowayout = WATCHDOG_NOWAYOUT; | 90 | static bool nowayout = WATCHDOG_NOWAYOUT; |
84 | module_param(nowayout, int, 0); | 91 | module_param(nowayout, bool, 0); |
85 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" | 92 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" |
86 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 93 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
87 | 94 | ||
@@ -220,8 +227,8 @@ static void usb_pcwd_intr_done(struct urb *urb) | |||
220 | resubmit: | 227 | resubmit: |
221 | retval = usb_submit_urb(urb, GFP_ATOMIC); | 228 | retval = usb_submit_urb(urb, GFP_ATOMIC); |
222 | if (retval) | 229 | if (retval) |
223 | printk(KERN_ERR PFX "can't resubmit intr, " | 230 | pr_err("can't resubmit intr, usb_submit_urb failed with result %d\n", |
224 | "usb_submit_urb failed with result %d\n", retval); | 231 | retval); |
225 | } | 232 | } |
226 | 233 | ||
227 | static int usb_pcwd_send_command(struct usb_pcwd_private *usb_pcwd, | 234 | static int usb_pcwd_send_command(struct usb_pcwd_private *usb_pcwd, |
@@ -284,8 +291,7 @@ static int usb_pcwd_start(struct usb_pcwd_private *usb_pcwd) | |||
284 | &msb, &lsb); | 291 | &msb, &lsb); |
285 | 292 | ||
286 | if ((retval == 0) || (lsb == 0)) { | 293 | if ((retval == 0) || (lsb == 0)) { |
287 | printk(KERN_ERR PFX | 294 | pr_err("Card did not acknowledge enable attempt\n"); |
288 | "Card did not acknowledge enable attempt\n"); | ||
289 | return -1; | 295 | return -1; |
290 | } | 296 | } |
291 | 297 | ||
@@ -303,8 +309,7 @@ static int usb_pcwd_stop(struct usb_pcwd_private *usb_pcwd) | |||
303 | &msb, &lsb); | 309 | &msb, &lsb); |
304 | 310 | ||
305 | if ((retval == 0) || (lsb != 0)) { | 311 | if ((retval == 0) || (lsb != 0)) { |
306 | printk(KERN_ERR PFX | 312 | pr_err("Card did not acknowledge disable attempt\n"); |
307 | "Card did not acknowledge disable attempt\n"); | ||
308 | return -1; | 313 | return -1; |
309 | } | 314 | } |
310 | 315 | ||
@@ -506,8 +511,7 @@ static int usb_pcwd_release(struct inode *inode, struct file *file) | |||
506 | if (expect_release == 42) { | 511 | if (expect_release == 42) { |
507 | usb_pcwd_stop(usb_pcwd_device); | 512 | usb_pcwd_stop(usb_pcwd_device); |
508 | } else { | 513 | } else { |
509 | printk(KERN_CRIT PFX | 514 | pr_crit("Unexpected close, not stopping watchdog!\n"); |
510 | "Unexpected close, not stopping watchdog!\n"); | ||
511 | usb_pcwd_keepalive(usb_pcwd_device); | 515 | usb_pcwd_keepalive(usb_pcwd_device); |
512 | } | 516 | } |
513 | expect_release = 0; | 517 | expect_release = 0; |
@@ -627,7 +631,7 @@ static int usb_pcwd_probe(struct usb_interface *interface, | |||
627 | 631 | ||
628 | cards_found++; | 632 | cards_found++; |
629 | if (cards_found > 1) { | 633 | if (cards_found > 1) { |
630 | printk(KERN_ERR PFX "This driver only supports 1 device\n"); | 634 | pr_err("This driver only supports 1 device\n"); |
631 | return -ENODEV; | 635 | return -ENODEV; |
632 | } | 636 | } |
633 | 637 | ||
@@ -636,8 +640,7 @@ static int usb_pcwd_probe(struct usb_interface *interface, | |||
636 | 640 | ||
637 | /* check out that we have a HID device */ | 641 | /* check out that we have a HID device */ |
638 | if (!(iface_desc->desc.bInterfaceClass == USB_CLASS_HID)) { | 642 | if (!(iface_desc->desc.bInterfaceClass == USB_CLASS_HID)) { |
639 | printk(KERN_ERR PFX | 643 | pr_err("The device isn't a Human Interface Device\n"); |
640 | "The device isn't a Human Interface Device\n"); | ||
641 | return -ENODEV; | 644 | return -ENODEV; |
642 | } | 645 | } |
643 | 646 | ||
@@ -646,7 +649,7 @@ static int usb_pcwd_probe(struct usb_interface *interface, | |||
646 | 649 | ||
647 | if (!usb_endpoint_is_int_in(endpoint)) { | 650 | if (!usb_endpoint_is_int_in(endpoint)) { |
648 | /* we didn't find a Interrupt endpoint with direction IN */ | 651 | /* we didn't find a Interrupt endpoint with direction IN */ |
649 | printk(KERN_ERR PFX "Couldn't find an INTR & IN endpoint\n"); | 652 | pr_err("Couldn't find an INTR & IN endpoint\n"); |
650 | return -ENODEV; | 653 | return -ENODEV; |
651 | } | 654 | } |
652 | 655 | ||
@@ -657,7 +660,7 @@ static int usb_pcwd_probe(struct usb_interface *interface, | |||
657 | /* allocate memory for our device and initialize it */ | 660 | /* allocate memory for our device and initialize it */ |
658 | usb_pcwd = kzalloc(sizeof(struct usb_pcwd_private), GFP_KERNEL); | 661 | usb_pcwd = kzalloc(sizeof(struct usb_pcwd_private), GFP_KERNEL); |
659 | if (usb_pcwd == NULL) { | 662 | if (usb_pcwd == NULL) { |
660 | printk(KERN_ERR PFX "Out of memory\n"); | 663 | pr_err("Out of memory\n"); |
661 | goto error; | 664 | goto error; |
662 | } | 665 | } |
663 | 666 | ||
@@ -674,14 +677,14 @@ static int usb_pcwd_probe(struct usb_interface *interface, | |||
674 | usb_pcwd->intr_buffer = usb_alloc_coherent(udev, usb_pcwd->intr_size, | 677 | usb_pcwd->intr_buffer = usb_alloc_coherent(udev, usb_pcwd->intr_size, |
675 | GFP_ATOMIC, &usb_pcwd->intr_dma); | 678 | GFP_ATOMIC, &usb_pcwd->intr_dma); |
676 | if (!usb_pcwd->intr_buffer) { | 679 | if (!usb_pcwd->intr_buffer) { |
677 | printk(KERN_ERR PFX "Out of memory\n"); | 680 | pr_err("Out of memory\n"); |
678 | goto error; | 681 | goto error; |
679 | } | 682 | } |
680 | 683 | ||
681 | /* allocate the urb's */ | 684 | /* allocate the urb's */ |
682 | usb_pcwd->intr_urb = usb_alloc_urb(0, GFP_KERNEL); | 685 | usb_pcwd->intr_urb = usb_alloc_urb(0, GFP_KERNEL); |
683 | if (!usb_pcwd->intr_urb) { | 686 | if (!usb_pcwd->intr_urb) { |
684 | printk(KERN_ERR PFX "Out of memory\n"); | 687 | pr_err("Out of memory\n"); |
685 | goto error; | 688 | goto error; |
686 | } | 689 | } |
687 | 690 | ||
@@ -694,7 +697,7 @@ static int usb_pcwd_probe(struct usb_interface *interface, | |||
694 | 697 | ||
695 | /* register our interrupt URB with the USB system */ | 698 | /* register our interrupt URB with the USB system */ |
696 | if (usb_submit_urb(usb_pcwd->intr_urb, GFP_KERNEL)) { | 699 | if (usb_submit_urb(usb_pcwd->intr_urb, GFP_KERNEL)) { |
697 | printk(KERN_ERR PFX "Problem registering interrupt URB\n"); | 700 | pr_err("Problem registering interrupt URB\n"); |
698 | retval = -EIO; /* failure */ | 701 | retval = -EIO; /* failure */ |
699 | goto error; | 702 | goto error; |
700 | } | 703 | } |
@@ -713,15 +716,13 @@ static int usb_pcwd_probe(struct usb_interface *interface, | |||
713 | else | 716 | else |
714 | sprintf(fw_ver_str, "<card no answer>"); | 717 | sprintf(fw_ver_str, "<card no answer>"); |
715 | 718 | ||
716 | printk(KERN_INFO PFX "Found card (Firmware: %s) with temp option\n", | 719 | pr_info("Found card (Firmware: %s) with temp option\n", fw_ver_str); |
717 | fw_ver_str); | ||
718 | 720 | ||
719 | /* Get switch settings */ | 721 | /* Get switch settings */ |
720 | usb_pcwd_send_command(usb_pcwd, CMD_GET_DIP_SWITCH_SETTINGS, &dummy, | 722 | usb_pcwd_send_command(usb_pcwd, CMD_GET_DIP_SWITCH_SETTINGS, &dummy, |
721 | &option_switches); | 723 | &option_switches); |
722 | 724 | ||
723 | printk(KERN_INFO PFX "Option switches (0x%02x): " | 725 | pr_info("Option switches (0x%02x): Temperature Reset Enable=%s, Power On Delay=%s\n", |
724 | "Temperature Reset Enable=%s, Power On Delay=%s\n", | ||
725 | option_switches, | 726 | option_switches, |
726 | ((option_switches & 0x10) ? "ON" : "OFF"), | 727 | ((option_switches & 0x10) ? "ON" : "OFF"), |
727 | ((option_switches & 0x08) ? "ON" : "OFF")); | 728 | ((option_switches & 0x08) ? "ON" : "OFF")); |
@@ -734,39 +735,34 @@ static int usb_pcwd_probe(struct usb_interface *interface, | |||
734 | * if not reset to the default */ | 735 | * if not reset to the default */ |
735 | if (usb_pcwd_set_heartbeat(usb_pcwd, heartbeat)) { | 736 | if (usb_pcwd_set_heartbeat(usb_pcwd, heartbeat)) { |
736 | usb_pcwd_set_heartbeat(usb_pcwd, WATCHDOG_HEARTBEAT); | 737 | usb_pcwd_set_heartbeat(usb_pcwd, WATCHDOG_HEARTBEAT); |
737 | printk(KERN_INFO PFX | 738 | pr_info("heartbeat value must be 0<heartbeat<65536, using %d\n", |
738 | "heartbeat value must be 0<heartbeat<65536, using %d\n", | ||
739 | WATCHDOG_HEARTBEAT); | 739 | WATCHDOG_HEARTBEAT); |
740 | } | 740 | } |
741 | 741 | ||
742 | retval = register_reboot_notifier(&usb_pcwd_notifier); | 742 | retval = register_reboot_notifier(&usb_pcwd_notifier); |
743 | if (retval != 0) { | 743 | if (retval != 0) { |
744 | printk(KERN_ERR PFX | 744 | pr_err("cannot register reboot notifier (err=%d)\n", retval); |
745 | "cannot register reboot notifier (err=%d)\n", | ||
746 | retval); | ||
747 | goto error; | 745 | goto error; |
748 | } | 746 | } |
749 | 747 | ||
750 | retval = misc_register(&usb_pcwd_temperature_miscdev); | 748 | retval = misc_register(&usb_pcwd_temperature_miscdev); |
751 | if (retval != 0) { | 749 | if (retval != 0) { |
752 | printk(KERN_ERR PFX | 750 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
753 | "cannot register miscdev on minor=%d (err=%d)\n", | 751 | TEMP_MINOR, retval); |
754 | TEMP_MINOR, retval); | ||
755 | goto err_out_unregister_reboot; | 752 | goto err_out_unregister_reboot; |
756 | } | 753 | } |
757 | 754 | ||
758 | retval = misc_register(&usb_pcwd_miscdev); | 755 | retval = misc_register(&usb_pcwd_miscdev); |
759 | if (retval != 0) { | 756 | if (retval != 0) { |
760 | printk(KERN_ERR PFX | 757 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
761 | "cannot register miscdev on minor=%d (err=%d)\n", | 758 | WATCHDOG_MINOR, retval); |
762 | WATCHDOG_MINOR, retval); | ||
763 | goto err_out_misc_deregister; | 759 | goto err_out_misc_deregister; |
764 | } | 760 | } |
765 | 761 | ||
766 | /* we can register the device now, as it is ready */ | 762 | /* we can register the device now, as it is ready */ |
767 | usb_set_intfdata(interface, usb_pcwd); | 763 | usb_set_intfdata(interface, usb_pcwd); |
768 | 764 | ||
769 | printk(KERN_INFO PFX "initialized. heartbeat=%d sec (nowayout=%d)\n", | 765 | pr_info("initialized. heartbeat=%d sec (nowayout=%d)\n", |
770 | heartbeat, nowayout); | 766 | heartbeat, nowayout); |
771 | 767 | ||
772 | return 0; | 768 | return 0; |
@@ -824,7 +820,7 @@ static void usb_pcwd_disconnect(struct usb_interface *interface) | |||
824 | 820 | ||
825 | mutex_unlock(&disconnect_mutex); | 821 | mutex_unlock(&disconnect_mutex); |
826 | 822 | ||
827 | printk(KERN_INFO PFX "USB PC Watchdog disconnected\n"); | 823 | pr_info("USB PC Watchdog disconnected\n"); |
828 | } | 824 | } |
829 | 825 | ||
830 | module_usb_driver(usb_pcwd_driver); | 826 | module_usb_driver(usb_pcwd_driver); |
diff --git a/drivers/watchdog/pika_wdt.c b/drivers/watchdog/pika_wdt.c index 2d22e996e996..7d3d471f810c 100644 --- a/drivers/watchdog/pika_wdt.c +++ b/drivers/watchdog/pika_wdt.c | |||
@@ -5,6 +5,8 @@ | |||
5 | * Sean MacLennan <smaclennan@pikatech.com> | 5 | * Sean MacLennan <smaclennan@pikatech.com> |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
9 | |||
8 | #include <linux/init.h> | 10 | #include <linux/init.h> |
9 | #include <linux/errno.h> | 11 | #include <linux/errno.h> |
10 | #include <linux/module.h> | 12 | #include <linux/module.h> |
@@ -23,7 +25,6 @@ | |||
23 | #include <linux/of_platform.h> | 25 | #include <linux/of_platform.h> |
24 | 26 | ||
25 | #define DRV_NAME "PIKA-WDT" | 27 | #define DRV_NAME "PIKA-WDT" |
26 | #define PFX DRV_NAME ": " | ||
27 | 28 | ||
28 | /* Hardware timeout in seconds */ | 29 | /* Hardware timeout in seconds */ |
29 | #define WDT_HW_TIMEOUT 2 | 30 | #define WDT_HW_TIMEOUT 2 |
@@ -38,8 +39,8 @@ module_param(heartbeat, int, 0); | |||
38 | MODULE_PARM_DESC(heartbeat, "Watchdog heartbeats in seconds. " | 39 | MODULE_PARM_DESC(heartbeat, "Watchdog heartbeats in seconds. " |
39 | "(default = " __MODULE_STRING(WDT_HEARTBEAT) ")"); | 40 | "(default = " __MODULE_STRING(WDT_HEARTBEAT) ")"); |
40 | 41 | ||
41 | static int nowayout = WATCHDOG_NOWAYOUT; | 42 | static bool nowayout = WATCHDOG_NOWAYOUT; |
42 | module_param(nowayout, int, 0); | 43 | module_param(nowayout, bool, 0); |
43 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started " | 44 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started " |
44 | "(default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 45 | "(default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
45 | 46 | ||
@@ -90,7 +91,7 @@ static void pikawdt_ping(unsigned long data) | |||
90 | pikawdt_reset(); | 91 | pikawdt_reset(); |
91 | mod_timer(&pikawdt_private.timer, jiffies + WDT_TIMEOUT); | 92 | mod_timer(&pikawdt_private.timer, jiffies + WDT_TIMEOUT); |
92 | } else | 93 | } else |
93 | printk(KERN_CRIT PFX "I will reset your machine !\n"); | 94 | pr_crit("I will reset your machine !\n"); |
94 | } | 95 | } |
95 | 96 | ||
96 | 97 | ||
@@ -228,14 +229,14 @@ static int __init pikawdt_init(void) | |||
228 | 229 | ||
229 | np = of_find_compatible_node(NULL, NULL, "pika,fpga"); | 230 | np = of_find_compatible_node(NULL, NULL, "pika,fpga"); |
230 | if (np == NULL) { | 231 | if (np == NULL) { |
231 | printk(KERN_ERR PFX "Unable to find fpga.\n"); | 232 | pr_err("Unable to find fpga\n"); |
232 | return -ENOENT; | 233 | return -ENOENT; |
233 | } | 234 | } |
234 | 235 | ||
235 | pikawdt_private.fpga = of_iomap(np, 0); | 236 | pikawdt_private.fpga = of_iomap(np, 0); |
236 | of_node_put(np); | 237 | of_node_put(np); |
237 | if (pikawdt_private.fpga == NULL) { | 238 | if (pikawdt_private.fpga == NULL) { |
238 | printk(KERN_ERR PFX "Unable to map fpga.\n"); | 239 | pr_err("Unable to map fpga\n"); |
239 | return -ENOMEM; | 240 | return -ENOMEM; |
240 | } | 241 | } |
241 | 242 | ||
@@ -244,7 +245,7 @@ static int __init pikawdt_init(void) | |||
244 | /* POST information is in the sd area. */ | 245 | /* POST information is in the sd area. */ |
245 | np = of_find_compatible_node(NULL, NULL, "pika,fpga-sd"); | 246 | np = of_find_compatible_node(NULL, NULL, "pika,fpga-sd"); |
246 | if (np == NULL) { | 247 | if (np == NULL) { |
247 | printk(KERN_ERR PFX "Unable to find fpga-sd.\n"); | 248 | pr_err("Unable to find fpga-sd\n"); |
248 | ret = -ENOENT; | 249 | ret = -ENOENT; |
249 | goto out; | 250 | goto out; |
250 | } | 251 | } |
@@ -252,7 +253,7 @@ static int __init pikawdt_init(void) | |||
252 | fpga = of_iomap(np, 0); | 253 | fpga = of_iomap(np, 0); |
253 | of_node_put(np); | 254 | of_node_put(np); |
254 | if (fpga == NULL) { | 255 | if (fpga == NULL) { |
255 | printk(KERN_ERR PFX "Unable to map fpga-sd.\n"); | 256 | pr_err("Unable to map fpga-sd\n"); |
256 | ret = -ENOMEM; | 257 | ret = -ENOMEM; |
257 | goto out; | 258 | goto out; |
258 | } | 259 | } |
@@ -271,12 +272,12 @@ static int __init pikawdt_init(void) | |||
271 | 272 | ||
272 | ret = misc_register(&pikawdt_miscdev); | 273 | ret = misc_register(&pikawdt_miscdev); |
273 | if (ret) { | 274 | if (ret) { |
274 | printk(KERN_ERR PFX "Unable to register miscdev.\n"); | 275 | pr_err("Unable to register miscdev\n"); |
275 | goto out; | 276 | goto out; |
276 | } | 277 | } |
277 | 278 | ||
278 | printk(KERN_INFO PFX "initialized. heartbeat=%d sec (nowayout=%d)\n", | 279 | pr_info("initialized. heartbeat=%d sec (nowayout=%d)\n", |
279 | heartbeat, nowayout); | 280 | heartbeat, nowayout); |
280 | return 0; | 281 | return 0; |
281 | 282 | ||
282 | out: | 283 | out: |
diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c index dfae030a7ef2..6b8432f61d05 100644 --- a/drivers/watchdog/pnx4008_wdt.c +++ b/drivers/watchdog/pnx4008_wdt.c | |||
@@ -8,33 +8,32 @@ | |||
8 | * Based on sa1100 driver, | 8 | * Based on sa1100 driver, |
9 | * Copyright (C) 2000 Oleg Drokin <green@crimea.edu> | 9 | * Copyright (C) 2000 Oleg Drokin <green@crimea.edu> |
10 | * | 10 | * |
11 | * 2005-2006 (c) MontaVista Software, Inc. This file is licensed under | 11 | * 2005-2006 (c) MontaVista Software, Inc. |
12 | * the terms of the GNU General Public License version 2. This program | 12 | * |
13 | * is licensed "as is" without any warranty of any kind, whether express | 13 | * (C) 2012 Wolfram Sang, Pengutronix |
14 | * or implied. | 14 | * |
15 | * This file is licensed under the terms of the GNU General Public License | ||
16 | * version 2. This program is licensed "as is" without any warranty of any | ||
17 | * kind, whether express or implied. | ||
15 | */ | 18 | */ |
16 | 19 | ||
20 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
21 | |||
17 | #include <linux/module.h> | 22 | #include <linux/module.h> |
18 | #include <linux/moduleparam.h> | 23 | #include <linux/moduleparam.h> |
19 | #include <linux/types.h> | 24 | #include <linux/types.h> |
20 | #include <linux/kernel.h> | 25 | #include <linux/kernel.h> |
21 | #include <linux/fs.h> | ||
22 | #include <linux/miscdevice.h> | 26 | #include <linux/miscdevice.h> |
23 | #include <linux/watchdog.h> | 27 | #include <linux/watchdog.h> |
24 | #include <linux/init.h> | 28 | #include <linux/init.h> |
25 | #include <linux/bitops.h> | ||
26 | #include <linux/ioport.h> | ||
27 | #include <linux/device.h> | ||
28 | #include <linux/platform_device.h> | 29 | #include <linux/platform_device.h> |
29 | #include <linux/clk.h> | 30 | #include <linux/clk.h> |
30 | #include <linux/spinlock.h> | 31 | #include <linux/spinlock.h> |
31 | #include <linux/uaccess.h> | ||
32 | #include <linux/io.h> | 32 | #include <linux/io.h> |
33 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
34 | #include <linux/err.h> | ||
34 | #include <mach/hardware.h> | 35 | #include <mach/hardware.h> |
35 | 36 | ||
36 | #define MODULE_NAME "PNX4008-WDT: " | ||
37 | |||
38 | /* WatchDog Timer - Chapter 23 Page 207 */ | 37 | /* WatchDog Timer - Chapter 23 Page 207 */ |
39 | 38 | ||
40 | #define DEFAULT_HEARTBEAT 19 | 39 | #define DEFAULT_HEARTBEAT 19 |
@@ -77,251 +76,128 @@ | |||
77 | 76 | ||
78 | #define WDOG_COUNTER_RATE 13000000 /*the counter clock is 13 MHz fixed */ | 77 | #define WDOG_COUNTER_RATE 13000000 /*the counter clock is 13 MHz fixed */ |
79 | 78 | ||
80 | static int nowayout = WATCHDOG_NOWAYOUT; | 79 | static bool nowayout = WATCHDOG_NOWAYOUT; |
81 | static int heartbeat = DEFAULT_HEARTBEAT; | 80 | static unsigned int heartbeat = DEFAULT_HEARTBEAT; |
82 | 81 | ||
83 | static DEFINE_SPINLOCK(io_lock); | 82 | static DEFINE_SPINLOCK(io_lock); |
84 | static unsigned long wdt_status; | ||
85 | #define WDT_IN_USE 0 | ||
86 | #define WDT_OK_TO_CLOSE 1 | ||
87 | #define WDT_REGION_INITED 2 | ||
88 | #define WDT_DEVICE_INITED 3 | ||
89 | |||
90 | static unsigned long boot_status; | ||
91 | |||
92 | static struct resource *wdt_mem; | ||
93 | static void __iomem *wdt_base; | 83 | static void __iomem *wdt_base; |
94 | struct clk *wdt_clk; | 84 | struct clk *wdt_clk; |
95 | 85 | ||
96 | static void wdt_enable(void) | 86 | static int pnx4008_wdt_start(struct watchdog_device *wdd) |
97 | { | 87 | { |
98 | spin_lock(&io_lock); | 88 | spin_lock(&io_lock); |
99 | 89 | ||
100 | /* stop counter, initiate counter reset */ | 90 | /* stop counter, initiate counter reset */ |
101 | __raw_writel(RESET_COUNT, WDTIM_CTRL(wdt_base)); | 91 | writel(RESET_COUNT, WDTIM_CTRL(wdt_base)); |
102 | /*wait for reset to complete. 100% guarantee event */ | 92 | /*wait for reset to complete. 100% guarantee event */ |
103 | while (__raw_readl(WDTIM_COUNTER(wdt_base))) | 93 | while (readl(WDTIM_COUNTER(wdt_base))) |
104 | cpu_relax(); | 94 | cpu_relax(); |
105 | /* internal and external reset, stop after that */ | 95 | /* internal and external reset, stop after that */ |
106 | __raw_writel(M_RES2 | STOP_COUNT0 | RESET_COUNT0, | 96 | writel(M_RES2 | STOP_COUNT0 | RESET_COUNT0, WDTIM_MCTRL(wdt_base)); |
107 | WDTIM_MCTRL(wdt_base)); | ||
108 | /* configure match output */ | 97 | /* configure match output */ |
109 | __raw_writel(MATCH_OUTPUT_HIGH, WDTIM_EMR(wdt_base)); | 98 | writel(MATCH_OUTPUT_HIGH, WDTIM_EMR(wdt_base)); |
110 | /* clear interrupt, just in case */ | 99 | /* clear interrupt, just in case */ |
111 | __raw_writel(MATCH_INT, WDTIM_INT(wdt_base)); | 100 | writel(MATCH_INT, WDTIM_INT(wdt_base)); |
112 | /* the longest pulse period 65541/(13*10^6) seconds ~ 5 ms. */ | 101 | /* the longest pulse period 65541/(13*10^6) seconds ~ 5 ms. */ |
113 | __raw_writel(0xFFFF, WDTIM_PULSE(wdt_base)); | 102 | writel(0xFFFF, WDTIM_PULSE(wdt_base)); |
114 | __raw_writel(heartbeat * WDOG_COUNTER_RATE, WDTIM_MATCH0(wdt_base)); | 103 | writel(wdd->timeout * WDOG_COUNTER_RATE, WDTIM_MATCH0(wdt_base)); |
115 | /*enable counter, stop when debugger active */ | 104 | /*enable counter, stop when debugger active */ |
116 | __raw_writel(COUNT_ENAB | DEBUG_EN, WDTIM_CTRL(wdt_base)); | 105 | writel(COUNT_ENAB | DEBUG_EN, WDTIM_CTRL(wdt_base)); |
117 | 106 | ||
118 | spin_unlock(&io_lock); | 107 | spin_unlock(&io_lock); |
108 | return 0; | ||
119 | } | 109 | } |
120 | 110 | ||
121 | static void wdt_disable(void) | 111 | static int pnx4008_wdt_stop(struct watchdog_device *wdd) |
122 | { | 112 | { |
123 | spin_lock(&io_lock); | 113 | spin_lock(&io_lock); |
124 | 114 | ||
125 | __raw_writel(0, WDTIM_CTRL(wdt_base)); /*stop counter */ | 115 | writel(0, WDTIM_CTRL(wdt_base)); /*stop counter */ |
126 | 116 | ||
127 | spin_unlock(&io_lock); | 117 | spin_unlock(&io_lock); |
118 | return 0; | ||
128 | } | 119 | } |
129 | 120 | ||
130 | static int pnx4008_wdt_open(struct inode *inode, struct file *file) | 121 | static int pnx4008_wdt_set_timeout(struct watchdog_device *wdd, |
131 | { | 122 | unsigned int new_timeout) |
132 | int ret; | ||
133 | |||
134 | if (test_and_set_bit(WDT_IN_USE, &wdt_status)) | ||
135 | return -EBUSY; | ||
136 | |||
137 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); | ||
138 | |||
139 | ret = clk_enable(wdt_clk); | ||
140 | if (ret) { | ||
141 | clear_bit(WDT_IN_USE, &wdt_status); | ||
142 | return ret; | ||
143 | } | ||
144 | |||
145 | wdt_enable(); | ||
146 | |||
147 | return nonseekable_open(inode, file); | ||
148 | } | ||
149 | |||
150 | static ssize_t pnx4008_wdt_write(struct file *file, const char *data, | ||
151 | size_t len, loff_t *ppos) | ||
152 | { | 123 | { |
153 | if (len) { | 124 | wdd->timeout = new_timeout; |
154 | if (!nowayout) { | 125 | return 0; |
155 | size_t i; | ||
156 | |||
157 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); | ||
158 | |||
159 | for (i = 0; i != len; i++) { | ||
160 | char c; | ||
161 | |||
162 | if (get_user(c, data + i)) | ||
163 | return -EFAULT; | ||
164 | if (c == 'V') | ||
165 | set_bit(WDT_OK_TO_CLOSE, &wdt_status); | ||
166 | } | ||
167 | } | ||
168 | wdt_enable(); | ||
169 | } | ||
170 | |||
171 | return len; | ||
172 | } | 126 | } |
173 | 127 | ||
174 | static const struct watchdog_info ident = { | 128 | static const struct watchdog_info pnx4008_wdt_ident = { |
175 | .options = WDIOF_CARDRESET | WDIOF_MAGICCLOSE | | 129 | .options = WDIOF_CARDRESET | WDIOF_MAGICCLOSE | |
176 | WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, | 130 | WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, |
177 | .identity = "PNX4008 Watchdog", | 131 | .identity = "PNX4008 Watchdog", |
178 | }; | 132 | }; |
179 | 133 | ||
180 | static long pnx4008_wdt_ioctl(struct file *file, unsigned int cmd, | 134 | static const struct watchdog_ops pnx4008_wdt_ops = { |
181 | unsigned long arg) | ||
182 | { | ||
183 | int ret = -ENOTTY; | ||
184 | int time; | ||
185 | |||
186 | switch (cmd) { | ||
187 | case WDIOC_GETSUPPORT: | ||
188 | ret = copy_to_user((struct watchdog_info *)arg, &ident, | ||
189 | sizeof(ident)) ? -EFAULT : 0; | ||
190 | break; | ||
191 | |||
192 | case WDIOC_GETSTATUS: | ||
193 | ret = put_user(0, (int *)arg); | ||
194 | break; | ||
195 | |||
196 | case WDIOC_GETBOOTSTATUS: | ||
197 | ret = put_user(boot_status, (int *)arg); | ||
198 | break; | ||
199 | |||
200 | case WDIOC_KEEPALIVE: | ||
201 | wdt_enable(); | ||
202 | ret = 0; | ||
203 | break; | ||
204 | |||
205 | case WDIOC_SETTIMEOUT: | ||
206 | ret = get_user(time, (int *)arg); | ||
207 | if (ret) | ||
208 | break; | ||
209 | |||
210 | if (time <= 0 || time > MAX_HEARTBEAT) { | ||
211 | ret = -EINVAL; | ||
212 | break; | ||
213 | } | ||
214 | |||
215 | heartbeat = time; | ||
216 | wdt_enable(); | ||
217 | /* Fall through */ | ||
218 | |||
219 | case WDIOC_GETTIMEOUT: | ||
220 | ret = put_user(heartbeat, (int *)arg); | ||
221 | break; | ||
222 | } | ||
223 | return ret; | ||
224 | } | ||
225 | |||
226 | static int pnx4008_wdt_release(struct inode *inode, struct file *file) | ||
227 | { | ||
228 | if (!test_bit(WDT_OK_TO_CLOSE, &wdt_status)) | ||
229 | printk(KERN_WARNING "WATCHDOG: Device closed unexpectedly\n"); | ||
230 | |||
231 | wdt_disable(); | ||
232 | clk_disable(wdt_clk); | ||
233 | clear_bit(WDT_IN_USE, &wdt_status); | ||
234 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); | ||
235 | |||
236 | return 0; | ||
237 | } | ||
238 | |||
239 | static const struct file_operations pnx4008_wdt_fops = { | ||
240 | .owner = THIS_MODULE, | 135 | .owner = THIS_MODULE, |
241 | .llseek = no_llseek, | 136 | .start = pnx4008_wdt_start, |
242 | .write = pnx4008_wdt_write, | 137 | .stop = pnx4008_wdt_stop, |
243 | .unlocked_ioctl = pnx4008_wdt_ioctl, | 138 | .set_timeout = pnx4008_wdt_set_timeout, |
244 | .open = pnx4008_wdt_open, | ||
245 | .release = pnx4008_wdt_release, | ||
246 | }; | 139 | }; |
247 | 140 | ||
248 | static struct miscdevice pnx4008_wdt_miscdev = { | 141 | static struct watchdog_device pnx4008_wdd = { |
249 | .minor = WATCHDOG_MINOR, | 142 | .info = &pnx4008_wdt_ident, |
250 | .name = "watchdog", | 143 | .ops = &pnx4008_wdt_ops, |
251 | .fops = &pnx4008_wdt_fops, | 144 | .min_timeout = 1, |
145 | .max_timeout = MAX_HEARTBEAT, | ||
252 | }; | 146 | }; |
253 | 147 | ||
254 | static int __devinit pnx4008_wdt_probe(struct platform_device *pdev) | 148 | static int __devinit pnx4008_wdt_probe(struct platform_device *pdev) |
255 | { | 149 | { |
256 | int ret = 0, size; | 150 | struct resource *r; |
151 | int ret = 0; | ||
257 | 152 | ||
258 | if (heartbeat < 1 || heartbeat > MAX_HEARTBEAT) | 153 | if (heartbeat < 1 || heartbeat > MAX_HEARTBEAT) |
259 | heartbeat = DEFAULT_HEARTBEAT; | 154 | heartbeat = DEFAULT_HEARTBEAT; |
260 | 155 | ||
261 | printk(KERN_INFO MODULE_NAME | 156 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
262 | "PNX4008 Watchdog Timer: heartbeat %d sec\n", heartbeat); | 157 | wdt_base = devm_request_and_ioremap(&pdev->dev, r); |
263 | 158 | if (!wdt_base) | |
264 | wdt_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 159 | return -EADDRINUSE; |
265 | if (wdt_mem == NULL) { | ||
266 | printk(KERN_INFO MODULE_NAME | ||
267 | "failed to get memory region resource\n"); | ||
268 | return -ENOENT; | ||
269 | } | ||
270 | |||
271 | size = resource_size(wdt_mem); | ||
272 | |||
273 | if (!request_mem_region(wdt_mem->start, size, pdev->name)) { | ||
274 | printk(KERN_INFO MODULE_NAME "failed to get memory region\n"); | ||
275 | return -ENOENT; | ||
276 | } | ||
277 | wdt_base = (void __iomem *)IO_ADDRESS(wdt_mem->start); | ||
278 | 160 | ||
279 | wdt_clk = clk_get(&pdev->dev, NULL); | 161 | wdt_clk = clk_get(&pdev->dev, NULL); |
280 | if (IS_ERR(wdt_clk)) { | 162 | if (IS_ERR(wdt_clk)) |
281 | ret = PTR_ERR(wdt_clk); | 163 | return PTR_ERR(wdt_clk); |
282 | release_mem_region(wdt_mem->start, size); | ||
283 | wdt_mem = NULL; | ||
284 | goto out; | ||
285 | } | ||
286 | 164 | ||
287 | ret = clk_enable(wdt_clk); | 165 | ret = clk_enable(wdt_clk); |
288 | if (ret) { | 166 | if (ret) |
289 | release_mem_region(wdt_mem->start, size); | ||
290 | wdt_mem = NULL; | ||
291 | clk_put(wdt_clk); | ||
292 | goto out; | 167 | goto out; |
293 | } | ||
294 | 168 | ||
295 | ret = misc_register(&pnx4008_wdt_miscdev); | 169 | pnx4008_wdd.timeout = heartbeat; |
170 | pnx4008_wdd.bootstatus = (readl(WDTIM_RES(wdt_base)) & WDOG_RESET) ? | ||
171 | WDIOF_CARDRESET : 0; | ||
172 | watchdog_set_nowayout(&pnx4008_wdd, nowayout); | ||
173 | |||
174 | pnx4008_wdt_stop(&pnx4008_wdd); /* disable for now */ | ||
175 | |||
176 | ret = watchdog_register_device(&pnx4008_wdd); | ||
296 | if (ret < 0) { | 177 | if (ret < 0) { |
297 | printk(KERN_ERR MODULE_NAME "cannot register misc device\n"); | 178 | dev_err(&pdev->dev, "cannot register watchdog device\n"); |
298 | release_mem_region(wdt_mem->start, size); | 179 | goto disable_clk; |
299 | wdt_mem = NULL; | ||
300 | clk_disable(wdt_clk); | ||
301 | clk_put(wdt_clk); | ||
302 | } else { | ||
303 | boot_status = (__raw_readl(WDTIM_RES(wdt_base)) & WDOG_RESET) ? | ||
304 | WDIOF_CARDRESET : 0; | ||
305 | wdt_disable(); /*disable for now */ | ||
306 | clk_disable(wdt_clk); | ||
307 | set_bit(WDT_DEVICE_INITED, &wdt_status); | ||
308 | } | 180 | } |
309 | 181 | ||
182 | dev_info(&pdev->dev, "PNX4008 Watchdog Timer: heartbeat %d sec\n", | ||
183 | heartbeat); | ||
184 | |||
185 | return 0; | ||
186 | |||
187 | disable_clk: | ||
188 | clk_disable(wdt_clk); | ||
310 | out: | 189 | out: |
190 | clk_put(wdt_clk); | ||
311 | return ret; | 191 | return ret; |
312 | } | 192 | } |
313 | 193 | ||
314 | static int __devexit pnx4008_wdt_remove(struct platform_device *pdev) | 194 | static int __devexit pnx4008_wdt_remove(struct platform_device *pdev) |
315 | { | 195 | { |
316 | misc_deregister(&pnx4008_wdt_miscdev); | 196 | watchdog_unregister_device(&pnx4008_wdd); |
317 | 197 | ||
318 | clk_disable(wdt_clk); | 198 | clk_disable(wdt_clk); |
319 | clk_put(wdt_clk); | 199 | clk_put(wdt_clk); |
320 | 200 | ||
321 | if (wdt_mem) { | ||
322 | release_mem_region(wdt_mem->start, resource_size(wdt_mem)); | ||
323 | wdt_mem = NULL; | ||
324 | } | ||
325 | return 0; | 201 | return 0; |
326 | } | 202 | } |
327 | 203 | ||
@@ -337,15 +213,16 @@ static struct platform_driver platform_wdt_driver = { | |||
337 | module_platform_driver(platform_wdt_driver); | 213 | module_platform_driver(platform_wdt_driver); |
338 | 214 | ||
339 | MODULE_AUTHOR("MontaVista Software, Inc. <source@mvista.com>"); | 215 | MODULE_AUTHOR("MontaVista Software, Inc. <source@mvista.com>"); |
216 | MODULE_AUTHOR("Wolfram Sang <w.sang@pengutronix.de>"); | ||
340 | MODULE_DESCRIPTION("PNX4008 Watchdog Driver"); | 217 | MODULE_DESCRIPTION("PNX4008 Watchdog Driver"); |
341 | 218 | ||
342 | module_param(heartbeat, int, 0); | 219 | module_param(heartbeat, uint, 0); |
343 | MODULE_PARM_DESC(heartbeat, | 220 | MODULE_PARM_DESC(heartbeat, |
344 | "Watchdog heartbeat period in seconds from 1 to " | 221 | "Watchdog heartbeat period in seconds from 1 to " |
345 | __MODULE_STRING(MAX_HEARTBEAT) ", default " | 222 | __MODULE_STRING(MAX_HEARTBEAT) ", default " |
346 | __MODULE_STRING(DEFAULT_HEARTBEAT)); | 223 | __MODULE_STRING(DEFAULT_HEARTBEAT)); |
347 | 224 | ||
348 | module_param(nowayout, int, 0); | 225 | module_param(nowayout, bool, 0); |
349 | MODULE_PARM_DESC(nowayout, | 226 | MODULE_PARM_DESC(nowayout, |
350 | "Set to 1 to keep watchdog running after device release"); | 227 | "Set to 1 to keep watchdog running after device release"); |
351 | 228 | ||
diff --git a/drivers/watchdog/pnx833x_wdt.c b/drivers/watchdog/pnx833x_wdt.c index a7b5ad2a98bd..1b62a7dfcc95 100644 --- a/drivers/watchdog/pnx833x_wdt.c +++ b/drivers/watchdog/pnx833x_wdt.c | |||
@@ -17,6 +17,8 @@ | |||
17 | * based on softdog.c by Alan Cox <alan@redhat.com> | 17 | * based on softdog.c by Alan Cox <alan@redhat.com> |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
21 | |||
20 | #include <linux/module.h> | 22 | #include <linux/module.h> |
21 | #include <linux/moduleparam.h> | 23 | #include <linux/moduleparam.h> |
22 | #include <linux/types.h> | 24 | #include <linux/types.h> |
@@ -30,7 +32,6 @@ | |||
30 | #include <linux/init.h> | 32 | #include <linux/init.h> |
31 | #include <asm/mach-pnx833x/pnx833x.h> | 33 | #include <asm/mach-pnx833x/pnx833x.h> |
32 | 34 | ||
33 | #define PFX "pnx833x: " | ||
34 | #define WATCHDOG_TIMEOUT 30 /* 30 sec Maximum timeout */ | 35 | #define WATCHDOG_TIMEOUT 30 /* 30 sec Maximum timeout */ |
35 | #define WATCHDOG_COUNT_FREQUENCY 68000000U /* Watchdog counts at 68MHZ. */ | 36 | #define WATCHDOG_COUNT_FREQUENCY 68000000U /* Watchdog counts at 68MHZ. */ |
36 | #define PNX_WATCHDOG_TIMEOUT (WATCHDOG_TIMEOUT * WATCHDOG_COUNT_FREQUENCY) | 37 | #define PNX_WATCHDOG_TIMEOUT (WATCHDOG_TIMEOUT * WATCHDOG_COUNT_FREQUENCY) |
@@ -54,8 +55,8 @@ module_param(pnx833x_wdt_timeout, int, 0); | |||
54 | MODULE_PARM_DESC(timeout, "Watchdog timeout in Mhz. (68Mhz clock), default=" | 55 | MODULE_PARM_DESC(timeout, "Watchdog timeout in Mhz. (68Mhz clock), default=" |
55 | __MODULE_STRING(PNX_TIMEOUT_VALUE) "(30 seconds)."); | 56 | __MODULE_STRING(PNX_TIMEOUT_VALUE) "(30 seconds)."); |
56 | 57 | ||
57 | static int nowayout = WATCHDOG_NOWAYOUT; | 58 | static bool nowayout = WATCHDOG_NOWAYOUT; |
58 | module_param(nowayout, int, 0); | 59 | module_param(nowayout, bool, 0); |
59 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" | 60 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" |
60 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 61 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
61 | 62 | ||
@@ -76,7 +77,7 @@ static void pnx833x_wdt_start(void) | |||
76 | PNX833X_REG(PNX833X_CONFIG + | 77 | PNX833X_REG(PNX833X_CONFIG + |
77 | PNX833X_CONFIG_CPU_COUNTERS_CONTROL) |= 0x1; | 78 | PNX833X_CONFIG_CPU_COUNTERS_CONTROL) |= 0x1; |
78 | 79 | ||
79 | printk(KERN_INFO PFX "Started watchdog timer.\n"); | 80 | pr_info("Started watchdog timer\n"); |
80 | } | 81 | } |
81 | 82 | ||
82 | static void pnx833x_wdt_stop(void) | 83 | static void pnx833x_wdt_stop(void) |
@@ -87,7 +88,7 @@ static void pnx833x_wdt_stop(void) | |||
87 | PNX833X_REG(PNX833X_CONFIG + | 88 | PNX833X_REG(PNX833X_CONFIG + |
88 | PNX833X_CONFIG_CPU_COUNTERS_CONTROL) &= 0xFFFFFFFE; | 89 | PNX833X_CONFIG_CPU_COUNTERS_CONTROL) &= 0xFFFFFFFE; |
89 | 90 | ||
90 | printk(KERN_INFO PFX "Stopped watchdog timer.\n"); | 91 | pr_info("Stopped watchdog timer\n"); |
91 | } | 92 | } |
92 | 93 | ||
93 | static void pnx833x_wdt_ping(void) | 94 | static void pnx833x_wdt_ping(void) |
@@ -113,7 +114,7 @@ static int pnx833x_wdt_open(struct inode *inode, struct file *file) | |||
113 | 114 | ||
114 | pnx833x_wdt_ping(); | 115 | pnx833x_wdt_ping(); |
115 | 116 | ||
116 | printk(KERN_INFO "Started watchdog timer.\n"); | 117 | pr_info("Started watchdog timer\n"); |
117 | 118 | ||
118 | return nonseekable_open(inode, file); | 119 | return nonseekable_open(inode, file); |
119 | } | 120 | } |
@@ -232,9 +233,6 @@ static struct notifier_block pnx833x_wdt_notifier = { | |||
232 | .notifier_call = pnx833x_wdt_notify_sys, | 233 | .notifier_call = pnx833x_wdt_notify_sys, |
233 | }; | 234 | }; |
234 | 235 | ||
235 | static char banner[] __initdata = | ||
236 | KERN_INFO PFX "Hardware Watchdog Timer for PNX833x: Version 0.1\n"; | ||
237 | |||
238 | static int __init watchdog_init(void) | 236 | static int __init watchdog_init(void) |
239 | { | 237 | { |
240 | int ret, cause; | 238 | int ret, cause; |
@@ -243,27 +241,25 @@ static int __init watchdog_init(void) | |||
243 | cause = PNX833X_REG(PNX833X_RESET); | 241 | cause = PNX833X_REG(PNX833X_RESET); |
244 | /*If bit 31 is set then watchdog was cause of reset.*/ | 242 | /*If bit 31 is set then watchdog was cause of reset.*/ |
245 | if (cause & 0x80000000) { | 243 | if (cause & 0x80000000) { |
246 | printk(KERN_INFO PFX "The system was previously reset due to " | 244 | pr_info("The system was previously reset due to the watchdog firing - please investigate...\n"); |
247 | "the watchdog firing - please investigate...\n"); | ||
248 | } | 245 | } |
249 | 246 | ||
250 | ret = register_reboot_notifier(&pnx833x_wdt_notifier); | 247 | ret = register_reboot_notifier(&pnx833x_wdt_notifier); |
251 | if (ret) { | 248 | if (ret) { |
252 | printk(KERN_ERR PFX | 249 | pr_err("cannot register reboot notifier (err=%d)\n", ret); |
253 | "cannot register reboot notifier (err=%d)\n", ret); | ||
254 | return ret; | 250 | return ret; |
255 | } | 251 | } |
256 | 252 | ||
257 | ret = misc_register(&pnx833x_wdt_miscdev); | 253 | ret = misc_register(&pnx833x_wdt_miscdev); |
258 | if (ret) { | 254 | if (ret) { |
259 | printk(KERN_ERR PFX | 255 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
260 | "cannot register miscdev on minor=%d (err=%d)\n", | 256 | WATCHDOG_MINOR, ret); |
261 | WATCHDOG_MINOR, ret); | ||
262 | unregister_reboot_notifier(&pnx833x_wdt_notifier); | 257 | unregister_reboot_notifier(&pnx833x_wdt_notifier); |
263 | return ret; | 258 | return ret; |
264 | } | 259 | } |
265 | 260 | ||
266 | printk(banner); | 261 | pr_info("Hardware Watchdog Timer for PNX833x: Version 0.1\n"); |
262 | |||
267 | if (start_enabled) | 263 | if (start_enabled) |
268 | pnx833x_wdt_start(); | 264 | pnx833x_wdt_start(); |
269 | 265 | ||
diff --git a/drivers/watchdog/rc32434_wdt.c b/drivers/watchdog/rc32434_wdt.c index bf7bc8aa1c01..547353a50ebb 100644 --- a/drivers/watchdog/rc32434_wdt.c +++ b/drivers/watchdog/rc32434_wdt.c | |||
@@ -17,6 +17,8 @@ | |||
17 | * | 17 | * |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
21 | |||
20 | #include <linux/module.h> /* For module specific items */ | 22 | #include <linux/module.h> /* For module specific items */ |
21 | #include <linux/moduleparam.h> /* For new moduleparam's */ | 23 | #include <linux/moduleparam.h> /* For new moduleparam's */ |
22 | #include <linux/types.h> /* For standard types (like size_t) */ | 24 | #include <linux/types.h> /* For standard types (like size_t) */ |
@@ -33,8 +35,6 @@ | |||
33 | 35 | ||
34 | #include <asm/mach-rc32434/integ.h> /* For the Watchdog registers */ | 36 | #include <asm/mach-rc32434/integ.h> /* For the Watchdog registers */ |
35 | 37 | ||
36 | #define PFX KBUILD_MODNAME ": " | ||
37 | |||
38 | #define VERSION "1.0" | 38 | #define VERSION "1.0" |
39 | 39 | ||
40 | static struct { | 40 | static struct { |
@@ -64,8 +64,8 @@ module_param(timeout, int, 0); | |||
64 | MODULE_PARM_DESC(timeout, "Watchdog timeout value, in seconds (default=" | 64 | MODULE_PARM_DESC(timeout, "Watchdog timeout value, in seconds (default=" |
65 | __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); | 65 | __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); |
66 | 66 | ||
67 | static int nowayout = WATCHDOG_NOWAYOUT; | 67 | static bool nowayout = WATCHDOG_NOWAYOUT; |
68 | module_param(nowayout, int, 0); | 68 | module_param(nowayout, bool, 0); |
69 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" | 69 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" |
70 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 70 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
71 | 71 | ||
@@ -78,8 +78,7 @@ static int rc32434_wdt_set(int new_timeout) | |||
78 | int max_to = WTCOMP2SEC((u32)-1); | 78 | int max_to = WTCOMP2SEC((u32)-1); |
79 | 79 | ||
80 | if (new_timeout < 0 || new_timeout > max_to) { | 80 | if (new_timeout < 0 || new_timeout > max_to) { |
81 | printk(KERN_ERR PFX "timeout value must be between 0 and %d", | 81 | pr_err("timeout value must be between 0 and %d\n", max_to); |
82 | max_to); | ||
83 | return -EINVAL; | 82 | return -EINVAL; |
84 | } | 83 | } |
85 | timeout = new_timeout; | 84 | timeout = new_timeout; |
@@ -119,7 +118,7 @@ static void rc32434_wdt_start(void) | |||
119 | SET_BITS(wdt_reg->wtc, or, nand); | 118 | SET_BITS(wdt_reg->wtc, or, nand); |
120 | 119 | ||
121 | spin_unlock(&rc32434_wdt_device.io_lock); | 120 | spin_unlock(&rc32434_wdt_device.io_lock); |
122 | printk(KERN_INFO PFX "Started watchdog timer.\n"); | 121 | pr_info("Started watchdog timer\n"); |
123 | } | 122 | } |
124 | 123 | ||
125 | static void rc32434_wdt_stop(void) | 124 | static void rc32434_wdt_stop(void) |
@@ -130,7 +129,7 @@ static void rc32434_wdt_stop(void) | |||
130 | SET_BITS(wdt_reg->wtc, 0, 1 << RC32434_WTC_EN); | 129 | SET_BITS(wdt_reg->wtc, 0, 1 << RC32434_WTC_EN); |
131 | 130 | ||
132 | spin_unlock(&rc32434_wdt_device.io_lock); | 131 | spin_unlock(&rc32434_wdt_device.io_lock); |
133 | printk(KERN_INFO PFX "Stopped watchdog timer.\n"); | 132 | pr_info("Stopped watchdog timer\n"); |
134 | } | 133 | } |
135 | 134 | ||
136 | static void rc32434_wdt_ping(void) | 135 | static void rc32434_wdt_ping(void) |
@@ -160,8 +159,7 @@ static int rc32434_wdt_release(struct inode *inode, struct file *file) | |||
160 | rc32434_wdt_stop(); | 159 | rc32434_wdt_stop(); |
161 | module_put(THIS_MODULE); | 160 | module_put(THIS_MODULE); |
162 | } else { | 161 | } else { |
163 | printk(KERN_CRIT PFX | 162 | pr_crit("device closed unexpectedly. WDT will not stop!\n"); |
164 | "device closed unexpectedly. WDT will not stop!\n"); | ||
165 | rc32434_wdt_ping(); | 163 | rc32434_wdt_ping(); |
166 | } | 164 | } |
167 | clear_bit(0, &rc32434_wdt_device.inuse); | 165 | clear_bit(0, &rc32434_wdt_device.inuse); |
@@ -262,9 +260,6 @@ static struct miscdevice rc32434_wdt_miscdev = { | |||
262 | .fops = &rc32434_wdt_fops, | 260 | .fops = &rc32434_wdt_fops, |
263 | }; | 261 | }; |
264 | 262 | ||
265 | static char banner[] __devinitdata = KERN_INFO PFX | ||
266 | "Watchdog Timer version " VERSION ", timer margin: %d sec\n"; | ||
267 | |||
268 | static int __devinit rc32434_wdt_probe(struct platform_device *pdev) | 263 | static int __devinit rc32434_wdt_probe(struct platform_device *pdev) |
269 | { | 264 | { |
270 | int ret; | 265 | int ret; |
@@ -272,13 +267,13 @@ static int __devinit rc32434_wdt_probe(struct platform_device *pdev) | |||
272 | 267 | ||
273 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "rb532_wdt_res"); | 268 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "rb532_wdt_res"); |
274 | if (!r) { | 269 | if (!r) { |
275 | printk(KERN_ERR PFX "failed to retrieve resources\n"); | 270 | pr_err("failed to retrieve resources\n"); |
276 | return -ENODEV; | 271 | return -ENODEV; |
277 | } | 272 | } |
278 | 273 | ||
279 | wdt_reg = ioremap_nocache(r->start, resource_size(r)); | 274 | wdt_reg = ioremap_nocache(r->start, resource_size(r)); |
280 | if (!wdt_reg) { | 275 | if (!wdt_reg) { |
281 | printk(KERN_ERR PFX "failed to remap I/O resources\n"); | 276 | pr_err("failed to remap I/O resources\n"); |
282 | return -ENXIO; | 277 | return -ENXIO; |
283 | } | 278 | } |
284 | 279 | ||
@@ -291,18 +286,18 @@ static int __devinit rc32434_wdt_probe(struct platform_device *pdev) | |||
291 | * if not reset to the default */ | 286 | * if not reset to the default */ |
292 | if (rc32434_wdt_set(timeout)) { | 287 | if (rc32434_wdt_set(timeout)) { |
293 | rc32434_wdt_set(WATCHDOG_TIMEOUT); | 288 | rc32434_wdt_set(WATCHDOG_TIMEOUT); |
294 | printk(KERN_INFO PFX | 289 | pr_info("timeout value must be between 0 and %d\n", |
295 | "timeout value must be between 0 and %d\n", | ||
296 | WTCOMP2SEC((u32)-1)); | 290 | WTCOMP2SEC((u32)-1)); |
297 | } | 291 | } |
298 | 292 | ||
299 | ret = misc_register(&rc32434_wdt_miscdev); | 293 | ret = misc_register(&rc32434_wdt_miscdev); |
300 | if (ret < 0) { | 294 | if (ret < 0) { |
301 | printk(KERN_ERR PFX "failed to register watchdog device\n"); | 295 | pr_err("failed to register watchdog device\n"); |
302 | goto unmap; | 296 | goto unmap; |
303 | } | 297 | } |
304 | 298 | ||
305 | printk(banner, timeout); | 299 | pr_info("Watchdog Timer version " VERSION ", timer margin: %d sec\n", |
300 | timeout); | ||
306 | 301 | ||
307 | return 0; | 302 | return 0; |
308 | 303 | ||
diff --git a/drivers/watchdog/riowd.c b/drivers/watchdog/riowd.c index c7e17ceafa6a..49e1b1c2135c 100644 --- a/drivers/watchdog/riowd.c +++ b/drivers/watchdog/riowd.c | |||
@@ -3,6 +3,8 @@ | |||
3 | * Copyright (C) 2001, 2008 David S. Miller (davem@davemloft.net) | 3 | * Copyright (C) 2001, 2008 David S. Miller (davem@davemloft.net) |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
7 | |||
6 | #include <linux/kernel.h> | 8 | #include <linux/kernel.h> |
7 | #include <linux/module.h> | 9 | #include <linux/module.h> |
8 | #include <linux/types.h> | 10 | #include <linux/types.h> |
@@ -189,7 +191,7 @@ static int __devinit riowd_probe(struct platform_device *op) | |||
189 | 191 | ||
190 | p->regs = of_ioremap(&op->resource[0], 0, 2, DRIVER_NAME); | 192 | p->regs = of_ioremap(&op->resource[0], 0, 2, DRIVER_NAME); |
191 | if (!p->regs) { | 193 | if (!p->regs) { |
192 | printk(KERN_ERR PFX "Cannot map registers.\n"); | 194 | pr_err("Cannot map registers\n"); |
193 | goto out_free; | 195 | goto out_free; |
194 | } | 196 | } |
195 | /* Make miscdev useable right away */ | 197 | /* Make miscdev useable right away */ |
@@ -197,12 +199,12 @@ static int __devinit riowd_probe(struct platform_device *op) | |||
197 | 199 | ||
198 | err = misc_register(&riowd_miscdev); | 200 | err = misc_register(&riowd_miscdev); |
199 | if (err) { | 201 | if (err) { |
200 | printk(KERN_ERR PFX "Cannot register watchdog misc device.\n"); | 202 | pr_err("Cannot register watchdog misc device\n"); |
201 | goto out_iounmap; | 203 | goto out_iounmap; |
202 | } | 204 | } |
203 | 205 | ||
204 | printk(KERN_INFO PFX "Hardware watchdog [%i minutes], " | 206 | pr_info("Hardware watchdog [%i minutes], regs at %p\n", |
205 | "regs at %p\n", riowd_timeout, p->regs); | 207 | riowd_timeout, p->regs); |
206 | 208 | ||
207 | dev_set_drvdata(&op->dev, p); | 209 | dev_set_drvdata(&op->dev, p); |
208 | return 0; | 210 | return 0; |
diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c index 404172f02c9b..04e5a6de47d7 100644 --- a/drivers/watchdog/s3c2410_wdt.c +++ b/drivers/watchdog/s3c2410_wdt.c | |||
@@ -23,6 +23,8 @@ | |||
23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
27 | |||
26 | #include <linux/module.h> | 28 | #include <linux/module.h> |
27 | #include <linux/moduleparam.h> | 29 | #include <linux/moduleparam.h> |
28 | #include <linux/types.h> | 30 | #include <linux/types.h> |
@@ -46,12 +48,10 @@ | |||
46 | 48 | ||
47 | #include <plat/regs-watchdog.h> | 49 | #include <plat/regs-watchdog.h> |
48 | 50 | ||
49 | #define PFX "s3c2410-wdt: " | ||
50 | |||
51 | #define CONFIG_S3C2410_WATCHDOG_ATBOOT (0) | 51 | #define CONFIG_S3C2410_WATCHDOG_ATBOOT (0) |
52 | #define CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME (15) | 52 | #define CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME (15) |
53 | 53 | ||
54 | static int nowayout = WATCHDOG_NOWAYOUT; | 54 | static bool nowayout = WATCHDOG_NOWAYOUT; |
55 | static int tmr_margin = CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME; | 55 | static int tmr_margin = CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME; |
56 | static int tmr_atboot = CONFIG_S3C2410_WATCHDOG_ATBOOT; | 56 | static int tmr_atboot = CONFIG_S3C2410_WATCHDOG_ATBOOT; |
57 | static int soft_noboot; | 57 | static int soft_noboot; |
@@ -59,7 +59,7 @@ static int debug; | |||
59 | 59 | ||
60 | module_param(tmr_margin, int, 0); | 60 | module_param(tmr_margin, int, 0); |
61 | module_param(tmr_atboot, int, 0); | 61 | module_param(tmr_atboot, int, 0); |
62 | module_param(nowayout, int, 0); | 62 | module_param(nowayout, bool, 0); |
63 | module_param(soft_noboot, int, 0); | 63 | module_param(soft_noboot, int, 0); |
64 | module_param(debug, int, 0); | 64 | module_param(debug, int, 0); |
65 | 65 | ||
@@ -84,10 +84,11 @@ static DEFINE_SPINLOCK(wdt_lock); | |||
84 | 84 | ||
85 | /* watchdog control routines */ | 85 | /* watchdog control routines */ |
86 | 86 | ||
87 | #define DBG(msg...) do { \ | 87 | #define DBG(fmt, ...) \ |
88 | if (debug) \ | 88 | do { \ |
89 | printk(KERN_INFO msg); \ | 89 | if (debug) \ |
90 | } while (0) | 90 | pr_info(fmt, ##__VA_ARGS__); \ |
91 | } while (0) | ||
91 | 92 | ||
92 | /* functions */ | 93 | /* functions */ |
93 | 94 | ||
@@ -200,6 +201,8 @@ static int s3c2410wdt_set_heartbeat(struct watchdog_device *wdd, unsigned timeou | |||
200 | writel(count, wdt_base + S3C2410_WTDAT); | 201 | writel(count, wdt_base + S3C2410_WTDAT); |
201 | writel(wtcon, wdt_base + S3C2410_WTCON); | 202 | writel(wtcon, wdt_base + S3C2410_WTCON); |
202 | 203 | ||
204 | wdd->timeout = timeout; | ||
205 | |||
203 | return 0; | 206 | return 0; |
204 | } | 207 | } |
205 | 208 | ||
@@ -354,7 +357,7 @@ static int __devinit s3c2410wdt_probe(struct platform_device *pdev) | |||
354 | 357 | ||
355 | ret = s3c2410wdt_cpufreq_register(); | 358 | ret = s3c2410wdt_cpufreq_register(); |
356 | if (ret < 0) { | 359 | if (ret < 0) { |
357 | printk(KERN_ERR PFX "failed to register cpufreq\n"); | 360 | pr_err("failed to register cpufreq\n"); |
358 | goto err_clk; | 361 | goto err_clk; |
359 | } | 362 | } |
360 | 363 | ||
@@ -483,8 +486,8 @@ static int s3c2410wdt_resume(struct platform_device *dev) | |||
483 | writel(wtdat_save, wdt_base + S3C2410_WTCNT); /* Reset count */ | 486 | writel(wtdat_save, wdt_base + S3C2410_WTCNT); /* Reset count */ |
484 | writel(wtcon_save, wdt_base + S3C2410_WTCON); | 487 | writel(wtcon_save, wdt_base + S3C2410_WTCON); |
485 | 488 | ||
486 | printk(KERN_INFO PFX "watchdog %sabled\n", | 489 | pr_info("watchdog %sabled\n", |
487 | (wtcon_save & S3C2410_WTCON_ENABLE) ? "en" : "dis"); | 490 | (wtcon_save & S3C2410_WTCON_ENABLE) ? "en" : "dis"); |
488 | 491 | ||
489 | return 0; | 492 | return 0; |
490 | } | 493 | } |
@@ -518,12 +521,10 @@ static struct platform_driver s3c2410wdt_driver = { | |||
518 | }; | 521 | }; |
519 | 522 | ||
520 | 523 | ||
521 | static char banner[] __initdata = | ||
522 | KERN_INFO "S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics\n"; | ||
523 | |||
524 | static int __init watchdog_init(void) | 524 | static int __init watchdog_init(void) |
525 | { | 525 | { |
526 | printk(banner); | 526 | pr_info("S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics\n"); |
527 | |||
527 | return platform_driver_register(&s3c2410wdt_driver); | 528 | return platform_driver_register(&s3c2410wdt_driver); |
528 | } | 529 | } |
529 | 530 | ||
diff --git a/drivers/watchdog/sa1100_wdt.c b/drivers/watchdog/sa1100_wdt.c index 016245419fad..d54e04df45e4 100644 --- a/drivers/watchdog/sa1100_wdt.c +++ b/drivers/watchdog/sa1100_wdt.c | |||
@@ -17,6 +17,9 @@ | |||
17 | * | 17 | * |
18 | * 27/11/2000 Initial release | 18 | * 27/11/2000 Initial release |
19 | */ | 19 | */ |
20 | |||
21 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
22 | |||
20 | #include <linux/module.h> | 23 | #include <linux/module.h> |
21 | #include <linux/moduleparam.h> | 24 | #include <linux/moduleparam.h> |
22 | #include <linux/types.h> | 25 | #include <linux/types.h> |
@@ -66,7 +69,7 @@ static int sa1100dog_open(struct inode *inode, struct file *file) | |||
66 | */ | 69 | */ |
67 | static int sa1100dog_release(struct inode *inode, struct file *file) | 70 | static int sa1100dog_release(struct inode *inode, struct file *file) |
68 | { | 71 | { |
69 | printk(KERN_CRIT "WATCHDOG: Device closed - timer will not stop\n"); | 72 | pr_crit("Device closed - timer will not stop\n"); |
70 | clear_bit(1, &sa1100wdt_users); | 73 | clear_bit(1, &sa1100wdt_users); |
71 | return 0; | 74 | return 0; |
72 | } | 75 | } |
@@ -169,9 +172,8 @@ static int __init sa1100dog_init(void) | |||
169 | 172 | ||
170 | ret = misc_register(&sa1100dog_miscdev); | 173 | ret = misc_register(&sa1100dog_miscdev); |
171 | if (ret == 0) | 174 | if (ret == 0) |
172 | printk(KERN_INFO | 175 | pr_info("SA1100/PXA2xx Watchdog Timer: timer margin %d sec\n", |
173 | "SA1100/PXA2xx Watchdog Timer: timer margin %d sec\n", | 176 | margin); |
174 | margin); | ||
175 | return ret; | 177 | return ret; |
176 | } | 178 | } |
177 | 179 | ||
diff --git a/drivers/watchdog/sb_wdog.c b/drivers/watchdog/sb_wdog.c index b01a30e5a663..25c7a3f9652d 100644 --- a/drivers/watchdog/sb_wdog.c +++ b/drivers/watchdog/sb_wdog.c | |||
@@ -43,6 +43,9 @@ | |||
43 | * version 1 or 2 as published by the Free Software Foundation. | 43 | * version 1 or 2 as published by the Free Software Foundation. |
44 | * | 44 | * |
45 | */ | 45 | */ |
46 | |||
47 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
48 | |||
46 | #include <linux/module.h> | 49 | #include <linux/module.h> |
47 | #include <linux/io.h> | 50 | #include <linux/io.h> |
48 | #include <linux/uaccess.h> | 51 | #include <linux/uaccess.h> |
@@ -125,9 +128,8 @@ static int sbwdog_release(struct inode *inode, struct file *file) | |||
125 | __raw_writeb(0, user_dog); | 128 | __raw_writeb(0, user_dog); |
126 | module_put(THIS_MODULE); | 129 | module_put(THIS_MODULE); |
127 | } else { | 130 | } else { |
128 | printk(KERN_CRIT | 131 | pr_crit("%s: Unexpected close, not stopping watchdog!\n", |
129 | "%s: Unexpected close, not stopping watchdog!\n", | 132 | ident.identity); |
130 | ident.identity); | ||
131 | sbwdog_pet(user_dog); | 133 | sbwdog_pet(user_dog); |
132 | } | 134 | } |
133 | clear_bit(0, &sbwdog_gate); | 135 | clear_bit(0, &sbwdog_gate); |
@@ -269,7 +271,7 @@ irqreturn_t sbwdog_interrupt(int irq, void *addr) | |||
269 | * if it's the second watchdog timer, it's for those users | 271 | * if it's the second watchdog timer, it's for those users |
270 | */ | 272 | */ |
271 | if (wd_cfg_reg == user_dog) | 273 | if (wd_cfg_reg == user_dog) |
272 | printk(KERN_CRIT "%s in danger of initiating system reset " | 274 | pr_crit("%s in danger of initiating system reset " |
273 | "in %ld.%01ld seconds\n", | 275 | "in %ld.%01ld seconds\n", |
274 | ident.identity, | 276 | ident.identity, |
275 | wd_init / 1000000, (wd_init / 100000) % 10); | 277 | wd_init / 1000000, (wd_init / 100000) % 10); |
@@ -290,9 +292,8 @@ static int __init sbwdog_init(void) | |||
290 | */ | 292 | */ |
291 | ret = register_reboot_notifier(&sbwdog_notifier); | 293 | ret = register_reboot_notifier(&sbwdog_notifier); |
292 | if (ret) { | 294 | if (ret) { |
293 | printk(KERN_ERR | 295 | pr_err("%s: cannot register reboot notifier (err=%d)\n", |
294 | "%s: cannot register reboot notifier (err=%d)\n", | 296 | ident.identity, ret); |
295 | ident.identity, ret); | ||
296 | return ret; | 297 | return ret; |
297 | } | 298 | } |
298 | 299 | ||
@@ -303,16 +304,16 @@ static int __init sbwdog_init(void) | |||
303 | ret = request_irq(1, sbwdog_interrupt, IRQF_SHARED, | 304 | ret = request_irq(1, sbwdog_interrupt, IRQF_SHARED, |
304 | ident.identity, (void *)user_dog); | 305 | ident.identity, (void *)user_dog); |
305 | if (ret) { | 306 | if (ret) { |
306 | printk(KERN_ERR "%s: failed to request irq 1 - %d\n", | 307 | pr_err("%s: failed to request irq 1 - %d\n", |
307 | ident.identity, ret); | 308 | ident.identity, ret); |
308 | goto out; | 309 | goto out; |
309 | } | 310 | } |
310 | 311 | ||
311 | ret = misc_register(&sbwdog_miscdev); | 312 | ret = misc_register(&sbwdog_miscdev); |
312 | if (ret == 0) { | 313 | if (ret == 0) { |
313 | printk(KERN_INFO "%s: timeout is %ld.%ld secs\n", | 314 | pr_info("%s: timeout is %ld.%ld secs\n", |
314 | ident.identity, | 315 | ident.identity, |
315 | timeout / 1000000, (timeout / 100000) % 10); | 316 | timeout / 1000000, (timeout / 100000) % 10); |
316 | return 0; | 317 | return 0; |
317 | } | 318 | } |
318 | free_irq(1, (void *)user_dog); | 319 | free_irq(1, (void *)user_dog); |
@@ -353,8 +354,7 @@ void platform_wd_setup(void) | |||
353 | ret = request_irq(1, sbwdog_interrupt, IRQF_SHARED, | 354 | ret = request_irq(1, sbwdog_interrupt, IRQF_SHARED, |
354 | "Kernel Watchdog", IOADDR(A_SCD_WDOG_CFG_0)); | 355 | "Kernel Watchdog", IOADDR(A_SCD_WDOG_CFG_0)); |
355 | if (ret) { | 356 | if (ret) { |
356 | printk(KERN_CRIT | 357 | pr_crit("Watchdog IRQ zero(0) failed to be requested - %d\n", ret); |
357 | "Watchdog IRQ zero(0) failed to be requested - %d\n", ret); | ||
358 | } | 358 | } |
359 | } | 359 | } |
360 | 360 | ||
diff --git a/drivers/watchdog/sbc60xxwdt.c b/drivers/watchdog/sbc60xxwdt.c index 626d0e8e56c3..6b41276755bc 100644 --- a/drivers/watchdog/sbc60xxwdt.c +++ b/drivers/watchdog/sbc60xxwdt.c | |||
@@ -48,6 +48,8 @@ | |||
48 | * | 48 | * |
49 | */ | 49 | */ |
50 | 50 | ||
51 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
52 | |||
51 | #include <linux/module.h> | 53 | #include <linux/module.h> |
52 | #include <linux/moduleparam.h> | 54 | #include <linux/moduleparam.h> |
53 | #include <linux/types.h> | 55 | #include <linux/types.h> |
@@ -105,8 +107,8 @@ MODULE_PARM_DESC(timeout, | |||
105 | "Watchdog timeout in seconds. (1<=timeout<=3600, default=" | 107 | "Watchdog timeout in seconds. (1<=timeout<=3600, default=" |
106 | __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); | 108 | __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); |
107 | 109 | ||
108 | static int nowayout = WATCHDOG_NOWAYOUT; | 110 | static bool nowayout = WATCHDOG_NOWAYOUT; |
109 | module_param(nowayout, int, 0); | 111 | module_param(nowayout, bool, 0); |
110 | MODULE_PARM_DESC(nowayout, | 112 | MODULE_PARM_DESC(nowayout, |
111 | "Watchdog cannot be stopped once started (default=" | 113 | "Watchdog cannot be stopped once started (default=" |
112 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 114 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
@@ -132,8 +134,7 @@ static void wdt_timer_ping(unsigned long data) | |||
132 | /* Re-set the timer interval */ | 134 | /* Re-set the timer interval */ |
133 | mod_timer(&timer, jiffies + WDT_INTERVAL); | 135 | mod_timer(&timer, jiffies + WDT_INTERVAL); |
134 | } else | 136 | } else |
135 | printk(KERN_WARNING PFX | 137 | pr_warn("Heartbeat lost! Will not ping the watchdog\n"); |
136 | "Heartbeat lost! Will not ping the watchdog\n"); | ||
137 | } | 138 | } |
138 | 139 | ||
139 | /* | 140 | /* |
@@ -146,7 +147,7 @@ static void wdt_startup(void) | |||
146 | 147 | ||
147 | /* Start the timer */ | 148 | /* Start the timer */ |
148 | mod_timer(&timer, jiffies + WDT_INTERVAL); | 149 | mod_timer(&timer, jiffies + WDT_INTERVAL); |
149 | printk(KERN_INFO PFX "Watchdog timer is now enabled.\n"); | 150 | pr_info("Watchdog timer is now enabled\n"); |
150 | } | 151 | } |
151 | 152 | ||
152 | static void wdt_turnoff(void) | 153 | static void wdt_turnoff(void) |
@@ -154,7 +155,7 @@ static void wdt_turnoff(void) | |||
154 | /* Stop the timer */ | 155 | /* Stop the timer */ |
155 | del_timer(&timer); | 156 | del_timer(&timer); |
156 | inb_p(wdt_stop); | 157 | inb_p(wdt_stop); |
157 | printk(KERN_INFO PFX "Watchdog timer is now disabled...\n"); | 158 | pr_info("Watchdog timer is now disabled...\n"); |
158 | } | 159 | } |
159 | 160 | ||
160 | static void wdt_keepalive(void) | 161 | static void wdt_keepalive(void) |
@@ -217,8 +218,7 @@ static int fop_close(struct inode *inode, struct file *file) | |||
217 | wdt_turnoff(); | 218 | wdt_turnoff(); |
218 | else { | 219 | else { |
219 | del_timer(&timer); | 220 | del_timer(&timer); |
220 | printk(KERN_CRIT PFX | 221 | pr_crit("device file closed unexpectedly. Will not stop the WDT!\n"); |
221 | "device file closed unexpectedly. Will not stop the WDT!\n"); | ||
222 | } | 222 | } |
223 | clear_bit(0, &wdt_is_open); | 223 | clear_bit(0, &wdt_is_open); |
224 | wdt_expect_close = 0; | 224 | wdt_expect_close = 0; |
@@ -335,14 +335,12 @@ static int __init sbc60xxwdt_init(void) | |||
335 | 335 | ||
336 | if (timeout < 1 || timeout > 3600) { /* arbitrary upper limit */ | 336 | if (timeout < 1 || timeout > 3600) { /* arbitrary upper limit */ |
337 | timeout = WATCHDOG_TIMEOUT; | 337 | timeout = WATCHDOG_TIMEOUT; |
338 | printk(KERN_INFO PFX | 338 | pr_info("timeout value must be 1 <= x <= 3600, using %d\n", |
339 | "timeout value must be 1 <= x <= 3600, using %d\n", | 339 | timeout); |
340 | timeout); | ||
341 | } | 340 | } |
342 | 341 | ||
343 | if (!request_region(wdt_start, 1, "SBC 60XX WDT")) { | 342 | if (!request_region(wdt_start, 1, "SBC 60XX WDT")) { |
344 | printk(KERN_ERR PFX "I/O address 0x%04x already in use\n", | 343 | pr_err("I/O address 0x%04x already in use\n", wdt_start); |
345 | wdt_start); | ||
346 | rc = -EIO; | 344 | rc = -EIO; |
347 | goto err_out; | 345 | goto err_out; |
348 | } | 346 | } |
@@ -350,9 +348,7 @@ static int __init sbc60xxwdt_init(void) | |||
350 | /* We cannot reserve 0x45 - the kernel already has! */ | 348 | /* We cannot reserve 0x45 - the kernel already has! */ |
351 | if (wdt_stop != 0x45 && wdt_stop != wdt_start) { | 349 | if (wdt_stop != 0x45 && wdt_stop != wdt_start) { |
352 | if (!request_region(wdt_stop, 1, "SBC 60XX WDT")) { | 350 | if (!request_region(wdt_stop, 1, "SBC 60XX WDT")) { |
353 | printk(KERN_ERR PFX | 351 | pr_err("I/O address 0x%04x already in use\n", wdt_stop); |
354 | "I/O address 0x%04x already in use\n", | ||
355 | wdt_stop); | ||
356 | rc = -EIO; | 352 | rc = -EIO; |
357 | goto err_out_region1; | 353 | goto err_out_region1; |
358 | } | 354 | } |
@@ -360,21 +356,18 @@ static int __init sbc60xxwdt_init(void) | |||
360 | 356 | ||
361 | rc = register_reboot_notifier(&wdt_notifier); | 357 | rc = register_reboot_notifier(&wdt_notifier); |
362 | if (rc) { | 358 | if (rc) { |
363 | printk(KERN_ERR PFX | 359 | pr_err("cannot register reboot notifier (err=%d)\n", rc); |
364 | "cannot register reboot notifier (err=%d)\n", rc); | ||
365 | goto err_out_region2; | 360 | goto err_out_region2; |
366 | } | 361 | } |
367 | 362 | ||
368 | rc = misc_register(&wdt_miscdev); | 363 | rc = misc_register(&wdt_miscdev); |
369 | if (rc) { | 364 | if (rc) { |
370 | printk(KERN_ERR PFX | 365 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
371 | "cannot register miscdev on minor=%d (err=%d)\n", | 366 | wdt_miscdev.minor, rc); |
372 | wdt_miscdev.minor, rc); | ||
373 | goto err_out_reboot; | 367 | goto err_out_reboot; |
374 | } | 368 | } |
375 | printk(KERN_INFO PFX | 369 | pr_info("WDT driver for 60XX single board computer initialised. timeout=%d sec (nowayout=%d)\n", |
376 | "WDT driver for 60XX single board computer initialised. " | 370 | timeout, nowayout); |
377 | "timeout=%d sec (nowayout=%d)\n", timeout, nowayout); | ||
378 | 371 | ||
379 | return 0; | 372 | return 0; |
380 | 373 | ||
diff --git a/drivers/watchdog/sbc7240_wdt.c b/drivers/watchdog/sbc7240_wdt.c index 93ac58953122..8ab757d3df5f 100644 --- a/drivers/watchdog/sbc7240_wdt.c +++ b/drivers/watchdog/sbc7240_wdt.c | |||
@@ -16,6 +16,8 @@ | |||
16 | * | 16 | * |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
20 | |||
19 | #include <linux/fs.h> | 21 | #include <linux/fs.h> |
20 | #include <linux/init.h> | 22 | #include <linux/init.h> |
21 | #include <linux/ioport.h> | 23 | #include <linux/ioport.h> |
@@ -32,8 +34,6 @@ | |||
32 | #include <linux/atomic.h> | 34 | #include <linux/atomic.h> |
33 | #include <asm/system.h> | 35 | #include <asm/system.h> |
34 | 36 | ||
35 | #define SBC7240_PREFIX "sbc7240_wdt: " | ||
36 | |||
37 | #define SBC7240_ENABLE_PORT 0x443 | 37 | #define SBC7240_ENABLE_PORT 0x443 |
38 | #define SBC7240_DISABLE_PORT 0x043 | 38 | #define SBC7240_DISABLE_PORT 0x043 |
39 | #define SBC7240_SET_TIMEOUT_PORT SBC7240_ENABLE_PORT | 39 | #define SBC7240_SET_TIMEOUT_PORT SBC7240_ENABLE_PORT |
@@ -47,8 +47,8 @@ MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. (1<=timeout<=" | |||
47 | __MODULE_STRING(SBC7240_MAX_TIMEOUT) ", default=" | 47 | __MODULE_STRING(SBC7240_MAX_TIMEOUT) ", default=" |
48 | __MODULE_STRING(SBC7240_TIMEOUT) ")"); | 48 | __MODULE_STRING(SBC7240_TIMEOUT) ")"); |
49 | 49 | ||
50 | static int nowayout = WATCHDOG_NOWAYOUT; | 50 | static bool nowayout = WATCHDOG_NOWAYOUT; |
51 | module_param(nowayout, int, 0); | 51 | module_param(nowayout, bool, 0); |
52 | MODULE_PARM_DESC(nowayout, "Disable watchdog when closing device file"); | 52 | MODULE_PARM_DESC(nowayout, "Disable watchdog when closing device file"); |
53 | 53 | ||
54 | #define SBC7240_OPEN_STATUS_BIT 0 | 54 | #define SBC7240_OPEN_STATUS_BIT 0 |
@@ -65,8 +65,7 @@ static void wdt_disable(void) | |||
65 | /* disable the watchdog */ | 65 | /* disable the watchdog */ |
66 | if (test_and_clear_bit(SBC7240_ENABLED_STATUS_BIT, &wdt_status)) { | 66 | if (test_and_clear_bit(SBC7240_ENABLED_STATUS_BIT, &wdt_status)) { |
67 | inb_p(SBC7240_DISABLE_PORT); | 67 | inb_p(SBC7240_DISABLE_PORT); |
68 | printk(KERN_INFO SBC7240_PREFIX | 68 | pr_info("Watchdog timer is now disabled\n"); |
69 | "Watchdog timer is now disabled.\n"); | ||
70 | } | 69 | } |
71 | } | 70 | } |
72 | 71 | ||
@@ -75,23 +74,20 @@ static void wdt_enable(void) | |||
75 | /* enable the watchdog */ | 74 | /* enable the watchdog */ |
76 | if (!test_and_set_bit(SBC7240_ENABLED_STATUS_BIT, &wdt_status)) { | 75 | if (!test_and_set_bit(SBC7240_ENABLED_STATUS_BIT, &wdt_status)) { |
77 | inb_p(SBC7240_ENABLE_PORT); | 76 | inb_p(SBC7240_ENABLE_PORT); |
78 | printk(KERN_INFO SBC7240_PREFIX | 77 | pr_info("Watchdog timer is now enabled\n"); |
79 | "Watchdog timer is now enabled.\n"); | ||
80 | } | 78 | } |
81 | } | 79 | } |
82 | 80 | ||
83 | static int wdt_set_timeout(int t) | 81 | static int wdt_set_timeout(int t) |
84 | { | 82 | { |
85 | if (t < 1 || t > SBC7240_MAX_TIMEOUT) { | 83 | if (t < 1 || t > SBC7240_MAX_TIMEOUT) { |
86 | printk(KERN_ERR SBC7240_PREFIX | 84 | pr_err("timeout value must be 1<=x<=%d\n", SBC7240_MAX_TIMEOUT); |
87 | "timeout value must be 1<=x<=%d\n", | ||
88 | SBC7240_MAX_TIMEOUT); | ||
89 | return -1; | 85 | return -1; |
90 | } | 86 | } |
91 | /* set the timeout */ | 87 | /* set the timeout */ |
92 | outb_p((unsigned)t, SBC7240_SET_TIMEOUT_PORT); | 88 | outb_p((unsigned)t, SBC7240_SET_TIMEOUT_PORT); |
93 | timeout = t; | 89 | timeout = t; |
94 | printk(KERN_INFO SBC7240_PREFIX "timeout set to %d seconds\n", t); | 90 | pr_info("timeout set to %d seconds\n", t); |
95 | return 0; | 91 | return 0; |
96 | } | 92 | } |
97 | 93 | ||
@@ -150,8 +146,7 @@ static int fop_close(struct inode *inode, struct file *file) | |||
150 | || !nowayout) { | 146 | || !nowayout) { |
151 | wdt_disable(); | 147 | wdt_disable(); |
152 | } else { | 148 | } else { |
153 | printk(KERN_CRIT SBC7240_PREFIX | 149 | pr_crit("Unexpected close, not stopping watchdog!\n"); |
154 | "Unexpected close, not stopping watchdog!\n"); | ||
155 | wdt_keepalive(); | 150 | wdt_keepalive(); |
156 | } | 151 | } |
157 | 152 | ||
@@ -252,7 +247,7 @@ static struct notifier_block wdt_notifier = { | |||
252 | 247 | ||
253 | static void __exit sbc7240_wdt_unload(void) | 248 | static void __exit sbc7240_wdt_unload(void) |
254 | { | 249 | { |
255 | printk(KERN_INFO SBC7240_PREFIX "Removing watchdog\n"); | 250 | pr_info("Removing watchdog\n"); |
256 | misc_deregister(&wdt_miscdev); | 251 | misc_deregister(&wdt_miscdev); |
257 | 252 | ||
258 | unregister_reboot_notifier(&wdt_notifier); | 253 | unregister_reboot_notifier(&wdt_notifier); |
@@ -264,8 +259,7 @@ static int __init sbc7240_wdt_init(void) | |||
264 | int rc = -EBUSY; | 259 | int rc = -EBUSY; |
265 | 260 | ||
266 | if (!request_region(SBC7240_ENABLE_PORT, 1, "SBC7240 WDT")) { | 261 | if (!request_region(SBC7240_ENABLE_PORT, 1, "SBC7240 WDT")) { |
267 | printk(KERN_ERR SBC7240_PREFIX | 262 | pr_err("I/O address 0x%04x already in use\n", |
268 | "I/O address 0x%04x already in use\n", | ||
269 | SBC7240_ENABLE_PORT); | 263 | SBC7240_ENABLE_PORT); |
270 | rc = -EIO; | 264 | rc = -EIO; |
271 | goto err_out; | 265 | goto err_out; |
@@ -277,31 +271,27 @@ static int __init sbc7240_wdt_init(void) | |||
277 | 271 | ||
278 | if (timeout < 1 || timeout > SBC7240_MAX_TIMEOUT) { | 272 | if (timeout < 1 || timeout > SBC7240_MAX_TIMEOUT) { |
279 | timeout = SBC7240_TIMEOUT; | 273 | timeout = SBC7240_TIMEOUT; |
280 | printk(KERN_INFO SBC7240_PREFIX | 274 | pr_info("timeout value must be 1<=x<=%d, using %d\n", |
281 | "timeout value must be 1<=x<=%d, using %d\n", | 275 | SBC7240_MAX_TIMEOUT, timeout); |
282 | SBC7240_MAX_TIMEOUT, timeout); | ||
283 | } | 276 | } |
284 | wdt_set_timeout(timeout); | 277 | wdt_set_timeout(timeout); |
285 | wdt_disable(); | 278 | wdt_disable(); |
286 | 279 | ||
287 | rc = register_reboot_notifier(&wdt_notifier); | 280 | rc = register_reboot_notifier(&wdt_notifier); |
288 | if (rc) { | 281 | if (rc) { |
289 | printk(KERN_ERR SBC7240_PREFIX | 282 | pr_err("cannot register reboot notifier (err=%d)\n", rc); |
290 | "cannot register reboot notifier (err=%d)\n", rc); | ||
291 | goto err_out_region; | 283 | goto err_out_region; |
292 | } | 284 | } |
293 | 285 | ||
294 | rc = misc_register(&wdt_miscdev); | 286 | rc = misc_register(&wdt_miscdev); |
295 | if (rc) { | 287 | if (rc) { |
296 | printk(KERN_ERR SBC7240_PREFIX | 288 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
297 | "cannot register miscdev on minor=%d (err=%d)\n", | ||
298 | wdt_miscdev.minor, rc); | 289 | wdt_miscdev.minor, rc); |
299 | goto err_out_reboot_notifier; | 290 | goto err_out_reboot_notifier; |
300 | } | 291 | } |
301 | 292 | ||
302 | printk(KERN_INFO SBC7240_PREFIX | 293 | pr_info("Watchdog driver for SBC7240 initialised (nowayout=%d)\n", |
303 | "Watchdog driver for SBC7240 initialised (nowayout=%d)\n", | 294 | nowayout); |
304 | nowayout); | ||
305 | 295 | ||
306 | return 0; | 296 | return 0; |
307 | 297 | ||
diff --git a/drivers/watchdog/sbc8360.c b/drivers/watchdog/sbc8360.c index 514ec23050f7..a9ea385fa125 100644 --- a/drivers/watchdog/sbc8360.c +++ b/drivers/watchdog/sbc8360.c | |||
@@ -36,6 +36,8 @@ | |||
36 | * | 36 | * |
37 | */ | 37 | */ |
38 | 38 | ||
39 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
40 | |||
39 | #include <linux/module.h> | 41 | #include <linux/module.h> |
40 | #include <linux/types.h> | 42 | #include <linux/types.h> |
41 | #include <linux/miscdevice.h> | 43 | #include <linux/miscdevice.h> |
@@ -56,8 +58,6 @@ | |||
56 | static unsigned long sbc8360_is_open; | 58 | static unsigned long sbc8360_is_open; |
57 | static char expect_close; | 59 | static char expect_close; |
58 | 60 | ||
59 | #define PFX "sbc8360: " | ||
60 | |||
61 | /* | 61 | /* |
62 | * | 62 | * |
63 | * Watchdog Timer Configuration | 63 | * Watchdog Timer Configuration |
@@ -197,11 +197,11 @@ static int wd_times[64][2] = { | |||
197 | static int timeout = 27; | 197 | static int timeout = 27; |
198 | static int wd_margin = 0xB; | 198 | static int wd_margin = 0xB; |
199 | static int wd_multiplier = 2; | 199 | static int wd_multiplier = 2; |
200 | static int nowayout = WATCHDOG_NOWAYOUT; | 200 | static bool nowayout = WATCHDOG_NOWAYOUT; |
201 | 201 | ||
202 | module_param(timeout, int, 0); | 202 | module_param(timeout, int, 0); |
203 | MODULE_PARM_DESC(timeout, "Index into timeout table (0-63) (default=27 (60s))"); | 203 | MODULE_PARM_DESC(timeout, "Index into timeout table (0-63) (default=27 (60s))"); |
204 | module_param(nowayout, int, 0); | 204 | module_param(nowayout, bool, 0); |
205 | MODULE_PARM_DESC(nowayout, | 205 | MODULE_PARM_DESC(nowayout, |
206 | "Watchdog cannot be stopped once started (default=" | 206 | "Watchdog cannot be stopped once started (default=" |
207 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 207 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
@@ -280,8 +280,7 @@ static int sbc8360_close(struct inode *inode, struct file *file) | |||
280 | if (expect_close == 42) | 280 | if (expect_close == 42) |
281 | sbc8360_stop(); | 281 | sbc8360_stop(); |
282 | else | 282 | else |
283 | printk(KERN_CRIT PFX "SBC8360 device closed unexpectedly. " | 283 | pr_crit("SBC8360 device closed unexpectedly. SBC8360 will not stop!\n"); |
284 | "SBC8360 will not stop!\n"); | ||
285 | 284 | ||
286 | clear_bit(0, &sbc8360_is_open); | 285 | clear_bit(0, &sbc8360_is_open); |
287 | expect_close = 0; | 286 | expect_close = 0; |
@@ -334,20 +333,19 @@ static int __init sbc8360_init(void) | |||
334 | unsigned long int mseconds = 60000; | 333 | unsigned long int mseconds = 60000; |
335 | 334 | ||
336 | if (timeout < 0 || timeout > 63) { | 335 | if (timeout < 0 || timeout > 63) { |
337 | printk(KERN_ERR PFX "Invalid timeout index (must be 0-63).\n"); | 336 | pr_err("Invalid timeout index (must be 0-63)\n"); |
338 | res = -EINVAL; | 337 | res = -EINVAL; |
339 | goto out; | 338 | goto out; |
340 | } | 339 | } |
341 | 340 | ||
342 | if (!request_region(SBC8360_ENABLE, 1, "SBC8360")) { | 341 | if (!request_region(SBC8360_ENABLE, 1, "SBC8360")) { |
343 | printk(KERN_ERR PFX "ENABLE method I/O %X is not available.\n", | 342 | pr_err("ENABLE method I/O %X is not available\n", |
344 | SBC8360_ENABLE); | 343 | SBC8360_ENABLE); |
345 | res = -EIO; | 344 | res = -EIO; |
346 | goto out; | 345 | goto out; |
347 | } | 346 | } |
348 | if (!request_region(SBC8360_BASETIME, 1, "SBC8360")) { | 347 | if (!request_region(SBC8360_BASETIME, 1, "SBC8360")) { |
349 | printk(KERN_ERR PFX | 348 | pr_err("BASETIME method I/O %X is not available\n", |
350 | "BASETIME method I/O %X is not available.\n", | ||
351 | SBC8360_BASETIME); | 349 | SBC8360_BASETIME); |
352 | res = -EIO; | 350 | res = -EIO; |
353 | goto out_nobasetimereg; | 351 | goto out_nobasetimereg; |
@@ -355,13 +353,13 @@ static int __init sbc8360_init(void) | |||
355 | 353 | ||
356 | res = register_reboot_notifier(&sbc8360_notifier); | 354 | res = register_reboot_notifier(&sbc8360_notifier); |
357 | if (res) { | 355 | if (res) { |
358 | printk(KERN_ERR PFX "Failed to register reboot notifier.\n"); | 356 | pr_err("Failed to register reboot notifier\n"); |
359 | goto out_noreboot; | 357 | goto out_noreboot; |
360 | } | 358 | } |
361 | 359 | ||
362 | res = misc_register(&sbc8360_miscdev); | 360 | res = misc_register(&sbc8360_miscdev); |
363 | if (res) { | 361 | if (res) { |
364 | printk(KERN_ERR PFX "failed to register misc device\n"); | 362 | pr_err("failed to register misc device\n"); |
365 | goto out_nomisc; | 363 | goto out_nomisc; |
366 | } | 364 | } |
367 | 365 | ||
@@ -378,7 +376,7 @@ static int __init sbc8360_init(void) | |||
378 | mseconds = (wd_margin + 1) * 100000; | 376 | mseconds = (wd_margin + 1) * 100000; |
379 | 377 | ||
380 | /* My kingdom for the ability to print "0.5 seconds" in the kernel! */ | 378 | /* My kingdom for the ability to print "0.5 seconds" in the kernel! */ |
381 | printk(KERN_INFO PFX "Timeout set at %ld ms.\n", mseconds); | 379 | pr_info("Timeout set at %ld ms\n", mseconds); |
382 | 380 | ||
383 | return 0; | 381 | return 0; |
384 | 382 | ||
diff --git a/drivers/watchdog/sbc_epx_c3.c b/drivers/watchdog/sbc_epx_c3.c index eaca366b7234..0c3e9f66ef77 100644 --- a/drivers/watchdog/sbc_epx_c3.c +++ b/drivers/watchdog/sbc_epx_c3.c | |||
@@ -13,6 +13,8 @@ | |||
13 | * based on softdog.c by Alan Cox <alan@lxorguk.ukuu.org.uk> | 13 | * based on softdog.c by Alan Cox <alan@lxorguk.ukuu.org.uk> |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
17 | |||
16 | #include <linux/module.h> | 18 | #include <linux/module.h> |
17 | #include <linux/moduleparam.h> | 19 | #include <linux/moduleparam.h> |
18 | #include <linux/types.h> | 20 | #include <linux/types.h> |
@@ -28,13 +30,12 @@ | |||
28 | #include <linux/uaccess.h> | 30 | #include <linux/uaccess.h> |
29 | #include <linux/io.h> | 31 | #include <linux/io.h> |
30 | 32 | ||
31 | #define PFX "epx_c3: " | ||
32 | static int epx_c3_alive; | 33 | static int epx_c3_alive; |
33 | 34 | ||
34 | #define WATCHDOG_TIMEOUT 1 /* 1 sec default timeout */ | 35 | #define WATCHDOG_TIMEOUT 1 /* 1 sec default timeout */ |
35 | 36 | ||
36 | static int nowayout = WATCHDOG_NOWAYOUT; | 37 | static bool nowayout = WATCHDOG_NOWAYOUT; |
37 | module_param(nowayout, int, 0); | 38 | module_param(nowayout, bool, 0); |
38 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" | 39 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" |
39 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 40 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
40 | 41 | ||
@@ -51,7 +52,7 @@ static void epx_c3_stop(void) | |||
51 | 52 | ||
52 | outb(0, EPXC3_WATCHDOG_CTL_REG); | 53 | outb(0, EPXC3_WATCHDOG_CTL_REG); |
53 | 54 | ||
54 | printk(KERN_INFO PFX "Stopped watchdog timer.\n"); | 55 | pr_info("Stopped watchdog timer\n"); |
55 | } | 56 | } |
56 | 57 | ||
57 | static void epx_c3_pet(void) | 58 | static void epx_c3_pet(void) |
@@ -75,7 +76,7 @@ static int epx_c3_open(struct inode *inode, struct file *file) | |||
75 | epx_c3_pet(); | 76 | epx_c3_pet(); |
76 | 77 | ||
77 | epx_c3_alive = 1; | 78 | epx_c3_alive = 1; |
78 | printk(KERN_INFO "Started watchdog timer.\n"); | 79 | pr_info("Started watchdog timer\n"); |
79 | 80 | ||
80 | return nonseekable_open(inode, file); | 81 | return nonseekable_open(inode, file); |
81 | } | 82 | } |
@@ -173,9 +174,6 @@ static struct notifier_block epx_c3_notifier = { | |||
173 | .notifier_call = epx_c3_notify_sys, | 174 | .notifier_call = epx_c3_notify_sys, |
174 | }; | 175 | }; |
175 | 176 | ||
176 | static const char banner[] __initconst = KERN_INFO PFX | ||
177 | "Hardware Watchdog Timer for Winsystems EPX-C3 SBC: 0.1\n"; | ||
178 | |||
179 | static int __init watchdog_init(void) | 177 | static int __init watchdog_init(void) |
180 | { | 178 | { |
181 | int ret; | 179 | int ret; |
@@ -185,20 +183,19 @@ static int __init watchdog_init(void) | |||
185 | 183 | ||
186 | ret = register_reboot_notifier(&epx_c3_notifier); | 184 | ret = register_reboot_notifier(&epx_c3_notifier); |
187 | if (ret) { | 185 | if (ret) { |
188 | printk(KERN_ERR PFX "cannot register reboot notifier " | 186 | pr_err("cannot register reboot notifier (err=%d)\n", ret); |
189 | "(err=%d)\n", ret); | ||
190 | goto out; | 187 | goto out; |
191 | } | 188 | } |
192 | 189 | ||
193 | ret = misc_register(&epx_c3_miscdev); | 190 | ret = misc_register(&epx_c3_miscdev); |
194 | if (ret) { | 191 | if (ret) { |
195 | printk(KERN_ERR PFX "cannot register miscdev on minor=%d " | 192 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
196 | "(err=%d)\n", WATCHDOG_MINOR, ret); | 193 | WATCHDOG_MINOR, ret); |
197 | unregister_reboot_notifier(&epx_c3_notifier); | 194 | unregister_reboot_notifier(&epx_c3_notifier); |
198 | goto out; | 195 | goto out; |
199 | } | 196 | } |
200 | 197 | ||
201 | printk(banner); | 198 | pr_info("Hardware Watchdog Timer for Winsystems EPX-C3 SBC: 0.1\n"); |
202 | 199 | ||
203 | return 0; | 200 | return 0; |
204 | 201 | ||
diff --git a/drivers/watchdog/sbc_fitpc2_wdt.c b/drivers/watchdog/sbc_fitpc2_wdt.c index d5d399464599..840428529227 100644 --- a/drivers/watchdog/sbc_fitpc2_wdt.c +++ b/drivers/watchdog/sbc_fitpc2_wdt.c | |||
@@ -27,7 +27,7 @@ | |||
27 | 27 | ||
28 | #include <asm/system.h> | 28 | #include <asm/system.h> |
29 | 29 | ||
30 | static int nowayout = WATCHDOG_NOWAYOUT; | 30 | static bool nowayout = WATCHDOG_NOWAYOUT; |
31 | static unsigned int margin = 60; /* (secs) Default is 1 minute */ | 31 | static unsigned int margin = 60; /* (secs) Default is 1 minute */ |
32 | static unsigned long wdt_status; | 32 | static unsigned long wdt_status; |
33 | static DEFINE_MUTEX(wdt_lock); | 33 | static DEFINE_MUTEX(wdt_lock); |
@@ -171,8 +171,7 @@ static int fitpc2_wdt_release(struct inode *inode, struct file *file) | |||
171 | wdt_disable(); | 171 | wdt_disable(); |
172 | pr_info("Device disabled\n"); | 172 | pr_info("Device disabled\n"); |
173 | } else { | 173 | } else { |
174 | pr_warning("Device closed unexpectedly -" | 174 | pr_warn("Device closed unexpectedly - timer will not stop\n"); |
175 | " timer will not stop\n"); | ||
176 | wdt_enable(); | 175 | wdt_enable(); |
177 | } | 176 | } |
178 | 177 | ||
@@ -222,8 +221,8 @@ static int __init fitpc2_wdt_init(void) | |||
222 | } | 221 | } |
223 | 222 | ||
224 | if (margin < 31 || margin > 255) { | 223 | if (margin < 31 || margin > 255) { |
225 | pr_err("margin must be in range 31 - 255" | 224 | pr_err("margin must be in range 31 - 255 seconds, you tried to set %d\n", |
226 | " seconds, you tried to set %d\n", margin); | 225 | margin); |
227 | err = -EINVAL; | 226 | err = -EINVAL; |
228 | goto err_margin; | 227 | goto err_margin; |
229 | } | 228 | } |
@@ -231,7 +230,7 @@ static int __init fitpc2_wdt_init(void) | |||
231 | err = misc_register(&fitpc2_wdt_miscdev); | 230 | err = misc_register(&fitpc2_wdt_miscdev); |
232 | if (err) { | 231 | if (err) { |
233 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", | 232 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
234 | WATCHDOG_MINOR, err); | 233 | WATCHDOG_MINOR, err); |
235 | goto err_margin; | 234 | goto err_margin; |
236 | } | 235 | } |
237 | 236 | ||
@@ -261,7 +260,7 @@ MODULE_DESCRIPTION("SBC-FITPC2 Watchdog"); | |||
261 | module_param(margin, int, 0); | 260 | module_param(margin, int, 0); |
262 | MODULE_PARM_DESC(margin, "Watchdog margin in seconds (default 60s)"); | 261 | MODULE_PARM_DESC(margin, "Watchdog margin in seconds (default 60s)"); |
263 | 262 | ||
264 | module_param(nowayout, int, 0); | 263 | module_param(nowayout, bool, 0); |
265 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started"); | 264 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started"); |
266 | 265 | ||
267 | MODULE_LICENSE("GPL"); | 266 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/watchdog/sc1200wdt.c b/drivers/watchdog/sc1200wdt.c index c01daca8405a..3fb83b0c28c2 100644 --- a/drivers/watchdog/sc1200wdt.c +++ b/drivers/watchdog/sc1200wdt.c | |||
@@ -31,6 +31,8 @@ | |||
31 | * | 31 | * |
32 | */ | 32 | */ |
33 | 33 | ||
34 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
35 | |||
34 | #include <linux/module.h> | 36 | #include <linux/module.h> |
35 | #include <linux/moduleparam.h> | 37 | #include <linux/moduleparam.h> |
36 | #include <linux/miscdevice.h> | 38 | #include <linux/miscdevice.h> |
@@ -48,7 +50,6 @@ | |||
48 | 50 | ||
49 | #define SC1200_MODULE_VER "build 20020303" | 51 | #define SC1200_MODULE_VER "build 20020303" |
50 | #define SC1200_MODULE_NAME "sc1200wdt" | 52 | #define SC1200_MODULE_NAME "sc1200wdt" |
51 | #define PFX SC1200_MODULE_NAME ": " | ||
52 | 53 | ||
53 | #define MAX_TIMEOUT 255 /* 255 minutes */ | 54 | #define MAX_TIMEOUT 255 /* 255 minutes */ |
54 | #define PMIR (io) /* Power Management Index Register */ | 55 | #define PMIR (io) /* Power Management Index Register */ |
@@ -71,7 +72,6 @@ | |||
71 | #define UART2_IRQ 0x04 /* Serial1 */ | 72 | #define UART2_IRQ 0x04 /* Serial1 */ |
72 | /* 5 -7 are reserved */ | 73 | /* 5 -7 are reserved */ |
73 | 74 | ||
74 | static char banner[] __initdata = PFX SC1200_MODULE_VER; | ||
75 | static int timeout = 1; | 75 | static int timeout = 1; |
76 | static int io = -1; | 76 | static int io = -1; |
77 | static int io_len = 2; /* for non plug and play */ | 77 | static int io_len = 2; /* for non plug and play */ |
@@ -93,8 +93,8 @@ MODULE_PARM_DESC(io, "io port"); | |||
93 | module_param(timeout, int, 0); | 93 | module_param(timeout, int, 0); |
94 | MODULE_PARM_DESC(timeout, "range is 0-255 minutes, default is 1"); | 94 | MODULE_PARM_DESC(timeout, "range is 0-255 minutes, default is 1"); |
95 | 95 | ||
96 | static int nowayout = WATCHDOG_NOWAYOUT; | 96 | static bool nowayout = WATCHDOG_NOWAYOUT; |
97 | module_param(nowayout, int, 0); | 97 | module_param(nowayout, bool, 0); |
98 | MODULE_PARM_DESC(nowayout, | 98 | MODULE_PARM_DESC(nowayout, |
99 | "Watchdog cannot be stopped once started (default=" | 99 | "Watchdog cannot be stopped once started (default=" |
100 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 100 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
@@ -176,7 +176,7 @@ static int sc1200wdt_open(struct inode *inode, struct file *file) | |||
176 | timeout = MAX_TIMEOUT; | 176 | timeout = MAX_TIMEOUT; |
177 | 177 | ||
178 | sc1200wdt_start(); | 178 | sc1200wdt_start(); |
179 | printk(KERN_INFO PFX "Watchdog enabled, timeout = %d min(s)", timeout); | 179 | pr_info("Watchdog enabled, timeout = %d min(s)", timeout); |
180 | 180 | ||
181 | return nonseekable_open(inode, file); | 181 | return nonseekable_open(inode, file); |
182 | } | 182 | } |
@@ -254,11 +254,10 @@ static int sc1200wdt_release(struct inode *inode, struct file *file) | |||
254 | { | 254 | { |
255 | if (expect_close == 42) { | 255 | if (expect_close == 42) { |
256 | sc1200wdt_stop(); | 256 | sc1200wdt_stop(); |
257 | printk(KERN_INFO PFX "Watchdog disabled\n"); | 257 | pr_info("Watchdog disabled\n"); |
258 | } else { | 258 | } else { |
259 | sc1200wdt_write_data(WDTO, timeout); | 259 | sc1200wdt_write_data(WDTO, timeout); |
260 | printk(KERN_CRIT PFX | 260 | pr_crit("Unexpected close!, timeout = %d min(s)\n", timeout); |
261 | "Unexpected close!, timeout = %d min(s)\n", timeout); | ||
262 | } | 261 | } |
263 | clear_bit(0, &open_flag); | 262 | clear_bit(0, &open_flag); |
264 | expect_close = 0; | 263 | expect_close = 0; |
@@ -361,12 +360,11 @@ static int scl200wdt_pnp_probe(struct pnp_dev *dev, | |||
361 | io_len = pnp_port_len(wdt_dev, 0); | 360 | io_len = pnp_port_len(wdt_dev, 0); |
362 | 361 | ||
363 | if (!request_region(io, io_len, SC1200_MODULE_NAME)) { | 362 | if (!request_region(io, io_len, SC1200_MODULE_NAME)) { |
364 | printk(KERN_ERR PFX "Unable to register IO port %#x\n", io); | 363 | pr_err("Unable to register IO port %#x\n", io); |
365 | return -EBUSY; | 364 | return -EBUSY; |
366 | } | 365 | } |
367 | 366 | ||
368 | printk(KERN_INFO "scl200wdt: PnP device found at io port %#x/%d\n", | 367 | pr_info("PnP device found at io port %#x/%d\n", io, io_len); |
369 | io, io_len); | ||
370 | return 0; | 368 | return 0; |
371 | } | 369 | } |
372 | 370 | ||
@@ -392,7 +390,7 @@ static int __init sc1200wdt_init(void) | |||
392 | { | 390 | { |
393 | int ret; | 391 | int ret; |
394 | 392 | ||
395 | printk(KERN_INFO "%s\n", banner); | 393 | pr_info("%s\n", SC1200_MODULE_VER); |
396 | 394 | ||
397 | #if defined CONFIG_PNP | 395 | #if defined CONFIG_PNP |
398 | if (isapnp) { | 396 | if (isapnp) { |
@@ -403,7 +401,7 @@ static int __init sc1200wdt_init(void) | |||
403 | #endif | 401 | #endif |
404 | 402 | ||
405 | if (io == -1) { | 403 | if (io == -1) { |
406 | printk(KERN_ERR PFX "io parameter must be specified\n"); | 404 | pr_err("io parameter must be specified\n"); |
407 | ret = -EINVAL; | 405 | ret = -EINVAL; |
408 | goto out_pnp; | 406 | goto out_pnp; |
409 | } | 407 | } |
@@ -416,7 +414,7 @@ static int __init sc1200wdt_init(void) | |||
416 | #endif | 414 | #endif |
417 | 415 | ||
418 | if (!request_region(io, io_len, SC1200_MODULE_NAME)) { | 416 | if (!request_region(io, io_len, SC1200_MODULE_NAME)) { |
419 | printk(KERN_ERR PFX "Unable to register IO port %#x\n", io); | 417 | pr_err("Unable to register IO port %#x\n", io); |
420 | ret = -EBUSY; | 418 | ret = -EBUSY; |
421 | goto out_pnp; | 419 | goto out_pnp; |
422 | } | 420 | } |
@@ -427,16 +425,14 @@ static int __init sc1200wdt_init(void) | |||
427 | 425 | ||
428 | ret = register_reboot_notifier(&sc1200wdt_notifier); | 426 | ret = register_reboot_notifier(&sc1200wdt_notifier); |
429 | if (ret) { | 427 | if (ret) { |
430 | printk(KERN_ERR PFX | 428 | pr_err("Unable to register reboot notifier err = %d\n", ret); |
431 | "Unable to register reboot notifier err = %d\n", ret); | ||
432 | goto out_io; | 429 | goto out_io; |
433 | } | 430 | } |
434 | 431 | ||
435 | ret = misc_register(&sc1200wdt_miscdev); | 432 | ret = misc_register(&sc1200wdt_miscdev); |
436 | if (ret) { | 433 | if (ret) { |
437 | printk(KERN_ERR PFX | 434 | pr_err("Unable to register miscdev on minor %d\n", |
438 | "Unable to register miscdev on minor %d\n", | 435 | WATCHDOG_MINOR); |
439 | WATCHDOG_MINOR); | ||
440 | goto out_rbt; | 436 | goto out_rbt; |
441 | } | 437 | } |
442 | 438 | ||
diff --git a/drivers/watchdog/sc520_wdt.c b/drivers/watchdog/sc520_wdt.c index b2840409ebc7..d1ef58579a37 100644 --- a/drivers/watchdog/sc520_wdt.c +++ b/drivers/watchdog/sc520_wdt.c | |||
@@ -52,6 +52,8 @@ | |||
52 | * This driver uses memory mapped IO, and spinlock. | 52 | * This driver uses memory mapped IO, and spinlock. |
53 | */ | 53 | */ |
54 | 54 | ||
55 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
56 | |||
55 | #include <linux/module.h> | 57 | #include <linux/module.h> |
56 | #include <linux/moduleparam.h> | 58 | #include <linux/moduleparam.h> |
57 | #include <linux/types.h> | 59 | #include <linux/types.h> |
@@ -69,9 +71,6 @@ | |||
69 | 71 | ||
70 | #include <asm/system.h> | 72 | #include <asm/system.h> |
71 | 73 | ||
72 | #define OUR_NAME "sc520_wdt" | ||
73 | #define PFX OUR_NAME ": " | ||
74 | |||
75 | /* | 74 | /* |
76 | * The AMD Elan SC520 timeout value is 492us times a power of 2 (0-7) | 75 | * The AMD Elan SC520 timeout value is 492us times a power of 2 (0-7) |
77 | * | 76 | * |
@@ -98,8 +97,8 @@ MODULE_PARM_DESC(timeout, | |||
98 | "Watchdog timeout in seconds. (1 <= timeout <= 3600, default=" | 97 | "Watchdog timeout in seconds. (1 <= timeout <= 3600, default=" |
99 | __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); | 98 | __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); |
100 | 99 | ||
101 | static int nowayout = WATCHDOG_NOWAYOUT; | 100 | static bool nowayout = WATCHDOG_NOWAYOUT; |
102 | module_param(nowayout, int, 0); | 101 | module_param(nowayout, bool, 0); |
103 | MODULE_PARM_DESC(nowayout, | 102 | MODULE_PARM_DESC(nowayout, |
104 | "Watchdog cannot be stopped once started (default=" | 103 | "Watchdog cannot be stopped once started (default=" |
105 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 104 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
@@ -151,8 +150,7 @@ static void wdt_timer_ping(unsigned long data) | |||
151 | /* Re-set the timer interval */ | 150 | /* Re-set the timer interval */ |
152 | mod_timer(&timer, jiffies + WDT_INTERVAL); | 151 | mod_timer(&timer, jiffies + WDT_INTERVAL); |
153 | } else | 152 | } else |
154 | printk(KERN_WARNING PFX | 153 | pr_warn("Heartbeat lost! Will not ping the watchdog\n"); |
155 | "Heartbeat lost! Will not ping the watchdog\n"); | ||
156 | } | 154 | } |
157 | 155 | ||
158 | /* | 156 | /* |
@@ -187,7 +185,7 @@ static int wdt_startup(void) | |||
187 | /* Start the watchdog */ | 185 | /* Start the watchdog */ |
188 | wdt_config(WDT_ENB | WDT_WRST_ENB | WDT_EXP_SEL_04); | 186 | wdt_config(WDT_ENB | WDT_WRST_ENB | WDT_EXP_SEL_04); |
189 | 187 | ||
190 | printk(KERN_INFO PFX "Watchdog timer is now enabled.\n"); | 188 | pr_info("Watchdog timer is now enabled\n"); |
191 | return 0; | 189 | return 0; |
192 | } | 190 | } |
193 | 191 | ||
@@ -199,7 +197,7 @@ static int wdt_turnoff(void) | |||
199 | /* Stop the watchdog */ | 197 | /* Stop the watchdog */ |
200 | wdt_config(0); | 198 | wdt_config(0); |
201 | 199 | ||
202 | printk(KERN_INFO PFX "Watchdog timer is now disabled...\n"); | 200 | pr_info("Watchdog timer is now disabled...\n"); |
203 | return 0; | 201 | return 0; |
204 | } | 202 | } |
205 | 203 | ||
@@ -270,8 +268,7 @@ static int fop_close(struct inode *inode, struct file *file) | |||
270 | if (wdt_expect_close == 42) | 268 | if (wdt_expect_close == 42) |
271 | wdt_turnoff(); | 269 | wdt_turnoff(); |
272 | else { | 270 | else { |
273 | printk(KERN_CRIT PFX | 271 | pr_crit("Unexpected close, not stopping watchdog!\n"); |
274 | "Unexpected close, not stopping watchdog!\n"); | ||
275 | wdt_keepalive(); | 272 | wdt_keepalive(); |
276 | } | 273 | } |
277 | clear_bit(0, &wdt_is_open); | 274 | clear_bit(0, &wdt_is_open); |
@@ -393,36 +390,32 @@ static int __init sc520_wdt_init(void) | |||
393 | if not reset to the default */ | 390 | if not reset to the default */ |
394 | if (wdt_set_heartbeat(timeout)) { | 391 | if (wdt_set_heartbeat(timeout)) { |
395 | wdt_set_heartbeat(WATCHDOG_TIMEOUT); | 392 | wdt_set_heartbeat(WATCHDOG_TIMEOUT); |
396 | printk(KERN_INFO PFX | 393 | pr_info("timeout value must be 1 <= timeout <= 3600, using %d\n", |
397 | "timeout value must be 1 <= timeout <= 3600, using %d\n", | 394 | WATCHDOG_TIMEOUT); |
398 | WATCHDOG_TIMEOUT); | ||
399 | } | 395 | } |
400 | 396 | ||
401 | wdtmrctl = ioremap(MMCR_BASE + OFFS_WDTMRCTL, 2); | 397 | wdtmrctl = ioremap(MMCR_BASE + OFFS_WDTMRCTL, 2); |
402 | if (!wdtmrctl) { | 398 | if (!wdtmrctl) { |
403 | printk(KERN_ERR PFX "Unable to remap memory\n"); | 399 | pr_err("Unable to remap memory\n"); |
404 | rc = -ENOMEM; | 400 | rc = -ENOMEM; |
405 | goto err_out_region2; | 401 | goto err_out_region2; |
406 | } | 402 | } |
407 | 403 | ||
408 | rc = register_reboot_notifier(&wdt_notifier); | 404 | rc = register_reboot_notifier(&wdt_notifier); |
409 | if (rc) { | 405 | if (rc) { |
410 | printk(KERN_ERR PFX | 406 | pr_err("cannot register reboot notifier (err=%d)\n", rc); |
411 | "cannot register reboot notifier (err=%d)\n", rc); | ||
412 | goto err_out_ioremap; | 407 | goto err_out_ioremap; |
413 | } | 408 | } |
414 | 409 | ||
415 | rc = misc_register(&wdt_miscdev); | 410 | rc = misc_register(&wdt_miscdev); |
416 | if (rc) { | 411 | if (rc) { |
417 | printk(KERN_ERR PFX | 412 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
418 | "cannot register miscdev on minor=%d (err=%d)\n", | 413 | WATCHDOG_MINOR, rc); |
419 | WATCHDOG_MINOR, rc); | ||
420 | goto err_out_notifier; | 414 | goto err_out_notifier; |
421 | } | 415 | } |
422 | 416 | ||
423 | printk(KERN_INFO PFX | 417 | pr_info("WDT driver for SC520 initialised. timeout=%d sec (nowayout=%d)\n", |
424 | "WDT driver for SC520 initialised. timeout=%d sec (nowayout=%d)\n", | 418 | timeout, nowayout); |
425 | timeout, nowayout); | ||
426 | 419 | ||
427 | return 0; | 420 | return 0; |
428 | 421 | ||
diff --git a/drivers/watchdog/sch311x_wdt.c b/drivers/watchdog/sch311x_wdt.c index 029467e34636..bd86f32d63ab 100644 --- a/drivers/watchdog/sch311x_wdt.c +++ b/drivers/watchdog/sch311x_wdt.c | |||
@@ -18,6 +18,8 @@ | |||
18 | * Includes, defines, variables, module parameters, ... | 18 | * Includes, defines, variables, module parameters, ... |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
22 | |||
21 | /* Includes */ | 23 | /* Includes */ |
22 | #include <linux/module.h> /* For module specific items */ | 24 | #include <linux/module.h> /* For module specific items */ |
23 | #include <linux/moduleparam.h> /* For new moduleparam's */ | 25 | #include <linux/moduleparam.h> /* For new moduleparam's */ |
@@ -37,7 +39,6 @@ | |||
37 | 39 | ||
38 | /* Module and version information */ | 40 | /* Module and version information */ |
39 | #define DRV_NAME "sch311x_wdt" | 41 | #define DRV_NAME "sch311x_wdt" |
40 | #define PFX DRV_NAME ": " | ||
41 | 42 | ||
42 | /* Runtime registers */ | 43 | /* Runtime registers */ |
43 | #define RESGEN 0x1d | 44 | #define RESGEN 0x1d |
@@ -79,8 +80,8 @@ MODULE_PARM_DESC(timeout, | |||
79 | "Watchdog timeout in seconds. 1<= timeout <=15300, default=" | 80 | "Watchdog timeout in seconds. 1<= timeout <=15300, default=" |
80 | __MODULE_STRING(WATCHDOG_TIMEOUT) "."); | 81 | __MODULE_STRING(WATCHDOG_TIMEOUT) "."); |
81 | 82 | ||
82 | static int nowayout = WATCHDOG_NOWAYOUT; | 83 | static bool nowayout = WATCHDOG_NOWAYOUT; |
83 | module_param(nowayout, int, 0); | 84 | module_param(nowayout, bool, 0); |
84 | MODULE_PARM_DESC(nowayout, | 85 | MODULE_PARM_DESC(nowayout, |
85 | "Watchdog cannot be stopped once started (default=" | 86 | "Watchdog cannot be stopped once started (default=" |
86 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 87 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
@@ -323,8 +324,7 @@ static int sch311x_wdt_close(struct inode *inode, struct file *file) | |||
323 | if (sch311x_wdt_expect_close == 42) { | 324 | if (sch311x_wdt_expect_close == 42) { |
324 | sch311x_wdt_stop(); | 325 | sch311x_wdt_stop(); |
325 | } else { | 326 | } else { |
326 | printk(KERN_CRIT PFX | 327 | pr_crit("Unexpected close, not stopping watchdog!\n"); |
327 | "Unexpected close, not stopping watchdog!\n"); | ||
328 | sch311x_wdt_keepalive(); | 328 | sch311x_wdt_keepalive(); |
329 | } | 329 | } |
330 | clear_bit(0, &sch311x_wdt_is_open); | 330 | clear_bit(0, &sch311x_wdt_is_open); |
@@ -504,20 +504,19 @@ static int __init sch311x_detect(int sio_config_port, unsigned short *addr) | |||
504 | 504 | ||
505 | /* Check if Logical Device Register is currently active */ | 505 | /* Check if Logical Device Register is currently active */ |
506 | if ((sch311x_sio_inb(sio_config_port, 0x30) & 0x01) == 0) | 506 | if ((sch311x_sio_inb(sio_config_port, 0x30) & 0x01) == 0) |
507 | printk(KERN_INFO PFX "Seems that LDN 0x0a is not active...\n"); | 507 | pr_info("Seems that LDN 0x0a is not active...\n"); |
508 | 508 | ||
509 | /* Get the base address of the runtime registers */ | 509 | /* Get the base address of the runtime registers */ |
510 | base_addr = (sch311x_sio_inb(sio_config_port, 0x60) << 8) | | 510 | base_addr = (sch311x_sio_inb(sio_config_port, 0x60) << 8) | |
511 | sch311x_sio_inb(sio_config_port, 0x61); | 511 | sch311x_sio_inb(sio_config_port, 0x61); |
512 | if (!base_addr) { | 512 | if (!base_addr) { |
513 | printk(KERN_ERR PFX "Base address not set.\n"); | 513 | pr_err("Base address not set\n"); |
514 | err = -ENODEV; | 514 | err = -ENODEV; |
515 | goto exit; | 515 | goto exit; |
516 | } | 516 | } |
517 | *addr = base_addr; | 517 | *addr = base_addr; |
518 | 518 | ||
519 | printk(KERN_INFO PFX "Found an SMSC SCH311%d chip at 0x%04x\n", | 519 | pr_info("Found an SMSC SCH311%d chip at 0x%04x\n", dev_id, base_addr); |
520 | dev_id, base_addr); | ||
521 | 520 | ||
522 | exit: | 521 | exit: |
523 | sch311x_sio_exit(sio_config_port); | 522 | sch311x_sio_exit(sio_config_port); |
diff --git a/drivers/watchdog/scx200_wdt.c b/drivers/watchdog/scx200_wdt.c index e67b76c0526c..8ae7c282d465 100644 --- a/drivers/watchdog/scx200_wdt.c +++ b/drivers/watchdog/scx200_wdt.c | |||
@@ -17,6 +17,8 @@ | |||
17 | of any nature resulting due to the use of this software. This | 17 | of any nature resulting due to the use of this software. This |
18 | software is provided AS-IS with no warranties. */ | 18 | software is provided AS-IS with no warranties. */ |
19 | 19 | ||
20 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
21 | |||
20 | #include <linux/module.h> | 22 | #include <linux/module.h> |
21 | #include <linux/moduleparam.h> | 23 | #include <linux/moduleparam.h> |
22 | #include <linux/init.h> | 24 | #include <linux/init.h> |
@@ -30,7 +32,7 @@ | |||
30 | #include <linux/uaccess.h> | 32 | #include <linux/uaccess.h> |
31 | #include <linux/io.h> | 33 | #include <linux/io.h> |
32 | 34 | ||
33 | #define NAME "scx200_wdt" | 35 | #define DEBUG |
34 | 36 | ||
35 | MODULE_AUTHOR("Christer Weinigel <wingel@nano-system.com>"); | 37 | MODULE_AUTHOR("Christer Weinigel <wingel@nano-system.com>"); |
36 | MODULE_DESCRIPTION("NatSemi SCx200 Watchdog Driver"); | 38 | MODULE_DESCRIPTION("NatSemi SCx200 Watchdog Driver"); |
@@ -41,8 +43,8 @@ static int margin = 60; /* in seconds */ | |||
41 | module_param(margin, int, 0); | 43 | module_param(margin, int, 0); |
42 | MODULE_PARM_DESC(margin, "Watchdog margin in seconds"); | 44 | MODULE_PARM_DESC(margin, "Watchdog margin in seconds"); |
43 | 45 | ||
44 | static int nowayout = WATCHDOG_NOWAYOUT; | 46 | static bool nowayout = WATCHDOG_NOWAYOUT; |
45 | module_param(nowayout, int, 0); | 47 | module_param(nowayout, bool, 0); |
46 | MODULE_PARM_DESC(nowayout, "Disable watchdog shutdown on close"); | 48 | MODULE_PARM_DESC(nowayout, "Disable watchdog shutdown on close"); |
47 | 49 | ||
48 | static u16 wdto_restart; | 50 | static u16 wdto_restart; |
@@ -66,14 +68,13 @@ static void scx200_wdt_ping(void) | |||
66 | 68 | ||
67 | static void scx200_wdt_update_margin(void) | 69 | static void scx200_wdt_update_margin(void) |
68 | { | 70 | { |
69 | printk(KERN_INFO NAME ": timer margin %d seconds\n", margin); | 71 | pr_info("timer margin %d seconds\n", margin); |
70 | wdto_restart = margin * W_SCALE; | 72 | wdto_restart = margin * W_SCALE; |
71 | } | 73 | } |
72 | 74 | ||
73 | static void scx200_wdt_enable(void) | 75 | static void scx200_wdt_enable(void) |
74 | { | 76 | { |
75 | printk(KERN_DEBUG NAME ": enabling watchdog timer, wdto_restart = %d\n", | 77 | pr_debug("enabling watchdog timer, wdto_restart = %d\n", wdto_restart); |
76 | wdto_restart); | ||
77 | 78 | ||
78 | spin_lock(&scx_lock); | 79 | spin_lock(&scx_lock); |
79 | outw(0, scx200_cb_base + SCx200_WDT_WDTO); | 80 | outw(0, scx200_cb_base + SCx200_WDT_WDTO); |
@@ -86,7 +87,7 @@ static void scx200_wdt_enable(void) | |||
86 | 87 | ||
87 | static void scx200_wdt_disable(void) | 88 | static void scx200_wdt_disable(void) |
88 | { | 89 | { |
89 | printk(KERN_DEBUG NAME ": disabling watchdog timer\n"); | 90 | pr_debug("disabling watchdog timer\n"); |
90 | 91 | ||
91 | spin_lock(&scx_lock); | 92 | spin_lock(&scx_lock); |
92 | outw(0, scx200_cb_base + SCx200_WDT_WDTO); | 93 | outw(0, scx200_cb_base + SCx200_WDT_WDTO); |
@@ -108,9 +109,7 @@ static int scx200_wdt_open(struct inode *inode, struct file *file) | |||
108 | static int scx200_wdt_release(struct inode *inode, struct file *file) | 109 | static int scx200_wdt_release(struct inode *inode, struct file *file) |
109 | { | 110 | { |
110 | if (expect_close != 42) | 111 | if (expect_close != 42) |
111 | printk(KERN_WARNING NAME | 112 | pr_warn("watchdog device closed unexpectedly, will not disable the watchdog timer\n"); |
112 | ": watchdog device closed unexpectedly, " | ||
113 | "will not disable the watchdog timer\n"); | ||
114 | else if (!nowayout) | 113 | else if (!nowayout) |
115 | scx200_wdt_disable(); | 114 | scx200_wdt_disable(); |
116 | expect_close = 0; | 115 | expect_close = 0; |
@@ -219,7 +218,7 @@ static int __init scx200_wdt_init(void) | |||
219 | { | 218 | { |
220 | int r; | 219 | int r; |
221 | 220 | ||
222 | printk(KERN_DEBUG NAME ": NatSemi SCx200 Watchdog Driver\n"); | 221 | pr_debug("NatSemi SCx200 Watchdog Driver\n"); |
223 | 222 | ||
224 | /* check that we have found the configuration block */ | 223 | /* check that we have found the configuration block */ |
225 | if (!scx200_cb_present()) | 224 | if (!scx200_cb_present()) |
@@ -228,7 +227,7 @@ static int __init scx200_wdt_init(void) | |||
228 | if (!request_region(scx200_cb_base + SCx200_WDT_OFFSET, | 227 | if (!request_region(scx200_cb_base + SCx200_WDT_OFFSET, |
229 | SCx200_WDT_SIZE, | 228 | SCx200_WDT_SIZE, |
230 | "NatSemi SCx200 Watchdog")) { | 229 | "NatSemi SCx200 Watchdog")) { |
231 | printk(KERN_WARNING NAME ": watchdog I/O region busy\n"); | 230 | pr_warn("watchdog I/O region busy\n"); |
232 | return -EBUSY; | 231 | return -EBUSY; |
233 | } | 232 | } |
234 | 233 | ||
@@ -237,7 +236,7 @@ static int __init scx200_wdt_init(void) | |||
237 | 236 | ||
238 | r = register_reboot_notifier(&scx200_wdt_notifier); | 237 | r = register_reboot_notifier(&scx200_wdt_notifier); |
239 | if (r) { | 238 | if (r) { |
240 | printk(KERN_ERR NAME ": unable to register reboot notifier"); | 239 | pr_err("unable to register reboot notifier\n"); |
241 | release_region(scx200_cb_base + SCx200_WDT_OFFSET, | 240 | release_region(scx200_cb_base + SCx200_WDT_OFFSET, |
242 | SCx200_WDT_SIZE); | 241 | SCx200_WDT_SIZE); |
243 | return r; | 242 | return r; |
diff --git a/drivers/watchdog/shwdt.c b/drivers/watchdog/shwdt.c index a267dc078daf..93958a7763e6 100644 --- a/drivers/watchdog/shwdt.c +++ b/drivers/watchdog/shwdt.c | |||
@@ -17,6 +17,9 @@ | |||
17 | * Added expect close support, made emulated timeout runtime changeable | 17 | * Added expect close support, made emulated timeout runtime changeable |
18 | * general cleanups, add some ioctls | 18 | * general cleanups, add some ioctls |
19 | */ | 19 | */ |
20 | |||
21 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
22 | |||
20 | #include <linux/module.h> | 23 | #include <linux/module.h> |
21 | #include <linux/moduleparam.h> | 24 | #include <linux/moduleparam.h> |
22 | #include <linux/platform_device.h> | 25 | #include <linux/platform_device.h> |
@@ -72,7 +75,7 @@ static DEFINE_SPINLOCK(shwdt_lock); | |||
72 | 75 | ||
73 | #define WATCHDOG_HEARTBEAT 30 /* 30 sec default heartbeat */ | 76 | #define WATCHDOG_HEARTBEAT 30 /* 30 sec default heartbeat */ |
74 | static int heartbeat = WATCHDOG_HEARTBEAT; /* in seconds */ | 77 | static int heartbeat = WATCHDOG_HEARTBEAT; /* in seconds */ |
75 | static int nowayout = WATCHDOG_NOWAYOUT; | 78 | static bool nowayout = WATCHDOG_NOWAYOUT; |
76 | static unsigned long next_heartbeat; | 79 | static unsigned long next_heartbeat; |
77 | 80 | ||
78 | struct sh_wdt { | 81 | struct sh_wdt { |
@@ -440,20 +443,20 @@ static int __init sh_wdt_init(void) | |||
440 | clock_division_ratio > 0x7)) { | 443 | clock_division_ratio > 0x7)) { |
441 | clock_division_ratio = WTCSR_CKS_4096; | 444 | clock_division_ratio = WTCSR_CKS_4096; |
442 | 445 | ||
443 | pr_info("%s: divisor must be 0x5<=x<=0x7, using %d\n", | 446 | pr_info("divisor must be 0x5<=x<=0x7, using %d\n", |
444 | DRV_NAME, clock_division_ratio); | 447 | clock_division_ratio); |
445 | } | 448 | } |
446 | 449 | ||
447 | rc = sh_wdt_set_heartbeat(heartbeat); | 450 | rc = sh_wdt_set_heartbeat(heartbeat); |
448 | if (unlikely(rc)) { | 451 | if (unlikely(rc)) { |
449 | heartbeat = WATCHDOG_HEARTBEAT; | 452 | heartbeat = WATCHDOG_HEARTBEAT; |
450 | 453 | ||
451 | pr_info("%s: heartbeat value must be 1<=x<=3600, using %d\n", | 454 | pr_info("heartbeat value must be 1<=x<=3600, using %d\n", |
452 | DRV_NAME, heartbeat); | 455 | heartbeat); |
453 | } | 456 | } |
454 | 457 | ||
455 | pr_info("%s: configured with heartbeat=%d sec (nowayout=%d)\n", | 458 | pr_info("configured with heartbeat=%d sec (nowayout=%d)\n", |
456 | DRV_NAME, heartbeat, nowayout); | 459 | heartbeat, nowayout); |
457 | 460 | ||
458 | return platform_driver_register(&sh_wdt_driver); | 461 | return platform_driver_register(&sh_wdt_driver); |
459 | } | 462 | } |
@@ -481,7 +484,7 @@ MODULE_PARM_DESC(heartbeat, | |||
481 | "Watchdog heartbeat in seconds. (1 <= heartbeat <= 3600, default=" | 484 | "Watchdog heartbeat in seconds. (1 <= heartbeat <= 3600, default=" |
482 | __MODULE_STRING(WATCHDOG_HEARTBEAT) ")"); | 485 | __MODULE_STRING(WATCHDOG_HEARTBEAT) ")"); |
483 | 486 | ||
484 | module_param(nowayout, int, 0); | 487 | module_param(nowayout, bool, 0); |
485 | MODULE_PARM_DESC(nowayout, | 488 | MODULE_PARM_DESC(nowayout, |
486 | "Watchdog cannot be stopped once started (default=" | 489 | "Watchdog cannot be stopped once started (default=" |
487 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 490 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
diff --git a/drivers/watchdog/smsc37b787_wdt.c b/drivers/watchdog/smsc37b787_wdt.c index 97b8184614ae..4c3400574ada 100644 --- a/drivers/watchdog/smsc37b787_wdt.c +++ b/drivers/watchdog/smsc37b787_wdt.c | |||
@@ -43,6 +43,8 @@ | |||
43 | * Documentation/watchdog/wdt.txt | 43 | * Documentation/watchdog/wdt.txt |
44 | */ | 44 | */ |
45 | 45 | ||
46 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
47 | |||
46 | #include <linux/module.h> | 48 | #include <linux/module.h> |
47 | #include <linux/moduleparam.h> | 49 | #include <linux/moduleparam.h> |
48 | #include <linux/types.h> | 50 | #include <linux/types.h> |
@@ -70,7 +72,6 @@ | |||
70 | #define UNIT_SECOND 0 | 72 | #define UNIT_SECOND 0 |
71 | #define UNIT_MINUTE 1 | 73 | #define UNIT_MINUTE 1 |
72 | 74 | ||
73 | #define MODNAME "smsc37b787_wdt: " | ||
74 | #define VERSION "1.1" | 75 | #define VERSION "1.1" |
75 | 76 | ||
76 | #define IOPORT 0x3F0 | 77 | #define IOPORT 0x3F0 |
@@ -85,7 +86,7 @@ static char expect_close; /* is the close expected? */ | |||
85 | 86 | ||
86 | static DEFINE_SPINLOCK(io_lock);/* to guard the watchdog from io races */ | 87 | static DEFINE_SPINLOCK(io_lock);/* to guard the watchdog from io races */ |
87 | 88 | ||
88 | static int nowayout = WATCHDOG_NOWAYOUT; | 89 | static bool nowayout = WATCHDOG_NOWAYOUT; |
89 | 90 | ||
90 | /* -- Low level function ----------------------------------------*/ | 91 | /* -- Low level function ----------------------------------------*/ |
91 | 92 | ||
@@ -363,8 +364,7 @@ static int wb_smsc_wdt_open(struct inode *inode, struct file *file) | |||
363 | /* Reload and activate timer */ | 364 | /* Reload and activate timer */ |
364 | wb_smsc_wdt_enable(); | 365 | wb_smsc_wdt_enable(); |
365 | 366 | ||
366 | printk(KERN_INFO MODNAME | 367 | pr_info("Watchdog enabled. Timeout set to %d %s\n", |
367 | "Watchdog enabled. Timeout set to %d %s.\n", | ||
368 | timeout, (unit == UNIT_SECOND) ? "second(s)" : "minute(s)"); | 368 | timeout, (unit == UNIT_SECOND) ? "second(s)" : "minute(s)"); |
369 | 369 | ||
370 | return nonseekable_open(inode, file); | 370 | return nonseekable_open(inode, file); |
@@ -378,11 +378,9 @@ static int wb_smsc_wdt_release(struct inode *inode, struct file *file) | |||
378 | 378 | ||
379 | if (expect_close == 42) { | 379 | if (expect_close == 42) { |
380 | wb_smsc_wdt_disable(); | 380 | wb_smsc_wdt_disable(); |
381 | printk(KERN_INFO MODNAME | 381 | pr_info("Watchdog disabled, sleeping again...\n"); |
382 | "Watchdog disabled, sleeping again...\n"); | ||
383 | } else { | 382 | } else { |
384 | printk(KERN_CRIT MODNAME | 383 | pr_crit("Unexpected close, not stopping watchdog!\n"); |
385 | "Unexpected close, not stopping watchdog!\n"); | ||
386 | wb_smsc_wdt_reset_timer(); | 384 | wb_smsc_wdt_reset_timer(); |
387 | } | 385 | } |
388 | 386 | ||
@@ -534,12 +532,11 @@ static int __init wb_smsc_wdt_init(void) | |||
534 | { | 532 | { |
535 | int ret; | 533 | int ret; |
536 | 534 | ||
537 | printk(KERN_INFO "SMsC 37B787 watchdog component driver " | 535 | pr_info("SMsC 37B787 watchdog component driver " |
538 | VERSION " initialising...\n"); | 536 | VERSION " initialising...\n"); |
539 | 537 | ||
540 | if (!request_region(IOPORT, IOPORT_SIZE, "SMsC 37B787 watchdog")) { | 538 | if (!request_region(IOPORT, IOPORT_SIZE, "SMsC 37B787 watchdog")) { |
541 | printk(KERN_ERR MODNAME "Unable to register IO port %#x\n", | 539 | pr_err("Unable to register IO port %#x\n", IOPORT); |
542 | IOPORT); | ||
543 | ret = -EBUSY; | 540 | ret = -EBUSY; |
544 | goto out_pnp; | 541 | goto out_pnp; |
545 | } | 542 | } |
@@ -553,25 +550,22 @@ static int __init wb_smsc_wdt_init(void) | |||
553 | 550 | ||
554 | ret = register_reboot_notifier(&wb_smsc_wdt_notifier); | 551 | ret = register_reboot_notifier(&wb_smsc_wdt_notifier); |
555 | if (ret) { | 552 | if (ret) { |
556 | printk(KERN_ERR MODNAME | 553 | pr_err("Unable to register reboot notifier err = %d\n", ret); |
557 | "Unable to register reboot notifier err = %d\n", ret); | ||
558 | goto out_io; | 554 | goto out_io; |
559 | } | 555 | } |
560 | 556 | ||
561 | ret = misc_register(&wb_smsc_wdt_miscdev); | 557 | ret = misc_register(&wb_smsc_wdt_miscdev); |
562 | if (ret) { | 558 | if (ret) { |
563 | printk(KERN_ERR MODNAME | 559 | pr_err("Unable to register miscdev on minor %d\n", |
564 | "Unable to register miscdev on minor %d\n", | 560 | WATCHDOG_MINOR); |
565 | WATCHDOG_MINOR); | ||
566 | goto out_rbt; | 561 | goto out_rbt; |
567 | } | 562 | } |
568 | 563 | ||
569 | /* output info */ | 564 | /* output info */ |
570 | printk(KERN_INFO MODNAME "Timeout set to %d %s.\n", | 565 | pr_info("Timeout set to %d %s\n", |
571 | timeout, (unit == UNIT_SECOND) ? "second(s)" : "minute(s)"); | 566 | timeout, (unit == UNIT_SECOND) ? "second(s)" : "minute(s)"); |
572 | printk(KERN_INFO MODNAME | 567 | pr_info("Watchdog initialized and sleeping (nowayout=%d)...\n", |
573 | "Watchdog initialized and sleeping (nowayout=%d)...\n", | 568 | nowayout); |
574 | nowayout); | ||
575 | out_clean: | 569 | out_clean: |
576 | return ret; | 570 | return ret; |
577 | 571 | ||
@@ -592,14 +586,14 @@ static void __exit wb_smsc_wdt_exit(void) | |||
592 | /* Stop the timer before we leave */ | 586 | /* Stop the timer before we leave */ |
593 | if (!nowayout) { | 587 | if (!nowayout) { |
594 | wb_smsc_wdt_shutdown(); | 588 | wb_smsc_wdt_shutdown(); |
595 | printk(KERN_INFO MODNAME "Watchdog disabled.\n"); | 589 | pr_info("Watchdog disabled\n"); |
596 | } | 590 | } |
597 | 591 | ||
598 | misc_deregister(&wb_smsc_wdt_miscdev); | 592 | misc_deregister(&wb_smsc_wdt_miscdev); |
599 | unregister_reboot_notifier(&wb_smsc_wdt_notifier); | 593 | unregister_reboot_notifier(&wb_smsc_wdt_notifier); |
600 | release_region(IOPORT, IOPORT_SIZE); | 594 | release_region(IOPORT, IOPORT_SIZE); |
601 | 595 | ||
602 | printk(KERN_INFO "SMsC 37B787 watchdog component driver removed.\n"); | 596 | pr_info("SMsC 37B787 watchdog component driver removed\n"); |
603 | } | 597 | } |
604 | 598 | ||
605 | module_init(wb_smsc_wdt_init); | 599 | module_init(wb_smsc_wdt_init); |
@@ -621,7 +615,7 @@ MODULE_PARM_DESC(unit, | |||
621 | module_param(timeout, int, 0); | 615 | module_param(timeout, int, 0); |
622 | MODULE_PARM_DESC(timeout, "range is 1-255 units, default is 60"); | 616 | MODULE_PARM_DESC(timeout, "range is 1-255 units, default is 60"); |
623 | 617 | ||
624 | module_param(nowayout, int, 0); | 618 | module_param(nowayout, bool, 0); |
625 | MODULE_PARM_DESC(nowayout, | 619 | MODULE_PARM_DESC(nowayout, |
626 | "Watchdog cannot be stopped once started (default=" | 620 | "Watchdog cannot be stopped once started (default=" |
627 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 621 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
diff --git a/drivers/watchdog/softdog.c b/drivers/watchdog/softdog.c index bf16ffb4d21e..fe83beb8f1b7 100644 --- a/drivers/watchdog/softdog.c +++ b/drivers/watchdog/softdog.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * SoftDog 0.07: A Software Watchdog Device | 2 | * SoftDog: A Software Watchdog Device |
3 | * | 3 | * |
4 | * (c) Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk>, | 4 | * (c) Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk>, |
5 | * All Rights Reserved. | 5 | * All Rights Reserved. |
@@ -36,45 +36,37 @@ | |||
36 | * Added Matt Domsch's nowayout module option. | 36 | * Added Matt Domsch's nowayout module option. |
37 | */ | 37 | */ |
38 | 38 | ||
39 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
40 | |||
39 | #include <linux/module.h> | 41 | #include <linux/module.h> |
40 | #include <linux/moduleparam.h> | 42 | #include <linux/moduleparam.h> |
41 | #include <linux/types.h> | 43 | #include <linux/types.h> |
42 | #include <linux/timer.h> | 44 | #include <linux/timer.h> |
43 | #include <linux/miscdevice.h> | 45 | #include <linux/miscdevice.h> |
44 | #include <linux/watchdog.h> | 46 | #include <linux/watchdog.h> |
45 | #include <linux/fs.h> | ||
46 | #include <linux/notifier.h> | 47 | #include <linux/notifier.h> |
47 | #include <linux/reboot.h> | 48 | #include <linux/reboot.h> |
48 | #include <linux/init.h> | 49 | #include <linux/init.h> |
49 | #include <linux/jiffies.h> | 50 | #include <linux/jiffies.h> |
50 | #include <linux/uaccess.h> | ||
51 | #include <linux/kernel.h> | 51 | #include <linux/kernel.h> |
52 | 52 | ||
53 | #define PFX "SoftDog: " | ||
54 | |||
55 | #define TIMER_MARGIN 60 /* Default is 60 seconds */ | 53 | #define TIMER_MARGIN 60 /* Default is 60 seconds */ |
56 | static int soft_margin = TIMER_MARGIN; /* in seconds */ | 54 | static unsigned int soft_margin = TIMER_MARGIN; /* in seconds */ |
57 | module_param(soft_margin, int, 0); | 55 | module_param(soft_margin, uint, 0); |
58 | MODULE_PARM_DESC(soft_margin, | 56 | MODULE_PARM_DESC(soft_margin, |
59 | "Watchdog soft_margin in seconds. (0 < soft_margin < 65536, default=" | 57 | "Watchdog soft_margin in seconds. (0 < soft_margin < 65536, default=" |
60 | __MODULE_STRING(TIMER_MARGIN) ")"); | 58 | __MODULE_STRING(TIMER_MARGIN) ")"); |
61 | 59 | ||
62 | static int nowayout = WATCHDOG_NOWAYOUT; | 60 | static bool nowayout = WATCHDOG_NOWAYOUT; |
63 | module_param(nowayout, int, 0); | 61 | module_param(nowayout, bool, 0); |
64 | MODULE_PARM_DESC(nowayout, | 62 | MODULE_PARM_DESC(nowayout, |
65 | "Watchdog cannot be stopped once started (default=" | 63 | "Watchdog cannot be stopped once started (default=" |
66 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 64 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
67 | 65 | ||
68 | #ifdef ONLY_TESTING | ||
69 | static int soft_noboot = 1; | ||
70 | #else | ||
71 | static int soft_noboot = 0; | 66 | static int soft_noboot = 0; |
72 | #endif /* ONLY_TESTING */ | ||
73 | |||
74 | module_param(soft_noboot, int, 0); | 67 | module_param(soft_noboot, int, 0); |
75 | MODULE_PARM_DESC(soft_noboot, | 68 | MODULE_PARM_DESC(soft_noboot, |
76 | "Softdog action, set to 1 to ignore reboots, 0 to reboot " | 69 | "Softdog action, set to 1 to ignore reboots, 0 to reboot (default=0)"); |
77 | "(default depends on ONLY_TESTING)"); | ||
78 | 70 | ||
79 | static int soft_panic; | 71 | static int soft_panic; |
80 | module_param(soft_panic, int, 0); | 72 | module_param(soft_panic, int, 0); |
@@ -89,9 +81,6 @@ static void watchdog_fire(unsigned long); | |||
89 | 81 | ||
90 | static struct timer_list watchdog_ticktock = | 82 | static struct timer_list watchdog_ticktock = |
91 | TIMER_INITIALIZER(watchdog_fire, 0, 0); | 83 | TIMER_INITIALIZER(watchdog_fire, 0, 0); |
92 | static unsigned long driver_open, orphan_timer; | ||
93 | static char expect_close; | ||
94 | |||
95 | 84 | ||
96 | /* | 85 | /* |
97 | * If the timer expires.. | 86 | * If the timer expires.. |
@@ -99,18 +88,15 @@ static char expect_close; | |||
99 | 88 | ||
100 | static void watchdog_fire(unsigned long data) | 89 | static void watchdog_fire(unsigned long data) |
101 | { | 90 | { |
102 | if (test_and_clear_bit(0, &orphan_timer)) | ||
103 | module_put(THIS_MODULE); | ||
104 | |||
105 | if (soft_noboot) | 91 | if (soft_noboot) |
106 | printk(KERN_CRIT PFX "Triggered - Reboot ignored.\n"); | 92 | pr_crit("Triggered - Reboot ignored\n"); |
107 | else if (soft_panic) { | 93 | else if (soft_panic) { |
108 | printk(KERN_CRIT PFX "Initiating panic.\n"); | 94 | pr_crit("Initiating panic\n"); |
109 | panic("Software Watchdog Timer expired."); | 95 | panic("Software Watchdog Timer expired"); |
110 | } else { | 96 | } else { |
111 | printk(KERN_CRIT PFX "Initiating system reboot.\n"); | 97 | pr_crit("Initiating system reboot\n"); |
112 | emergency_restart(); | 98 | emergency_restart(); |
113 | printk(KERN_CRIT PFX "Reboot didn't ?????\n"); | 99 | pr_crit("Reboot didn't ?????\n"); |
114 | } | 100 | } |
115 | } | 101 | } |
116 | 102 | ||
@@ -118,127 +104,24 @@ static void watchdog_fire(unsigned long data) | |||
118 | * Softdog operations | 104 | * Softdog operations |
119 | */ | 105 | */ |
120 | 106 | ||
121 | static int softdog_keepalive(void) | 107 | static int softdog_ping(struct watchdog_device *w) |
122 | { | 108 | { |
123 | mod_timer(&watchdog_ticktock, jiffies+(soft_margin*HZ)); | 109 | mod_timer(&watchdog_ticktock, jiffies+(w->timeout*HZ)); |
124 | return 0; | 110 | return 0; |
125 | } | 111 | } |
126 | 112 | ||
127 | static int softdog_stop(void) | 113 | static int softdog_stop(struct watchdog_device *w) |
128 | { | 114 | { |
129 | del_timer(&watchdog_ticktock); | 115 | del_timer(&watchdog_ticktock); |
130 | return 0; | 116 | return 0; |
131 | } | 117 | } |
132 | 118 | ||
133 | static int softdog_set_heartbeat(int t) | 119 | static int softdog_set_timeout(struct watchdog_device *w, unsigned int t) |
134 | { | ||
135 | if ((t < 0x0001) || (t > 0xFFFF)) | ||
136 | return -EINVAL; | ||
137 | |||
138 | soft_margin = t; | ||
139 | return 0; | ||
140 | } | ||
141 | |||
142 | /* | ||
143 | * /dev/watchdog handling | ||
144 | */ | ||
145 | |||
146 | static int softdog_open(struct inode *inode, struct file *file) | ||
147 | { | ||
148 | if (test_and_set_bit(0, &driver_open)) | ||
149 | return -EBUSY; | ||
150 | if (!test_and_clear_bit(0, &orphan_timer)) | ||
151 | __module_get(THIS_MODULE); | ||
152 | /* | ||
153 | * Activate timer | ||
154 | */ | ||
155 | softdog_keepalive(); | ||
156 | return nonseekable_open(inode, file); | ||
157 | } | ||
158 | |||
159 | static int softdog_release(struct inode *inode, struct file *file) | ||
160 | { | 120 | { |
161 | /* | 121 | w->timeout = t; |
162 | * Shut off the timer. | ||
163 | * Lock it in if it's a module and we set nowayout | ||
164 | */ | ||
165 | if (expect_close == 42) { | ||
166 | softdog_stop(); | ||
167 | module_put(THIS_MODULE); | ||
168 | } else { | ||
169 | printk(KERN_CRIT PFX | ||
170 | "Unexpected close, not stopping watchdog!\n"); | ||
171 | set_bit(0, &orphan_timer); | ||
172 | softdog_keepalive(); | ||
173 | } | ||
174 | clear_bit(0, &driver_open); | ||
175 | expect_close = 0; | ||
176 | return 0; | 122 | return 0; |
177 | } | 123 | } |
178 | 124 | ||
179 | static ssize_t softdog_write(struct file *file, const char __user *data, | ||
180 | size_t len, loff_t *ppos) | ||
181 | { | ||
182 | /* | ||
183 | * Refresh the timer. | ||
184 | */ | ||
185 | if (len) { | ||
186 | if (!nowayout) { | ||
187 | size_t i; | ||
188 | |||
189 | /* In case it was set long ago */ | ||
190 | expect_close = 0; | ||
191 | |||
192 | for (i = 0; i != len; i++) { | ||
193 | char c; | ||
194 | |||
195 | if (get_user(c, data + i)) | ||
196 | return -EFAULT; | ||
197 | if (c == 'V') | ||
198 | expect_close = 42; | ||
199 | } | ||
200 | } | ||
201 | softdog_keepalive(); | ||
202 | } | ||
203 | return len; | ||
204 | } | ||
205 | |||
206 | static long softdog_ioctl(struct file *file, unsigned int cmd, | ||
207 | unsigned long arg) | ||
208 | { | ||
209 | void __user *argp = (void __user *)arg; | ||
210 | int __user *p = argp; | ||
211 | int new_margin; | ||
212 | static const struct watchdog_info ident = { | ||
213 | .options = WDIOF_SETTIMEOUT | | ||
214 | WDIOF_KEEPALIVEPING | | ||
215 | WDIOF_MAGICCLOSE, | ||
216 | .firmware_version = 0, | ||
217 | .identity = "Software Watchdog", | ||
218 | }; | ||
219 | switch (cmd) { | ||
220 | case WDIOC_GETSUPPORT: | ||
221 | return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0; | ||
222 | case WDIOC_GETSTATUS: | ||
223 | case WDIOC_GETBOOTSTATUS: | ||
224 | return put_user(0, p); | ||
225 | case WDIOC_KEEPALIVE: | ||
226 | softdog_keepalive(); | ||
227 | return 0; | ||
228 | case WDIOC_SETTIMEOUT: | ||
229 | if (get_user(new_margin, p)) | ||
230 | return -EFAULT; | ||
231 | if (softdog_set_heartbeat(new_margin)) | ||
232 | return -EINVAL; | ||
233 | softdog_keepalive(); | ||
234 | /* Fall */ | ||
235 | case WDIOC_GETTIMEOUT: | ||
236 | return put_user(soft_margin, p); | ||
237 | default: | ||
238 | return -ENOTTY; | ||
239 | } | ||
240 | } | ||
241 | |||
242 | /* | 125 | /* |
243 | * Notifier for system down | 126 | * Notifier for system down |
244 | */ | 127 | */ |
@@ -248,7 +131,7 @@ static int softdog_notify_sys(struct notifier_block *this, unsigned long code, | |||
248 | { | 131 | { |
249 | if (code == SYS_DOWN || code == SYS_HALT) | 132 | if (code == SYS_DOWN || code == SYS_HALT) |
250 | /* Turn the WDT off */ | 133 | /* Turn the WDT off */ |
251 | softdog_stop(); | 134 | softdog_stop(NULL); |
252 | return NOTIFY_DONE; | 135 | return NOTIFY_DONE; |
253 | } | 136 | } |
254 | 137 | ||
@@ -256,28 +139,29 @@ static int softdog_notify_sys(struct notifier_block *this, unsigned long code, | |||
256 | * Kernel Interfaces | 139 | * Kernel Interfaces |
257 | */ | 140 | */ |
258 | 141 | ||
259 | static const struct file_operations softdog_fops = { | 142 | static struct notifier_block softdog_notifier = { |
260 | .owner = THIS_MODULE, | 143 | .notifier_call = softdog_notify_sys, |
261 | .llseek = no_llseek, | ||
262 | .write = softdog_write, | ||
263 | .unlocked_ioctl = softdog_ioctl, | ||
264 | .open = softdog_open, | ||
265 | .release = softdog_release, | ||
266 | }; | 144 | }; |
267 | 145 | ||
268 | static struct miscdevice softdog_miscdev = { | 146 | static struct watchdog_info softdog_info = { |
269 | .minor = WATCHDOG_MINOR, | 147 | .identity = "Software Watchdog", |
270 | .name = "watchdog", | 148 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, |
271 | .fops = &softdog_fops, | ||
272 | }; | 149 | }; |
273 | 150 | ||
274 | static struct notifier_block softdog_notifier = { | 151 | static struct watchdog_ops softdog_ops = { |
275 | .notifier_call = softdog_notify_sys, | 152 | .owner = THIS_MODULE, |
153 | .start = softdog_ping, | ||
154 | .stop = softdog_stop, | ||
155 | .ping = softdog_ping, | ||
156 | .set_timeout = softdog_set_timeout, | ||
276 | }; | 157 | }; |
277 | 158 | ||
278 | static char banner[] __initdata = KERN_INFO "Software Watchdog Timer: 0.07 " | 159 | static struct watchdog_device softdog_dev = { |
279 | "initialized. soft_noboot=%d soft_margin=%d sec soft_panic=%d " | 160 | .info = &softdog_info, |
280 | "(nowayout= %d)\n"; | 161 | .ops = &softdog_ops, |
162 | .min_timeout = 1, | ||
163 | .max_timeout = 0xFFFF | ||
164 | }; | ||
281 | 165 | ||
282 | static int __init watchdog_init(void) | 166 | static int __init watchdog_init(void) |
283 | { | 167 | { |
@@ -285,37 +169,36 @@ static int __init watchdog_init(void) | |||
285 | 169 | ||
286 | /* Check that the soft_margin value is within it's range; | 170 | /* Check that the soft_margin value is within it's range; |
287 | if not reset to the default */ | 171 | if not reset to the default */ |
288 | if (softdog_set_heartbeat(soft_margin)) { | 172 | if (soft_margin < 1 || soft_margin > 65535) { |
289 | softdog_set_heartbeat(TIMER_MARGIN); | 173 | pr_info("soft_margin must be 0 < soft_margin < 65536, using %d\n", |
290 | printk(KERN_INFO PFX | ||
291 | "soft_margin must be 0 < soft_margin < 65536, using %d\n", | ||
292 | TIMER_MARGIN); | 174 | TIMER_MARGIN); |
175 | return -EINVAL; | ||
293 | } | 176 | } |
177 | softdog_dev.timeout = soft_margin; | ||
178 | |||
179 | watchdog_set_nowayout(&softdog_dev, nowayout); | ||
294 | 180 | ||
295 | ret = register_reboot_notifier(&softdog_notifier); | 181 | ret = register_reboot_notifier(&softdog_notifier); |
296 | if (ret) { | 182 | if (ret) { |
297 | printk(KERN_ERR PFX | 183 | pr_err("cannot register reboot notifier (err=%d)\n", ret); |
298 | "cannot register reboot notifier (err=%d)\n", ret); | ||
299 | return ret; | 184 | return ret; |
300 | } | 185 | } |
301 | 186 | ||
302 | ret = misc_register(&softdog_miscdev); | 187 | ret = watchdog_register_device(&softdog_dev); |
303 | if (ret) { | 188 | if (ret) { |
304 | printk(KERN_ERR PFX | ||
305 | "cannot register miscdev on minor=%d (err=%d)\n", | ||
306 | WATCHDOG_MINOR, ret); | ||
307 | unregister_reboot_notifier(&softdog_notifier); | 189 | unregister_reboot_notifier(&softdog_notifier); |
308 | return ret; | 190 | return ret; |
309 | } | 191 | } |
310 | 192 | ||
311 | printk(banner, soft_noboot, soft_margin, soft_panic, nowayout); | 193 | pr_info("Software Watchdog Timer: 0.08 initialized. soft_noboot=%d soft_margin=%d sec soft_panic=%d (nowayout=%d)\n", |
194 | soft_noboot, soft_margin, soft_panic, nowayout); | ||
312 | 195 | ||
313 | return 0; | 196 | return 0; |
314 | } | 197 | } |
315 | 198 | ||
316 | static void __exit watchdog_exit(void) | 199 | static void __exit watchdog_exit(void) |
317 | { | 200 | { |
318 | misc_deregister(&softdog_miscdev); | 201 | watchdog_unregister_device(&softdog_dev); |
319 | unregister_reboot_notifier(&softdog_notifier); | 202 | unregister_reboot_notifier(&softdog_notifier); |
320 | } | 203 | } |
321 | 204 | ||
diff --git a/drivers/watchdog/sp5100_tco.c b/drivers/watchdog/sp5100_tco.c index 87e0527669d8..59108e48ada3 100644 --- a/drivers/watchdog/sp5100_tco.c +++ b/drivers/watchdog/sp5100_tco.c | |||
@@ -20,6 +20,8 @@ | |||
20 | * Includes, defines, variables, module parameters, ... | 20 | * Includes, defines, variables, module parameters, ... |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
24 | |||
23 | #include <linux/module.h> | 25 | #include <linux/module.h> |
24 | #include <linux/moduleparam.h> | 26 | #include <linux/moduleparam.h> |
25 | #include <linux/types.h> | 27 | #include <linux/types.h> |
@@ -39,7 +41,6 @@ | |||
39 | #define TCO_VERSION "0.01" | 41 | #define TCO_VERSION "0.01" |
40 | #define TCO_MODULE_NAME "SP5100 TCO timer" | 42 | #define TCO_MODULE_NAME "SP5100 TCO timer" |
41 | #define TCO_DRIVER_NAME TCO_MODULE_NAME ", v" TCO_VERSION | 43 | #define TCO_DRIVER_NAME TCO_MODULE_NAME ", v" TCO_VERSION |
42 | #define PFX TCO_MODULE_NAME ": " | ||
43 | 44 | ||
44 | /* internal variables */ | 45 | /* internal variables */ |
45 | static u32 tcobase_phys; | 46 | static u32 tcobase_phys; |
@@ -61,8 +62,8 @@ module_param(heartbeat, int, 0); | |||
61 | MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (default=" | 62 | MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (default=" |
62 | __MODULE_STRING(WATCHDOG_HEARTBEAT) ")"); | 63 | __MODULE_STRING(WATCHDOG_HEARTBEAT) ")"); |
63 | 64 | ||
64 | static int nowayout = WATCHDOG_NOWAYOUT; | 65 | static bool nowayout = WATCHDOG_NOWAYOUT; |
65 | module_param(nowayout, int, 0); | 66 | module_param(nowayout, bool, 0); |
66 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started" | 67 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started" |
67 | " (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 68 | " (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
68 | 69 | ||
@@ -143,8 +144,7 @@ static int sp5100_tco_release(struct inode *inode, struct file *file) | |||
143 | if (tco_expect_close == 42) { | 144 | if (tco_expect_close == 42) { |
144 | tco_timer_stop(); | 145 | tco_timer_stop(); |
145 | } else { | 146 | } else { |
146 | printk(KERN_CRIT PFX | 147 | pr_crit("Unexpected close, not stopping watchdog!\n"); |
147 | "Unexpected close, not stopping watchdog!\n"); | ||
148 | tco_timer_keepalive(); | 148 | tco_timer_keepalive(); |
149 | } | 149 | } |
150 | clear_bit(0, &timer_alive); | 150 | clear_bit(0, &timer_alive); |
@@ -290,8 +290,7 @@ static unsigned char __devinit sp5100_tco_setupdevice(void) | |||
290 | /* Request the IO ports used by this driver */ | 290 | /* Request the IO ports used by this driver */ |
291 | pm_iobase = SP5100_IO_PM_INDEX_REG; | 291 | pm_iobase = SP5100_IO_PM_INDEX_REG; |
292 | if (!request_region(pm_iobase, SP5100_PM_IOPORTS_SIZE, "SP5100 TCO")) { | 292 | if (!request_region(pm_iobase, SP5100_PM_IOPORTS_SIZE, "SP5100 TCO")) { |
293 | printk(KERN_ERR PFX "I/O address 0x%04x already in use\n", | 293 | pr_err("I/O address 0x%04x already in use\n", pm_iobase); |
294 | pm_iobase); | ||
295 | goto exit; | 294 | goto exit; |
296 | } | 295 | } |
297 | 296 | ||
@@ -308,15 +307,14 @@ static unsigned char __devinit sp5100_tco_setupdevice(void) | |||
308 | 307 | ||
309 | if (!request_mem_region_exclusive(val, SP5100_WDT_MEM_MAP_SIZE, | 308 | if (!request_mem_region_exclusive(val, SP5100_WDT_MEM_MAP_SIZE, |
310 | "SP5100 TCO")) { | 309 | "SP5100 TCO")) { |
311 | printk(KERN_ERR PFX "mmio address 0x%04x already in use\n", | 310 | pr_err("mmio address 0x%04x already in use\n", val); |
312 | val); | ||
313 | goto unreg_region; | 311 | goto unreg_region; |
314 | } | 312 | } |
315 | tcobase_phys = val; | 313 | tcobase_phys = val; |
316 | 314 | ||
317 | tcobase = ioremap(val, SP5100_WDT_MEM_MAP_SIZE); | 315 | tcobase = ioremap(val, SP5100_WDT_MEM_MAP_SIZE); |
318 | if (tcobase == 0) { | 316 | if (tcobase == 0) { |
319 | printk(KERN_ERR PFX "failed to get tcobase address\n"); | 317 | pr_err("failed to get tcobase address\n"); |
320 | goto unreg_mem_region; | 318 | goto unreg_mem_region; |
321 | } | 319 | } |
322 | 320 | ||
@@ -375,9 +373,9 @@ static int __devinit sp5100_tco_init(struct platform_device *dev) | |||
375 | return -ENODEV; | 373 | return -ENODEV; |
376 | 374 | ||
377 | /* Check to see if last reboot was due to watchdog timeout */ | 375 | /* Check to see if last reboot was due to watchdog timeout */ |
378 | printk(KERN_INFO PFX "Watchdog reboot %sdetected.\n", | 376 | pr_info("Watchdog reboot %sdetected\n", |
379 | readl(SP5100_WDT_CONTROL(tcobase)) & SP5100_PM_WATCHDOG_FIRED ? | 377 | readl(SP5100_WDT_CONTROL(tcobase)) & SP5100_PM_WATCHDOG_FIRED ? |
380 | "" : "not "); | 378 | "" : "not "); |
381 | 379 | ||
382 | /* Clear out the old status */ | 380 | /* Clear out the old status */ |
383 | val = readl(SP5100_WDT_CONTROL(tcobase)); | 381 | val = readl(SP5100_WDT_CONTROL(tcobase)); |
@@ -395,16 +393,14 @@ static int __devinit sp5100_tco_init(struct platform_device *dev) | |||
395 | 393 | ||
396 | ret = misc_register(&sp5100_tco_miscdev); | 394 | ret = misc_register(&sp5100_tco_miscdev); |
397 | if (ret != 0) { | 395 | if (ret != 0) { |
398 | printk(KERN_ERR PFX "cannot register miscdev on minor=" | 396 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
399 | "%d (err=%d)\n", | ||
400 | WATCHDOG_MINOR, ret); | 397 | WATCHDOG_MINOR, ret); |
401 | goto exit; | 398 | goto exit; |
402 | } | 399 | } |
403 | 400 | ||
404 | clear_bit(0, &timer_alive); | 401 | clear_bit(0, &timer_alive); |
405 | 402 | ||
406 | printk(KERN_INFO PFX "initialized (0x%p). heartbeat=%d sec" | 403 | pr_info("initialized (0x%p). heartbeat=%d sec (nowayout=%d)\n", |
407 | " (nowayout=%d)\n", | ||
408 | tcobase, heartbeat, nowayout); | 404 | tcobase, heartbeat, nowayout); |
409 | 405 | ||
410 | return 0; | 406 | return 0; |
@@ -455,8 +451,7 @@ static int __init sp5100_tco_init_module(void) | |||
455 | { | 451 | { |
456 | int err; | 452 | int err; |
457 | 453 | ||
458 | printk(KERN_INFO PFX "SP5100 TCO WatchDog Timer Driver v%s\n", | 454 | pr_info("SP5100 TCO WatchDog Timer Driver v%s\n", TCO_VERSION); |
459 | TCO_VERSION); | ||
460 | 455 | ||
461 | err = platform_driver_register(&sp5100_tco_driver); | 456 | err = platform_driver_register(&sp5100_tco_driver); |
462 | if (err) | 457 | if (err) |
@@ -480,7 +475,7 @@ static void __exit sp5100_tco_cleanup_module(void) | |||
480 | { | 475 | { |
481 | platform_device_unregister(sp5100_tco_platform_device); | 476 | platform_device_unregister(sp5100_tco_platform_device); |
482 | platform_driver_unregister(&sp5100_tco_driver); | 477 | platform_driver_unregister(&sp5100_tco_driver); |
483 | printk(KERN_INFO PFX "SP5100 TCO Watchdog Module Unloaded.\n"); | 478 | pr_info("SP5100 TCO Watchdog Module Unloaded\n"); |
484 | } | 479 | } |
485 | 480 | ||
486 | module_init(sp5100_tco_init_module); | 481 | module_init(sp5100_tco_init_module); |
diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c index 3ff9e47bd218..bbb170e50055 100644 --- a/drivers/watchdog/sp805_wdt.c +++ b/drivers/watchdog/sp805_wdt.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/miscdevice.h> | 25 | #include <linux/miscdevice.h> |
26 | #include <linux/module.h> | 26 | #include <linux/module.h> |
27 | #include <linux/moduleparam.h> | 27 | #include <linux/moduleparam.h> |
28 | #include <linux/pm.h> | ||
28 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
29 | #include <linux/spinlock.h> | 30 | #include <linux/spinlock.h> |
30 | #include <linux/types.h> | 31 | #include <linux/types.h> |
@@ -55,14 +56,13 @@ | |||
55 | 56 | ||
56 | /** | 57 | /** |
57 | * struct sp805_wdt: sp805 wdt device structure | 58 | * struct sp805_wdt: sp805 wdt device structure |
58 | * | 59 | * @lock: spin lock protecting dev structure and io access |
59 | * lock: spin lock protecting dev structure and io access | 60 | * @base: base address of wdt |
60 | * base: base address of wdt | 61 | * @clk: clock structure of wdt |
61 | * clk: clock structure of wdt | 62 | * @adev: amba device structure of wdt |
62 | * dev: amba device structure of wdt | 63 | * @status: current status of wdt |
63 | * status: current status of wdt | 64 | * @load_val: load value to be set for current timeout |
64 | * load_val: load value to be set for current timeout | 65 | * @timeout: current programmed timeout |
65 | * timeout: current programmed timeout | ||
66 | */ | 66 | */ |
67 | struct sp805_wdt { | 67 | struct sp805_wdt { |
68 | spinlock_t lock; | 68 | spinlock_t lock; |
@@ -78,7 +78,7 @@ struct sp805_wdt { | |||
78 | 78 | ||
79 | /* local variables */ | 79 | /* local variables */ |
80 | static struct sp805_wdt *wdt; | 80 | static struct sp805_wdt *wdt; |
81 | static int nowayout = WATCHDOG_NOWAYOUT; | 81 | static bool nowayout = WATCHDOG_NOWAYOUT; |
82 | 82 | ||
83 | /* This routine finds load value that will reset system in required timout */ | 83 | /* This routine finds load value that will reset system in required timout */ |
84 | static void wdt_setload(unsigned int timeout) | 84 | static void wdt_setload(unsigned int timeout) |
@@ -113,10 +113,10 @@ static u32 wdt_timeleft(void) | |||
113 | rate = clk_get_rate(wdt->clk); | 113 | rate = clk_get_rate(wdt->clk); |
114 | 114 | ||
115 | spin_lock(&wdt->lock); | 115 | spin_lock(&wdt->lock); |
116 | load = readl(wdt->base + WDTVALUE); | 116 | load = readl_relaxed(wdt->base + WDTVALUE); |
117 | 117 | ||
118 | /*If the interrupt is inactive then time left is WDTValue + WDTLoad. */ | 118 | /*If the interrupt is inactive then time left is WDTValue + WDTLoad. */ |
119 | if (!(readl(wdt->base + WDTRIS) & INT_MASK)) | 119 | if (!(readl_relaxed(wdt->base + WDTRIS) & INT_MASK)) |
120 | load += wdt->load_val + 1; | 120 | load += wdt->load_val + 1; |
121 | spin_unlock(&wdt->lock); | 121 | spin_unlock(&wdt->lock); |
122 | 122 | ||
@@ -128,14 +128,14 @@ static void wdt_enable(void) | |||
128 | { | 128 | { |
129 | spin_lock(&wdt->lock); | 129 | spin_lock(&wdt->lock); |
130 | 130 | ||
131 | writel(UNLOCK, wdt->base + WDTLOCK); | 131 | writel_relaxed(UNLOCK, wdt->base + WDTLOCK); |
132 | writel(wdt->load_val, wdt->base + WDTLOAD); | 132 | writel_relaxed(wdt->load_val, wdt->base + WDTLOAD); |
133 | writel(INT_MASK, wdt->base + WDTINTCLR); | 133 | writel_relaxed(INT_MASK, wdt->base + WDTINTCLR); |
134 | writel(INT_ENABLE | RESET_ENABLE, wdt->base + WDTCONTROL); | 134 | writel_relaxed(INT_ENABLE | RESET_ENABLE, wdt->base + WDTCONTROL); |
135 | writel(LOCK, wdt->base + WDTLOCK); | 135 | writel_relaxed(LOCK, wdt->base + WDTLOCK); |
136 | 136 | ||
137 | /* Flush posted writes. */ | 137 | /* Flush posted writes. */ |
138 | readl(wdt->base + WDTLOCK); | 138 | readl_relaxed(wdt->base + WDTLOCK); |
139 | spin_unlock(&wdt->lock); | 139 | spin_unlock(&wdt->lock); |
140 | } | 140 | } |
141 | 141 | ||
@@ -144,12 +144,12 @@ static void wdt_disable(void) | |||
144 | { | 144 | { |
145 | spin_lock(&wdt->lock); | 145 | spin_lock(&wdt->lock); |
146 | 146 | ||
147 | writel(UNLOCK, wdt->base + WDTLOCK); | 147 | writel_relaxed(UNLOCK, wdt->base + WDTLOCK); |
148 | writel(0, wdt->base + WDTCONTROL); | 148 | writel_relaxed(0, wdt->base + WDTCONTROL); |
149 | writel(LOCK, wdt->base + WDTLOCK); | 149 | writel_relaxed(LOCK, wdt->base + WDTLOCK); |
150 | 150 | ||
151 | /* Flush posted writes. */ | 151 | /* Flush posted writes. */ |
152 | readl(wdt->base + WDTLOCK); | 152 | readl_relaxed(wdt->base + WDTLOCK); |
153 | spin_unlock(&wdt->lock); | 153 | spin_unlock(&wdt->lock); |
154 | } | 154 | } |
155 | 155 | ||
@@ -285,32 +285,33 @@ sp805_wdt_probe(struct amba_device *adev, const struct amba_id *id) | |||
285 | { | 285 | { |
286 | int ret = 0; | 286 | int ret = 0; |
287 | 287 | ||
288 | if (!request_mem_region(adev->res.start, resource_size(&adev->res), | 288 | if (!devm_request_mem_region(&adev->dev, adev->res.start, |
289 | "sp805_wdt")) { | 289 | resource_size(&adev->res), "sp805_wdt")) { |
290 | dev_warn(&adev->dev, "Failed to get memory region resource\n"); | 290 | dev_warn(&adev->dev, "Failed to get memory region resource\n"); |
291 | ret = -ENOENT; | 291 | ret = -ENOENT; |
292 | goto err; | 292 | goto err; |
293 | } | 293 | } |
294 | 294 | ||
295 | wdt = kzalloc(sizeof(*wdt), GFP_KERNEL); | 295 | wdt = devm_kzalloc(&adev->dev, sizeof(*wdt), GFP_KERNEL); |
296 | if (!wdt) { | 296 | if (!wdt) { |
297 | dev_warn(&adev->dev, "Kzalloc failed\n"); | 297 | dev_warn(&adev->dev, "Kzalloc failed\n"); |
298 | ret = -ENOMEM; | 298 | ret = -ENOMEM; |
299 | goto err_kzalloc; | 299 | goto err; |
300 | } | ||
301 | |||
302 | wdt->base = devm_ioremap(&adev->dev, adev->res.start, | ||
303 | resource_size(&adev->res)); | ||
304 | if (!wdt->base) { | ||
305 | ret = -ENOMEM; | ||
306 | dev_warn(&adev->dev, "ioremap fail\n"); | ||
307 | goto err; | ||
300 | } | 308 | } |
301 | 309 | ||
302 | wdt->clk = clk_get(&adev->dev, NULL); | 310 | wdt->clk = clk_get(&adev->dev, NULL); |
303 | if (IS_ERR(wdt->clk)) { | 311 | if (IS_ERR(wdt->clk)) { |
304 | dev_warn(&adev->dev, "Clock not found\n"); | 312 | dev_warn(&adev->dev, "Clock not found\n"); |
305 | ret = PTR_ERR(wdt->clk); | 313 | ret = PTR_ERR(wdt->clk); |
306 | goto err_clk_get; | 314 | goto err; |
307 | } | ||
308 | |||
309 | wdt->base = ioremap(adev->res.start, resource_size(&adev->res)); | ||
310 | if (!wdt->base) { | ||
311 | ret = -ENOMEM; | ||
312 | dev_warn(&adev->dev, "ioremap fail\n"); | ||
313 | goto err_ioremap; | ||
314 | } | 315 | } |
315 | 316 | ||
316 | wdt->adev = adev; | 317 | wdt->adev = adev; |
@@ -327,14 +328,7 @@ sp805_wdt_probe(struct amba_device *adev, const struct amba_id *id) | |||
327 | return 0; | 328 | return 0; |
328 | 329 | ||
329 | err_misc_register: | 330 | err_misc_register: |
330 | iounmap(wdt->base); | ||
331 | err_ioremap: | ||
332 | clk_put(wdt->clk); | 331 | clk_put(wdt->clk); |
333 | err_clk_get: | ||
334 | kfree(wdt); | ||
335 | wdt = NULL; | ||
336 | err_kzalloc: | ||
337 | release_mem_region(adev->res.start, resource_size(&adev->res)); | ||
338 | err: | 332 | err: |
339 | dev_err(&adev->dev, "Probe Failed!!!\n"); | 333 | dev_err(&adev->dev, "Probe Failed!!!\n"); |
340 | return ret; | 334 | return ret; |
@@ -343,14 +337,42 @@ err: | |||
343 | static int __devexit sp805_wdt_remove(struct amba_device *adev) | 337 | static int __devexit sp805_wdt_remove(struct amba_device *adev) |
344 | { | 338 | { |
345 | misc_deregister(&sp805_wdt_miscdev); | 339 | misc_deregister(&sp805_wdt_miscdev); |
346 | iounmap(wdt->base); | ||
347 | clk_put(wdt->clk); | 340 | clk_put(wdt->clk); |
348 | kfree(wdt); | ||
349 | release_mem_region(adev->res.start, resource_size(&adev->res)); | ||
350 | 341 | ||
351 | return 0; | 342 | return 0; |
352 | } | 343 | } |
353 | 344 | ||
345 | #ifdef CONFIG_PM | ||
346 | static int sp805_wdt_suspend(struct device *dev) | ||
347 | { | ||
348 | if (test_bit(WDT_BUSY, &wdt->status)) { | ||
349 | wdt_disable(); | ||
350 | clk_disable(wdt->clk); | ||
351 | } | ||
352 | |||
353 | return 0; | ||
354 | } | ||
355 | |||
356 | static int sp805_wdt_resume(struct device *dev) | ||
357 | { | ||
358 | int ret = 0; | ||
359 | |||
360 | if (test_bit(WDT_BUSY, &wdt->status)) { | ||
361 | ret = clk_enable(wdt->clk); | ||
362 | if (ret) { | ||
363 | dev_err(dev, "clock enable fail"); | ||
364 | return ret; | ||
365 | } | ||
366 | wdt_enable(); | ||
367 | } | ||
368 | |||
369 | return ret; | ||
370 | } | ||
371 | #endif /* CONFIG_PM */ | ||
372 | |||
373 | static SIMPLE_DEV_PM_OPS(sp805_wdt_dev_pm_ops, sp805_wdt_suspend, | ||
374 | sp805_wdt_resume); | ||
375 | |||
354 | static struct amba_id sp805_wdt_ids[] = { | 376 | static struct amba_id sp805_wdt_ids[] = { |
355 | { | 377 | { |
356 | .id = 0x00141805, | 378 | .id = 0x00141805, |
@@ -364,6 +386,7 @@ MODULE_DEVICE_TABLE(amba, sp805_wdt_ids); | |||
364 | static struct amba_driver sp805_wdt_driver = { | 386 | static struct amba_driver sp805_wdt_driver = { |
365 | .drv = { | 387 | .drv = { |
366 | .name = MODULE_NAME, | 388 | .name = MODULE_NAME, |
389 | .pm = &sp805_wdt_dev_pm_ops, | ||
367 | }, | 390 | }, |
368 | .id_table = sp805_wdt_ids, | 391 | .id_table = sp805_wdt_ids, |
369 | .probe = sp805_wdt_probe, | 392 | .probe = sp805_wdt_probe, |
@@ -372,7 +395,7 @@ static struct amba_driver sp805_wdt_driver = { | |||
372 | 395 | ||
373 | module_amba_driver(sp805_wdt_driver); | 396 | module_amba_driver(sp805_wdt_driver); |
374 | 397 | ||
375 | module_param(nowayout, int, 0); | 398 | module_param(nowayout, bool, 0); |
376 | MODULE_PARM_DESC(nowayout, | 399 | MODULE_PARM_DESC(nowayout, |
377 | "Set to 1 to keep watchdog running after device release"); | 400 | "Set to 1 to keep watchdog running after device release"); |
378 | 401 | ||
diff --git a/drivers/watchdog/stmp3xxx_wdt.c b/drivers/watchdog/stmp3xxx_wdt.c index e37d81178b9e..21d96b92bfd7 100644 --- a/drivers/watchdog/stmp3xxx_wdt.c +++ b/drivers/watchdog/stmp3xxx_wdt.c | |||
@@ -6,6 +6,9 @@ | |||
6 | * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. | 6 | * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. |
7 | * Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. | 7 | * Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. |
8 | */ | 8 | */ |
9 | |||
10 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
11 | |||
9 | #include <linux/init.h> | 12 | #include <linux/init.h> |
10 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
11 | #include <linux/fs.h> | 14 | #include <linux/fs.h> |
@@ -32,7 +35,7 @@ | |||
32 | 35 | ||
33 | static DEFINE_SPINLOCK(stmp3xxx_wdt_io_lock); | 36 | static DEFINE_SPINLOCK(stmp3xxx_wdt_io_lock); |
34 | static unsigned long wdt_status; | 37 | static unsigned long wdt_status; |
35 | static const int nowayout = WATCHDOG_NOWAYOUT; | 38 | static const bool nowayout = WATCHDOG_NOWAYOUT; |
36 | static int heartbeat = DEFAULT_HEARTBEAT; | 39 | static int heartbeat = DEFAULT_HEARTBEAT; |
37 | static unsigned long boot_status; | 40 | static unsigned long boot_status; |
38 | 41 | ||
@@ -221,8 +224,7 @@ static int __devinit stmp3xxx_wdt_probe(struct platform_device *pdev) | |||
221 | return ret; | 224 | return ret; |
222 | } | 225 | } |
223 | 226 | ||
224 | printk(KERN_INFO "stmp3xxx watchdog: initialized, heartbeat %d sec\n", | 227 | pr_info("initialized, heartbeat %d sec\n", heartbeat); |
225 | heartbeat); | ||
226 | 228 | ||
227 | return ret; | 229 | return ret; |
228 | } | 230 | } |
diff --git a/drivers/watchdog/ts72xx_wdt.c b/drivers/watchdog/ts72xx_wdt.c index 1490293dc7da..8df050d800e6 100644 --- a/drivers/watchdog/ts72xx_wdt.c +++ b/drivers/watchdog/ts72xx_wdt.c | |||
@@ -34,8 +34,8 @@ MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. " | |||
34 | __MODULE_STRING(TS72XX_WDT_DEFAULT_TIMEOUT) | 34 | __MODULE_STRING(TS72XX_WDT_DEFAULT_TIMEOUT) |
35 | ")"); | 35 | ")"); |
36 | 36 | ||
37 | static int nowayout = WATCHDOG_NOWAYOUT; | 37 | static bool nowayout = WATCHDOG_NOWAYOUT; |
38 | module_param(nowayout, int, 0); | 38 | module_param(nowayout, bool, 0); |
39 | MODULE_PARM_DESC(nowayout, "Disable watchdog shutdown on close"); | 39 | MODULE_PARM_DESC(nowayout, "Disable watchdog shutdown on close"); |
40 | 40 | ||
41 | /** | 41 | /** |
diff --git a/drivers/watchdog/twl4030_wdt.c b/drivers/watchdog/twl4030_wdt.c index 0764c6239b98..249f11305d26 100644 --- a/drivers/watchdog/twl4030_wdt.c +++ b/drivers/watchdog/twl4030_wdt.c | |||
@@ -42,8 +42,8 @@ struct twl4030_wdt { | |||
42 | unsigned long state; | 42 | unsigned long state; |
43 | }; | 43 | }; |
44 | 44 | ||
45 | static int nowayout = WATCHDOG_NOWAYOUT; | 45 | static bool nowayout = WATCHDOG_NOWAYOUT; |
46 | module_param(nowayout, int, 0); | 46 | module_param(nowayout, bool, 0); |
47 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started " | 47 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started " |
48 | "(default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 48 | "(default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
49 | 49 | ||
diff --git a/drivers/watchdog/txx9wdt.c b/drivers/watchdog/txx9wdt.c index 9e9ed7bfabcb..98e16373e640 100644 --- a/drivers/watchdog/txx9wdt.c +++ b/drivers/watchdog/txx9wdt.c | |||
@@ -7,177 +7,99 @@ | |||
7 | * it under the terms of the GNU General Public License version 2 as | 7 | * it under the terms of the GNU General Public License version 2 as |
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
9 | */ | 9 | */ |
10 | |||
11 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
12 | |||
10 | #include <linux/module.h> | 13 | #include <linux/module.h> |
11 | #include <linux/moduleparam.h> | 14 | #include <linux/moduleparam.h> |
12 | #include <linux/types.h> | 15 | #include <linux/types.h> |
13 | #include <linux/miscdevice.h> | 16 | #include <linux/miscdevice.h> |
14 | #include <linux/watchdog.h> | 17 | #include <linux/watchdog.h> |
15 | #include <linux/fs.h> | ||
16 | #include <linux/init.h> | 18 | #include <linux/init.h> |
17 | #include <linux/uaccess.h> | ||
18 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
19 | #include <linux/clk.h> | 20 | #include <linux/clk.h> |
20 | #include <linux/err.h> | 21 | #include <linux/err.h> |
21 | #include <linux/io.h> | 22 | #include <linux/io.h> |
22 | #include <asm/txx9tmr.h> | 23 | #include <asm/txx9tmr.h> |
23 | 24 | ||
25 | #define WD_TIMER_CCD 7 /* 1/256 */ | ||
26 | #define WD_TIMER_CLK (clk_get_rate(txx9_imclk) / (2 << WD_TIMER_CCD)) | ||
27 | #define WD_MAX_TIMEOUT ((0xffffffff >> (32 - TXX9_TIMER_BITS)) / WD_TIMER_CLK) | ||
24 | #define TIMER_MARGIN 60 /* Default is 60 seconds */ | 28 | #define TIMER_MARGIN 60 /* Default is 60 seconds */ |
25 | 29 | ||
26 | static int timeout = TIMER_MARGIN; /* in seconds */ | 30 | static unsigned int timeout = TIMER_MARGIN; /* in seconds */ |
27 | module_param(timeout, int, 0); | 31 | module_param(timeout, uint, 0); |
28 | MODULE_PARM_DESC(timeout, | 32 | MODULE_PARM_DESC(timeout, |
29 | "Watchdog timeout in seconds. " | 33 | "Watchdog timeout in seconds. " |
30 | "(0<timeout<((2^" __MODULE_STRING(TXX9_TIMER_BITS) ")/(IMCLK/256)), " | 34 | "(0<timeout<((2^" __MODULE_STRING(TXX9_TIMER_BITS) ")/(IMCLK/256)), " |
31 | "default=" __MODULE_STRING(TIMER_MARGIN) ")"); | 35 | "default=" __MODULE_STRING(TIMER_MARGIN) ")"); |
32 | 36 | ||
33 | static int nowayout = WATCHDOG_NOWAYOUT; | 37 | static bool nowayout = WATCHDOG_NOWAYOUT; |
34 | module_param(nowayout, int, 0); | 38 | module_param(nowayout, bool, 0); |
35 | MODULE_PARM_DESC(nowayout, | 39 | MODULE_PARM_DESC(nowayout, |
36 | "Watchdog cannot be stopped once started " | 40 | "Watchdog cannot be stopped once started " |
37 | "(default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 41 | "(default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
38 | 42 | ||
39 | #define WD_TIMER_CCD 7 /* 1/256 */ | ||
40 | #define WD_TIMER_CLK (clk_get_rate(txx9_imclk) / (2 << WD_TIMER_CCD)) | ||
41 | #define WD_MAX_TIMEOUT ((0xffffffff >> (32 - TXX9_TIMER_BITS)) / WD_TIMER_CLK) | ||
42 | |||
43 | static unsigned long txx9wdt_alive; | ||
44 | static int expect_close; | ||
45 | static struct txx9_tmr_reg __iomem *txx9wdt_reg; | 43 | static struct txx9_tmr_reg __iomem *txx9wdt_reg; |
46 | static struct clk *txx9_imclk; | 44 | static struct clk *txx9_imclk; |
47 | static DEFINE_SPINLOCK(txx9_lock); | 45 | static DEFINE_SPINLOCK(txx9_lock); |
48 | 46 | ||
49 | static void txx9wdt_ping(void) | 47 | static int txx9wdt_ping(struct watchdog_device *wdt_dev) |
50 | { | 48 | { |
51 | spin_lock(&txx9_lock); | 49 | spin_lock(&txx9_lock); |
52 | __raw_writel(TXx9_TMWTMR_TWIE | TXx9_TMWTMR_TWC, &txx9wdt_reg->wtmr); | 50 | __raw_writel(TXx9_TMWTMR_TWIE | TXx9_TMWTMR_TWC, &txx9wdt_reg->wtmr); |
53 | spin_unlock(&txx9_lock); | 51 | spin_unlock(&txx9_lock); |
52 | return 0; | ||
54 | } | 53 | } |
55 | 54 | ||
56 | static void txx9wdt_start(void) | 55 | static int txx9wdt_start(struct watchdog_device *wdt_dev) |
57 | { | 56 | { |
58 | spin_lock(&txx9_lock); | 57 | spin_lock(&txx9_lock); |
59 | __raw_writel(WD_TIMER_CLK * timeout, &txx9wdt_reg->cpra); | 58 | __raw_writel(WD_TIMER_CLK * wdt_dev->timeout, &txx9wdt_reg->cpra); |
60 | __raw_writel(WD_TIMER_CCD, &txx9wdt_reg->ccdr); | 59 | __raw_writel(WD_TIMER_CCD, &txx9wdt_reg->ccdr); |
61 | __raw_writel(0, &txx9wdt_reg->tisr); /* clear pending interrupt */ | 60 | __raw_writel(0, &txx9wdt_reg->tisr); /* clear pending interrupt */ |
62 | __raw_writel(TXx9_TMTCR_TCE | TXx9_TMTCR_CCDE | TXx9_TMTCR_TMODE_WDOG, | 61 | __raw_writel(TXx9_TMTCR_TCE | TXx9_TMTCR_CCDE | TXx9_TMTCR_TMODE_WDOG, |
63 | &txx9wdt_reg->tcr); | 62 | &txx9wdt_reg->tcr); |
64 | __raw_writel(TXx9_TMWTMR_TWIE | TXx9_TMWTMR_TWC, &txx9wdt_reg->wtmr); | 63 | __raw_writel(TXx9_TMWTMR_TWIE | TXx9_TMWTMR_TWC, &txx9wdt_reg->wtmr); |
65 | spin_unlock(&txx9_lock); | 64 | spin_unlock(&txx9_lock); |
65 | return 0; | ||
66 | } | 66 | } |
67 | 67 | ||
68 | static void txx9wdt_stop(void) | 68 | static int txx9wdt_stop(struct watchdog_device *wdt_dev) |
69 | { | 69 | { |
70 | spin_lock(&txx9_lock); | 70 | spin_lock(&txx9_lock); |
71 | __raw_writel(TXx9_TMWTMR_WDIS, &txx9wdt_reg->wtmr); | 71 | __raw_writel(TXx9_TMWTMR_WDIS, &txx9wdt_reg->wtmr); |
72 | __raw_writel(__raw_readl(&txx9wdt_reg->tcr) & ~TXx9_TMTCR_TCE, | 72 | __raw_writel(__raw_readl(&txx9wdt_reg->tcr) & ~TXx9_TMTCR_TCE, |
73 | &txx9wdt_reg->tcr); | 73 | &txx9wdt_reg->tcr); |
74 | spin_unlock(&txx9_lock); | 74 | spin_unlock(&txx9_lock); |
75 | } | ||
76 | |||
77 | static int txx9wdt_open(struct inode *inode, struct file *file) | ||
78 | { | ||
79 | if (test_and_set_bit(0, &txx9wdt_alive)) | ||
80 | return -EBUSY; | ||
81 | |||
82 | if (__raw_readl(&txx9wdt_reg->tcr) & TXx9_TMTCR_TCE) { | ||
83 | clear_bit(0, &txx9wdt_alive); | ||
84 | return -EBUSY; | ||
85 | } | ||
86 | |||
87 | if (nowayout) | ||
88 | __module_get(THIS_MODULE); | ||
89 | |||
90 | txx9wdt_start(); | ||
91 | return nonseekable_open(inode, file); | ||
92 | } | ||
93 | |||
94 | static int txx9wdt_release(struct inode *inode, struct file *file) | ||
95 | { | ||
96 | if (expect_close) | ||
97 | txx9wdt_stop(); | ||
98 | else { | ||
99 | printk(KERN_CRIT "txx9wdt: " | ||
100 | "Unexpected close, not stopping watchdog!\n"); | ||
101 | txx9wdt_ping(); | ||
102 | } | ||
103 | clear_bit(0, &txx9wdt_alive); | ||
104 | expect_close = 0; | ||
105 | return 0; | 75 | return 0; |
106 | } | 76 | } |
107 | 77 | ||
108 | static ssize_t txx9wdt_write(struct file *file, const char __user *data, | 78 | static int txx9wdt_set_timeout(struct watchdog_device *wdt_dev, |
109 | size_t len, loff_t *ppos) | 79 | unsigned int new_timeout) |
110 | { | 80 | { |
111 | if (len) { | 81 | wdt_dev->timeout = new_timeout; |
112 | if (!nowayout) { | 82 | txx9wdt_stop(wdt_dev); |
113 | size_t i; | 83 | txx9wdt_start(wdt_dev); |
114 | 84 | return 0; | |
115 | expect_close = 0; | ||
116 | for (i = 0; i != len; i++) { | ||
117 | char c; | ||
118 | if (get_user(c, data + i)) | ||
119 | return -EFAULT; | ||
120 | if (c == 'V') | ||
121 | expect_close = 1; | ||
122 | } | ||
123 | } | ||
124 | txx9wdt_ping(); | ||
125 | } | ||
126 | return len; | ||
127 | } | 85 | } |
128 | 86 | ||
129 | static long txx9wdt_ioctl(struct file *file, unsigned int cmd, | 87 | static const struct watchdog_info txx9wdt_info = { |
130 | unsigned long arg) | 88 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, |
131 | { | 89 | .identity = "Hardware Watchdog for TXx9", |
132 | void __user *argp = (void __user *)arg; | 90 | }; |
133 | int __user *p = argp; | ||
134 | int new_timeout; | ||
135 | static const struct watchdog_info ident = { | ||
136 | .options = WDIOF_SETTIMEOUT | | ||
137 | WDIOF_KEEPALIVEPING | | ||
138 | WDIOF_MAGICCLOSE, | ||
139 | .firmware_version = 0, | ||
140 | .identity = "Hardware Watchdog for TXx9", | ||
141 | }; | ||
142 | |||
143 | switch (cmd) { | ||
144 | case WDIOC_GETSUPPORT: | ||
145 | return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0; | ||
146 | case WDIOC_GETSTATUS: | ||
147 | case WDIOC_GETBOOTSTATUS: | ||
148 | return put_user(0, p); | ||
149 | case WDIOC_KEEPALIVE: | ||
150 | txx9wdt_ping(); | ||
151 | return 0; | ||
152 | case WDIOC_SETTIMEOUT: | ||
153 | if (get_user(new_timeout, p)) | ||
154 | return -EFAULT; | ||
155 | if (new_timeout < 1 || new_timeout > WD_MAX_TIMEOUT) | ||
156 | return -EINVAL; | ||
157 | timeout = new_timeout; | ||
158 | txx9wdt_stop(); | ||
159 | txx9wdt_start(); | ||
160 | /* Fall */ | ||
161 | case WDIOC_GETTIMEOUT: | ||
162 | return put_user(timeout, p); | ||
163 | default: | ||
164 | return -ENOTTY; | ||
165 | } | ||
166 | } | ||
167 | 91 | ||
168 | static const struct file_operations txx9wdt_fops = { | 92 | static const struct watchdog_ops txx9wdt_ops = { |
169 | .owner = THIS_MODULE, | 93 | .owner = THIS_MODULE, |
170 | .llseek = no_llseek, | 94 | .start = txx9wdt_start, |
171 | .write = txx9wdt_write, | 95 | .stop = txx9wdt_stop, |
172 | .unlocked_ioctl = txx9wdt_ioctl, | 96 | .ping = txx9wdt_ping, |
173 | .open = txx9wdt_open, | 97 | .set_timeout = txx9wdt_set_timeout, |
174 | .release = txx9wdt_release, | ||
175 | }; | 98 | }; |
176 | 99 | ||
177 | static struct miscdevice txx9wdt_miscdev = { | 100 | static struct watchdog_device txx9wdt = { |
178 | .minor = WATCHDOG_MINOR, | 101 | .info = &txx9wdt_info, |
179 | .name = "watchdog", | 102 | .ops = &txx9wdt_ops, |
180 | .fops = &txx9wdt_fops, | ||
181 | }; | 103 | }; |
182 | 104 | ||
183 | static int __init txx9wdt_probe(struct platform_device *dev) | 105 | static int __init txx9wdt_probe(struct platform_device *dev) |
@@ -199,27 +121,27 @@ static int __init txx9wdt_probe(struct platform_device *dev) | |||
199 | } | 121 | } |
200 | 122 | ||
201 | res = platform_get_resource(dev, IORESOURCE_MEM, 0); | 123 | res = platform_get_resource(dev, IORESOURCE_MEM, 0); |
202 | if (!res) | 124 | txx9wdt_reg = devm_request_and_ioremap(&dev->dev, res); |
203 | goto exit_busy; | 125 | if (!txx9wdt_reg) { |
204 | if (!devm_request_mem_region(&dev->dev, res->start, resource_size(res), | 126 | ret = -EBUSY; |
205 | "txx9wdt")) | ||
206 | goto exit_busy; | ||
207 | txx9wdt_reg = devm_ioremap(&dev->dev, res->start, resource_size(res)); | ||
208 | if (!txx9wdt_reg) | ||
209 | goto exit_busy; | ||
210 | |||
211 | ret = misc_register(&txx9wdt_miscdev); | ||
212 | if (ret) { | ||
213 | goto exit; | 127 | goto exit; |
214 | } | 128 | } |
215 | 129 | ||
216 | printk(KERN_INFO "Hardware Watchdog Timer for TXx9: " | 130 | if (timeout < 1 || timeout > WD_MAX_TIMEOUT) |
217 | "timeout=%d sec (max %ld) (nowayout= %d)\n", | 131 | timeout = TIMER_MARGIN; |
218 | timeout, WD_MAX_TIMEOUT, nowayout); | 132 | txx9wdt.timeout = timeout; |
133 | txx9wdt.min_timeout = 1; | ||
134 | txx9wdt.max_timeout = WD_MAX_TIMEOUT; | ||
135 | watchdog_set_nowayout(&txx9wdt, nowayout); | ||
136 | |||
137 | ret = watchdog_register_device(&txx9wdt); | ||
138 | if (ret) | ||
139 | goto exit; | ||
140 | |||
141 | pr_info("Hardware Watchdog Timer: timeout=%d sec (max %ld) (nowayout= %d)\n", | ||
142 | timeout, WD_MAX_TIMEOUT, nowayout); | ||
219 | 143 | ||
220 | return 0; | 144 | return 0; |
221 | exit_busy: | ||
222 | ret = -EBUSY; | ||
223 | exit: | 145 | exit: |
224 | if (txx9_imclk) { | 146 | if (txx9_imclk) { |
225 | clk_disable(txx9_imclk); | 147 | clk_disable(txx9_imclk); |
@@ -230,7 +152,7 @@ exit: | |||
230 | 152 | ||
231 | static int __exit txx9wdt_remove(struct platform_device *dev) | 153 | static int __exit txx9wdt_remove(struct platform_device *dev) |
232 | { | 154 | { |
233 | misc_deregister(&txx9wdt_miscdev); | 155 | watchdog_unregister_device(&txx9wdt); |
234 | clk_disable(txx9_imclk); | 156 | clk_disable(txx9_imclk); |
235 | clk_put(txx9_imclk); | 157 | clk_put(txx9_imclk); |
236 | return 0; | 158 | return 0; |
@@ -238,7 +160,7 @@ static int __exit txx9wdt_remove(struct platform_device *dev) | |||
238 | 160 | ||
239 | static void txx9wdt_shutdown(struct platform_device *dev) | 161 | static void txx9wdt_shutdown(struct platform_device *dev) |
240 | { | 162 | { |
241 | txx9wdt_stop(); | 163 | txx9wdt_stop(&txx9wdt); |
242 | } | 164 | } |
243 | 165 | ||
244 | static struct platform_driver txx9wdt_driver = { | 166 | static struct platform_driver txx9wdt_driver = { |
diff --git a/drivers/watchdog/via_wdt.c b/drivers/watchdog/via_wdt.c index 8f07dd4bd94a..465e08273c97 100644 --- a/drivers/watchdog/via_wdt.c +++ b/drivers/watchdog/via_wdt.c | |||
@@ -10,6 +10,9 @@ | |||
10 | * Caveat: PnP must be enabled in BIOS to allow full access to watchdog | 10 | * Caveat: PnP must be enabled in BIOS to allow full access to watchdog |
11 | * control registers. If not, the watchdog must be configured in BIOS manually. | 11 | * control registers. If not, the watchdog must be configured in BIOS manually. |
12 | */ | 12 | */ |
13 | |||
14 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
15 | |||
13 | #include <linux/device.h> | 16 | #include <linux/device.h> |
14 | #include <linux/io.h> | 17 | #include <linux/io.h> |
15 | #include <linux/jiffies.h> | 18 | #include <linux/jiffies.h> |
@@ -55,8 +58,8 @@ module_param(timeout, int, 0); | |||
55 | MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds, between 1 and 1023 " | 58 | MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds, between 1 and 1023 " |
56 | "(default = " __MODULE_STRING(WDT_TIMEOUT) ")"); | 59 | "(default = " __MODULE_STRING(WDT_TIMEOUT) ")"); |
57 | 60 | ||
58 | static int nowayout = WATCHDOG_NOWAYOUT; | 61 | static bool nowayout = WATCHDOG_NOWAYOUT; |
59 | module_param(nowayout, int, 0); | 62 | module_param(nowayout, bool, 0); |
60 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started " | 63 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started " |
61 | "(default = " __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 64 | "(default = " __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
62 | 65 | ||
@@ -98,7 +101,7 @@ static void wdt_timer_tick(unsigned long data) | |||
98 | static int wdt_ping(struct watchdog_device *wdd) | 101 | static int wdt_ping(struct watchdog_device *wdd) |
99 | { | 102 | { |
100 | /* calculate when the next userspace timeout will be */ | 103 | /* calculate when the next userspace timeout will be */ |
101 | next_heartbeat = jiffies + timeout * HZ; | 104 | next_heartbeat = jiffies + wdd->timeout * HZ; |
102 | return 0; | 105 | return 0; |
103 | } | 106 | } |
104 | 107 | ||
@@ -106,7 +109,7 @@ static int wdt_start(struct watchdog_device *wdd) | |||
106 | { | 109 | { |
107 | unsigned int ctl = readl(wdt_mem); | 110 | unsigned int ctl = readl(wdt_mem); |
108 | 111 | ||
109 | writel(timeout, wdt_mem + VIA_WDT_COUNT); | 112 | writel(wdd->timeout, wdt_mem + VIA_WDT_COUNT); |
110 | writel(ctl | VIA_WDT_RUNNING | VIA_WDT_TRIGGER, wdt_mem); | 113 | writel(ctl | VIA_WDT_RUNNING | VIA_WDT_TRIGGER, wdt_mem); |
111 | wdt_ping(wdd); | 114 | wdt_ping(wdd); |
112 | mod_timer(&timer, jiffies + WDT_HEARTBEAT); | 115 | mod_timer(&timer, jiffies + WDT_HEARTBEAT); |
@@ -125,7 +128,7 @@ static int wdt_set_timeout(struct watchdog_device *wdd, | |||
125 | unsigned int new_timeout) | 128 | unsigned int new_timeout) |
126 | { | 129 | { |
127 | writel(new_timeout, wdt_mem + VIA_WDT_COUNT); | 130 | writel(new_timeout, wdt_mem + VIA_WDT_COUNT); |
128 | timeout = new_timeout; | 131 | wdd->timeout = new_timeout; |
129 | return 0; | 132 | return 0; |
130 | } | 133 | } |
131 | 134 | ||
diff --git a/drivers/watchdog/w83627hf_wdt.c b/drivers/watchdog/w83627hf_wdt.c index 576a388a1164..452980361c63 100644 --- a/drivers/watchdog/w83627hf_wdt.c +++ b/drivers/watchdog/w83627hf_wdt.c | |||
@@ -26,6 +26,8 @@ | |||
26 | * (c) Copyright 1995 Alan Cox <alan@lxorguk.ukuu.org.uk> | 26 | * (c) Copyright 1995 Alan Cox <alan@lxorguk.ukuu.org.uk> |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
30 | |||
29 | #include <linux/module.h> | 31 | #include <linux/module.h> |
30 | #include <linux/moduleparam.h> | 32 | #include <linux/moduleparam.h> |
31 | #include <linux/types.h> | 33 | #include <linux/types.h> |
@@ -43,7 +45,6 @@ | |||
43 | #include <asm/system.h> | 45 | #include <asm/system.h> |
44 | 46 | ||
45 | #define WATCHDOG_NAME "w83627hf/thf/hg/dhg WDT" | 47 | #define WATCHDOG_NAME "w83627hf/thf/hg/dhg WDT" |
46 | #define PFX WATCHDOG_NAME ": " | ||
47 | #define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */ | 48 | #define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */ |
48 | 49 | ||
49 | static unsigned long wdt_is_open; | 50 | static unsigned long wdt_is_open; |
@@ -61,8 +62,8 @@ MODULE_PARM_DESC(timeout, | |||
61 | "Watchdog timeout in seconds. 1 <= timeout <= 255, default=" | 62 | "Watchdog timeout in seconds. 1 <= timeout <= 255, default=" |
62 | __MODULE_STRING(WATCHDOG_TIMEOUT) "."); | 63 | __MODULE_STRING(WATCHDOG_TIMEOUT) "."); |
63 | 64 | ||
64 | static int nowayout = WATCHDOG_NOWAYOUT; | 65 | static bool nowayout = WATCHDOG_NOWAYOUT; |
65 | module_param(nowayout, int, 0); | 66 | module_param(nowayout, bool, 0); |
66 | MODULE_PARM_DESC(nowayout, | 67 | MODULE_PARM_DESC(nowayout, |
67 | "Watchdog cannot be stopped once started (default=" | 68 | "Watchdog cannot be stopped once started (default=" |
68 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 69 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
@@ -119,9 +120,8 @@ static void w83627hf_init(void) | |||
119 | outb_p(0xF6, WDT_EFER); /* Select CRF6 */ | 120 | outb_p(0xF6, WDT_EFER); /* Select CRF6 */ |
120 | t = inb_p(WDT_EFDR); /* read CRF6 */ | 121 | t = inb_p(WDT_EFDR); /* read CRF6 */ |
121 | if (t != 0) { | 122 | if (t != 0) { |
122 | printk(KERN_INFO PFX | 123 | pr_info("Watchdog already running. Resetting timeout to %d sec\n", |
123 | "Watchdog already running. Resetting timeout to %d sec\n", | 124 | timeout); |
124 | timeout); | ||
125 | outb_p(timeout, WDT_EFDR); /* Write back to CRF6 */ | 125 | outb_p(timeout, WDT_EFDR); /* Write back to CRF6 */ |
126 | } | 126 | } |
127 | 127 | ||
@@ -290,8 +290,7 @@ static int wdt_close(struct inode *inode, struct file *file) | |||
290 | if (expect_close == 42) | 290 | if (expect_close == 42) |
291 | wdt_disable(); | 291 | wdt_disable(); |
292 | else { | 292 | else { |
293 | printk(KERN_CRIT PFX | 293 | pr_crit("Unexpected close, not stopping watchdog!\n"); |
294 | "Unexpected close, not stopping watchdog!\n"); | ||
295 | wdt_ping(); | 294 | wdt_ping(); |
296 | } | 295 | } |
297 | expect_close = 0; | 296 | expect_close = 0; |
@@ -344,18 +343,16 @@ static int __init wdt_init(void) | |||
344 | { | 343 | { |
345 | int ret; | 344 | int ret; |
346 | 345 | ||
347 | printk(KERN_INFO "WDT driver for the Winbond(TM) W83627HF/THF/HG/DHG Super I/O chip initialising.\n"); | 346 | pr_info("WDT driver for the Winbond(TM) W83627HF/THF/HG/DHG Super I/O chip initialising\n"); |
348 | 347 | ||
349 | if (wdt_set_heartbeat(timeout)) { | 348 | if (wdt_set_heartbeat(timeout)) { |
350 | wdt_set_heartbeat(WATCHDOG_TIMEOUT); | 349 | wdt_set_heartbeat(WATCHDOG_TIMEOUT); |
351 | printk(KERN_INFO PFX | 350 | pr_info("timeout value must be 1 <= timeout <= 255, using %d\n", |
352 | "timeout value must be 1 <= timeout <= 255, using %d\n", | 351 | WATCHDOG_TIMEOUT); |
353 | WATCHDOG_TIMEOUT); | ||
354 | } | 352 | } |
355 | 353 | ||
356 | if (!request_region(wdt_io, 1, WATCHDOG_NAME)) { | 354 | if (!request_region(wdt_io, 1, WATCHDOG_NAME)) { |
357 | printk(KERN_ERR PFX "I/O address 0x%04x already in use\n", | 355 | pr_err("I/O address 0x%04x already in use\n", wdt_io); |
358 | wdt_io); | ||
359 | ret = -EIO; | 356 | ret = -EIO; |
360 | goto out; | 357 | goto out; |
361 | } | 358 | } |
@@ -364,22 +361,19 @@ static int __init wdt_init(void) | |||
364 | 361 | ||
365 | ret = register_reboot_notifier(&wdt_notifier); | 362 | ret = register_reboot_notifier(&wdt_notifier); |
366 | if (ret != 0) { | 363 | if (ret != 0) { |
367 | printk(KERN_ERR PFX | 364 | pr_err("cannot register reboot notifier (err=%d)\n", ret); |
368 | "cannot register reboot notifier (err=%d)\n", ret); | ||
369 | goto unreg_regions; | 365 | goto unreg_regions; |
370 | } | 366 | } |
371 | 367 | ||
372 | ret = misc_register(&wdt_miscdev); | 368 | ret = misc_register(&wdt_miscdev); |
373 | if (ret != 0) { | 369 | if (ret != 0) { |
374 | printk(KERN_ERR PFX | 370 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
375 | "cannot register miscdev on minor=%d (err=%d)\n", | 371 | WATCHDOG_MINOR, ret); |
376 | WATCHDOG_MINOR, ret); | ||
377 | goto unreg_reboot; | 372 | goto unreg_reboot; |
378 | } | 373 | } |
379 | 374 | ||
380 | printk(KERN_INFO PFX | 375 | pr_info("initialized. timeout=%d sec (nowayout=%d)\n", |
381 | "initialized. timeout=%d sec (nowayout=%d)\n", | 376 | timeout, nowayout); |
382 | timeout, nowayout); | ||
383 | 377 | ||
384 | out: | 378 | out: |
385 | return ret; | 379 | return ret; |
diff --git a/drivers/watchdog/w83697hf_wdt.c b/drivers/watchdog/w83697hf_wdt.c index af08972de506..f5c9d9901acc 100644 --- a/drivers/watchdog/w83697hf_wdt.c +++ b/drivers/watchdog/w83697hf_wdt.c | |||
@@ -25,6 +25,8 @@ | |||
25 | * "AS-IS" and at no charge. | 25 | * "AS-IS" and at no charge. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
29 | |||
28 | #include <linux/module.h> | 30 | #include <linux/module.h> |
29 | #include <linux/moduleparam.h> | 31 | #include <linux/moduleparam.h> |
30 | #include <linux/types.h> | 32 | #include <linux/types.h> |
@@ -42,7 +44,6 @@ | |||
42 | #include <asm/system.h> | 44 | #include <asm/system.h> |
43 | 45 | ||
44 | #define WATCHDOG_NAME "w83697hf/hg WDT" | 46 | #define WATCHDOG_NAME "w83697hf/hg WDT" |
45 | #define PFX WATCHDOG_NAME ": " | ||
46 | #define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */ | 47 | #define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */ |
47 | #define WATCHDOG_EARLY_DISABLE 1 /* Disable until userland kicks in */ | 48 | #define WATCHDOG_EARLY_DISABLE 1 /* Disable until userland kicks in */ |
48 | 49 | ||
@@ -62,8 +63,8 @@ MODULE_PARM_DESC(timeout, | |||
62 | "Watchdog timeout in seconds. 1<= timeout <=255 (default=" | 63 | "Watchdog timeout in seconds. 1<= timeout <=255 (default=" |
63 | __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); | 64 | __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); |
64 | 65 | ||
65 | static int nowayout = WATCHDOG_NOWAYOUT; | 66 | static bool nowayout = WATCHDOG_NOWAYOUT; |
66 | module_param(nowayout, int, 0); | 67 | module_param(nowayout, bool, 0); |
67 | MODULE_PARM_DESC(nowayout, | 68 | MODULE_PARM_DESC(nowayout, |
68 | "Watchdog cannot be stopped once started (default=" | 69 | "Watchdog cannot be stopped once started (default=" |
69 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 70 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
@@ -309,8 +310,7 @@ static int wdt_close(struct inode *inode, struct file *file) | |||
309 | if (expect_close == 42) | 310 | if (expect_close == 42) |
310 | wdt_disable(); | 311 | wdt_disable(); |
311 | else { | 312 | else { |
312 | printk(KERN_CRIT PFX | 313 | pr_crit("Unexpected close, not stopping watchdog!\n"); |
313 | "Unexpected close, not stopping watchdog!\n"); | ||
314 | wdt_ping(); | 314 | wdt_ping(); |
315 | } | 315 | } |
316 | expect_close = 0; | 316 | expect_close = 0; |
@@ -362,24 +362,21 @@ static struct notifier_block wdt_notifier = { | |||
362 | static int w83697hf_check_wdt(void) | 362 | static int w83697hf_check_wdt(void) |
363 | { | 363 | { |
364 | if (!request_region(wdt_io, 2, WATCHDOG_NAME)) { | 364 | if (!request_region(wdt_io, 2, WATCHDOG_NAME)) { |
365 | printk(KERN_ERR PFX | 365 | pr_err("I/O address 0x%x already in use\n", wdt_io); |
366 | "I/O address 0x%x already in use\n", wdt_io); | ||
367 | return -EIO; | 366 | return -EIO; |
368 | } | 367 | } |
369 | 368 | ||
370 | printk(KERN_DEBUG PFX | 369 | pr_debug("Looking for watchdog at address 0x%x\n", wdt_io); |
371 | "Looking for watchdog at address 0x%x\n", wdt_io); | ||
372 | w83697hf_unlock(); | 370 | w83697hf_unlock(); |
373 | if (w83697hf_get_reg(0x20) == 0x60) { | 371 | if (w83697hf_get_reg(0x20) == 0x60) { |
374 | printk(KERN_INFO PFX | 372 | pr_info("watchdog found at address 0x%x\n", wdt_io); |
375 | "watchdog found at address 0x%x\n", wdt_io); | ||
376 | w83697hf_lock(); | 373 | w83697hf_lock(); |
377 | return 0; | 374 | return 0; |
378 | } | 375 | } |
379 | /* Reprotect in case it was a compatible device */ | 376 | /* Reprotect in case it was a compatible device */ |
380 | w83697hf_lock(); | 377 | w83697hf_lock(); |
381 | 378 | ||
382 | printk(KERN_INFO PFX "watchdog not found at address 0x%x\n", wdt_io); | 379 | pr_info("watchdog not found at address 0x%x\n", wdt_io); |
383 | release_region(wdt_io, 2); | 380 | release_region(wdt_io, 2); |
384 | return -EIO; | 381 | return -EIO; |
385 | } | 382 | } |
@@ -390,7 +387,7 @@ static int __init wdt_init(void) | |||
390 | { | 387 | { |
391 | int ret, i, found = 0; | 388 | int ret, i, found = 0; |
392 | 389 | ||
393 | printk(KERN_INFO PFX "WDT driver for W83697HF/HG initializing\n"); | 390 | pr_info("WDT driver for W83697HF/HG initializing\n"); |
394 | 391 | ||
395 | if (wdt_io == 0) { | 392 | if (wdt_io == 0) { |
396 | /* we will autodetect the W83697HF/HG watchdog */ | 393 | /* we will autodetect the W83697HF/HG watchdog */ |
@@ -405,7 +402,7 @@ static int __init wdt_init(void) | |||
405 | } | 402 | } |
406 | 403 | ||
407 | if (!found) { | 404 | if (!found) { |
408 | printk(KERN_ERR PFX "No W83697HF/HG could be found\n"); | 405 | pr_err("No W83697HF/HG could be found\n"); |
409 | ret = -EIO; | 406 | ret = -EIO; |
410 | goto out; | 407 | goto out; |
411 | } | 408 | } |
@@ -413,34 +410,30 @@ static int __init wdt_init(void) | |||
413 | w83697hf_init(); | 410 | w83697hf_init(); |
414 | if (early_disable) { | 411 | if (early_disable) { |
415 | if (wdt_running()) | 412 | if (wdt_running()) |
416 | printk(KERN_WARNING PFX "Stopping previously enabled " | 413 | pr_warn("Stopping previously enabled watchdog until userland kicks in\n"); |
417 | "watchdog until userland kicks in\n"); | ||
418 | wdt_disable(); | 414 | wdt_disable(); |
419 | } | 415 | } |
420 | 416 | ||
421 | if (wdt_set_heartbeat(timeout)) { | 417 | if (wdt_set_heartbeat(timeout)) { |
422 | wdt_set_heartbeat(WATCHDOG_TIMEOUT); | 418 | wdt_set_heartbeat(WATCHDOG_TIMEOUT); |
423 | printk(KERN_INFO PFX | 419 | pr_info("timeout value must be 1 <= timeout <= 255, using %d\n", |
424 | "timeout value must be 1 <= timeout <= 255, using %d\n", | 420 | WATCHDOG_TIMEOUT); |
425 | WATCHDOG_TIMEOUT); | ||
426 | } | 421 | } |
427 | 422 | ||
428 | ret = register_reboot_notifier(&wdt_notifier); | 423 | ret = register_reboot_notifier(&wdt_notifier); |
429 | if (ret != 0) { | 424 | if (ret != 0) { |
430 | printk(KERN_ERR PFX | 425 | pr_err("cannot register reboot notifier (err=%d)\n", ret); |
431 | "cannot register reboot notifier (err=%d)\n", ret); | ||
432 | goto unreg_regions; | 426 | goto unreg_regions; |
433 | } | 427 | } |
434 | 428 | ||
435 | ret = misc_register(&wdt_miscdev); | 429 | ret = misc_register(&wdt_miscdev); |
436 | if (ret != 0) { | 430 | if (ret != 0) { |
437 | printk(KERN_ERR PFX | 431 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
438 | "cannot register miscdev on minor=%d (err=%d)\n", | 432 | WATCHDOG_MINOR, ret); |
439 | WATCHDOG_MINOR, ret); | ||
440 | goto unreg_reboot; | 433 | goto unreg_reboot; |
441 | } | 434 | } |
442 | 435 | ||
443 | printk(KERN_INFO PFX "initialized. timeout=%d sec (nowayout=%d)\n", | 436 | pr_info("initialized. timeout=%d sec (nowayout=%d)\n", |
444 | timeout, nowayout); | 437 | timeout, nowayout); |
445 | 438 | ||
446 | out: | 439 | out: |
diff --git a/drivers/watchdog/w83697ug_wdt.c b/drivers/watchdog/w83697ug_wdt.c index be9c4d839e15..ab45bfdf935c 100644 --- a/drivers/watchdog/w83697ug_wdt.c +++ b/drivers/watchdog/w83697ug_wdt.c | |||
@@ -30,6 +30,8 @@ | |||
30 | * (c) Copyright 1995 Alan Cox <alan@redhat.com> | 30 | * (c) Copyright 1995 Alan Cox <alan@redhat.com> |
31 | */ | 31 | */ |
32 | 32 | ||
33 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
34 | |||
33 | #include <linux/module.h> | 35 | #include <linux/module.h> |
34 | #include <linux/moduleparam.h> | 36 | #include <linux/moduleparam.h> |
35 | #include <linux/types.h> | 37 | #include <linux/types.h> |
@@ -47,7 +49,6 @@ | |||
47 | #include <asm/system.h> | 49 | #include <asm/system.h> |
48 | 50 | ||
49 | #define WATCHDOG_NAME "w83697ug/uf WDT" | 51 | #define WATCHDOG_NAME "w83697ug/uf WDT" |
50 | #define PFX WATCHDOG_NAME ": " | ||
51 | #define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */ | 52 | #define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */ |
52 | 53 | ||
53 | static unsigned long wdt_is_open; | 54 | static unsigned long wdt_is_open; |
@@ -64,8 +65,8 @@ MODULE_PARM_DESC(timeout, | |||
64 | "Watchdog timeout in seconds. 1<= timeout <=255 (default=" | 65 | "Watchdog timeout in seconds. 1<= timeout <=255 (default=" |
65 | __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); | 66 | __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); |
66 | 67 | ||
67 | static int nowayout = WATCHDOG_NOWAYOUT; | 68 | static bool nowayout = WATCHDOG_NOWAYOUT; |
68 | module_param(nowayout, int, 0); | 69 | module_param(nowayout, bool, 0); |
69 | MODULE_PARM_DESC(nowayout, | 70 | MODULE_PARM_DESC(nowayout, |
70 | "Watchdog cannot be stopped once started (default=" | 71 | "Watchdog cannot be stopped once started (default=" |
71 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 72 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
@@ -91,8 +92,8 @@ static int w83697ug_select_wd_register(void) | |||
91 | version = inb(WDT_EFDR); | 92 | version = inb(WDT_EFDR); |
92 | 93 | ||
93 | if (version == 0x68) { /* W83697UG */ | 94 | if (version == 0x68) { /* W83697UG */ |
94 | printk(KERN_INFO PFX "Watchdog chip version 0x%02x = " | 95 | pr_info("Watchdog chip version 0x%02x = W83697UG/UF found at 0x%04x\n", |
95 | "W83697UG/UF found at 0x%04x\n", version, wdt_io); | 96 | version, wdt_io); |
96 | 97 | ||
97 | outb_p(0x2b, WDT_EFER); | 98 | outb_p(0x2b, WDT_EFER); |
98 | c = inb_p(WDT_EFDR); /* select WDT0 */ | 99 | c = inb_p(WDT_EFDR); /* select WDT0 */ |
@@ -101,7 +102,7 @@ static int w83697ug_select_wd_register(void) | |||
101 | outb_p(c, WDT_EFDR); /* set pin118 to WDT0 */ | 102 | outb_p(c, WDT_EFDR); /* set pin118 to WDT0 */ |
102 | 103 | ||
103 | } else { | 104 | } else { |
104 | printk(KERN_ERR PFX "No W83697UG/UF could be found\n"); | 105 | pr_err("No W83697UG/UF could be found\n"); |
105 | return -ENODEV; | 106 | return -ENODEV; |
106 | } | 107 | } |
107 | 108 | ||
@@ -131,8 +132,8 @@ static int w83697ug_init(void) | |||
131 | outb_p(0xF6, WDT_EFER); /* Select CRF6 */ | 132 | outb_p(0xF6, WDT_EFER); /* Select CRF6 */ |
132 | t = inb_p(WDT_EFDR); /* read CRF6 */ | 133 | t = inb_p(WDT_EFDR); /* read CRF6 */ |
133 | if (t != 0) { | 134 | if (t != 0) { |
134 | printk(KERN_INFO PFX "Watchdog already running." | 135 | pr_info("Watchdog already running. Resetting timeout to %d sec\n", |
135 | " Resetting timeout to %d sec\n", timeout); | 136 | timeout); |
136 | outb_p(timeout, WDT_EFDR); /* Write back to CRF6 */ | 137 | outb_p(timeout, WDT_EFDR); /* Write back to CRF6 */ |
137 | } | 138 | } |
138 | outb_p(0xF5, WDT_EFER); /* Select CRF5 */ | 139 | outb_p(0xF5, WDT_EFER); /* Select CRF5 */ |
@@ -286,8 +287,7 @@ static int wdt_close(struct inode *inode, struct file *file) | |||
286 | if (expect_close == 42) | 287 | if (expect_close == 42) |
287 | wdt_disable(); | 288 | wdt_disable(); |
288 | else { | 289 | else { |
289 | printk(KERN_CRIT PFX | 290 | pr_crit("Unexpected close, not stopping watchdog!\n"); |
290 | "Unexpected close, not stopping watchdog!\n"); | ||
291 | wdt_ping(); | 291 | wdt_ping(); |
292 | } | 292 | } |
293 | expect_close = 0; | 293 | expect_close = 0; |
@@ -340,18 +340,16 @@ static int __init wdt_init(void) | |||
340 | { | 340 | { |
341 | int ret; | 341 | int ret; |
342 | 342 | ||
343 | printk(KERN_INFO "WDT driver for the Winbond(TM) W83697UG/UF Super I/O chip initialising.\n"); | 343 | pr_info("WDT driver for the Winbond(TM) W83697UG/UF Super I/O chip initialising\n"); |
344 | 344 | ||
345 | if (wdt_set_heartbeat(timeout)) { | 345 | if (wdt_set_heartbeat(timeout)) { |
346 | wdt_set_heartbeat(WATCHDOG_TIMEOUT); | 346 | wdt_set_heartbeat(WATCHDOG_TIMEOUT); |
347 | printk(KERN_INFO PFX | 347 | pr_info("timeout value must be 1<=timeout<=255, using %d\n", |
348 | "timeout value must be 1<=timeout<=255, using %d\n", | ||
349 | WATCHDOG_TIMEOUT); | 348 | WATCHDOG_TIMEOUT); |
350 | } | 349 | } |
351 | 350 | ||
352 | if (!request_region(wdt_io, 1, WATCHDOG_NAME)) { | 351 | if (!request_region(wdt_io, 1, WATCHDOG_NAME)) { |
353 | printk(KERN_ERR PFX "I/O address 0x%04x already in use\n", | 352 | pr_err("I/O address 0x%04x already in use\n", wdt_io); |
354 | wdt_io); | ||
355 | ret = -EIO; | 353 | ret = -EIO; |
356 | goto out; | 354 | goto out; |
357 | } | 355 | } |
@@ -362,20 +360,18 @@ static int __init wdt_init(void) | |||
362 | 360 | ||
363 | ret = register_reboot_notifier(&wdt_notifier); | 361 | ret = register_reboot_notifier(&wdt_notifier); |
364 | if (ret != 0) { | 362 | if (ret != 0) { |
365 | printk(KERN_ERR PFX | 363 | pr_err("cannot register reboot notifier (err=%d)\n", ret); |
366 | "cannot register reboot notifier (err=%d)\n", ret); | ||
367 | goto unreg_regions; | 364 | goto unreg_regions; |
368 | } | 365 | } |
369 | 366 | ||
370 | ret = misc_register(&wdt_miscdev); | 367 | ret = misc_register(&wdt_miscdev); |
371 | if (ret != 0) { | 368 | if (ret != 0) { |
372 | printk(KERN_ERR PFX | 369 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
373 | "cannot register miscdev on minor=%d (err=%d)\n", | 370 | WATCHDOG_MINOR, ret); |
374 | WATCHDOG_MINOR, ret); | ||
375 | goto unreg_reboot; | 371 | goto unreg_reboot; |
376 | } | 372 | } |
377 | 373 | ||
378 | printk(KERN_INFO PFX "initialized. timeout=%d sec (nowayout=%d)\n", | 374 | pr_info("initialized. timeout=%d sec (nowayout=%d)\n", |
379 | timeout, nowayout); | 375 | timeout, nowayout); |
380 | 376 | ||
381 | out: | 377 | out: |
diff --git a/drivers/watchdog/w83877f_wdt.c b/drivers/watchdog/w83877f_wdt.c index 24587d2060c4..e76e7e309301 100644 --- a/drivers/watchdog/w83877f_wdt.c +++ b/drivers/watchdog/w83877f_wdt.c | |||
@@ -42,6 +42,8 @@ | |||
42 | * daemon always getting scheduled within that time frame. | 42 | * daemon always getting scheduled within that time frame. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
46 | |||
45 | #include <linux/module.h> | 47 | #include <linux/module.h> |
46 | #include <linux/moduleparam.h> | 48 | #include <linux/moduleparam.h> |
47 | #include <linux/types.h> | 49 | #include <linux/types.h> |
@@ -59,7 +61,6 @@ | |||
59 | #include <asm/system.h> | 61 | #include <asm/system.h> |
60 | 62 | ||
61 | #define OUR_NAME "w83877f_wdt" | 63 | #define OUR_NAME "w83877f_wdt" |
62 | #define PFX OUR_NAME ": " | ||
63 | 64 | ||
64 | #define ENABLE_W83877F_PORT 0x3F0 | 65 | #define ENABLE_W83877F_PORT 0x3F0 |
65 | #define ENABLE_W83877F 0x87 | 66 | #define ENABLE_W83877F 0x87 |
@@ -91,8 +92,8 @@ MODULE_PARM_DESC(timeout, | |||
91 | __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); | 92 | __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); |
92 | 93 | ||
93 | 94 | ||
94 | static int nowayout = WATCHDOG_NOWAYOUT; | 95 | static bool nowayout = WATCHDOG_NOWAYOUT; |
95 | module_param(nowayout, int, 0); | 96 | module_param(nowayout, bool, 0); |
96 | MODULE_PARM_DESC(nowayout, | 97 | MODULE_PARM_DESC(nowayout, |
97 | "Watchdog cannot be stopped once started (default=" | 98 | "Watchdog cannot be stopped once started (default=" |
98 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 99 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
@@ -126,8 +127,7 @@ static void wdt_timer_ping(unsigned long data) | |||
126 | spin_unlock(&wdt_spinlock); | 127 | spin_unlock(&wdt_spinlock); |
127 | 128 | ||
128 | } else | 129 | } else |
129 | printk(KERN_WARNING PFX | 130 | pr_warn("Heartbeat lost! Will not ping the watchdog\n"); |
130 | "Heartbeat lost! Will not ping the watchdog\n"); | ||
131 | } | 131 | } |
132 | 132 | ||
133 | /* | 133 | /* |
@@ -165,7 +165,7 @@ static void wdt_startup(void) | |||
165 | 165 | ||
166 | wdt_change(WDT_ENABLE); | 166 | wdt_change(WDT_ENABLE); |
167 | 167 | ||
168 | printk(KERN_INFO PFX "Watchdog timer is now enabled.\n"); | 168 | pr_info("Watchdog timer is now enabled\n"); |
169 | } | 169 | } |
170 | 170 | ||
171 | static void wdt_turnoff(void) | 171 | static void wdt_turnoff(void) |
@@ -175,7 +175,7 @@ static void wdt_turnoff(void) | |||
175 | 175 | ||
176 | wdt_change(WDT_DISABLE); | 176 | wdt_change(WDT_DISABLE); |
177 | 177 | ||
178 | printk(KERN_INFO PFX "Watchdog timer is now disabled...\n"); | 178 | pr_info("Watchdog timer is now disabled...\n"); |
179 | } | 179 | } |
180 | 180 | ||
181 | static void wdt_keepalive(void) | 181 | static void wdt_keepalive(void) |
@@ -234,8 +234,7 @@ static int fop_close(struct inode *inode, struct file *file) | |||
234 | wdt_turnoff(); | 234 | wdt_turnoff(); |
235 | else { | 235 | else { |
236 | del_timer(&timer); | 236 | del_timer(&timer); |
237 | printk(KERN_CRIT PFX | 237 | pr_crit("device file closed unexpectedly. Will not stop the WDT!\n"); |
238 | "device file closed unexpectedly. Will not stop the WDT!\n"); | ||
239 | } | 238 | } |
240 | clear_bit(0, &wdt_is_open); | 239 | clear_bit(0, &wdt_is_open); |
241 | wdt_expect_close = 0; | 240 | wdt_expect_close = 0; |
@@ -357,42 +356,37 @@ static int __init w83877f_wdt_init(void) | |||
357 | 356 | ||
358 | if (timeout < 1 || timeout > 3600) { /* arbitrary upper limit */ | 357 | if (timeout < 1 || timeout > 3600) { /* arbitrary upper limit */ |
359 | timeout = WATCHDOG_TIMEOUT; | 358 | timeout = WATCHDOG_TIMEOUT; |
360 | printk(KERN_INFO PFX | 359 | pr_info("timeout value must be 1 <= x <= 3600, using %d\n", |
361 | "timeout value must be 1 <= x <= 3600, using %d\n", | 360 | timeout); |
362 | timeout); | ||
363 | } | 361 | } |
364 | 362 | ||
365 | if (!request_region(ENABLE_W83877F_PORT, 2, "W83877F WDT")) { | 363 | if (!request_region(ENABLE_W83877F_PORT, 2, "W83877F WDT")) { |
366 | printk(KERN_ERR PFX "I/O address 0x%04x already in use\n", | 364 | pr_err("I/O address 0x%04x already in use\n", |
367 | ENABLE_W83877F_PORT); | 365 | ENABLE_W83877F_PORT); |
368 | rc = -EIO; | 366 | rc = -EIO; |
369 | goto err_out; | 367 | goto err_out; |
370 | } | 368 | } |
371 | 369 | ||
372 | if (!request_region(WDT_PING, 1, "W8387FF WDT")) { | 370 | if (!request_region(WDT_PING, 1, "W8387FF WDT")) { |
373 | printk(KERN_ERR PFX "I/O address 0x%04x already in use\n", | 371 | pr_err("I/O address 0x%04x already in use\n", WDT_PING); |
374 | WDT_PING); | ||
375 | rc = -EIO; | 372 | rc = -EIO; |
376 | goto err_out_region1; | 373 | goto err_out_region1; |
377 | } | 374 | } |
378 | 375 | ||
379 | rc = register_reboot_notifier(&wdt_notifier); | 376 | rc = register_reboot_notifier(&wdt_notifier); |
380 | if (rc) { | 377 | if (rc) { |
381 | printk(KERN_ERR PFX | 378 | pr_err("cannot register reboot notifier (err=%d)\n", rc); |
382 | "cannot register reboot notifier (err=%d)\n", rc); | ||
383 | goto err_out_region2; | 379 | goto err_out_region2; |
384 | } | 380 | } |
385 | 381 | ||
386 | rc = misc_register(&wdt_miscdev); | 382 | rc = misc_register(&wdt_miscdev); |
387 | if (rc) { | 383 | if (rc) { |
388 | printk(KERN_ERR PFX | 384 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
389 | "cannot register miscdev on minor=%d (err=%d)\n", | 385 | wdt_miscdev.minor, rc); |
390 | wdt_miscdev.minor, rc); | ||
391 | goto err_out_reboot; | 386 | goto err_out_reboot; |
392 | } | 387 | } |
393 | 388 | ||
394 | printk(KERN_INFO PFX | 389 | pr_info("WDT driver for W83877F initialised. timeout=%d sec (nowayout=%d)\n", |
395 | "WDT driver for W83877F initialised. timeout=%d sec (nowayout=%d)\n", | ||
396 | timeout, nowayout); | 390 | timeout, nowayout); |
397 | 391 | ||
398 | return 0; | 392 | return 0; |
diff --git a/drivers/watchdog/w83977f_wdt.c b/drivers/watchdog/w83977f_wdt.c index 6e6743d1066f..56bfded1f361 100644 --- a/drivers/watchdog/w83977f_wdt.c +++ b/drivers/watchdog/w83977f_wdt.c | |||
@@ -15,6 +15,8 @@ | |||
15 | * | 15 | * |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
19 | |||
18 | #include <linux/module.h> | 20 | #include <linux/module.h> |
19 | #include <linux/moduleparam.h> | 21 | #include <linux/moduleparam.h> |
20 | #include <linux/types.h> | 22 | #include <linux/types.h> |
@@ -33,8 +35,6 @@ | |||
33 | 35 | ||
34 | #define WATCHDOG_VERSION "1.00" | 36 | #define WATCHDOG_VERSION "1.00" |
35 | #define WATCHDOG_NAME "W83977F WDT" | 37 | #define WATCHDOG_NAME "W83977F WDT" |
36 | #define PFX WATCHDOG_NAME ": " | ||
37 | #define DRIVER_VERSION WATCHDOG_NAME " driver, v" WATCHDOG_VERSION "\n" | ||
38 | 38 | ||
39 | #define IO_INDEX_PORT 0x3F0 | 39 | #define IO_INDEX_PORT 0x3F0 |
40 | #define IO_DATA_PORT (IO_INDEX_PORT+1) | 40 | #define IO_DATA_PORT (IO_INDEX_PORT+1) |
@@ -59,8 +59,8 @@ MODULE_PARM_DESC(timeout, | |||
59 | module_param(testmode, int, 0); | 59 | module_param(testmode, int, 0); |
60 | MODULE_PARM_DESC(testmode, "Watchdog testmode (1 = no reboot), default=0"); | 60 | MODULE_PARM_DESC(testmode, "Watchdog testmode (1 = no reboot), default=0"); |
61 | 61 | ||
62 | static int nowayout = WATCHDOG_NOWAYOUT; | 62 | static bool nowayout = WATCHDOG_NOWAYOUT; |
63 | module_param(nowayout, int, 0); | 63 | module_param(nowayout, bool, 0); |
64 | MODULE_PARM_DESC(nowayout, | 64 | MODULE_PARM_DESC(nowayout, |
65 | "Watchdog cannot be stopped once started (default=" | 65 | "Watchdog cannot be stopped once started (default=" |
66 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 66 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
@@ -131,7 +131,7 @@ static int wdt_start(void) | |||
131 | 131 | ||
132 | spin_unlock_irqrestore(&spinlock, flags); | 132 | spin_unlock_irqrestore(&spinlock, flags); |
133 | 133 | ||
134 | printk(KERN_INFO PFX "activated.\n"); | 134 | pr_info("activated\n"); |
135 | 135 | ||
136 | return 0; | 136 | return 0; |
137 | } | 137 | } |
@@ -185,7 +185,7 @@ static int wdt_stop(void) | |||
185 | 185 | ||
186 | spin_unlock_irqrestore(&spinlock, flags); | 186 | spin_unlock_irqrestore(&spinlock, flags); |
187 | 187 | ||
188 | printk(KERN_INFO PFX "shutdown.\n"); | 188 | pr_info("shutdown\n"); |
189 | 189 | ||
190 | return 0; | 190 | return 0; |
191 | } | 191 | } |
@@ -313,8 +313,7 @@ static int wdt_release(struct inode *inode, struct file *file) | |||
313 | clear_bit(0, &timer_alive); | 313 | clear_bit(0, &timer_alive); |
314 | } else { | 314 | } else { |
315 | wdt_keepalive(); | 315 | wdt_keepalive(); |
316 | printk(KERN_CRIT PFX | 316 | pr_crit("unexpected close, not stopping watchdog!\n"); |
317 | "unexpected close, not stopping watchdog!\n"); | ||
318 | } | 317 | } |
319 | expect_close = 0; | 318 | expect_close = 0; |
320 | return 0; | 319 | return 0; |
@@ -471,7 +470,7 @@ static int __init w83977f_wdt_init(void) | |||
471 | { | 470 | { |
472 | int rc; | 471 | int rc; |
473 | 472 | ||
474 | printk(KERN_INFO PFX DRIVER_VERSION); | 473 | pr_info("driver v%s\n", WATCHDOG_VERSION); |
475 | 474 | ||
476 | /* | 475 | /* |
477 | * Check that the timeout value is within it's range; | 476 | * Check that the timeout value is within it's range; |
@@ -479,36 +478,31 @@ static int __init w83977f_wdt_init(void) | |||
479 | */ | 478 | */ |
480 | if (wdt_set_timeout(timeout)) { | 479 | if (wdt_set_timeout(timeout)) { |
481 | wdt_set_timeout(DEFAULT_TIMEOUT); | 480 | wdt_set_timeout(DEFAULT_TIMEOUT); |
482 | printk(KERN_INFO PFX | 481 | pr_info("timeout value must be 15 <= timeout <= 7635, using %d\n", |
483 | "timeout value must be 15 <= timeout <= 7635, using %d\n", | 482 | DEFAULT_TIMEOUT); |
484 | DEFAULT_TIMEOUT); | ||
485 | } | 483 | } |
486 | 484 | ||
487 | if (!request_region(IO_INDEX_PORT, 2, WATCHDOG_NAME)) { | 485 | if (!request_region(IO_INDEX_PORT, 2, WATCHDOG_NAME)) { |
488 | printk(KERN_ERR PFX "I/O address 0x%04x already in use\n", | 486 | pr_err("I/O address 0x%04x already in use\n", IO_INDEX_PORT); |
489 | IO_INDEX_PORT); | ||
490 | rc = -EIO; | 487 | rc = -EIO; |
491 | goto err_out; | 488 | goto err_out; |
492 | } | 489 | } |
493 | 490 | ||
494 | rc = register_reboot_notifier(&wdt_notifier); | 491 | rc = register_reboot_notifier(&wdt_notifier); |
495 | if (rc) { | 492 | if (rc) { |
496 | printk(KERN_ERR PFX | 493 | pr_err("cannot register reboot notifier (err=%d)\n", rc); |
497 | "cannot register reboot notifier (err=%d)\n", rc); | ||
498 | goto err_out_region; | 494 | goto err_out_region; |
499 | } | 495 | } |
500 | 496 | ||
501 | rc = misc_register(&wdt_miscdev); | 497 | rc = misc_register(&wdt_miscdev); |
502 | if (rc) { | 498 | if (rc) { |
503 | printk(KERN_ERR PFX | 499 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
504 | "cannot register miscdev on minor=%d (err=%d)\n", | 500 | wdt_miscdev.minor, rc); |
505 | wdt_miscdev.minor, rc); | ||
506 | goto err_out_reboot; | 501 | goto err_out_reboot; |
507 | } | 502 | } |
508 | 503 | ||
509 | printk(KERN_INFO PFX | 504 | pr_info("initialized. timeout=%d sec (nowayout=%d testmode=%d)\n", |
510 | "initialized. timeout=%d sec (nowayout=%d testmode=%d)\n", | 505 | timeout, nowayout, testmode); |
511 | timeout, nowayout, testmode); | ||
512 | 506 | ||
513 | return 0; | 507 | return 0; |
514 | 508 | ||
diff --git a/drivers/watchdog/wafer5823wdt.c b/drivers/watchdog/wafer5823wdt.c index c3c3188c34d7..25aba6e00a23 100644 --- a/drivers/watchdog/wafer5823wdt.c +++ b/drivers/watchdog/wafer5823wdt.c | |||
@@ -26,6 +26,8 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
30 | |||
29 | #include <linux/module.h> | 31 | #include <linux/module.h> |
30 | #include <linux/moduleparam.h> | 32 | #include <linux/moduleparam.h> |
31 | #include <linux/miscdevice.h> | 33 | #include <linux/miscdevice.h> |
@@ -65,8 +67,8 @@ MODULE_PARM_DESC(timeout, | |||
65 | "Watchdog timeout in seconds. 1 <= timeout <= 255, default=" | 67 | "Watchdog timeout in seconds. 1 <= timeout <= 255, default=" |
66 | __MODULE_STRING(WD_TIMO) "."); | 68 | __MODULE_STRING(WD_TIMO) "."); |
67 | 69 | ||
68 | static int nowayout = WATCHDOG_NOWAYOUT; | 70 | static bool nowayout = WATCHDOG_NOWAYOUT; |
69 | module_param(nowayout, int, 0); | 71 | module_param(nowayout, bool, 0); |
70 | MODULE_PARM_DESC(nowayout, | 72 | MODULE_PARM_DESC(nowayout, |
71 | "Watchdog cannot be stopped once started (default=" | 73 | "Watchdog cannot be stopped once started (default=" |
72 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 74 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
@@ -203,8 +205,7 @@ static int wafwdt_close(struct inode *inode, struct file *file) | |||
203 | if (expect_close == 42) | 205 | if (expect_close == 42) |
204 | wafwdt_stop(); | 206 | wafwdt_stop(); |
205 | else { | 207 | else { |
206 | printk(KERN_CRIT PFX | 208 | pr_crit("WDT device closed unexpectedly. WDT will not stop!\n"); |
207 | "WDT device closed unexpectedly. WDT will not stop!\n"); | ||
208 | wafwdt_ping(); | 209 | wafwdt_ping(); |
209 | } | 210 | } |
210 | clear_bit(0, &wafwdt_is_open); | 211 | clear_bit(0, &wafwdt_is_open); |
@@ -256,49 +257,42 @@ static int __init wafwdt_init(void) | |||
256 | { | 257 | { |
257 | int ret; | 258 | int ret; |
258 | 259 | ||
259 | printk(KERN_INFO | 260 | pr_info("WDT driver for Wafer 5823 single board computer initialising\n"); |
260 | "WDT driver for Wafer 5823 single board computer initialising.\n"); | ||
261 | 261 | ||
262 | if (timeout < 1 || timeout > 255) { | 262 | if (timeout < 1 || timeout > 255) { |
263 | timeout = WD_TIMO; | 263 | timeout = WD_TIMO; |
264 | printk(KERN_INFO PFX | 264 | pr_info("timeout value must be 1 <= x <= 255, using %d\n", |
265 | "timeout value must be 1 <= x <= 255, using %d\n", | 265 | timeout); |
266 | timeout); | ||
267 | } | 266 | } |
268 | 267 | ||
269 | if (wdt_stop != wdt_start) { | 268 | if (wdt_stop != wdt_start) { |
270 | if (!request_region(wdt_stop, 1, "Wafer 5823 WDT")) { | 269 | if (!request_region(wdt_stop, 1, "Wafer 5823 WDT")) { |
271 | printk(KERN_ERR PFX | 270 | pr_err("I/O address 0x%04x already in use\n", wdt_stop); |
272 | "I/O address 0x%04x already in use\n", | ||
273 | wdt_stop); | ||
274 | ret = -EIO; | 271 | ret = -EIO; |
275 | goto error; | 272 | goto error; |
276 | } | 273 | } |
277 | } | 274 | } |
278 | 275 | ||
279 | if (!request_region(wdt_start, 1, "Wafer 5823 WDT")) { | 276 | if (!request_region(wdt_start, 1, "Wafer 5823 WDT")) { |
280 | printk(KERN_ERR PFX "I/O address 0x%04x already in use\n", | 277 | pr_err("I/O address 0x%04x already in use\n", wdt_start); |
281 | wdt_start); | ||
282 | ret = -EIO; | 278 | ret = -EIO; |
283 | goto error2; | 279 | goto error2; |
284 | } | 280 | } |
285 | 281 | ||
286 | ret = register_reboot_notifier(&wafwdt_notifier); | 282 | ret = register_reboot_notifier(&wafwdt_notifier); |
287 | if (ret != 0) { | 283 | if (ret != 0) { |
288 | printk(KERN_ERR PFX | 284 | pr_err("cannot register reboot notifier (err=%d)\n", ret); |
289 | "cannot register reboot notifier (err=%d)\n", ret); | ||
290 | goto error3; | 285 | goto error3; |
291 | } | 286 | } |
292 | 287 | ||
293 | ret = misc_register(&wafwdt_miscdev); | 288 | ret = misc_register(&wafwdt_miscdev); |
294 | if (ret != 0) { | 289 | if (ret != 0) { |
295 | printk(KERN_ERR PFX | 290 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
296 | "cannot register miscdev on minor=%d (err=%d)\n", | 291 | WATCHDOG_MINOR, ret); |
297 | WATCHDOG_MINOR, ret); | ||
298 | goto error4; | 292 | goto error4; |
299 | } | 293 | } |
300 | 294 | ||
301 | printk(KERN_INFO PFX "initialized. timeout=%d sec (nowayout=%d)\n", | 295 | pr_info("initialized. timeout=%d sec (nowayout=%d)\n", |
302 | timeout, nowayout); | 296 | timeout, nowayout); |
303 | 297 | ||
304 | return ret; | 298 | return ret; |
diff --git a/drivers/watchdog/watchdog_core.c b/drivers/watchdog/watchdog_core.c index cfa1a1518aad..14d768bfa267 100644 --- a/drivers/watchdog/watchdog_core.c +++ b/drivers/watchdog/watchdog_core.c | |||
@@ -77,7 +77,7 @@ int watchdog_register_device(struct watchdog_device *wdd) | |||
77 | /* We only support 1 watchdog device via the /dev/watchdog interface */ | 77 | /* We only support 1 watchdog device via the /dev/watchdog interface */ |
78 | ret = watchdog_dev_register(wdd); | 78 | ret = watchdog_dev_register(wdd); |
79 | if (ret) { | 79 | if (ret) { |
80 | pr_err("error registering /dev/watchdog (err=%d).\n", ret); | 80 | pr_err("error registering /dev/watchdog (err=%d)\n", ret); |
81 | return ret; | 81 | return ret; |
82 | } | 82 | } |
83 | 83 | ||
@@ -101,7 +101,7 @@ void watchdog_unregister_device(struct watchdog_device *wdd) | |||
101 | 101 | ||
102 | ret = watchdog_dev_unregister(wdd); | 102 | ret = watchdog_dev_unregister(wdd); |
103 | if (ret) | 103 | if (ret) |
104 | pr_err("error unregistering /dev/watchdog (err=%d).\n", ret); | 104 | pr_err("error unregistering /dev/watchdog (err=%d)\n", ret); |
105 | } | 105 | } |
106 | EXPORT_SYMBOL_GPL(watchdog_unregister_device); | 106 | EXPORT_SYMBOL_GPL(watchdog_unregister_device); |
107 | 107 | ||
diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c index 1199da0f98cf..8558da912c42 100644 --- a/drivers/watchdog/watchdog_dev.c +++ b/drivers/watchdog/watchdog_dev.c | |||
@@ -226,7 +226,6 @@ static long watchdog_ioctl(struct file *file, unsigned int cmd, | |||
226 | err = wdd->ops->set_timeout(wdd, val); | 226 | err = wdd->ops->set_timeout(wdd, val); |
227 | if (err < 0) | 227 | if (err < 0) |
228 | return err; | 228 | return err; |
229 | wdd->timeout = val; | ||
230 | /* If the watchdog is active then we send a keepalive ping | 229 | /* If the watchdog is active then we send a keepalive ping |
231 | * to make sure that the watchdog keep's running (and if | 230 | * to make sure that the watchdog keep's running (and if |
232 | * possible that it takes the new timeout) */ | 231 | * possible that it takes the new timeout) */ |
@@ -237,6 +236,11 @@ static long watchdog_ioctl(struct file *file, unsigned int cmd, | |||
237 | if (wdd->timeout == 0) | 236 | if (wdd->timeout == 0) |
238 | return -EOPNOTSUPP; | 237 | return -EOPNOTSUPP; |
239 | return put_user(wdd->timeout, p); | 238 | return put_user(wdd->timeout, p); |
239 | case WDIOC_GETTIMELEFT: | ||
240 | if (!wdd->ops->get_timeleft) | ||
241 | return -EOPNOTSUPP; | ||
242 | |||
243 | return put_user(wdd->ops->get_timeleft(wdd), p); | ||
240 | default: | 244 | default: |
241 | return -ENOTTY; | 245 | return -ENOTTY; |
242 | } | 246 | } |
@@ -347,7 +351,7 @@ int watchdog_dev_register(struct watchdog_device *watchdog) | |||
347 | 351 | ||
348 | /* Only one device can register for /dev/watchdog */ | 352 | /* Only one device can register for /dev/watchdog */ |
349 | if (test_and_set_bit(0, &watchdog_dev_busy)) { | 353 | if (test_and_set_bit(0, &watchdog_dev_busy)) { |
350 | pr_err("only one watchdog can use /dev/watchdog.\n"); | 354 | pr_err("only one watchdog can use /dev/watchdog\n"); |
351 | return -EBUSY; | 355 | return -EBUSY; |
352 | } | 356 | } |
353 | 357 | ||
@@ -355,8 +359,8 @@ int watchdog_dev_register(struct watchdog_device *watchdog) | |||
355 | 359 | ||
356 | err = misc_register(&watchdog_miscdev); | 360 | err = misc_register(&watchdog_miscdev); |
357 | if (err != 0) { | 361 | if (err != 0) { |
358 | pr_err("%s: cannot register miscdev on minor=%d (err=%d).\n", | 362 | pr_err("%s: cannot register miscdev on minor=%d (err=%d)\n", |
359 | watchdog->info->identity, WATCHDOG_MINOR, err); | 363 | watchdog->info->identity, WATCHDOG_MINOR, err); |
360 | goto out; | 364 | goto out; |
361 | } | 365 | } |
362 | 366 | ||
@@ -383,8 +387,8 @@ int watchdog_dev_unregister(struct watchdog_device *watchdog) | |||
383 | 387 | ||
384 | /* We can only unregister the watchdog device that was registered */ | 388 | /* We can only unregister the watchdog device that was registered */ |
385 | if (watchdog != wdd) { | 389 | if (watchdog != wdd) { |
386 | pr_err("%s: watchdog was not registered as /dev/watchdog.\n", | 390 | pr_err("%s: watchdog was not registered as /dev/watchdog\n", |
387 | watchdog->info->identity); | 391 | watchdog->info->identity); |
388 | return -ENODEV; | 392 | return -ENODEV; |
389 | } | 393 | } |
390 | 394 | ||
diff --git a/drivers/watchdog/wdrtas.c b/drivers/watchdog/wdrtas.c index 94ec22b9e66b..0a77655cda60 100644 --- a/drivers/watchdog/wdrtas.c +++ b/drivers/watchdog/wdrtas.c | |||
@@ -26,6 +26,8 @@ | |||
26 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 26 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
30 | |||
29 | #include <linux/fs.h> | 31 | #include <linux/fs.h> |
30 | #include <linux/init.h> | 32 | #include <linux/init.h> |
31 | #include <linux/kernel.h> | 33 | #include <linux/kernel.h> |
@@ -49,7 +51,7 @@ MODULE_LICENSE("GPL"); | |||
49 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | 51 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); |
50 | MODULE_ALIAS_MISCDEV(TEMP_MINOR); | 52 | MODULE_ALIAS_MISCDEV(TEMP_MINOR); |
51 | 53 | ||
52 | static int wdrtas_nowayout = WATCHDOG_NOWAYOUT; | 54 | static bool wdrtas_nowayout = WATCHDOG_NOWAYOUT; |
53 | static atomic_t wdrtas_miscdev_open = ATOMIC_INIT(0); | 55 | static atomic_t wdrtas_miscdev_open = ATOMIC_INIT(0); |
54 | static char wdrtas_expect_close; | 56 | static char wdrtas_expect_close; |
55 | 57 | ||
@@ -93,8 +95,8 @@ static int wdrtas_set_interval(int interval) | |||
93 | result = rtas_call(wdrtas_token_set_indicator, 3, 1, NULL, | 95 | result = rtas_call(wdrtas_token_set_indicator, 3, 1, NULL, |
94 | WDRTAS_SURVEILLANCE_IND, 0, interval); | 96 | WDRTAS_SURVEILLANCE_IND, 0, interval); |
95 | if (result < 0 && print_msg) { | 97 | if (result < 0 && print_msg) { |
96 | printk(KERN_ERR "wdrtas: setting the watchdog to %i " | 98 | pr_err("setting the watchdog to %i timeout failed: %li\n", |
97 | "timeout failed: %li\n", interval, result); | 99 | interval, result); |
98 | print_msg--; | 100 | print_msg--; |
99 | } | 101 | } |
100 | 102 | ||
@@ -128,8 +130,8 @@ static int wdrtas_get_interval(int fallback_value) | |||
128 | spin_unlock(&rtas_data_buf_lock); | 130 | spin_unlock(&rtas_data_buf_lock); |
129 | 131 | ||
130 | if (value[0] != 0 || value[1] != 2 || value[3] != 0 || result < 0) { | 132 | if (value[0] != 0 || value[1] != 2 || value[3] != 0 || result < 0) { |
131 | printk(KERN_WARNING "wdrtas: could not get sp_spi watchdog " | 133 | pr_warn("could not get sp_spi watchdog timeout (%li). Continuing\n", |
132 | "timeout (%li). Continuing\n", result); | 134 | result); |
133 | return fallback_value; | 135 | return fallback_value; |
134 | } | 136 | } |
135 | 137 | ||
@@ -170,18 +172,18 @@ static void wdrtas_log_scanned_event(void) | |||
170 | int i; | 172 | int i; |
171 | 173 | ||
172 | for (i = 0; i < WDRTAS_LOGBUFFER_LEN; i += 16) | 174 | for (i = 0; i < WDRTAS_LOGBUFFER_LEN; i += 16) |
173 | printk(KERN_INFO "wdrtas: dumping event (line %i/%i), data = " | 175 | pr_info("dumping event (line %i/%i), data = " |
174 | "%02x %02x %02x %02x %02x %02x %02x %02x " | 176 | "%02x %02x %02x %02x %02x %02x %02x %02x " |
175 | "%02x %02x %02x %02x %02x %02x %02x %02x\n", | 177 | "%02x %02x %02x %02x %02x %02x %02x %02x\n", |
176 | (i / 16) + 1, (WDRTAS_LOGBUFFER_LEN / 16), | 178 | (i / 16) + 1, (WDRTAS_LOGBUFFER_LEN / 16), |
177 | wdrtas_logbuffer[i + 0], wdrtas_logbuffer[i + 1], | 179 | wdrtas_logbuffer[i + 0], wdrtas_logbuffer[i + 1], |
178 | wdrtas_logbuffer[i + 2], wdrtas_logbuffer[i + 3], | 180 | wdrtas_logbuffer[i + 2], wdrtas_logbuffer[i + 3], |
179 | wdrtas_logbuffer[i + 4], wdrtas_logbuffer[i + 5], | 181 | wdrtas_logbuffer[i + 4], wdrtas_logbuffer[i + 5], |
180 | wdrtas_logbuffer[i + 6], wdrtas_logbuffer[i + 7], | 182 | wdrtas_logbuffer[i + 6], wdrtas_logbuffer[i + 7], |
181 | wdrtas_logbuffer[i + 8], wdrtas_logbuffer[i + 9], | 183 | wdrtas_logbuffer[i + 8], wdrtas_logbuffer[i + 9], |
182 | wdrtas_logbuffer[i + 10], wdrtas_logbuffer[i + 11], | 184 | wdrtas_logbuffer[i + 10], wdrtas_logbuffer[i + 11], |
183 | wdrtas_logbuffer[i + 12], wdrtas_logbuffer[i + 13], | 185 | wdrtas_logbuffer[i + 12], wdrtas_logbuffer[i + 13], |
184 | wdrtas_logbuffer[i + 14], wdrtas_logbuffer[i + 15]); | 186 | wdrtas_logbuffer[i + 14], wdrtas_logbuffer[i + 15]); |
185 | } | 187 | } |
186 | 188 | ||
187 | /** | 189 | /** |
@@ -201,8 +203,7 @@ static void wdrtas_timer_keepalive(void) | |||
201 | (void *)__pa(wdrtas_logbuffer), | 203 | (void *)__pa(wdrtas_logbuffer), |
202 | WDRTAS_LOGBUFFER_LEN); | 204 | WDRTAS_LOGBUFFER_LEN); |
203 | if (result < 0) | 205 | if (result < 0) |
204 | printk(KERN_ERR "wdrtas: event-scan failed: %li\n", | 206 | pr_err("event-scan failed: %li\n", result); |
205 | result); | ||
206 | if (result == 0) | 207 | if (result == 0) |
207 | wdrtas_log_scanned_event(); | 208 | wdrtas_log_scanned_event(); |
208 | } while (result == 0); | 209 | } while (result == 0); |
@@ -224,8 +225,7 @@ static int wdrtas_get_temperature(void) | |||
224 | result = rtas_get_sensor(WDRTAS_THERMAL_SENSOR, 0, &temperature); | 225 | result = rtas_get_sensor(WDRTAS_THERMAL_SENSOR, 0, &temperature); |
225 | 226 | ||
226 | if (result < 0) | 227 | if (result < 0) |
227 | printk(KERN_WARNING "wdrtas: reading the thermal sensor " | 228 | pr_warn("reading the thermal sensor failed: %i\n", result); |
228 | "failed: %i\n", result); | ||
229 | else | 229 | else |
230 | temperature = ((temperature * 9) / 5) + 32; /* fahrenheit */ | 230 | temperature = ((temperature * 9) / 5) + 32; /* fahrenheit */ |
231 | 231 | ||
@@ -419,8 +419,7 @@ static int wdrtas_close(struct inode *inode, struct file *file) | |||
419 | if (wdrtas_expect_close == WDRTAS_MAGIC_CHAR) | 419 | if (wdrtas_expect_close == WDRTAS_MAGIC_CHAR) |
420 | wdrtas_timer_stop(); | 420 | wdrtas_timer_stop(); |
421 | else { | 421 | else { |
422 | printk(KERN_WARNING "wdrtas: got unexpected close. Watchdog " | 422 | pr_warn("got unexpected close. Watchdog not stopped.\n"); |
423 | "not stopped.\n"); | ||
424 | wdrtas_timer_keepalive(); | 423 | wdrtas_timer_keepalive(); |
425 | } | 424 | } |
426 | 425 | ||
@@ -552,30 +551,24 @@ static int wdrtas_get_tokens(void) | |||
552 | { | 551 | { |
553 | wdrtas_token_get_sensor_state = rtas_token("get-sensor-state"); | 552 | wdrtas_token_get_sensor_state = rtas_token("get-sensor-state"); |
554 | if (wdrtas_token_get_sensor_state == RTAS_UNKNOWN_SERVICE) { | 553 | if (wdrtas_token_get_sensor_state == RTAS_UNKNOWN_SERVICE) { |
555 | printk(KERN_WARNING "wdrtas: couldn't get token for " | 554 | pr_warn("couldn't get token for get-sensor-state. Trying to continue without temperature support.\n"); |
556 | "get-sensor-state. Trying to continue without " | ||
557 | "temperature support.\n"); | ||
558 | } | 555 | } |
559 | 556 | ||
560 | wdrtas_token_get_sp = rtas_token("ibm,get-system-parameter"); | 557 | wdrtas_token_get_sp = rtas_token("ibm,get-system-parameter"); |
561 | if (wdrtas_token_get_sp == RTAS_UNKNOWN_SERVICE) { | 558 | if (wdrtas_token_get_sp == RTAS_UNKNOWN_SERVICE) { |
562 | printk(KERN_WARNING "wdrtas: couldn't get token for " | 559 | pr_warn("couldn't get token for ibm,get-system-parameter. Trying to continue with a default timeout value of %i seconds.\n", |
563 | "ibm,get-system-parameter. Trying to continue with " | 560 | WDRTAS_DEFAULT_INTERVAL); |
564 | "a default timeout value of %i seconds.\n", | ||
565 | WDRTAS_DEFAULT_INTERVAL); | ||
566 | } | 561 | } |
567 | 562 | ||
568 | wdrtas_token_set_indicator = rtas_token("set-indicator"); | 563 | wdrtas_token_set_indicator = rtas_token("set-indicator"); |
569 | if (wdrtas_token_set_indicator == RTAS_UNKNOWN_SERVICE) { | 564 | if (wdrtas_token_set_indicator == RTAS_UNKNOWN_SERVICE) { |
570 | printk(KERN_ERR "wdrtas: couldn't get token for " | 565 | pr_err("couldn't get token for set-indicator. Terminating watchdog code.\n"); |
571 | "set-indicator. Terminating watchdog code.\n"); | ||
572 | return -EIO; | 566 | return -EIO; |
573 | } | 567 | } |
574 | 568 | ||
575 | wdrtas_token_event_scan = rtas_token("event-scan"); | 569 | wdrtas_token_event_scan = rtas_token("event-scan"); |
576 | if (wdrtas_token_event_scan == RTAS_UNKNOWN_SERVICE) { | 570 | if (wdrtas_token_event_scan == RTAS_UNKNOWN_SERVICE) { |
577 | printk(KERN_ERR "wdrtas: couldn't get token for event-scan. " | 571 | pr_err("couldn't get token for event-scan. Terminating watchdog code.\n"); |
578 | "Terminating watchdog code.\n"); | ||
579 | return -EIO; | 572 | return -EIO; |
580 | } | 573 | } |
581 | 574 | ||
@@ -609,17 +602,14 @@ static int wdrtas_register_devs(void) | |||
609 | 602 | ||
610 | result = misc_register(&wdrtas_miscdev); | 603 | result = misc_register(&wdrtas_miscdev); |
611 | if (result) { | 604 | if (result) { |
612 | printk(KERN_ERR "wdrtas: couldn't register watchdog misc " | 605 | pr_err("couldn't register watchdog misc device. Terminating watchdog code.\n"); |
613 | "device. Terminating watchdog code.\n"); | ||
614 | return result; | 606 | return result; |
615 | } | 607 | } |
616 | 608 | ||
617 | if (wdrtas_token_get_sensor_state != RTAS_UNKNOWN_SERVICE) { | 609 | if (wdrtas_token_get_sensor_state != RTAS_UNKNOWN_SERVICE) { |
618 | result = misc_register(&wdrtas_tempdev); | 610 | result = misc_register(&wdrtas_tempdev); |
619 | if (result) { | 611 | if (result) { |
620 | printk(KERN_WARNING "wdrtas: couldn't register " | 612 | pr_warn("couldn't register watchdog temperature misc device. Continuing without temperature support.\n"); |
621 | "watchdog temperature misc device. Continuing " | ||
622 | "without temperature support.\n"); | ||
623 | wdrtas_token_get_sensor_state = RTAS_UNKNOWN_SERVICE; | 613 | wdrtas_token_get_sensor_state = RTAS_UNKNOWN_SERVICE; |
624 | } | 614 | } |
625 | } | 615 | } |
@@ -643,8 +633,7 @@ static int __init wdrtas_init(void) | |||
643 | return -ENODEV; | 633 | return -ENODEV; |
644 | 634 | ||
645 | if (register_reboot_notifier(&wdrtas_notifier)) { | 635 | if (register_reboot_notifier(&wdrtas_notifier)) { |
646 | printk(KERN_ERR "wdrtas: could not register reboot notifier. " | 636 | pr_err("could not register reboot notifier. Terminating watchdog code.\n"); |
647 | "Terminating watchdog code.\n"); | ||
648 | wdrtas_unregister_devs(); | 637 | wdrtas_unregister_devs(); |
649 | return -ENODEV; | 638 | return -ENODEV; |
650 | } | 639 | } |
diff --git a/drivers/watchdog/wdt.c b/drivers/watchdog/wdt.c index d2ef002be96b..64079d933c63 100644 --- a/drivers/watchdog/wdt.c +++ b/drivers/watchdog/wdt.c | |||
@@ -32,6 +32,8 @@ | |||
32 | * Matt Domsch : Added nowayout module option | 32 | * Matt Domsch : Added nowayout module option |
33 | */ | 33 | */ |
34 | 34 | ||
35 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
36 | |||
35 | #include <linux/interrupt.h> | 37 | #include <linux/interrupt.h> |
36 | #include <linux/module.h> | 38 | #include <linux/module.h> |
37 | #include <linux/moduleparam.h> | 39 | #include <linux/moduleparam.h> |
@@ -65,8 +67,8 @@ MODULE_PARM_DESC(heartbeat, | |||
65 | "Watchdog heartbeat in seconds. (0 < heartbeat < 65536, default=" | 67 | "Watchdog heartbeat in seconds. (0 < heartbeat < 65536, default=" |
66 | __MODULE_STRING(WD_TIMO) ")"); | 68 | __MODULE_STRING(WD_TIMO) ")"); |
67 | 69 | ||
68 | static int nowayout = WATCHDOG_NOWAYOUT; | 70 | static bool nowayout = WATCHDOG_NOWAYOUT; |
69 | module_param(nowayout, int, 0); | 71 | module_param(nowayout, bool, 0); |
70 | MODULE_PARM_DESC(nowayout, | 72 | MODULE_PARM_DESC(nowayout, |
71 | "Watchdog cannot be stopped once started (default=" | 73 | "Watchdog cannot be stopped once started (default=" |
72 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 74 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
@@ -252,11 +254,11 @@ static int wdt_get_temperature(void) | |||
252 | static void wdt_decode_501(int status) | 254 | static void wdt_decode_501(int status) |
253 | { | 255 | { |
254 | if (!(status & WDC_SR_TGOOD)) | 256 | if (!(status & WDC_SR_TGOOD)) |
255 | printk(KERN_CRIT "Overheat alarm.(%d)\n", inb_p(WDT_RT)); | 257 | pr_crit("Overheat alarm (%d)\n", inb_p(WDT_RT)); |
256 | if (!(status & WDC_SR_PSUOVER)) | 258 | if (!(status & WDC_SR_PSUOVER)) |
257 | printk(KERN_CRIT "PSU over voltage.\n"); | 259 | pr_crit("PSU over voltage\n"); |
258 | if (!(status & WDC_SR_PSUUNDR)) | 260 | if (!(status & WDC_SR_PSUUNDR)) |
259 | printk(KERN_CRIT "PSU under voltage.\n"); | 261 | pr_crit("PSU under voltage\n"); |
260 | } | 262 | } |
261 | 263 | ||
262 | /** | 264 | /** |
@@ -280,25 +282,25 @@ static irqreturn_t wdt_interrupt(int irq, void *dev_id) | |||
280 | spin_lock(&wdt_lock); | 282 | spin_lock(&wdt_lock); |
281 | status = inb_p(WDT_SR); | 283 | status = inb_p(WDT_SR); |
282 | 284 | ||
283 | printk(KERN_CRIT "WDT status %d\n", status); | 285 | pr_crit("WDT status %d\n", status); |
284 | 286 | ||
285 | if (type == 501) { | 287 | if (type == 501) { |
286 | wdt_decode_501(status); | 288 | wdt_decode_501(status); |
287 | if (tachometer) { | 289 | if (tachometer) { |
288 | if (!(status & WDC_SR_FANGOOD)) | 290 | if (!(status & WDC_SR_FANGOOD)) |
289 | printk(KERN_CRIT "Possible fan fault.\n"); | 291 | pr_crit("Possible fan fault\n"); |
290 | } | 292 | } |
291 | } | 293 | } |
292 | if (!(status & WDC_SR_WCCR)) { | 294 | if (!(status & WDC_SR_WCCR)) { |
293 | #ifdef SOFTWARE_REBOOT | 295 | #ifdef SOFTWARE_REBOOT |
294 | #ifdef ONLY_TESTING | 296 | #ifdef ONLY_TESTING |
295 | printk(KERN_CRIT "Would Reboot.\n"); | 297 | pr_crit("Would Reboot\n"); |
296 | #else | 298 | #else |
297 | printk(KERN_CRIT "Initiating system reboot.\n"); | 299 | pr_crit("Initiating system reboot\n"); |
298 | emergency_restart(); | 300 | emergency_restart(); |
299 | #endif | 301 | #endif |
300 | #else | 302 | #else |
301 | printk(KERN_CRIT "Reset in 5ms.\n"); | 303 | pr_crit("Reset in 5ms\n"); |
302 | #endif | 304 | #endif |
303 | } | 305 | } |
304 | spin_unlock(&wdt_lock); | 306 | spin_unlock(&wdt_lock); |
@@ -441,8 +443,7 @@ static int wdt_release(struct inode *inode, struct file *file) | |||
441 | wdt_stop(); | 443 | wdt_stop(); |
442 | clear_bit(0, &wdt_is_open); | 444 | clear_bit(0, &wdt_is_open); |
443 | } else { | 445 | } else { |
444 | printk(KERN_CRIT | 446 | pr_crit("WDT device closed unexpectedly. WDT will not stop!\n"); |
445 | "wdt: WDT device closed unexpectedly. WDT will not stop!\n"); | ||
446 | wdt_ping(); | 447 | wdt_ping(); |
447 | } | 448 | } |
448 | expect_close = 0; | 449 | expect_close = 0; |
@@ -593,7 +594,7 @@ static int __init wdt_init(void) | |||
593 | int ret; | 594 | int ret; |
594 | 595 | ||
595 | if (type != 500 && type != 501) { | 596 | if (type != 500 && type != 501) { |
596 | printk(KERN_ERR "wdt: unknown card type '%d'.\n", type); | 597 | pr_err("unknown card type '%d'\n", type); |
597 | return -ENODEV; | 598 | return -ENODEV; |
598 | } | 599 | } |
599 | 600 | ||
@@ -601,53 +602,49 @@ static int __init wdt_init(void) | |||
601 | if not reset to the default */ | 602 | if not reset to the default */ |
602 | if (wdt_set_heartbeat(heartbeat)) { | 603 | if (wdt_set_heartbeat(heartbeat)) { |
603 | wdt_set_heartbeat(WD_TIMO); | 604 | wdt_set_heartbeat(WD_TIMO); |
604 | printk(KERN_INFO "wdt: heartbeat value must be " | 605 | pr_info("heartbeat value must be 0 < heartbeat < 65536, using %d\n", |
605 | "0 < heartbeat < 65536, using %d\n", WD_TIMO); | 606 | WD_TIMO); |
606 | } | 607 | } |
607 | 608 | ||
608 | if (!request_region(io, 8, "wdt501p")) { | 609 | if (!request_region(io, 8, "wdt501p")) { |
609 | printk(KERN_ERR | 610 | pr_err("I/O address 0x%04x already in use\n", io); |
610 | "wdt: I/O address 0x%04x already in use\n", io); | ||
611 | ret = -EBUSY; | 611 | ret = -EBUSY; |
612 | goto out; | 612 | goto out; |
613 | } | 613 | } |
614 | 614 | ||
615 | ret = request_irq(irq, wdt_interrupt, 0, "wdt501p", NULL); | 615 | ret = request_irq(irq, wdt_interrupt, 0, "wdt501p", NULL); |
616 | if (ret) { | 616 | if (ret) { |
617 | printk(KERN_ERR "wdt: IRQ %d is not free.\n", irq); | 617 | pr_err("IRQ %d is not free\n", irq); |
618 | goto outreg; | 618 | goto outreg; |
619 | } | 619 | } |
620 | 620 | ||
621 | ret = register_reboot_notifier(&wdt_notifier); | 621 | ret = register_reboot_notifier(&wdt_notifier); |
622 | if (ret) { | 622 | if (ret) { |
623 | printk(KERN_ERR | 623 | pr_err("cannot register reboot notifier (err=%d)\n", ret); |
624 | "wdt: cannot register reboot notifier (err=%d)\n", ret); | ||
625 | goto outirq; | 624 | goto outirq; |
626 | } | 625 | } |
627 | 626 | ||
628 | if (type == 501) { | 627 | if (type == 501) { |
629 | ret = misc_register(&temp_miscdev); | 628 | ret = misc_register(&temp_miscdev); |
630 | if (ret) { | 629 | if (ret) { |
631 | printk(KERN_ERR "wdt: cannot register miscdev " | 630 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
632 | "on minor=%d (err=%d)\n", TEMP_MINOR, ret); | 631 | TEMP_MINOR, ret); |
633 | goto outrbt; | 632 | goto outrbt; |
634 | } | 633 | } |
635 | } | 634 | } |
636 | 635 | ||
637 | ret = misc_register(&wdt_miscdev); | 636 | ret = misc_register(&wdt_miscdev); |
638 | if (ret) { | 637 | if (ret) { |
639 | printk(KERN_ERR | 638 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
640 | "wdt: cannot register miscdev on minor=%d (err=%d)\n", | 639 | WATCHDOG_MINOR, ret); |
641 | WATCHDOG_MINOR, ret); | ||
642 | goto outmisc; | 640 | goto outmisc; |
643 | } | 641 | } |
644 | 642 | ||
645 | printk(KERN_INFO "WDT500/501-P driver 0.10 " | 643 | pr_info("WDT500/501-P driver 0.10 at 0x%04x (Interrupt %d). heartbeat=%d sec (nowayout=%d)\n", |
646 | "at 0x%04x (Interrupt %d). heartbeat=%d sec (nowayout=%d)\n", | ||
647 | io, irq, heartbeat, nowayout); | 644 | io, irq, heartbeat, nowayout); |
648 | if (type == 501) | 645 | if (type == 501) |
649 | printk(KERN_INFO "wdt: Fan Tachometer is %s\n", | 646 | pr_info("Fan Tachometer is %s\n", |
650 | (tachometer ? "Enabled" : "Disabled")); | 647 | tachometer ? "Enabled" : "Disabled"); |
651 | return 0; | 648 | return 0; |
652 | 649 | ||
653 | outmisc: | 650 | outmisc: |
diff --git a/drivers/watchdog/wdt285.c b/drivers/watchdog/wdt285.c index f55135662d78..3daa330ae436 100644 --- a/drivers/watchdog/wdt285.c +++ b/drivers/watchdog/wdt285.c | |||
@@ -16,6 +16,8 @@ | |||
16 | * | 16 | * |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
20 | |||
19 | #include <linux/module.h> | 21 | #include <linux/module.h> |
20 | #include <linux/moduleparam.h> | 22 | #include <linux/moduleparam.h> |
21 | #include <linux/types.h> | 23 | #include <linux/types.h> |
@@ -49,7 +51,7 @@ static unsigned long timer_alive; | |||
49 | */ | 51 | */ |
50 | static void watchdog_fire(int irq, void *dev_id) | 52 | static void watchdog_fire(int irq, void *dev_id) |
51 | { | 53 | { |
52 | printk(KERN_CRIT "Watchdog: Would Reboot.\n"); | 54 | pr_crit("Would Reboot\n"); |
53 | *CSR_TIMER4_CNTL = 0; | 55 | *CSR_TIMER4_CNTL = 0; |
54 | *CSR_TIMER4_CLR = 0; | 56 | *CSR_TIMER4_CLR = 0; |
55 | } | 57 | } |
@@ -205,13 +207,11 @@ static int __init footbridge_watchdog_init(void) | |||
205 | if (retval < 0) | 207 | if (retval < 0) |
206 | return retval; | 208 | return retval; |
207 | 209 | ||
208 | printk(KERN_INFO | 210 | pr_info("Footbridge Watchdog Timer: 0.01, timer margin: %d sec\n", |
209 | "Footbridge Watchdog Timer: 0.01, timer margin: %d sec\n", | 211 | soft_margin); |
210 | soft_margin); | ||
211 | 212 | ||
212 | if (machine_is_cats()) | 213 | if (machine_is_cats()) |
213 | printk(KERN_WARNING | 214 | pr_warn("Warning: Watchdog reset may not work on this machine\n"); |
214 | "Warning: Watchdog reset may not work on this machine.\n"); | ||
215 | return 0; | 215 | return 0; |
216 | } | 216 | } |
217 | 217 | ||
diff --git a/drivers/watchdog/wdt977.c b/drivers/watchdog/wdt977.c index a2f01c9f5c34..2de1632708a0 100644 --- a/drivers/watchdog/wdt977.c +++ b/drivers/watchdog/wdt977.c | |||
@@ -23,6 +23,8 @@ | |||
23 | * Netwinders only | 23 | * Netwinders only |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
27 | |||
26 | #include <linux/module.h> | 28 | #include <linux/module.h> |
27 | #include <linux/moduleparam.h> | 29 | #include <linux/moduleparam.h> |
28 | #include <linux/types.h> | 30 | #include <linux/types.h> |
@@ -42,8 +44,6 @@ | |||
42 | 44 | ||
43 | #define WATCHDOG_VERSION "0.04" | 45 | #define WATCHDOG_VERSION "0.04" |
44 | #define WATCHDOG_NAME "Wdt977" | 46 | #define WATCHDOG_NAME "Wdt977" |
45 | #define PFX WATCHDOG_NAME ": " | ||
46 | #define DRIVER_VERSION WATCHDOG_NAME " driver, v" WATCHDOG_VERSION "\n" | ||
47 | 47 | ||
48 | #define IO_INDEX_PORT 0x370 /* on some systems it can be 0x3F0 */ | 48 | #define IO_INDEX_PORT 0x370 /* on some systems it can be 0x3F0 */ |
49 | #define IO_DATA_PORT (IO_INDEX_PORT + 1) | 49 | #define IO_DATA_PORT (IO_INDEX_PORT + 1) |
@@ -68,8 +68,8 @@ MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds (60..15300, default=" | |||
68 | module_param(testmode, int, 0); | 68 | module_param(testmode, int, 0); |
69 | MODULE_PARM_DESC(testmode, "Watchdog testmode (1 = no reboot), default=0"); | 69 | MODULE_PARM_DESC(testmode, "Watchdog testmode (1 = no reboot), default=0"); |
70 | 70 | ||
71 | static int nowayout = WATCHDOG_NOWAYOUT; | 71 | static bool nowayout = WATCHDOG_NOWAYOUT; |
72 | module_param(nowayout, int, 0); | 72 | module_param(nowayout, bool, 0); |
73 | MODULE_PARM_DESC(nowayout, | 73 | MODULE_PARM_DESC(nowayout, |
74 | "Watchdog cannot be stopped once started (default=" | 74 | "Watchdog cannot be stopped once started (default=" |
75 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 75 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
@@ -119,7 +119,7 @@ static int wdt977_start(void) | |||
119 | outb_p(LOCK_DATA, IO_INDEX_PORT); | 119 | outb_p(LOCK_DATA, IO_INDEX_PORT); |
120 | 120 | ||
121 | spin_unlock_irqrestore(&spinlock, flags); | 121 | spin_unlock_irqrestore(&spinlock, flags); |
122 | printk(KERN_INFO PFX "activated.\n"); | 122 | pr_info("activated\n"); |
123 | 123 | ||
124 | return 0; | 124 | return 0; |
125 | } | 125 | } |
@@ -164,7 +164,7 @@ static int wdt977_stop(void) | |||
164 | outb_p(LOCK_DATA, IO_INDEX_PORT); | 164 | outb_p(LOCK_DATA, IO_INDEX_PORT); |
165 | 165 | ||
166 | spin_unlock_irqrestore(&spinlock, flags); | 166 | spin_unlock_irqrestore(&spinlock, flags); |
167 | printk(KERN_INFO PFX "shutdown.\n"); | 167 | pr_info("shutdown\n"); |
168 | 168 | ||
169 | return 0; | 169 | return 0; |
170 | } | 170 | } |
@@ -288,8 +288,7 @@ static int wdt977_release(struct inode *inode, struct file *file) | |||
288 | clear_bit(0, &timer_alive); | 288 | clear_bit(0, &timer_alive); |
289 | } else { | 289 | } else { |
290 | wdt977_keepalive(); | 290 | wdt977_keepalive(); |
291 | printk(KERN_CRIT PFX | 291 | pr_crit("Unexpected close, not stopping watchdog!\n"); |
292 | "Unexpected close, not stopping watchdog!\n"); | ||
293 | } | 292 | } |
294 | expect_close = 0; | 293 | expect_close = 0; |
295 | return 0; | 294 | return 0; |
@@ -446,15 +445,14 @@ static int __init wd977_init(void) | |||
446 | { | 445 | { |
447 | int rc; | 446 | int rc; |
448 | 447 | ||
449 | printk(KERN_INFO PFX DRIVER_VERSION); | 448 | pr_info("driver v%s\n", WATCHDOG_VERSION); |
450 | 449 | ||
451 | /* Check that the timeout value is within its range; | 450 | /* Check that the timeout value is within its range; |
452 | if not reset to the default */ | 451 | if not reset to the default */ |
453 | if (wdt977_set_timeout(timeout)) { | 452 | if (wdt977_set_timeout(timeout)) { |
454 | wdt977_set_timeout(DEFAULT_TIMEOUT); | 453 | wdt977_set_timeout(DEFAULT_TIMEOUT); |
455 | printk(KERN_INFO PFX | 454 | pr_info("timeout value must be 60 < timeout < 15300, using %d\n", |
456 | "timeout value must be 60 < timeout < 15300, using %d\n", | 455 | DEFAULT_TIMEOUT); |
457 | DEFAULT_TIMEOUT); | ||
458 | } | 456 | } |
459 | 457 | ||
460 | /* on Netwinder the IOports are already reserved by | 458 | /* on Netwinder the IOports are already reserved by |
@@ -462,9 +460,8 @@ static int __init wd977_init(void) | |||
462 | */ | 460 | */ |
463 | if (!machine_is_netwinder()) { | 461 | if (!machine_is_netwinder()) { |
464 | if (!request_region(IO_INDEX_PORT, 2, WATCHDOG_NAME)) { | 462 | if (!request_region(IO_INDEX_PORT, 2, WATCHDOG_NAME)) { |
465 | printk(KERN_ERR PFX | 463 | pr_err("I/O address 0x%04x already in use\n", |
466 | "I/O address 0x%04x already in use\n", | 464 | IO_INDEX_PORT); |
467 | IO_INDEX_PORT); | ||
468 | rc = -EIO; | 465 | rc = -EIO; |
469 | goto err_out; | 466 | goto err_out; |
470 | } | 467 | } |
@@ -472,22 +469,19 @@ static int __init wd977_init(void) | |||
472 | 469 | ||
473 | rc = register_reboot_notifier(&wdt977_notifier); | 470 | rc = register_reboot_notifier(&wdt977_notifier); |
474 | if (rc) { | 471 | if (rc) { |
475 | printk(KERN_ERR PFX | 472 | pr_err("cannot register reboot notifier (err=%d)\n", rc); |
476 | "cannot register reboot notifier (err=%d)\n", rc); | ||
477 | goto err_out_region; | 473 | goto err_out_region; |
478 | } | 474 | } |
479 | 475 | ||
480 | rc = misc_register(&wdt977_miscdev); | 476 | rc = misc_register(&wdt977_miscdev); |
481 | if (rc) { | 477 | if (rc) { |
482 | printk(KERN_ERR PFX | 478 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
483 | "cannot register miscdev on minor=%d (err=%d)\n", | 479 | wdt977_miscdev.minor, rc); |
484 | wdt977_miscdev.minor, rc); | ||
485 | goto err_out_reboot; | 480 | goto err_out_reboot; |
486 | } | 481 | } |
487 | 482 | ||
488 | printk(KERN_INFO PFX | 483 | pr_info("initialized. timeout=%d sec (nowayout=%d, testmode=%i)\n", |
489 | "initialized. timeout=%d sec (nowayout=%d, testmode=%i)\n", | 484 | timeout, nowayout, testmode); |
490 | timeout, nowayout, testmode); | ||
491 | 485 | ||
492 | return 0; | 486 | return 0; |
493 | 487 | ||
diff --git a/drivers/watchdog/wdt_pci.c b/drivers/watchdog/wdt_pci.c index e0fc3baa9197..a3cea594c8f2 100644 --- a/drivers/watchdog/wdt_pci.c +++ b/drivers/watchdog/wdt_pci.c | |||
@@ -37,6 +37,8 @@ | |||
37 | * Matt Domsch : nowayout module option | 37 | * Matt Domsch : nowayout module option |
38 | */ | 38 | */ |
39 | 39 | ||
40 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
41 | |||
40 | #include <linux/interrupt.h> | 42 | #include <linux/interrupt.h> |
41 | #include <linux/module.h> | 43 | #include <linux/module.h> |
42 | #include <linux/moduleparam.h> | 44 | #include <linux/moduleparam.h> |
@@ -58,8 +60,6 @@ | |||
58 | #define WDT_IS_PCI | 60 | #define WDT_IS_PCI |
59 | #include "wd501p.h" | 61 | #include "wd501p.h" |
60 | 62 | ||
61 | #define PFX "wdt_pci: " | ||
62 | |||
63 | /* We can only use 1 card due to the /dev/watchdog restriction */ | 63 | /* We can only use 1 card due to the /dev/watchdog restriction */ |
64 | static int dev_count; | 64 | static int dev_count; |
65 | 65 | ||
@@ -80,8 +80,8 @@ MODULE_PARM_DESC(heartbeat, | |||
80 | "Watchdog heartbeat in seconds. (0<heartbeat<65536, default=" | 80 | "Watchdog heartbeat in seconds. (0<heartbeat<65536, default=" |
81 | __MODULE_STRING(WD_TIMO) ")"); | 81 | __MODULE_STRING(WD_TIMO) ")"); |
82 | 82 | ||
83 | static int nowayout = WATCHDOG_NOWAYOUT; | 83 | static bool nowayout = WATCHDOG_NOWAYOUT; |
84 | module_param(nowayout, int, 0); | 84 | module_param(nowayout, bool, 0); |
85 | MODULE_PARM_DESC(nowayout, | 85 | MODULE_PARM_DESC(nowayout, |
86 | "Watchdog cannot be stopped once started (default=" | 86 | "Watchdog cannot be stopped once started (default=" |
87 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 87 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
@@ -312,33 +312,32 @@ static irqreturn_t wdtpci_interrupt(int irq, void *dev_id) | |||
312 | status = inb(WDT_SR); | 312 | status = inb(WDT_SR); |
313 | udelay(8); | 313 | udelay(8); |
314 | 314 | ||
315 | printk(KERN_CRIT PFX "status %d\n", status); | 315 | pr_crit("status %d\n", status); |
316 | 316 | ||
317 | if (type == 501) { | 317 | if (type == 501) { |
318 | if (!(status & WDC_SR_TGOOD)) { | 318 | if (!(status & WDC_SR_TGOOD)) { |
319 | printk(KERN_CRIT PFX "Overheat alarm.(%d)\n", | 319 | pr_crit("Overheat alarm (%d)\n", inb(WDT_RT)); |
320 | inb(WDT_RT)); | ||
321 | udelay(8); | 320 | udelay(8); |
322 | } | 321 | } |
323 | if (!(status & WDC_SR_PSUOVER)) | 322 | if (!(status & WDC_SR_PSUOVER)) |
324 | printk(KERN_CRIT PFX "PSU over voltage.\n"); | 323 | pr_crit("PSU over voltage\n"); |
325 | if (!(status & WDC_SR_PSUUNDR)) | 324 | if (!(status & WDC_SR_PSUUNDR)) |
326 | printk(KERN_CRIT PFX "PSU under voltage.\n"); | 325 | pr_crit("PSU under voltage\n"); |
327 | if (tachometer) { | 326 | if (tachometer) { |
328 | if (!(status & WDC_SR_FANGOOD)) | 327 | if (!(status & WDC_SR_FANGOOD)) |
329 | printk(KERN_CRIT PFX "Possible fan fault.\n"); | 328 | pr_crit("Possible fan fault\n"); |
330 | } | 329 | } |
331 | } | 330 | } |
332 | if (!(status & WDC_SR_WCCR)) { | 331 | if (!(status & WDC_SR_WCCR)) { |
333 | #ifdef SOFTWARE_REBOOT | 332 | #ifdef SOFTWARE_REBOOT |
334 | #ifdef ONLY_TESTING | 333 | #ifdef ONLY_TESTING |
335 | printk(KERN_CRIT PFX "Would Reboot.\n"); | 334 | pr_crit("Would Reboot\n"); |
336 | #else | 335 | #else |
337 | printk(KERN_CRIT PFX "Initiating system reboot.\n"); | 336 | pr_crit("Initiating system reboot\n"); |
338 | emergency_restart(NULL); | 337 | emergency_restart(NULL); |
339 | #endif | 338 | #endif |
340 | #else | 339 | #else |
341 | printk(KERN_CRIT PFX "Reset in 5ms.\n"); | 340 | pr_crit("Reset in 5ms\n"); |
342 | #endif | 341 | #endif |
343 | } | 342 | } |
344 | spin_unlock(&wdtpci_lock); | 343 | spin_unlock(&wdtpci_lock); |
@@ -484,7 +483,7 @@ static int wdtpci_release(struct inode *inode, struct file *file) | |||
484 | if (expect_close == 42) { | 483 | if (expect_close == 42) { |
485 | wdtpci_stop(); | 484 | wdtpci_stop(); |
486 | } else { | 485 | } else { |
487 | printk(KERN_CRIT PFX "Unexpected close, not stopping timer!"); | 486 | pr_crit("Unexpected close, not stopping timer!\n"); |
488 | wdtpci_ping(); | 487 | wdtpci_ping(); |
489 | } | 488 | } |
490 | expect_close = 0; | 489 | expect_close = 0; |
@@ -614,29 +613,29 @@ static int __devinit wdtpci_init_one(struct pci_dev *dev, | |||
614 | 613 | ||
615 | dev_count++; | 614 | dev_count++; |
616 | if (dev_count > 1) { | 615 | if (dev_count > 1) { |
617 | printk(KERN_ERR PFX "This driver only supports one device\n"); | 616 | pr_err("This driver only supports one device\n"); |
618 | return -ENODEV; | 617 | return -ENODEV; |
619 | } | 618 | } |
620 | 619 | ||
621 | if (type != 500 && type != 501) { | 620 | if (type != 500 && type != 501) { |
622 | printk(KERN_ERR PFX "unknown card type '%d'.\n", type); | 621 | pr_err("unknown card type '%d'\n", type); |
623 | return -ENODEV; | 622 | return -ENODEV; |
624 | } | 623 | } |
625 | 624 | ||
626 | if (pci_enable_device(dev)) { | 625 | if (pci_enable_device(dev)) { |
627 | printk(KERN_ERR PFX "Not possible to enable PCI Device\n"); | 626 | pr_err("Not possible to enable PCI Device\n"); |
628 | return -ENODEV; | 627 | return -ENODEV; |
629 | } | 628 | } |
630 | 629 | ||
631 | if (pci_resource_start(dev, 2) == 0x0000) { | 630 | if (pci_resource_start(dev, 2) == 0x0000) { |
632 | printk(KERN_ERR PFX "No I/O-Address for card detected\n"); | 631 | pr_err("No I/O-Address for card detected\n"); |
633 | ret = -ENODEV; | 632 | ret = -ENODEV; |
634 | goto out_pci; | 633 | goto out_pci; |
635 | } | 634 | } |
636 | 635 | ||
637 | if (pci_request_region(dev, 2, "wdt_pci")) { | 636 | if (pci_request_region(dev, 2, "wdt_pci")) { |
638 | printk(KERN_ERR PFX "I/O address 0x%llx already in use\n", | 637 | pr_err("I/O address 0x%llx already in use\n", |
639 | (unsigned long long)pci_resource_start(dev, 2)); | 638 | (unsigned long long)pci_resource_start(dev, 2)); |
640 | goto out_pci; | 639 | goto out_pci; |
641 | } | 640 | } |
642 | 641 | ||
@@ -645,53 +644,48 @@ static int __devinit wdtpci_init_one(struct pci_dev *dev, | |||
645 | 644 | ||
646 | if (request_irq(irq, wdtpci_interrupt, IRQF_SHARED, | 645 | if (request_irq(irq, wdtpci_interrupt, IRQF_SHARED, |
647 | "wdt_pci", &wdtpci_miscdev)) { | 646 | "wdt_pci", &wdtpci_miscdev)) { |
648 | printk(KERN_ERR PFX "IRQ %d is not free\n", irq); | 647 | pr_err("IRQ %d is not free\n", irq); |
649 | goto out_reg; | 648 | goto out_reg; |
650 | } | 649 | } |
651 | 650 | ||
652 | printk(KERN_INFO | 651 | pr_info("PCI-WDT500/501 (PCI-WDG-CSM) driver 0.10 at 0x%llx (Interrupt %d)\n", |
653 | "PCI-WDT500/501 (PCI-WDG-CSM) driver 0.10 at 0x%llx (Interrupt %d)\n", | 652 | (unsigned long long)io, irq); |
654 | (unsigned long long)io, irq); | ||
655 | 653 | ||
656 | /* Check that the heartbeat value is within its range; | 654 | /* Check that the heartbeat value is within its range; |
657 | if not reset to the default */ | 655 | if not reset to the default */ |
658 | if (wdtpci_set_heartbeat(heartbeat)) { | 656 | if (wdtpci_set_heartbeat(heartbeat)) { |
659 | wdtpci_set_heartbeat(WD_TIMO); | 657 | wdtpci_set_heartbeat(WD_TIMO); |
660 | printk(KERN_INFO PFX | 658 | pr_info("heartbeat value must be 0 < heartbeat < 65536, using %d\n", |
661 | "heartbeat value must be 0 < heartbeat < 65536, using %d\n", | 659 | WD_TIMO); |
662 | WD_TIMO); | ||
663 | } | 660 | } |
664 | 661 | ||
665 | ret = register_reboot_notifier(&wdtpci_notifier); | 662 | ret = register_reboot_notifier(&wdtpci_notifier); |
666 | if (ret) { | 663 | if (ret) { |
667 | printk(KERN_ERR PFX | 664 | pr_err("cannot register reboot notifier (err=%d)\n", ret); |
668 | "cannot register reboot notifier (err=%d)\n", ret); | ||
669 | goto out_irq; | 665 | goto out_irq; |
670 | } | 666 | } |
671 | 667 | ||
672 | if (type == 501) { | 668 | if (type == 501) { |
673 | ret = misc_register(&temp_miscdev); | 669 | ret = misc_register(&temp_miscdev); |
674 | if (ret) { | 670 | if (ret) { |
675 | printk(KERN_ERR PFX | 671 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
676 | "cannot register miscdev on minor=%d (err=%d)\n", | 672 | TEMP_MINOR, ret); |
677 | TEMP_MINOR, ret); | ||
678 | goto out_rbt; | 673 | goto out_rbt; |
679 | } | 674 | } |
680 | } | 675 | } |
681 | 676 | ||
682 | ret = misc_register(&wdtpci_miscdev); | 677 | ret = misc_register(&wdtpci_miscdev); |
683 | if (ret) { | 678 | if (ret) { |
684 | printk(KERN_ERR PFX | 679 | pr_err("cannot register miscdev on minor=%d (err=%d)\n", |
685 | "cannot register miscdev on minor=%d (err=%d)\n", | 680 | WATCHDOG_MINOR, ret); |
686 | WATCHDOG_MINOR, ret); | ||
687 | goto out_misc; | 681 | goto out_misc; |
688 | } | 682 | } |
689 | 683 | ||
690 | printk(KERN_INFO PFX "initialized. heartbeat=%d sec (nowayout=%d)\n", | 684 | pr_info("initialized. heartbeat=%d sec (nowayout=%d)\n", |
691 | heartbeat, nowayout); | 685 | heartbeat, nowayout); |
692 | if (type == 501) | 686 | if (type == 501) |
693 | printk(KERN_INFO "wdt: Fan Tachometer is %s\n", | 687 | pr_info("Fan Tachometer is %s\n", |
694 | (tachometer ? "Enabled" : "Disabled")); | 688 | tachometer ? "Enabled" : "Disabled"); |
695 | 689 | ||
696 | ret = 0; | 690 | ret = 0; |
697 | out: | 691 | out: |
diff --git a/drivers/watchdog/wm831x_wdt.c b/drivers/watchdog/wm831x_wdt.c index 263c883f0806..b1815c5ed7a7 100644 --- a/drivers/watchdog/wm831x_wdt.c +++ b/drivers/watchdog/wm831x_wdt.c | |||
@@ -22,8 +22,8 @@ | |||
22 | #include <linux/mfd/wm831x/pdata.h> | 22 | #include <linux/mfd/wm831x/pdata.h> |
23 | #include <linux/mfd/wm831x/watchdog.h> | 23 | #include <linux/mfd/wm831x/watchdog.h> |
24 | 24 | ||
25 | static int nowayout = WATCHDOG_NOWAYOUT; | 25 | static bool nowayout = WATCHDOG_NOWAYOUT; |
26 | module_param(nowayout, int, 0); | 26 | module_param(nowayout, bool, 0); |
27 | MODULE_PARM_DESC(nowayout, | 27 | MODULE_PARM_DESC(nowayout, |
28 | "Watchdog cannot be stopped once started (default=" | 28 | "Watchdog cannot be stopped once started (default=" |
29 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 29 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
@@ -163,6 +163,8 @@ static int wm831x_wdt_set_timeout(struct watchdog_device *wdt_dev, | |||
163 | ret); | 163 | ret); |
164 | } | 164 | } |
165 | 165 | ||
166 | wdt_dev->timeout = timeout; | ||
167 | |||
166 | return ret; | 168 | return ret; |
167 | } | 169 | } |
168 | 170 | ||
diff --git a/drivers/watchdog/wm8350_wdt.c b/drivers/watchdog/wm8350_wdt.c index 5d7113c7e501..3c76693447fd 100644 --- a/drivers/watchdog/wm8350_wdt.c +++ b/drivers/watchdog/wm8350_wdt.c | |||
@@ -8,63 +8,65 @@ | |||
8 | * as published by the Free Software Foundation | 8 | * as published by the Free Software Foundation |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
12 | |||
11 | #include <linux/module.h> | 13 | #include <linux/module.h> |
12 | #include <linux/moduleparam.h> | 14 | #include <linux/moduleparam.h> |
13 | #include <linux/types.h> | 15 | #include <linux/types.h> |
14 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
15 | #include <linux/fs.h> | ||
16 | #include <linux/miscdevice.h> | ||
17 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
18 | #include <linux/watchdog.h> | 18 | #include <linux/watchdog.h> |
19 | #include <linux/uaccess.h> | 19 | #include <linux/uaccess.h> |
20 | #include <linux/mfd/wm8350/core.h> | 20 | #include <linux/mfd/wm8350/core.h> |
21 | 21 | ||
22 | static int nowayout = WATCHDOG_NOWAYOUT; | 22 | static bool nowayout = WATCHDOG_NOWAYOUT; |
23 | module_param(nowayout, int, 0); | 23 | module_param(nowayout, bool, 0); |
24 | MODULE_PARM_DESC(nowayout, | 24 | MODULE_PARM_DESC(nowayout, |
25 | "Watchdog cannot be stopped once started (default=" | 25 | "Watchdog cannot be stopped once started (default=" |
26 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 26 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
27 | 27 | ||
28 | static unsigned long wm8350_wdt_users; | ||
29 | static struct miscdevice wm8350_wdt_miscdev; | ||
30 | static int wm8350_wdt_expect_close; | ||
31 | static DEFINE_MUTEX(wdt_mutex); | 28 | static DEFINE_MUTEX(wdt_mutex); |
32 | 29 | ||
33 | static struct { | 30 | static struct { |
34 | int time; /* Seconds */ | 31 | unsigned int time; /* Seconds */ |
35 | u16 val; /* To be set in WM8350_SYSTEM_CONTROL_2 */ | 32 | u16 val; /* To be set in WM8350_SYSTEM_CONTROL_2 */ |
36 | } wm8350_wdt_cfgs[] = { | 33 | } wm8350_wdt_cfgs[] = { |
37 | { 1, 0x02 }, | 34 | { 1, 0x02 }, |
38 | { 2, 0x04 }, | 35 | { 2, 0x04 }, |
39 | { 4, 0x05 }, | 36 | { 4, 0x05 }, |
40 | }; | 37 | }; |
41 | 38 | ||
42 | static struct wm8350 *get_wm8350(void) | 39 | static int wm8350_wdt_set_timeout(struct watchdog_device *wdt_dev, |
43 | { | 40 | unsigned int timeout) |
44 | return dev_get_drvdata(wm8350_wdt_miscdev.parent); | ||
45 | } | ||
46 | |||
47 | static int wm8350_wdt_set_timeout(struct wm8350 *wm8350, u16 value) | ||
48 | { | 41 | { |
49 | int ret; | 42 | struct wm8350 *wm8350 = watchdog_get_drvdata(wdt_dev); |
43 | int ret, i; | ||
50 | u16 reg; | 44 | u16 reg; |
51 | 45 | ||
46 | for (i = 0; i < ARRAY_SIZE(wm8350_wdt_cfgs); i++) | ||
47 | if (wm8350_wdt_cfgs[i].time == timeout) | ||
48 | break; | ||
49 | if (i == ARRAY_SIZE(wm8350_wdt_cfgs)) | ||
50 | return -EINVAL; | ||
51 | |||
52 | mutex_lock(&wdt_mutex); | 52 | mutex_lock(&wdt_mutex); |
53 | wm8350_reg_unlock(wm8350); | 53 | wm8350_reg_unlock(wm8350); |
54 | 54 | ||
55 | reg = wm8350_reg_read(wm8350, WM8350_SYSTEM_CONTROL_2); | 55 | reg = wm8350_reg_read(wm8350, WM8350_SYSTEM_CONTROL_2); |
56 | reg &= ~WM8350_WDOG_TO_MASK; | 56 | reg &= ~WM8350_WDOG_TO_MASK; |
57 | reg |= value; | 57 | reg |= wm8350_wdt_cfgs[i].val; |
58 | ret = wm8350_reg_write(wm8350, WM8350_SYSTEM_CONTROL_2, reg); | 58 | ret = wm8350_reg_write(wm8350, WM8350_SYSTEM_CONTROL_2, reg); |
59 | 59 | ||
60 | wm8350_reg_lock(wm8350); | 60 | wm8350_reg_lock(wm8350); |
61 | mutex_unlock(&wdt_mutex); | 61 | mutex_unlock(&wdt_mutex); |
62 | 62 | ||
63 | wdt_dev->timeout = timeout; | ||
63 | return ret; | 64 | return ret; |
64 | } | 65 | } |
65 | 66 | ||
66 | static int wm8350_wdt_start(struct wm8350 *wm8350) | 67 | static int wm8350_wdt_start(struct watchdog_device *wdt_dev) |
67 | { | 68 | { |
69 | struct wm8350 *wm8350 = watchdog_get_drvdata(wdt_dev); | ||
68 | int ret; | 70 | int ret; |
69 | u16 reg; | 71 | u16 reg; |
70 | 72 | ||
@@ -82,8 +84,9 @@ static int wm8350_wdt_start(struct wm8350 *wm8350) | |||
82 | return ret; | 84 | return ret; |
83 | } | 85 | } |
84 | 86 | ||
85 | static int wm8350_wdt_stop(struct wm8350 *wm8350) | 87 | static int wm8350_wdt_stop(struct watchdog_device *wdt_dev) |
86 | { | 88 | { |
89 | struct wm8350 *wm8350 = watchdog_get_drvdata(wdt_dev); | ||
87 | int ret; | 90 | int ret; |
88 | u16 reg; | 91 | u16 reg; |
89 | 92 | ||
@@ -100,8 +103,9 @@ static int wm8350_wdt_stop(struct wm8350 *wm8350) | |||
100 | return ret; | 103 | return ret; |
101 | } | 104 | } |
102 | 105 | ||
103 | static int wm8350_wdt_kick(struct wm8350 *wm8350) | 106 | static int wm8350_wdt_ping(struct watchdog_device *wdt_dev) |
104 | { | 107 | { |
108 | struct wm8350 *wm8350 = watchdog_get_drvdata(wdt_dev); | ||
105 | int ret; | 109 | int ret; |
106 | u16 reg; | 110 | u16 reg; |
107 | 111 | ||
@@ -115,168 +119,25 @@ static int wm8350_wdt_kick(struct wm8350 *wm8350) | |||
115 | return ret; | 119 | return ret; |
116 | } | 120 | } |
117 | 121 | ||
118 | static int wm8350_wdt_open(struct inode *inode, struct file *file) | 122 | static const struct watchdog_info wm8350_wdt_info = { |
119 | { | ||
120 | struct wm8350 *wm8350 = get_wm8350(); | ||
121 | int ret; | ||
122 | |||
123 | if (!wm8350) | ||
124 | return -ENODEV; | ||
125 | |||
126 | if (test_and_set_bit(0, &wm8350_wdt_users)) | ||
127 | return -EBUSY; | ||
128 | |||
129 | ret = wm8350_wdt_start(wm8350); | ||
130 | if (ret != 0) | ||
131 | return ret; | ||
132 | |||
133 | return nonseekable_open(inode, file); | ||
134 | } | ||
135 | |||
136 | static int wm8350_wdt_release(struct inode *inode, struct file *file) | ||
137 | { | ||
138 | struct wm8350 *wm8350 = get_wm8350(); | ||
139 | |||
140 | if (wm8350_wdt_expect_close) | ||
141 | wm8350_wdt_stop(wm8350); | ||
142 | else { | ||
143 | dev_warn(wm8350->dev, "Watchdog device closed uncleanly\n"); | ||
144 | wm8350_wdt_kick(wm8350); | ||
145 | } | ||
146 | |||
147 | clear_bit(0, &wm8350_wdt_users); | ||
148 | |||
149 | return 0; | ||
150 | } | ||
151 | |||
152 | static ssize_t wm8350_wdt_write(struct file *file, | ||
153 | const char __user *data, size_t count, | ||
154 | loff_t *ppos) | ||
155 | { | ||
156 | struct wm8350 *wm8350 = get_wm8350(); | ||
157 | size_t i; | ||
158 | |||
159 | if (count) { | ||
160 | wm8350_wdt_kick(wm8350); | ||
161 | |||
162 | if (!nowayout) { | ||
163 | /* In case it was set long ago */ | ||
164 | wm8350_wdt_expect_close = 0; | ||
165 | |||
166 | /* scan to see whether or not we got the magic | ||
167 | character */ | ||
168 | for (i = 0; i != count; i++) { | ||
169 | char c; | ||
170 | if (get_user(c, data + i)) | ||
171 | return -EFAULT; | ||
172 | if (c == 'V') | ||
173 | wm8350_wdt_expect_close = 42; | ||
174 | } | ||
175 | } | ||
176 | } | ||
177 | return count; | ||
178 | } | ||
179 | |||
180 | static const struct watchdog_info ident = { | ||
181 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, | 123 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, |
182 | .identity = "WM8350 Watchdog", | 124 | .identity = "WM8350 Watchdog", |
183 | }; | 125 | }; |
184 | 126 | ||
185 | static long wm8350_wdt_ioctl(struct file *file, unsigned int cmd, | 127 | static const struct watchdog_ops wm8350_wdt_ops = { |
186 | unsigned long arg) | ||
187 | { | ||
188 | struct wm8350 *wm8350 = get_wm8350(); | ||
189 | int ret = -ENOTTY, time, i; | ||
190 | void __user *argp = (void __user *)arg; | ||
191 | int __user *p = argp; | ||
192 | u16 reg; | ||
193 | |||
194 | switch (cmd) { | ||
195 | case WDIOC_GETSUPPORT: | ||
196 | ret = copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0; | ||
197 | break; | ||
198 | |||
199 | case WDIOC_GETSTATUS: | ||
200 | case WDIOC_GETBOOTSTATUS: | ||
201 | ret = put_user(0, p); | ||
202 | break; | ||
203 | |||
204 | case WDIOC_SETOPTIONS: | ||
205 | { | ||
206 | int options; | ||
207 | |||
208 | if (get_user(options, p)) | ||
209 | return -EFAULT; | ||
210 | |||
211 | ret = -EINVAL; | ||
212 | |||
213 | /* Setting both simultaneously means at least one must fail */ | ||
214 | if (options == WDIOS_DISABLECARD) | ||
215 | ret = wm8350_wdt_stop(wm8350); | ||
216 | |||
217 | if (options == WDIOS_ENABLECARD) | ||
218 | ret = wm8350_wdt_start(wm8350); | ||
219 | break; | ||
220 | } | ||
221 | |||
222 | case WDIOC_KEEPALIVE: | ||
223 | ret = wm8350_wdt_kick(wm8350); | ||
224 | break; | ||
225 | |||
226 | case WDIOC_SETTIMEOUT: | ||
227 | ret = get_user(time, p); | ||
228 | if (ret) | ||
229 | break; | ||
230 | |||
231 | if (time == 0) { | ||
232 | if (nowayout) | ||
233 | ret = -EINVAL; | ||
234 | else | ||
235 | wm8350_wdt_stop(wm8350); | ||
236 | break; | ||
237 | } | ||
238 | |||
239 | for (i = 0; i < ARRAY_SIZE(wm8350_wdt_cfgs); i++) | ||
240 | if (wm8350_wdt_cfgs[i].time == time) | ||
241 | break; | ||
242 | if (i == ARRAY_SIZE(wm8350_wdt_cfgs)) | ||
243 | ret = -EINVAL; | ||
244 | else | ||
245 | ret = wm8350_wdt_set_timeout(wm8350, | ||
246 | wm8350_wdt_cfgs[i].val); | ||
247 | break; | ||
248 | |||
249 | case WDIOC_GETTIMEOUT: | ||
250 | reg = wm8350_reg_read(wm8350, WM8350_SYSTEM_CONTROL_2); | ||
251 | reg &= WM8350_WDOG_TO_MASK; | ||
252 | for (i = 0; i < ARRAY_SIZE(wm8350_wdt_cfgs); i++) | ||
253 | if (wm8350_wdt_cfgs[i].val == reg) | ||
254 | break; | ||
255 | if (i == ARRAY_SIZE(wm8350_wdt_cfgs)) { | ||
256 | dev_warn(wm8350->dev, | ||
257 | "Unknown watchdog configuration: %x\n", reg); | ||
258 | ret = -EINVAL; | ||
259 | } else | ||
260 | ret = put_user(wm8350_wdt_cfgs[i].time, p); | ||
261 | |||
262 | } | ||
263 | |||
264 | return ret; | ||
265 | } | ||
266 | |||
267 | static const struct file_operations wm8350_wdt_fops = { | ||
268 | .owner = THIS_MODULE, | 128 | .owner = THIS_MODULE, |
269 | .llseek = no_llseek, | 129 | .start = wm8350_wdt_start, |
270 | .write = wm8350_wdt_write, | 130 | .stop = wm8350_wdt_stop, |
271 | .unlocked_ioctl = wm8350_wdt_ioctl, | 131 | .ping = wm8350_wdt_ping, |
272 | .open = wm8350_wdt_open, | 132 | .set_timeout = wm8350_wdt_set_timeout, |
273 | .release = wm8350_wdt_release, | ||
274 | }; | 133 | }; |
275 | 134 | ||
276 | static struct miscdevice wm8350_wdt_miscdev = { | 135 | static struct watchdog_device wm8350_wdt = { |
277 | .minor = WATCHDOG_MINOR, | 136 | .info = &wm8350_wdt_info, |
278 | .name = "watchdog", | 137 | .ops = &wm8350_wdt_ops, |
279 | .fops = &wm8350_wdt_fops, | 138 | .timeout = 4, |
139 | .min_timeout = 1, | ||
140 | .max_timeout = 4, | ||
280 | }; | 141 | }; |
281 | 142 | ||
282 | static int __devinit wm8350_wdt_probe(struct platform_device *pdev) | 143 | static int __devinit wm8350_wdt_probe(struct platform_device *pdev) |
@@ -288,18 +149,18 @@ static int __devinit wm8350_wdt_probe(struct platform_device *pdev) | |||
288 | return -ENODEV; | 149 | return -ENODEV; |
289 | } | 150 | } |
290 | 151 | ||
291 | /* Default to 4s timeout */ | 152 | watchdog_set_nowayout(&wm8350_wdt, nowayout); |
292 | wm8350_wdt_set_timeout(wm8350, 0x05); | 153 | watchdog_set_drvdata(&wm8350_wdt, wm8350); |
293 | 154 | ||
294 | wm8350_wdt_miscdev.parent = &pdev->dev; | 155 | /* Default to 4s timeout */ |
156 | wm8350_wdt_set_timeout(&wm8350_wdt, 4); | ||
295 | 157 | ||
296 | return misc_register(&wm8350_wdt_miscdev); | 158 | return watchdog_register_device(&wm8350_wdt); |
297 | } | 159 | } |
298 | 160 | ||
299 | static int __devexit wm8350_wdt_remove(struct platform_device *pdev) | 161 | static int __devexit wm8350_wdt_remove(struct platform_device *pdev) |
300 | { | 162 | { |
301 | misc_deregister(&wm8350_wdt_miscdev); | 163 | watchdog_unregister_device(&wm8350_wdt); |
302 | |||
303 | return 0; | 164 | return 0; |
304 | } | 165 | } |
305 | 166 | ||
diff --git a/drivers/watchdog/xen_wdt.c b/drivers/watchdog/xen_wdt.c index 49bd9d395562..e4a25b51165c 100644 --- a/drivers/watchdog/xen_wdt.c +++ b/drivers/watchdog/xen_wdt.c | |||
@@ -9,9 +9,10 @@ | |||
9 | * 2 of the License, or (at your option) any later version. | 9 | * 2 of the License, or (at your option) any later version. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
13 | |||
12 | #define DRV_NAME "wdt" | 14 | #define DRV_NAME "wdt" |
13 | #define DRV_VERSION "0.01" | 15 | #define DRV_VERSION "0.01" |
14 | #define PFX DRV_NAME ": " | ||
15 | 16 | ||
16 | #include <linux/bug.h> | 17 | #include <linux/bug.h> |
17 | #include <linux/errno.h> | 18 | #include <linux/errno.h> |
@@ -131,16 +132,17 @@ static int xen_wdt_open(struct inode *inode, struct file *file) | |||
131 | 132 | ||
132 | static int xen_wdt_release(struct inode *inode, struct file *file) | 133 | static int xen_wdt_release(struct inode *inode, struct file *file) |
133 | { | 134 | { |
135 | int err = 0; | ||
136 | |||
134 | if (expect_release) | 137 | if (expect_release) |
135 | xen_wdt_stop(); | 138 | err = xen_wdt_stop(); |
136 | else { | 139 | else { |
137 | printk(KERN_CRIT PFX | 140 | pr_crit("unexpected close, not stopping watchdog!\n"); |
138 | "unexpected close, not stopping watchdog!\n"); | ||
139 | xen_wdt_kick(); | 141 | xen_wdt_kick(); |
140 | } | 142 | } |
141 | is_active = false; | 143 | is_active = err; |
142 | expect_release = false; | 144 | expect_release = false; |
143 | return 0; | 145 | return err; |
144 | } | 146 | } |
145 | 147 | ||
146 | static ssize_t xen_wdt_write(struct file *file, const char __user *data, | 148 | static ssize_t xen_wdt_write(struct file *file, const char __user *data, |
@@ -251,30 +253,27 @@ static int __devinit xen_wdt_probe(struct platform_device *dev) | |||
251 | case -EINVAL: | 253 | case -EINVAL: |
252 | if (!timeout) { | 254 | if (!timeout) { |
253 | timeout = WATCHDOG_TIMEOUT; | 255 | timeout = WATCHDOG_TIMEOUT; |
254 | printk(KERN_INFO PFX | 256 | pr_info("timeout value invalid, using %d\n", timeout); |
255 | "timeout value invalid, using %d\n", timeout); | ||
256 | } | 257 | } |
257 | 258 | ||
258 | ret = misc_register(&xen_wdt_miscdev); | 259 | ret = misc_register(&xen_wdt_miscdev); |
259 | if (ret) { | 260 | if (ret) { |
260 | printk(KERN_ERR PFX | 261 | pr_err("cannot register miscdev on minor=%d (%d)\n", |
261 | "cannot register miscdev on minor=%d (%d)\n", | ||
262 | WATCHDOG_MINOR, ret); | 262 | WATCHDOG_MINOR, ret); |
263 | break; | 263 | break; |
264 | } | 264 | } |
265 | 265 | ||
266 | printk(KERN_INFO PFX | 266 | pr_info("initialized (timeout=%ds, nowayout=%d)\n", |
267 | "initialized (timeout=%ds, nowayout=%d)\n", | 267 | timeout, nowayout); |
268 | timeout, nowayout); | ||
269 | break; | 268 | break; |
270 | 269 | ||
271 | case -ENOSYS: | 270 | case -ENOSYS: |
272 | printk(KERN_INFO PFX "not supported\n"); | 271 | pr_info("not supported\n"); |
273 | ret = -ENODEV; | 272 | ret = -ENODEV; |
274 | break; | 273 | break; |
275 | 274 | ||
276 | default: | 275 | default: |
277 | printk(KERN_INFO PFX "bogus return value %d\n", ret); | 276 | pr_info("bogus return value %d\n", ret); |
278 | break; | 277 | break; |
279 | } | 278 | } |
280 | 279 | ||
@@ -299,11 +298,18 @@ static void xen_wdt_shutdown(struct platform_device *dev) | |||
299 | 298 | ||
300 | static int xen_wdt_suspend(struct platform_device *dev, pm_message_t state) | 299 | static int xen_wdt_suspend(struct platform_device *dev, pm_message_t state) |
301 | { | 300 | { |
302 | return xen_wdt_stop(); | 301 | typeof(wdt.id) id = wdt.id; |
302 | int rc = xen_wdt_stop(); | ||
303 | |||
304 | wdt.id = id; | ||
305 | return rc; | ||
303 | } | 306 | } |
304 | 307 | ||
305 | static int xen_wdt_resume(struct platform_device *dev) | 308 | static int xen_wdt_resume(struct platform_device *dev) |
306 | { | 309 | { |
310 | if (!wdt.id) | ||
311 | return 0; | ||
312 | wdt.id = 0; | ||
307 | return xen_wdt_start(); | 313 | return xen_wdt_start(); |
308 | } | 314 | } |
309 | 315 | ||
@@ -326,7 +332,7 @@ static int __init xen_wdt_init_module(void) | |||
326 | if (!xen_domain()) | 332 | if (!xen_domain()) |
327 | return -ENODEV; | 333 | return -ENODEV; |
328 | 334 | ||
329 | printk(KERN_INFO PFX "Xen WatchDog Timer Driver v%s\n", DRV_VERSION); | 335 | pr_info("Xen WatchDog Timer Driver v%s\n", DRV_VERSION); |
330 | 336 | ||
331 | err = platform_driver_register(&xen_wdt_driver); | 337 | err = platform_driver_register(&xen_wdt_driver); |
332 | if (err) | 338 | if (err) |
@@ -346,7 +352,7 @@ static void __exit xen_wdt_cleanup_module(void) | |||
346 | { | 352 | { |
347 | platform_device_unregister(platform_device); | 353 | platform_device_unregister(platform_device); |
348 | platform_driver_unregister(&xen_wdt_driver); | 354 | platform_driver_unregister(&xen_wdt_driver); |
349 | printk(KERN_INFO PFX "module unloaded\n"); | 355 | pr_info("module unloaded\n"); |
350 | } | 356 | } |
351 | 357 | ||
352 | module_init(xen_wdt_init_module); | 358 | module_init(xen_wdt_init_module); |
diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h index 43ba5b3ce2a3..ac40716b44e9 100644 --- a/include/linux/watchdog.h +++ b/include/linux/watchdog.h | |||
@@ -66,6 +66,7 @@ struct watchdog_device; | |||
66 | * @ping: The routine that sends a keepalive ping to the watchdog device. | 66 | * @ping: The routine that sends a keepalive ping to the watchdog device. |
67 | * @status: The routine that shows the status of the watchdog device. | 67 | * @status: The routine that shows the status of the watchdog device. |
68 | * @set_timeout:The routine for setting the watchdog devices timeout value. | 68 | * @set_timeout:The routine for setting the watchdog devices timeout value. |
69 | * @get_timeleft:The routine that get's the time that's left before a reset. | ||
69 | * @ioctl: The routines that handles extra ioctl calls. | 70 | * @ioctl: The routines that handles extra ioctl calls. |
70 | * | 71 | * |
71 | * The watchdog_ops structure contains a list of low-level operations | 72 | * The watchdog_ops structure contains a list of low-level operations |
@@ -82,6 +83,7 @@ struct watchdog_ops { | |||
82 | int (*ping)(struct watchdog_device *); | 83 | int (*ping)(struct watchdog_device *); |
83 | unsigned int (*status)(struct watchdog_device *); | 84 | unsigned int (*status)(struct watchdog_device *); |
84 | int (*set_timeout)(struct watchdog_device *, unsigned int); | 85 | int (*set_timeout)(struct watchdog_device *, unsigned int); |
86 | unsigned int (*get_timeleft)(struct watchdog_device *); | ||
85 | long (*ioctl)(struct watchdog_device *, unsigned int, unsigned long); | 87 | long (*ioctl)(struct watchdog_device *, unsigned int, unsigned long); |
86 | }; | 88 | }; |
87 | 89 | ||
@@ -127,7 +129,7 @@ struct watchdog_device { | |||
127 | #endif | 129 | #endif |
128 | 130 | ||
129 | /* Use the following function to set the nowayout feature */ | 131 | /* Use the following function to set the nowayout feature */ |
130 | static inline void watchdog_set_nowayout(struct watchdog_device *wdd, int nowayout) | 132 | static inline void watchdog_set_nowayout(struct watchdog_device *wdd, bool nowayout) |
131 | { | 133 | { |
132 | if (nowayout) | 134 | if (nowayout) |
133 | set_bit(WDOG_NO_WAY_OUT, &wdd->status); | 135 | set_bit(WDOG_NO_WAY_OUT, &wdd->status); |