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 @@
#include <asm/uaccess.h>
#include <asm/io.h>
#define WD_VER "1.16 (03/27/2004)"
#define WD_VER "1.16 (06/12/2004)"
#define PFX "pcwd: "
/*
......@@ -299,10 +299,11 @@ static int pcwd_stop(void)
return 0;
}
static void pcwd_keepalive(void)
static int pcwd_keepalive(void)
{
/* user land ping */
next_heartbeat = jiffies + (heartbeat * HZ);
return 0;
}
static int pcwd_set_heartbeat(int t)
......@@ -529,12 +530,12 @@ static int pcwd_close(struct inode *inode, struct file *file)
{
if (expect_close == 42) {
pcwd_stop();
atomic_inc( &open_allowed );
} else {
printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
pcwd_keepalive();
}
expect_close = 0;
atomic_inc( &open_allowed );
return 0;
}
......
......@@ -49,7 +49,7 @@
/* Module and version information */
#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_NAME "pcwd_pci"
#define PFX WATCHDOG_NAME ": "
......@@ -73,7 +73,7 @@
#define WD_PCI_TTRP 0x04 /* Temperature Trip status */
/* 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
/* Watchdog's internal commands */
......@@ -404,8 +404,8 @@ static int pcipcwd_release(struct inode *inode, struct file *file)
printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
pcipcwd_keepalive();
}
clear_bit(0, &is_active);
expect_release = 0;
clear_bit(0, &is_active);
return 0;
}
......@@ -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");
/* Check that the heartbeat value is within it's range ; if not reset to the default */
if (heartbeat < 1 || heartbeat > 0xFFFF) {
heartbeat = WATCHDOG_HEARTBEAT;
if (pcipcwd_set_heartbeat(heartbeat)) {
pcipcwd_set_heartbeat(WATCHDOG_HEARTBEAT);
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);
if (ret != 0) {
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,
goto err_out_release_region;
}
ret = misc_register(&pcipcwd_miscdev);
if (pcipcwd_private.supports_temp) {
ret = misc_register(&pcipcwd_temp_miscdev);
if (ret != 0) {
printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
WATCHDOG_MINOR, ret);
TEMP_MINOR, ret);
goto err_out_unregister_reboot;
}
}
if (pcipcwd_private.supports_temp) {
ret = misc_register(&pcipcwd_temp_miscdev);
ret = misc_register(&pcipcwd_miscdev);
if (ret != 0) {
printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
TEMP_MINOR, ret);
WATCHDOG_MINOR, ret);
goto err_out_misc_deregister;
}
}
printk(KERN_INFO PFX "initialized. heartbeat=%d sec (nowayout=%d)\n",
heartbeat, nowayout);
......@@ -623,7 +620,8 @@ static int __devinit pcipcwd_card_init(struct pci_dev *pdev,
return 0;
err_out_misc_deregister:
misc_deregister(&pcipcwd_miscdev);
if (pcipcwd_private.supports_temp)
misc_deregister(&pcipcwd_temp_miscdev);
err_out_unregister_reboot:
unregister_reboot_notifier(&pcipcwd_notifier);
err_out_release_region:
......@@ -640,9 +638,9 @@ static void __devexit pcipcwd_card_exit(struct pci_dev *pdev)
pcipcwd_stop();
/* Deregister */
misc_deregister(&pcipcwd_miscdev);
if (pcipcwd_private.supports_temp)
misc_deregister(&pcipcwd_temp_miscdev);
misc_deregister(&pcipcwd_miscdev);
unregister_reboot_notifier(&pcipcwd_notifier);
pci_release_regions(pdev);
pci_disable_device(pdev);
......
......@@ -56,7 +56,8 @@
/* 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_DESC "Berkshire USB-PC Watchdog driver"
#define DRIVER_LICENSE "GPL"
......@@ -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");
usb_pcwd_keepalive(usb_pcwd_device);
}
clear_bit(0, &is_active);
expect_release = 0;
clear_bit(0, &is_active);
return 0;
}
......@@ -681,15 +682,12 @@ static int usb_pcwd_probe(struct usb_interface *interface, const struct usb_devi
((option_switches & 0x08) ? "ON" : "OFF"));
/* Check that the heartbeat value is within it's range ; if not reset to the default */
if (heartbeat < 1 || heartbeat > 0xFFFF) {
heartbeat = WATCHDOG_HEARTBEAT;
if (usb_pcwd_set_heartbeat(usb_pcwd, heartbeat)) {
usb_pcwd_set_heartbeat(usb_pcwd, WATCHDOG_HEARTBEAT);
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);
if (retval != 0) {
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
goto error;
}
retval = misc_register(&usb_pcwd_miscdev);
retval = misc_register(&usb_pcwd_temperature_miscdev);
if (retval != 0) {
printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
WATCHDOG_MINOR, retval);
TEMP_MINOR, retval);
goto err_out_unregister_reboot;
}
retval = misc_register(&usb_pcwd_temperature_miscdev);
retval = misc_register(&usb_pcwd_miscdev);
if (retval != 0) {
printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
TEMP_MINOR, retval);
WATCHDOG_MINOR, retval);
goto err_out_misc_deregister;
}
......@@ -720,7 +718,7 @@ static int usb_pcwd_probe(struct usb_interface *interface, const struct usb_devi
return 0;
err_out_misc_deregister:
misc_deregister(&usb_pcwd_miscdev);
misc_deregister(&usb_pcwd_temperature_miscdev);
err_out_unregister_reboot:
unregister_reboot_notifier(&usb_pcwd_notifier);
error:
......@@ -758,8 +756,8 @@ static void usb_pcwd_disconnect(struct usb_interface *interface)
usb_pcwd->exists = 0;
/* Deregister */
misc_deregister(&usb_pcwd_temperature_miscdev);
misc_deregister(&usb_pcwd_miscdev);
misc_deregister(&usb_pcwd_temperature_miscdev);
unregister_reboot_notifier(&usb_pcwd_notifier);
up (&usb_pcwd->sem);
......@@ -791,7 +789,7 @@ static int __init usb_pcwd_init(void)
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;
}
......
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