commit ab772027 (sparc: arch/sparc/kernel/apc.c to unlocked_ioctl)
added lock/unlock_kernel() to the apc ioctl code.

The code needs no serialization at all. Neither put/get_user nor the
read/write access to the sbus devices require it. Remove BKL.

cycle_kernel_lock() was added during the big BKL pushdown. It should
ensure the serializiation against driver init code. In this case there
is nothing to serialize. Remove it as well.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Thomas Gleixner 2009-11-02 21:15:59 -08:00 коммит произвёл David S. Miller
Родитель 8401707ff6
Коммит 49ab972aea
1 изменённых файлов: 10 добавлений и 27 удалений

Просмотреть файл

@ -10,7 +10,6 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/miscdevice.h> #include <linux/miscdevice.h>
#include <linux/smp_lock.h>
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_device.h> #include <linux/of_device.h>
@ -76,7 +75,6 @@ static inline void apc_free(struct of_device *op)
static int apc_open(struct inode *inode, struct file *f) static int apc_open(struct inode *inode, struct file *f)
{ {
cycle_kernel_lock();
return 0; return 0;
} }
@ -87,61 +85,46 @@ static int apc_release(struct inode *inode, struct file *f)
static long apc_ioctl(struct file *f, unsigned int cmd, unsigned long __arg) static long apc_ioctl(struct file *f, unsigned int cmd, unsigned long __arg)
{ {
__u8 inarg, __user *arg; __u8 inarg, __user *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;
} }