diff options
Diffstat (limited to 'drivers/watchdog/wdt_pci.c')
-rw-r--r-- | drivers/watchdog/wdt_pci.c | 70 |
1 files changed, 32 insertions, 38 deletions
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: |