* /dev/watchdog handling
*/
-static ssize_t usb_pcwd_write(struct file *file, const char *data,
+static ssize_t usb_pcwd_write(struct file *file, const char __user *data,
size_t len, loff_t *ppos)
{
- /* Can't seek (pwrite) on this device */
- if (ppos != &file->f_pos)
- return -ESPIPE;
-
/* See if we got the magic character 'V' and reload the timer */
if (len) {
if (!nowayout) {
static int usb_pcwd_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
+ void __user *argp = (void __user *)arg;
+ int __user *p = argp;
static struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING |
WDIOF_SETTIMEOUT |
switch (cmd) {
case WDIOC_GETSUPPORT:
- return copy_to_user((struct watchdog_info *) arg, &ident,
+ return copy_to_user(argp, &ident,
sizeof (ident)) ? -EFAULT : 0;
case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS:
- return put_user(0, (int *) arg);
+ return put_user(0, p);
case WDIOC_GETTEMP:
{
if (usb_pcwd_get_temperature(usb_pcwd_device, &temperature))
return -EFAULT;
- return put_user(temperature, (int *) arg);
+ return put_user(temperature, p);
}
case WDIOC_KEEPALIVE:
{
int new_options, retval = -EINVAL;
- if (get_user (new_options, (int *) arg))
+ if (get_user (new_options, p))
return -EFAULT;
if (new_options & WDIOS_DISABLECARD) {
{
int new_heartbeat;
- if (get_user(new_heartbeat, (int *) arg))
+ if (get_user(new_heartbeat, p))
return -EFAULT;
if (usb_pcwd_set_heartbeat(usb_pcwd_device, new_heartbeat))
}
case WDIOC_GETTIMEOUT:
- return put_user(heartbeat, (int *)arg);
+ return put_user(heartbeat, p);
default:
return -ENOIOCTLCMD;
/* Activate */
usb_pcwd_start(usb_pcwd_device);
usb_pcwd_keepalive(usb_pcwd_device);
- return 0;
+ return nonseekable_open(inode, file);
}
static int usb_pcwd_release(struct inode *inode, struct file *file)
* /dev/temperature handling
*/
-static ssize_t usb_pcwd_temperature_read(struct file *file, char *data,
+static ssize_t usb_pcwd_temperature_read(struct file *file, char __user *data,
size_t len, loff_t *ppos)
{
int temperature;
- /* Can't seek (pwrite) on this device */
- if (ppos != &file->f_pos)
- return -ESPIPE;
-
if (usb_pcwd_get_temperature(usb_pcwd_device, &temperature))
return -EFAULT;
- if (copy_to_user (data, &temperature, 1))
+ if (copy_to_user(data, &temperature, 1))
return -EFAULT;
return 1;
static int usb_pcwd_temperature_open(struct inode *inode, struct file *file)
{
- return 0;
+ return nonseekable_open(inode, file);
}
static int usb_pcwd_temperature_release(struct inode *inode, struct file *file)