sparc: arch/sparc/kernel/apc.c to unlocked_ioctl

This changes arch/sparc/kernel/apc.c to use unlocked_ioctl

Signed-off-by: Stoyan Gaydarov <stoyboyker@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Stoyan Gaydarov 2008-07-14 22:12:29 -07:00 committed by David S. Miller
parent f5e706ad88
commit ab772027ca
1 changed files with 28 additions and 12 deletions

View File

@ -85,52 +85,68 @@ static int apc_release(struct inode *inode, struct file *f)
return 0; return 0;
} }
static int apc_ioctl(struct inode *inode, struct file *f, static long apc_ioctl(struct file *f, unsigned int cmd, unsigned long __arg)
unsigned int cmd, unsigned long __arg)
{ {
__u8 inarg, __user *arg; __u8 inarg, __user *arg;
arg = (__u8 __user *) __arg; arg = (__u8 __user *) __arg;
lock_kernel();
switch (cmd) { switch (cmd) {
case APCIOCGFANCTL: case APCIOCGFANCTL:
if (put_user(apc_readb(APC_FANCTL_REG) & APC_REGMASK, arg)) if (put_user(apc_readb(APC_FANCTL_REG) & APC_REGMASK, arg)) {
unlock_kernel();
return -EFAULT; return -EFAULT;
}
break; break;
case APCIOCGCPWR: case APCIOCGCPWR:
if (put_user(apc_readb(APC_CPOWER_REG) & APC_REGMASK, arg)) if (put_user(apc_readb(APC_CPOWER_REG) & APC_REGMASK, arg)) {
unlock_kernel();
return -EFAULT; return -EFAULT;
}
break; break;
case APCIOCGBPORT: case APCIOCGBPORT:
if (put_user(apc_readb(APC_BPORT_REG) & APC_BPMASK, arg)) if (put_user(apc_readb(APC_BPORT_REG) & APC_BPMASK, arg)) {
unlock_kernel();
return -EFAULT; return -EFAULT;
}
break; break;
case APCIOCSFANCTL: case APCIOCSFANCTL:
if (get_user(inarg, arg)) if (get_user(inarg, arg)) {
unlock_kernel();
return -EFAULT; return -EFAULT;
}
apc_writeb(inarg & APC_REGMASK, APC_FANCTL_REG); apc_writeb(inarg & APC_REGMASK, APC_FANCTL_REG);
break; break;
case APCIOCSCPWR: case APCIOCSCPWR:
if (get_user(inarg, arg)) if (get_user(inarg, arg)) {
unlock_kernel();
return -EFAULT; return -EFAULT;
}
apc_writeb(inarg & APC_REGMASK, APC_CPOWER_REG); apc_writeb(inarg & APC_REGMASK, APC_CPOWER_REG);
break; break;
case APCIOCSBPORT: case APCIOCSBPORT:
if (get_user(inarg, arg)) if (get_user(inarg, arg)) {
unlock_kernel();
return -EFAULT; return -EFAULT;
}
apc_writeb(inarg & APC_BPMASK, APC_BPORT_REG); apc_writeb(inarg & APC_BPMASK, APC_BPORT_REG);
break; break;
default: default:
unlock_kernel();
return -EINVAL; return -EINVAL;
}; };
unlock_kernel();
return 0; return 0;
} }
static const struct file_operations apc_fops = { static const struct file_operations apc_fops = {
.ioctl = apc_ioctl, .unlocked_ioctl = apc_ioctl,
.open = apc_open, .open = apc_open,
.release = apc_release, .release = apc_release,
}; };