Commit f5aa8cc6 authored by Linus Torvalds's avatar Linus Torvalds

Merge http://linux-watchdog.bkbits.net/linux-2.6-watchdog

into ppc970.osdl.org:/home/torvalds/v2.6/linux
parents 2f5bf694 b3dea13a
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/io.h> #include <asm/io.h>
#define WD_VER "1.16 (03/27/2004)" #define WD_VER "1.16 (06/12/2004)"
#define PFX "pcwd: " #define PFX "pcwd: "
/* /*
...@@ -299,10 +299,11 @@ static int pcwd_stop(void) ...@@ -299,10 +299,11 @@ static int pcwd_stop(void)
return 0; return 0;
} }
static void pcwd_keepalive(void) static int pcwd_keepalive(void)
{ {
/* user land ping */ /* user land ping */
next_heartbeat = jiffies + (heartbeat * HZ); next_heartbeat = jiffies + (heartbeat * HZ);
return 0;
} }
static int pcwd_set_heartbeat(int t) static int pcwd_set_heartbeat(int t)
...@@ -529,12 +530,12 @@ static int pcwd_close(struct inode *inode, struct file *file) ...@@ -529,12 +530,12 @@ static int pcwd_close(struct inode *inode, struct file *file)
{ {
if (expect_close == 42) { if (expect_close == 42) {
pcwd_stop(); pcwd_stop();
atomic_inc( &open_allowed );
} else { } else {
printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n"); printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
pcwd_keepalive(); pcwd_keepalive();
} }
expect_close = 0; expect_close = 0;
atomic_inc( &open_allowed );
return 0; return 0;
} }
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
/* Module and version information */ /* Module and version information */
#define WATCHDOG_VERSION "1.00" #define WATCHDOG_VERSION "1.00"
#define WATCHDOG_DATE "13/03/2004" #define WATCHDOG_DATE "12 Jun 2004"
#define WATCHDOG_DRIVER_NAME "PCI-PC Watchdog" #define WATCHDOG_DRIVER_NAME "PCI-PC Watchdog"
#define WATCHDOG_NAME "pcwd_pci" #define WATCHDOG_NAME "pcwd_pci"
#define PFX WATCHDOG_NAME ": " #define PFX WATCHDOG_NAME ": "
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
#define WD_PCI_TTRP 0x04 /* Temperature Trip status */ #define WD_PCI_TTRP 0x04 /* Temperature Trip status */
/* according to documentation max. time to process a command for the pci /* according to documentation max. time to process a command for the pci
watchdog card is 100 ms, so we give it 150 ms to do it's job */ * watchdog card is 100 ms, so we give it 150 ms to do it's job */
#define PCI_COMMAND_TIMEOUT 150 #define PCI_COMMAND_TIMEOUT 150
/* Watchdog's internal commands */ /* Watchdog's internal commands */
...@@ -404,8 +404,8 @@ static int pcipcwd_release(struct inode *inode, struct file *file) ...@@ -404,8 +404,8 @@ static int pcipcwd_release(struct inode *inode, struct file *file)
printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n"); printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
pcipcwd_keepalive(); pcipcwd_keepalive();
} }
clear_bit(0, &is_active);
expect_release = 0; expect_release = 0;
clear_bit(0, &is_active);
return 0; return 0;
} }
...@@ -585,15 +585,12 @@ static int __devinit pcipcwd_card_init(struct pci_dev *pdev, ...@@ -585,15 +585,12 @@ static int __devinit pcipcwd_card_init(struct pci_dev *pdev,
printk(KERN_INFO PFX "No previous trip detected - Cold boot or reset\n"); printk(KERN_INFO PFX "No previous trip detected - Cold boot or reset\n");
/* Check that the heartbeat value is within it's range ; if not reset to the default */ /* Check that the heartbeat value is within it's range ; if not reset to the default */
if (heartbeat < 1 || heartbeat > 0xFFFF) { if (pcipcwd_set_heartbeat(heartbeat)) {
heartbeat = WATCHDOG_HEARTBEAT; pcipcwd_set_heartbeat(WATCHDOG_HEARTBEAT);
printk(KERN_INFO PFX "heartbeat value must be 0<heartbeat<65536, using %d\n", printk(KERN_INFO PFX "heartbeat value must be 0<heartbeat<65536, using %d\n",
heartbeat); WATCHDOG_HEARTBEAT);
} }
/* Calculate the watchdog's heartbeat */
pcipcwd_set_heartbeat(heartbeat);
ret = register_reboot_notifier(&pcipcwd_notifier); ret = register_reboot_notifier(&pcipcwd_notifier);
if (ret != 0) { if (ret != 0) {
printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n",
...@@ -601,21 +598,21 @@ static int __devinit pcipcwd_card_init(struct pci_dev *pdev, ...@@ -601,21 +598,21 @@ static int __devinit pcipcwd_card_init(struct pci_dev *pdev,
goto err_out_release_region; goto err_out_release_region;
} }
ret = misc_register(&pcipcwd_miscdev); if (pcipcwd_private.supports_temp) {
ret = misc_register(&pcipcwd_temp_miscdev);
if (ret != 0) { if (ret != 0) {
printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
WATCHDOG_MINOR, ret); TEMP_MINOR, ret);
goto err_out_unregister_reboot; goto err_out_unregister_reboot;
} }
}
if (pcipcwd_private.supports_temp) { ret = misc_register(&pcipcwd_miscdev);
ret = misc_register(&pcipcwd_temp_miscdev);
if (ret != 0) { if (ret != 0) {
printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
TEMP_MINOR, ret); WATCHDOG_MINOR, ret);
goto err_out_misc_deregister; goto err_out_misc_deregister;
} }
}
printk(KERN_INFO PFX "initialized. heartbeat=%d sec (nowayout=%d)\n", printk(KERN_INFO PFX "initialized. heartbeat=%d sec (nowayout=%d)\n",
heartbeat, nowayout); heartbeat, nowayout);
...@@ -623,7 +620,8 @@ static int __devinit pcipcwd_card_init(struct pci_dev *pdev, ...@@ -623,7 +620,8 @@ static int __devinit pcipcwd_card_init(struct pci_dev *pdev,
return 0; return 0;
err_out_misc_deregister: err_out_misc_deregister:
misc_deregister(&pcipcwd_miscdev); if (pcipcwd_private.supports_temp)
misc_deregister(&pcipcwd_temp_miscdev);
err_out_unregister_reboot: err_out_unregister_reboot:
unregister_reboot_notifier(&pcipcwd_notifier); unregister_reboot_notifier(&pcipcwd_notifier);
err_out_release_region: err_out_release_region:
...@@ -640,9 +638,9 @@ static void __devexit pcipcwd_card_exit(struct pci_dev *pdev) ...@@ -640,9 +638,9 @@ static void __devexit pcipcwd_card_exit(struct pci_dev *pdev)
pcipcwd_stop(); pcipcwd_stop();
/* Deregister */ /* Deregister */
misc_deregister(&pcipcwd_miscdev);
if (pcipcwd_private.supports_temp) if (pcipcwd_private.supports_temp)
misc_deregister(&pcipcwd_temp_miscdev); misc_deregister(&pcipcwd_temp_miscdev);
misc_deregister(&pcipcwd_miscdev);
unregister_reboot_notifier(&pcipcwd_notifier); unregister_reboot_notifier(&pcipcwd_notifier);
pci_release_regions(pdev); pci_release_regions(pdev);
pci_disable_device(pdev); pci_disable_device(pdev);
......
...@@ -56,7 +56,8 @@ ...@@ -56,7 +56,8 @@
/* Module and Version Information */ /* Module and Version Information */
#define DRIVER_VERSION "v1.00 (28/02/2004)" #define DRIVER_VERSION "1.00"
#define DRIVER_DATE "12 Jun 2004"
#define DRIVER_AUTHOR "Wim Van Sebroeck <wim@iguana.be>" #define DRIVER_AUTHOR "Wim Van Sebroeck <wim@iguana.be>"
#define DRIVER_DESC "Berkshire USB-PC Watchdog driver" #define DRIVER_DESC "Berkshire USB-PC Watchdog driver"
#define DRIVER_LICENSE "GPL" #define DRIVER_LICENSE "GPL"
...@@ -456,8 +457,8 @@ static int usb_pcwd_release(struct inode *inode, struct file *file) ...@@ -456,8 +457,8 @@ static int usb_pcwd_release(struct inode *inode, struct file *file)
printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n"); printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
usb_pcwd_keepalive(usb_pcwd_device); usb_pcwd_keepalive(usb_pcwd_device);
} }
clear_bit(0, &is_active);
expect_release = 0; expect_release = 0;
clear_bit(0, &is_active);
return 0; return 0;
} }
...@@ -681,15 +682,12 @@ static int usb_pcwd_probe(struct usb_interface *interface, const struct usb_devi ...@@ -681,15 +682,12 @@ static int usb_pcwd_probe(struct usb_interface *interface, const struct usb_devi
((option_switches & 0x08) ? "ON" : "OFF")); ((option_switches & 0x08) ? "ON" : "OFF"));
/* Check that the heartbeat value is within it's range ; if not reset to the default */ /* Check that the heartbeat value is within it's range ; if not reset to the default */
if (heartbeat < 1 || heartbeat > 0xFFFF) { if (usb_pcwd_set_heartbeat(usb_pcwd, heartbeat)) {
heartbeat = WATCHDOG_HEARTBEAT; usb_pcwd_set_heartbeat(usb_pcwd, WATCHDOG_HEARTBEAT);
printk(KERN_INFO PFX "heartbeat value must be 0<heartbeat<65536, using %d\n", printk(KERN_INFO PFX "heartbeat value must be 0<heartbeat<65536, using %d\n",
heartbeat); WATCHDOG_HEARTBEAT);
} }
/* Calculate the watchdog's heartbeat */
usb_pcwd_set_heartbeat(usb_pcwd, heartbeat);
retval = register_reboot_notifier(&usb_pcwd_notifier); retval = register_reboot_notifier(&usb_pcwd_notifier);
if (retval != 0) { if (retval != 0) {
printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n",
...@@ -697,17 +695,17 @@ static int usb_pcwd_probe(struct usb_interface *interface, const struct usb_devi ...@@ -697,17 +695,17 @@ static int usb_pcwd_probe(struct usb_interface *interface, const struct usb_devi
goto error; goto error;
} }
retval = misc_register(&usb_pcwd_miscdev); retval = misc_register(&usb_pcwd_temperature_miscdev);
if (retval != 0) { if (retval != 0) {
printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
WATCHDOG_MINOR, retval); TEMP_MINOR, retval);
goto err_out_unregister_reboot; goto err_out_unregister_reboot;
} }
retval = misc_register(&usb_pcwd_temperature_miscdev); retval = misc_register(&usb_pcwd_miscdev);
if (retval != 0) { if (retval != 0) {
printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
TEMP_MINOR, retval); WATCHDOG_MINOR, retval);
goto err_out_misc_deregister; goto err_out_misc_deregister;
} }
...@@ -720,7 +718,7 @@ static int usb_pcwd_probe(struct usb_interface *interface, const struct usb_devi ...@@ -720,7 +718,7 @@ static int usb_pcwd_probe(struct usb_interface *interface, const struct usb_devi
return 0; return 0;
err_out_misc_deregister: err_out_misc_deregister:
misc_deregister(&usb_pcwd_miscdev); misc_deregister(&usb_pcwd_temperature_miscdev);
err_out_unregister_reboot: err_out_unregister_reboot:
unregister_reboot_notifier(&usb_pcwd_notifier); unregister_reboot_notifier(&usb_pcwd_notifier);
error: error:
...@@ -758,8 +756,8 @@ static void usb_pcwd_disconnect(struct usb_interface *interface) ...@@ -758,8 +756,8 @@ static void usb_pcwd_disconnect(struct usb_interface *interface)
usb_pcwd->exists = 0; usb_pcwd->exists = 0;
/* Deregister */ /* Deregister */
misc_deregister(&usb_pcwd_temperature_miscdev);
misc_deregister(&usb_pcwd_miscdev); misc_deregister(&usb_pcwd_miscdev);
misc_deregister(&usb_pcwd_temperature_miscdev);
unregister_reboot_notifier(&usb_pcwd_notifier); unregister_reboot_notifier(&usb_pcwd_notifier);
up (&usb_pcwd->sem); up (&usb_pcwd->sem);
...@@ -791,7 +789,7 @@ static int __init usb_pcwd_init(void) ...@@ -791,7 +789,7 @@ static int __init usb_pcwd_init(void)
return result; return result;
} }
printk(KERN_INFO PFX DRIVER_DESC " " DRIVER_VERSION "\n"); printk(KERN_INFO PFX DRIVER_DESC " v" DRIVER_VERSION " (" DRIVER_DATE ")\n");
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment