Commit b3dea13a authored by Wim Van Sebroeck's avatar Wim Van Sebroeck

[WATCHDOG] pcwd_usb.c-single_open+set_heartbeat+init-patch

- /dev/watchdog is single open only: make sure that the bit that
prevents a second open is cleared as the last instruction of the
release code
- Change the way we set the original heartbeat code
- Make sure that /dev/temperature get's registered before /dev/watchdog
parent 71eba4ab
......@@ -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