aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/watchdog
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2006-09-26 23:31:01 -0400
committerPaul Mundt <lethal@linux-sh.org>2006-09-26 23:31:01 -0400
commite4c2cfee5d5cf3e4c16b423be23551aeddf2717b (patch)
tree656b3feabfb595448b04f4111ea82f6e395d1e0a /drivers/char/watchdog
parenta56d276c05a80ce727902076a3b4c6247705e2df (diff)
sh: Various cosmetic cleanups.
We had quite a bit of whitespace damage, clean most of it up.. Signed-off-by: Stuart Menefy <stuart.menefy@st.com> Signed-off-by: Arthur Othieno <a.othieno@bluewin.ch> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/char/watchdog')
-rw-r--r--drivers/char/watchdog/shwdt.c58
1 files changed, 24 insertions, 34 deletions
diff --git a/drivers/char/watchdog/shwdt.c b/drivers/char/watchdog/shwdt.c
index 1355038f1044..7c39f39effdf 100644
--- a/drivers/char/watchdog/shwdt.c
+++ b/drivers/char/watchdog/shwdt.c
@@ -125,7 +125,6 @@ static void sh_wdt_start(void)
125 125
126/** 126/**
127 * sh_wdt_stop - Stop the Watchdog 127 * sh_wdt_stop - Stop the Watchdog
128 *
129 * Stops the watchdog. 128 * Stops the watchdog.
130 */ 129 */
131static void sh_wdt_stop(void) 130static void sh_wdt_stop(void)
@@ -141,22 +140,20 @@ static void sh_wdt_stop(void)
141 140
142/** 141/**
143 * sh_wdt_keepalive - Keep the Userspace Watchdog Alive 142 * sh_wdt_keepalive - Keep the Userspace Watchdog Alive
144 *
145 * The Userspace watchdog got a KeepAlive: schedule the next heartbeat. 143 * The Userspace watchdog got a KeepAlive: schedule the next heartbeat.
146 */ 144 */
147static void sh_wdt_keepalive(void) 145static inline void sh_wdt_keepalive(void)
148{ 146{
149 next_heartbeat = jiffies + (heartbeat * HZ); 147 next_heartbeat = jiffies + (heartbeat * HZ);
150} 148}
151 149
152/** 150/**
153 * sh_wdt_set_heartbeat - Set the Userspace Watchdog heartbeat 151 * sh_wdt_set_heartbeat - Set the Userspace Watchdog heartbeat
154 *
155 * Set the Userspace Watchdog heartbeat 152 * Set the Userspace Watchdog heartbeat
156 */ 153 */
157static int sh_wdt_set_heartbeat(int t) 154static int sh_wdt_set_heartbeat(int t)
158{ 155{
159 if ((t < 1) || (t > 3600)) /* arbitrary upper limit */ 156 if (unlikely((t < 1) || (t > 3600))) /* arbitrary upper limit */
160 return -EINVAL; 157 return -EINVAL;
161 158
162 heartbeat = t; 159 heartbeat = t;
@@ -165,7 +162,6 @@ static int sh_wdt_set_heartbeat(int t)
165 162
166/** 163/**
167 * sh_wdt_ping - Ping the Watchdog 164 * sh_wdt_ping - Ping the Watchdog
168 *
169 * @data: Unused 165 * @data: Unused
170 * 166 *
171 * Clears overflow bit, resets timer counter. 167 * Clears overflow bit, resets timer counter.
@@ -182,14 +178,13 @@ static void sh_wdt_ping(unsigned long data)
182 sh_wdt_write_cnt(0); 178 sh_wdt_write_cnt(0);
183 179
184 mod_timer(&timer, next_ping_period(clock_division_ratio)); 180 mod_timer(&timer, next_ping_period(clock_division_ratio));
185 } else { 181 } else
186 printk(KERN_WARNING PFX "Heartbeat lost! Will not ping the watchdog\n"); 182 printk(KERN_WARNING PFX "Heartbeat lost! Will not ping "
187 } 183 "the watchdog\n");
188} 184}
189 185
190/** 186/**
191 * sh_wdt_open - Open the Device 187 * sh_wdt_open - Open the Device
192 *
193 * @inode: inode of device 188 * @inode: inode of device
194 * @file: file handle of device 189 * @file: file handle of device
195 * 190 *
@@ -209,7 +204,6 @@ static int sh_wdt_open(struct inode *inode, struct file *file)
209 204
210/** 205/**
211 * sh_wdt_close - Close the Device 206 * sh_wdt_close - Close the Device
212 *
213 * @inode: inode of device 207 * @inode: inode of device
214 * @file: file handle of device 208 * @file: file handle of device
215 * 209 *
@@ -220,7 +214,8 @@ static int sh_wdt_close(struct inode *inode, struct file *file)
220 if (shwdt_expect_close == 42) { 214 if (shwdt_expect_close == 42) {
221 sh_wdt_stop(); 215 sh_wdt_stop();
222 } else { 216 } else {
223 printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n"); 217 printk(KERN_CRIT PFX "Unexpected close, not "
218 "stopping watchdog!\n");
224 sh_wdt_keepalive(); 219 sh_wdt_keepalive();
225 } 220 }
226 221
@@ -232,7 +227,6 @@ static int sh_wdt_close(struct inode *inode, struct file *file)
232 227
233/** 228/**
234 * sh_wdt_write - Write to Device 229 * sh_wdt_write - Write to Device
235 *
236 * @file: file handle of device 230 * @file: file handle of device
237 * @buf: buffer to write 231 * @buf: buffer to write
238 * @count: length of buffer 232 * @count: length of buffer
@@ -265,7 +259,6 @@ static ssize_t sh_wdt_write(struct file *file, const char *buf,
265 259
266/** 260/**
267 * sh_wdt_ioctl - Query Device 261 * sh_wdt_ioctl - Query Device
268 *
269 * @inode: inode of device 262 * @inode: inode of device
270 * @file: file handle of device 263 * @file: file handle of device
271 * @cmd: watchdog command 264 * @cmd: watchdog command
@@ -326,7 +319,6 @@ static int sh_wdt_ioctl(struct inode *inode, struct file *file,
326 319
327/** 320/**
328 * sh_wdt_notify_sys - Notifier Handler 321 * sh_wdt_notify_sys - Notifier Handler
329 *
330 * @this: notifier block 322 * @this: notifier block
331 * @code: notifier event 323 * @code: notifier event
332 * @unused: unused 324 * @unused: unused
@@ -337,9 +329,8 @@ static int sh_wdt_ioctl(struct inode *inode, struct file *file,
337static int sh_wdt_notify_sys(struct notifier_block *this, 329static int sh_wdt_notify_sys(struct notifier_block *this,
338 unsigned long code, void *unused) 330 unsigned long code, void *unused)
339{ 331{
340 if (code == SYS_DOWN || code == SYS_HALT) { 332 if (code == SYS_DOWN || code == SYS_HALT)
341 sh_wdt_stop(); 333 sh_wdt_stop();
342 }
343 334
344 return NOTIFY_DONE; 335 return NOTIFY_DONE;
345} 336}
@@ -354,7 +345,8 @@ static const struct file_operations sh_wdt_fops = {
354}; 345};
355 346
356static struct watchdog_info sh_wdt_info = { 347static struct watchdog_info sh_wdt_info = {
357 .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE, 348 .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT |
349 WDIOF_MAGICCLOSE,
358 .firmware_version = 1, 350 .firmware_version = 1,
359 .identity = "SH WDT", 351 .identity = "SH WDT",
360}; 352};
@@ -371,7 +363,6 @@ static struct miscdevice sh_wdt_miscdev = {
371 363
372/** 364/**
373 * sh_wdt_init - Initialize module 365 * sh_wdt_init - Initialize module
374 *
375 * Registers the device and notifier handler. Actual device 366 * Registers the device and notifier handler. Actual device
376 * initialization is handled by sh_wdt_open(). 367 * initialization is handled by sh_wdt_open().
377 */ 368 */
@@ -381,15 +372,15 @@ static int __init sh_wdt_init(void)
381 372
382 if ((clock_division_ratio < 0x5) || (clock_division_ratio > 0x7)) { 373 if ((clock_division_ratio < 0x5) || (clock_division_ratio > 0x7)) {
383 clock_division_ratio = WTCSR_CKS_4096; 374 clock_division_ratio = WTCSR_CKS_4096;
384 printk(KERN_INFO PFX "clock_division_ratio value must be 0x5<=x<=0x7, using %d\n", 375 printk(KERN_INFO PFX "clock_division_ratio value must "
385 clock_division_ratio); 376 "be 0x5<=x<=0x7, using %d\n", clock_division_ratio);
386 } 377 }
387 378
388 if (sh_wdt_set_heartbeat(heartbeat)) 379 rc = sh_wdt_set_heartbeat(heartbeat);
389 { 380 if (unlikely(rc)) {
390 heartbeat = WATCHDOG_HEARTBEAT; 381 heartbeat = WATCHDOG_HEARTBEAT;
391 printk(KERN_INFO PFX "heartbeat value must be 1<=x<=3600, using %d\n", 382 printk(KERN_INFO PFX "heartbeat value must "
392 heartbeat); 383 "be 1<=x<=3600, using %d\n", heartbeat);
393 } 384 }
394 385
395 init_timer(&timer); 386 init_timer(&timer);
@@ -397,15 +388,16 @@ static int __init sh_wdt_init(void)
397 timer.data = 0; 388 timer.data = 0;
398 389
399 rc = register_reboot_notifier(&sh_wdt_notifier); 390 rc = register_reboot_notifier(&sh_wdt_notifier);
400 if (rc) { 391 if (unlikely(rc)) {
401 printk(KERN_ERR PFX "Can't register reboot notifier (err=%d)\n", rc); 392 printk(KERN_ERR PFX "Can't register reboot notifier (err=%d)\n",
393 rc);
402 return rc; 394 return rc;
403 } 395 }
404 396
405 rc = misc_register(&sh_wdt_miscdev); 397 rc = misc_register(&sh_wdt_miscdev);
406 if (rc) { 398 if (unlikely(rc)) {
407 printk(KERN_ERR PFX "Can't register miscdev on minor=%d (err=%d)\n", 399 printk(KERN_ERR PFX "Can't register miscdev on "
408 sh_wdt_miscdev.minor, rc); 400 "minor=%d (err=%d)\n", sh_wdt_miscdev.minor, rc);
409 unregister_reboot_notifier(&sh_wdt_notifier); 401 unregister_reboot_notifier(&sh_wdt_notifier);
410 return rc; 402 return rc;
411 } 403 }
@@ -418,7 +410,6 @@ static int __init sh_wdt_init(void)
418 410
419/** 411/**
420 * sh_wdt_exit - Deinitialize module 412 * sh_wdt_exit - Deinitialize module
421 *
422 * Unregisters the device and notifier handler. Actual device 413 * Unregisters the device and notifier handler. Actual device
423 * deinitialization is handled by sh_wdt_close(). 414 * deinitialization is handled by sh_wdt_close().
424 */ 415 */
@@ -434,14 +425,13 @@ MODULE_LICENSE("GPL");
434MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); 425MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
435 426
436module_param(clock_division_ratio, int, 0); 427module_param(clock_division_ratio, int, 0);
437MODULE_PARM_DESC(clock_division_ratio, "Clock division ratio. Valid ranges are from 0x5 (1.31ms) to 0x7 (5.25ms). Defaults to 0x7."); 428MODULE_PARM_DESC(clock_division_ratio, "Clock division ratio. Valid ranges are from 0x5 (1.31ms) to 0x7 (5.25ms). (default=" __MODULE_STRING(clock_division_ratio) ")");
438 429
439module_param(heartbeat, int, 0); 430module_param(heartbeat, int, 0);
440MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (1<=heartbeat<=3600, default=" __MODULE_STRING(WATCHDOG_HEARTBEAT) ")"); 431MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (1<=heartbeat<=3600, default=" __MODULE_STRING(WATCHDOG_HEARTBEAT) ")");
441 432
442module_param(nowayout, int, 0); 433module_param(nowayout, int, 0);
443MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 434MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
444 435
445module_init(sh_wdt_init); 436module_init(sh_wdt_init);
446module_exit(sh_wdt_exit); 437module_exit(sh_wdt_exit);
447