aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/watchdog
diff options
context:
space:
mode:
authorBen Dooks <ben-linux@fluff.org>2007-06-14 07:08:55 -0400
committerWim Van Sebroeck <wim@iguana.be>2007-06-17 14:41:42 -0400
commite8ef92b8dc939cebf0c1fe153e898e5162c2ad05 (patch)
tree33a3fa5cc2b3b2623067b2fe251a6da707f8442a /drivers/char/watchdog
parent46b814d6e00c1a1e3127f8f9c254dda310781bec (diff)
[WATCHDOG] change s3c2410_wdt to using dev_() macros for output
Move to using dev_info(), dev_dbg() and dev_err() for reporting information from the driver. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/char/watchdog')
-rw-r--r--drivers/char/watchdog/s3c2410_wdt.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/drivers/char/watchdog/s3c2410_wdt.c b/drivers/char/watchdog/s3c2410_wdt.c
index 7cc026353bcd..50430bced2f2 100644
--- a/drivers/char/watchdog/s3c2410_wdt.c
+++ b/drivers/char/watchdog/s3c2410_wdt.c
@@ -92,6 +92,7 @@ typedef enum close_state {
92 92
93static DECLARE_MUTEX(open_lock); 93static DECLARE_MUTEX(open_lock);
94 94
95static struct device *wdt_dev; /* platform device attached to */
95static struct resource *wdt_mem; 96static struct resource *wdt_mem;
96static struct resource *wdt_irq; 97static struct resource *wdt_irq;
97static struct clk *wdt_clock; 98static struct clk *wdt_clock;
@@ -180,7 +181,7 @@ static int s3c2410wdt_set_heartbeat(int timeout)
180 } 181 }
181 182
182 if ((count / divisor) >= 0x10000) { 183 if ((count / divisor) >= 0x10000) {
183 printk(KERN_ERR PFX "timeout %d too big\n", timeout); 184 dev_err(wdt_dev, "timeout %d too big\n", timeout);
184 return -EINVAL; 185 return -EINVAL;
185 } 186 }
186 } 187 }
@@ -233,7 +234,7 @@ static int s3c2410wdt_release(struct inode *inode, struct file *file)
233 if (allow_close == CLOSE_STATE_ALLOW) { 234 if (allow_close == CLOSE_STATE_ALLOW) {
234 s3c2410wdt_stop(); 235 s3c2410wdt_stop();
235 } else { 236 } else {
236 printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n"); 237 dev_err(wdt_dev, "Unexpected close, not stopping watchdog\n");
237 s3c2410wdt_keepalive(); 238 s3c2410wdt_keepalive();
238 } 239 }
239 240
@@ -338,7 +339,7 @@ static struct miscdevice s3c2410wdt_miscdev = {
338 339
339static irqreturn_t s3c2410wdt_irq(int irqno, void *param) 340static irqreturn_t s3c2410wdt_irq(int irqno, void *param)
340{ 341{
341 printk(KERN_INFO PFX "Watchdog timer expired!\n"); 342 dev_info(wdt_dev, "watchdog timer expired (irq)\n");
342 343
343 s3c2410wdt_keepalive(); 344 s3c2410wdt_keepalive();
344 return IRQ_HANDLED; 345 return IRQ_HANDLED;
@@ -348,6 +349,7 @@ static irqreturn_t s3c2410wdt_irq(int irqno, void *param)
348static int s3c2410wdt_probe(struct platform_device *pdev) 349static int s3c2410wdt_probe(struct platform_device *pdev)
349{ 350{
350 struct resource *res; 351 struct resource *res;
352 struct device *dev;
351 unsigned int wtcon; 353 unsigned int wtcon;
352 int started = 0; 354 int started = 0;
353 int ret; 355 int ret;
@@ -355,25 +357,28 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
355 357
356 DBG("%s: probe=%p\n", __FUNCTION__, pdev); 358 DBG("%s: probe=%p\n", __FUNCTION__, pdev);
357 359
360 dev = &pdev->dev;
361 wdt_dev = &pdev->dev;
362
358 /* get the memory region for the watchdog timer */ 363 /* get the memory region for the watchdog timer */
359 364
360 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 365 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
361 if (res == NULL) { 366 if (res == NULL) {
362 printk(KERN_INFO PFX "failed to get memory region resouce\n"); 367 dev_err(dev, "no memory resource specified\n");
363 return -ENOENT; 368 return -ENOENT;
364 } 369 }
365 370
366 size = (res->end-res->start)+1; 371 size = (res->end-res->start)+1;
367 wdt_mem = request_mem_region(res->start, size, pdev->name); 372 wdt_mem = request_mem_region(res->start, size, pdev->name);
368 if (wdt_mem == NULL) { 373 if (wdt_mem == NULL) {
369 printk(KERN_INFO PFX "failed to get memory region\n"); 374 dev_err(dev, "failed to get memory region\n");
370 ret = -ENOENT; 375 ret = -ENOENT;
371 goto err_req; 376 goto err_req;
372 } 377 }
373 378
374 wdt_base = ioremap(res->start, size); 379 wdt_base = ioremap(res->start, size);
375 if (wdt_base == 0) { 380 if (wdt_base == 0) {
376 printk(KERN_INFO PFX "failed to ioremap() region\n"); 381 dev_err(dev, "failed to ioremap() region\n");
377 ret = -EINVAL; 382 ret = -EINVAL;
378 goto err_req; 383 goto err_req;
379 } 384 }
@@ -382,20 +387,20 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
382 387
383 wdt_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 388 wdt_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
384 if (wdt_irq == NULL) { 389 if (wdt_irq == NULL) {
385 printk(KERN_INFO PFX "failed to get irq resource\n"); 390 dev_err(dev, "no irq resource specified\n");
386 ret = -ENOENT; 391 ret = -ENOENT;
387 goto err_map; 392 goto err_map;
388 } 393 }
389 394
390 ret = request_irq(wdt_irq->start, s3c2410wdt_irq, 0, pdev->name, pdev); 395 ret = request_irq(wdt_irq->start, s3c2410wdt_irq, 0, pdev->name, pdev);
391 if (ret != 0) { 396 if (ret != 0) {
392 printk(KERN_INFO PFX "failed to install irq (%d)\n", ret); 397 dev_err(dev, "failed to install irq (%d)\n", ret);
393 goto err_map; 398 goto err_map;
394 } 399 }
395 400
396 wdt_clock = clk_get(&pdev->dev, "watchdog"); 401 wdt_clock = clk_get(&pdev->dev, "watchdog");
397 if (IS_ERR(wdt_clock)) { 402 if (IS_ERR(wdt_clock)) {
398 printk(KERN_INFO PFX "failed to find watchdog clock source\n"); 403 dev_err(dev, "failed to find watchdog clock source\n");
399 ret = PTR_ERR(wdt_clock); 404 ret = PTR_ERR(wdt_clock);
400 goto err_irq; 405 goto err_irq;
401 } 406 }
@@ -409,22 +414,22 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
409 started = s3c2410wdt_set_heartbeat(CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME); 414 started = s3c2410wdt_set_heartbeat(CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME);
410 415
411 if (started == 0) { 416 if (started == 0) {
412 printk(KERN_INFO PFX "tmr_margin value out of range, default %d used\n", 417 dev_info(dev,"tmr_margin value out of range, default %d used\n",
413 CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME); 418 CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME);
414 } else { 419 } else {
415 printk(KERN_INFO PFX "default timer value is out of range, cannot start\n"); 420 dev_info(dev, "default timer value is out of range, cannot start\n");
416 } 421 }
417 } 422 }
418 423
419 ret = misc_register(&s3c2410wdt_miscdev); 424 ret = misc_register(&s3c2410wdt_miscdev);
420 if (ret) { 425 if (ret) {
421 printk (KERN_ERR PFX "cannot register miscdev on minor=%d (%d)\n", 426 dev_err(dev, "cannot register miscdev on minor=%d (%d)\n",
422 WATCHDOG_MINOR, ret); 427 WATCHDOG_MINOR, ret);
423 goto err_clk; 428 goto err_clk;
424 } 429 }
425 430
426 if (tmr_atboot && started == 0) { 431 if (tmr_atboot && started == 0) {
427 printk(KERN_INFO PFX "Starting Watchdog Timer\n"); 432 dev_info(dev, "starting watchdog timer\n");
428 s3c2410wdt_start(); 433 s3c2410wdt_start();
429 } else if (!tmr_atboot) { 434 } else if (!tmr_atboot) {
430 /* if we're not enabling the watchdog, then ensure it is 435 /* if we're not enabling the watchdog, then ensure it is
@@ -438,12 +443,11 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
438 443
439 wtcon = readl(wdt_base + S3C2410_WTCON); 444 wtcon = readl(wdt_base + S3C2410_WTCON);
440 445
441 dev_info(&pdev->dev, 446 dev_info(dev, "watchdog %sactive, reset %sabled, irq %sabled\n",
442 "watchdog %sactive, reset %sabled, irq %sabled\n",
443 (wtcon & S3C2410_WTCON_ENABLE) ? "" : "in", 447 (wtcon & S3C2410_WTCON_ENABLE) ? "" : "in",
444 (wtcon & S3C2410_WTCON_RSTEN) ? "" : "dis", 448 (wtcon & S3C2410_WTCON_RSTEN) ? "" : "dis",
445 (wtcon & S3C2410_WTCON_INTEN) ? "" : "en"); 449 (wtcon & S3C2410_WTCON_INTEN) ? "" : "en");
446 450
447 return 0; 451 return 0;
448 452
449 err_clk: 453 err_clk: