Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 55929332 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Frederic Weisbecker
Browse files

drivers: Push down BKL into various drivers



These are the last remaining device drivers using
the ->ioctl file operation in the drivers directory
(except from v4l drivers).

[fweisbec: drop i8k pushdown as it has been done from
procfs pushdown branch already]

Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
parent 703c631e
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -265,8 +265,8 @@ static unsigned int apm_poll(struct file *fp, poll_table * wait)
 *   Only when everyone who has opened /dev/apm_bios with write permission
 *   has acknowledge does the actual suspend happen.
 */
static int
apm_ioctl(struct inode * inode, struct file *filp, u_int cmd, u_long arg)
static long
apm_ioctl(struct file *filp, u_int cmd, u_long arg)
{
	struct apm_user *as = filp->private_data;
	int err = -EINVAL;
@@ -274,6 +274,7 @@ apm_ioctl(struct inode * inode, struct file *filp, u_int cmd, u_long arg)
	if (!as->suser || !as->writer)
		return -EPERM;

	lock_kernel();
	switch (cmd) {
	case APM_IOC_SUSPEND:
		mutex_lock(&state_lock);
@@ -334,6 +335,7 @@ apm_ioctl(struct inode * inode, struct file *filp, u_int cmd, u_long arg)
		mutex_unlock(&state_lock);
		break;
	}
	unlock_kernel();

	return err;
}
@@ -397,7 +399,7 @@ static const struct file_operations apm_bios_fops = {
	.owner		= THIS_MODULE,
	.read		= apm_read,
	.poll		= apm_poll,
	.ioctl		= apm_ioctl,
	.unlocked_ioctl	= apm_ioctl,
	.open		= apm_open,
	.release	= apm_release,
};
+8 −5
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/smp_lock.h>
#include <linux/miscdevice.h>
#include <linux/pci.h>
#include <linux/wait.h>
@@ -106,8 +107,7 @@ static unsigned int DeviceErrorCount; /* number of device error */

static ssize_t ac_read (struct file *, char __user *, size_t, loff_t *);
static ssize_t ac_write (struct file *, const char __user *, size_t, loff_t *);
static int ac_ioctl(struct inode *, struct file *, unsigned int,
		    unsigned long);
static long ac_ioctl(struct file *, unsigned int, unsigned long);
static irqreturn_t ac_interrupt(int, void *);

static const struct file_operations ac_fops = {
@@ -115,7 +115,7 @@ static const struct file_operations ac_fops = {
	.llseek = no_llseek,
	.read = ac_read,
	.write = ac_write,
	.ioctl = ac_ioctl,
	.unlocked_ioctl = ac_ioctl,
};

static struct miscdevice ac_miscdev = {
@@ -689,7 +689,7 @@ static irqreturn_t ac_interrupt(int vec, void *dev_instance)



static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
static long ac_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
     
{				/* @ ADG ou ATO selon le cas */
	int i;
@@ -712,6 +712,7 @@ static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
		return -EFAULT;
	}

	lock_kernel();	
	IndexCard = adgl->num_card-1;
	 
	if(cmd != 6 && ((IndexCard >= MAX_BOARD) || !apbs[IndexCard].RamIO)) {
@@ -721,6 +722,7 @@ static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
			warncount--;
		}
		kfree(adgl);
		unlock_kernel();
		return -EINVAL;
	}

@@ -838,6 +840,7 @@ static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
	}
	Dummy = readb(apbs[IndexCard].RamIO + VERS);
	kfree(adgl);
	unlock_kernel();
	return 0;
}
+14 −2
Original line number Diff line number Diff line
@@ -232,7 +232,7 @@ ds1620_read(struct file *file, char __user *buf, size_t count, loff_t *ptr)
}

static int
ds1620_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
ds1620_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
	struct therm therm;
	union {
@@ -316,6 +316,18 @@ ds1620_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned
	return 0;
}

static long
ds1620_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
	int ret;

	lock_kernel();
	ret = ds1620_ioctl(file, cmd, arg);
	unlock_kernel();

	return ret;
}

#ifdef THERM_USE_PROC
static int
proc_therm_ds1620_read(char *buf, char **start, off_t offset,
@@ -344,7 +356,7 @@ static const struct file_operations ds1620_fops = {
	.owner		= THIS_MODULE,
	.open		= ds1620_open,
	.read		= ds1620_read,
	.ioctl		= ds1620_ioctl,
	.unlocked_ioctl	= ds1620_unlocked_ioctl,
};

static struct miscdevice ds1620_miscdev = {
+8 −7
Original line number Diff line number Diff line
@@ -93,7 +93,7 @@ static ssize_t dtlk_write(struct file *, const char __user *,
static unsigned int dtlk_poll(struct file *, poll_table *);
static int dtlk_open(struct inode *, struct file *);
static int dtlk_release(struct inode *, struct file *);
static int dtlk_ioctl(struct inode *inode, struct file *file,
static long dtlk_ioctl(struct file *file,
		       unsigned int cmd, unsigned long arg);

static const struct file_operations dtlk_fops =
@@ -102,7 +102,7 @@ static const struct file_operations dtlk_fops =
	.read		= dtlk_read,
	.write		= dtlk_write,
	.poll		= dtlk_poll,
	.ioctl		= dtlk_ioctl,
	.unlocked_ioctl	= dtlk_ioctl,
	.open		= dtlk_open,
	.release	= dtlk_release,
};
@@ -263,8 +263,7 @@ static void dtlk_timer_tick(unsigned long data)
	wake_up_interruptible(&dtlk_process_list);
}

static int dtlk_ioctl(struct inode *inode,
		      struct file *file,
static long dtlk_ioctl(struct file *file,
		       unsigned int cmd,
		       unsigned long arg)
{
@@ -276,7 +275,9 @@ static int dtlk_ioctl(struct inode *inode,
	switch (cmd) {

	case DTLK_INTERROGATE:
		lock_kernel();
		sp = dtlk_interrogate();
		unlock_kernel();
		if (copy_to_user(argp, sp, sizeof(struct dtlk_settings)))
			return -EINVAL;
		return 0;
+14 −3
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include <linux/miscdevice.h>
#include <linux/fcntl.h>
#include <linux/init.h>
#include <linux/smp_lock.h>
#include <asm/uaccess.h>
#include <asm/nvram.h>
#ifdef CONFIG_PPC_PMAC
@@ -84,8 +85,7 @@ static ssize_t write_nvram(struct file *file, const char __user *buf,
	return p - buf;
}

static int nvram_ioctl(struct inode *inode, struct file *file,
	unsigned int cmd, unsigned long arg)
static int nvram_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
	switch(cmd) {
#ifdef CONFIG_PPC_PMAC
@@ -116,12 +116,23 @@ static int nvram_ioctl(struct inode *inode, struct file *file,
	return 0;
}

static long nvram_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
	int ret;

	lock_kernel();
	ret = nvram_ioctl(file, cmd, arg);
	unlock_kernel();

	return ret;
}

const struct file_operations nvram_fops = {
	.owner		= THIS_MODULE,
	.llseek		= nvram_llseek,
	.read		= read_nvram,
	.write		= write_nvram,
	.ioctl		= nvram_ioctl,
	.unlocked_ioctl	= nvram_unlocked_ioctl,
};

static struct miscdevice nvram_dev = {
Loading