* /dev/watchdog handling
*/
-static ssize_t pcipcwd_write(struct file *file, const char *data,
+static ssize_t pcipcwd_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 pcipcwd_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_OVERHEAT |
WDIOF_CARDRESET |
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:
pcipcwd_get_status(&status);
- return put_user(status, (int *) arg);
+ return put_user(status, p);
}
case WDIOC_GETBOOTSTATUS:
- return put_user(pcipcwd_private.boot_status, (int *) arg);
+ return put_user(pcipcwd_private.boot_status, p);
case WDIOC_GETTEMP:
{
if (pcipcwd_get_temperature(&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 (pcipcwd_set_heartbeat(new_heartbeat))
}
case WDIOC_GETTIMEOUT:
- return put_user(heartbeat, (int *)arg);
+ return put_user(heartbeat, p);
default:
return -ENOIOCTLCMD;
/* Activate */
pcipcwd_start();
pcipcwd_keepalive();
- return 0;
+ return nonseekable_open(inode, file);
}
static int pcipcwd_release(struct inode *inode, struct file *file)
* /dev/temperature handling
*/
-static ssize_t pcipcwd_temp_read(struct file *file, char *data,
+static ssize_t pcipcwd_temp_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 (pcipcwd_get_temperature(&temperature))
return -EFAULT;
if (!pcipcwd_private.supports_temp)
return -ENODEV;
- return 0;
+ return nonseekable_open(inode, file);
}
static int pcipcwd_temp_release(struct inode *inode, struct file *file)