* http://www.berkprod.com/ or http://www.pcwatchdog.com/
*/
+#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/completion.h>
#include <asm/uaccess.h>
#include <linux/usb.h>
-#include <linux/mutex.h>
#ifdef CONFIG_USB_DEBUG
static struct usb_pcwd_private *usb_pcwd_device;
/* prevent races between open() and disconnect() */
-static DEFINE_MUTEX(disconnect_mutex);
+static DECLARE_MUTEX (disconnect_sem);
/* local function prototypes */
static int usb_pcwd_probe (struct usb_interface *interface, const struct usb_device_id *id);
return 0;
}
-static int usb_pcwd_get_timeleft(struct usb_pcwd_private *usb_pcwd, int *time_left)
-{
- unsigned char msb, lsb;
-
- /* Read the time that's left before rebooting */
- /* Note: if the board is not yet armed then we will read 0xFFFF */
- usb_pcwd_send_command(usb_pcwd, CMD_READ_WATCHDOG_TIMEOUT, &msb, &lsb);
-
- *time_left = (msb << 8) + lsb;
-
- return 0;
-}
-
/*
* /dev/watchdog handling
*/
case WDIOC_GETTIMEOUT:
return put_user(heartbeat, p);
- case WDIOC_GETTIMELEFT:
- {
- int time_left;
-
- if (usb_pcwd_get_timeleft(usb_pcwd_device, &time_left))
- return -EFAULT;
-
- return put_user(time_left, p);
- }
-
default:
return -ENOIOCTLCMD;
}
* Kernel Interfaces
*/
-static const struct file_operations usb_pcwd_fops = {
+static struct file_operations usb_pcwd_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
.write = usb_pcwd_write,
.fops = &usb_pcwd_fops,
};
-static const struct file_operations usb_pcwd_temperature_fops = {
+static struct file_operations usb_pcwd_temperature_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
.read = usb_pcwd_temperature_read,
err_out_unregister_reboot:
unregister_reboot_notifier(&usb_pcwd_notifier);
error:
- if (usb_pcwd)
- usb_pcwd_delete(usb_pcwd);
+ usb_pcwd_delete (usb_pcwd);
usb_pcwd_device = NULL;
return retval;
}
struct usb_pcwd_private *usb_pcwd;
/* prevent races with open() */
- mutex_lock(&disconnect_mutex);
+ down (&disconnect_sem);
usb_pcwd = usb_get_intfdata (interface);
usb_set_intfdata (interface, NULL);
cards_found--;
- mutex_unlock(&disconnect_mutex);
+ up (&disconnect_sem);
printk(KERN_INFO PFX "USB PC Watchdog disconnected\n");
}