Skip to content

Commit

Permalink
Merge branch 'bkl/ioctl' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/frederic/random-tracing

* 'bkl/ioctl' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing:
  uml: Pushdown the bkl from harddog_kern ioctl
  sunrpc: Pushdown the bkl from sunrpc cache ioctl
  sunrpc: Pushdown the bkl from ioctl
  autofs4: Pushdown the bkl from ioctl
  uml: Convert to unlocked_ioctls to remove implicit BKL
  ncpfs: BKL ioctl pushdown
  coda: Clean-up whitespace problems in pioctl.c
  coda: BKL ioctl pushdown
  drivers: Push down BKL into various drivers
  isdn: Push down BKL into ioctl functions
  scsi: Push down BKL into ioctl functions
  dvb: Push down BKL into ioctl functions
  smbfs: Push down BKL into ioctl function
  coda/psdev: Remove BKL from ioctl function
  um/mmapper: Remove BKL usage
  sn_hwperf: Kill BKL usage
  hfsplus: Push down BKL into ioctl function
  • Loading branch information
torvalds committed May 24, 2010
2 parents 1595365 + 9f37af6 commit f137711
Show file tree
Hide file tree
Showing 68 changed files with 669 additions and 312 deletions.
9 changes: 2 additions & 7 deletions arch/ia64/sn/kernel/sn2/sn_hwperf.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include <linux/miscdevice.h>
#include <linux/utsname.h>
#include <linux/cpumask.h>
#include <linux/smp_lock.h>
#include <linux/nodemask.h>
#include <linux/smp.h>
#include <linux/mutex.h>
Expand Down Expand Up @@ -682,8 +681,7 @@ static int sn_hwperf_map_err(int hwperf_err)
/*
* ioctl for "sn_hwperf" misc device
*/
static int
sn_hwperf_ioctl(struct inode *in, struct file *fp, u32 op, unsigned long arg)
static long sn_hwperf_ioctl(struct file *fp, u32 op, unsigned long arg)
{
struct sn_hwperf_ioctl_args a;
struct cpuinfo_ia64 *cdata;
Expand All @@ -699,8 +697,6 @@ sn_hwperf_ioctl(struct inode *in, struct file *fp, u32 op, unsigned long arg)
int i;
int j;

unlock_kernel();

/* only user requests are allowed here */
if ((op & SN_HWPERF_OP_MASK) < 10) {
r = -EINVAL;
Expand Down Expand Up @@ -859,12 +855,11 @@ sn_hwperf_ioctl(struct inode *in, struct file *fp, u32 op, unsigned long arg)
error:
vfree(p);

lock_kernel();
return r;
}

static const struct file_operations sn_hwperf_fops = {
.ioctl = sn_hwperf_ioctl,
.unlocked_ioctl = sn_hwperf_ioctl,
};

static struct miscdevice sn_hwperf_dev = {
Expand Down
18 changes: 15 additions & 3 deletions arch/um/drivers/harddog_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ static ssize_t harddog_write(struct file *file, const char __user *data, size_t
return 0;
}

static int harddog_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
static int harddog_ioctl_unlocked(struct file *file,
unsigned int cmd, unsigned long arg)
{
void __user *argp= (void __user *)arg;
static struct watchdog_info ident = {
Expand All @@ -148,10 +148,22 @@ static int harddog_ioctl(struct inode *inode, struct file *file,
}
}

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

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

return ret;
}

static const struct file_operations harddog_fops = {
.owner = THIS_MODULE,
.write = harddog_write,
.ioctl = harddog_ioctl,
.unlocked_ioctl = harddog_ioctl,
.open = harddog_open,
.release = harddog_release,
};
Expand Down
8 changes: 4 additions & 4 deletions arch/um/drivers/hostaudio_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ static unsigned int hostaudio_poll(struct file *file,
return mask;
}

static int hostaudio_ioctl(struct inode *inode, struct file *file,
static long hostaudio_ioctl(struct file *file,
unsigned int cmd, unsigned long arg)
{
struct hostaudio_state *state = file->private_data;
Expand Down Expand Up @@ -223,7 +223,7 @@ static int hostaudio_release(struct inode *inode, struct file *file)

/* /dev/mixer file operations */

static int hostmixer_ioctl_mixdev(struct inode *inode, struct file *file,
static long hostmixer_ioctl_mixdev(struct file *file,
unsigned int cmd, unsigned long arg)
{
struct hostmixer_state *state = file->private_data;
Expand Down Expand Up @@ -289,7 +289,7 @@ static const struct file_operations hostaudio_fops = {
.read = hostaudio_read,
.write = hostaudio_write,
.poll = hostaudio_poll,
.ioctl = hostaudio_ioctl,
.unlocked_ioctl = hostaudio_ioctl,
.mmap = NULL,
.open = hostaudio_open,
.release = hostaudio_release,
Expand All @@ -298,7 +298,7 @@ static const struct file_operations hostaudio_fops = {
static const struct file_operations hostmixer_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
.ioctl = hostmixer_ioctl_mixdev,
.unlocked_ioctl = hostmixer_ioctl_mixdev,
.open = hostmixer_open_mixdev,
.release = hostmixer_release,
};
Expand Down
5 changes: 2 additions & 3 deletions arch/um/drivers/mmapper_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ static ssize_t mmapper_write(struct file *file, const char __user *buf,
return count;
}

static int mmapper_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
static long mmapper_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
return -ENOIOCTLCMD;
}
Expand Down Expand Up @@ -90,7 +89,7 @@ static const struct file_operations mmapper_fops = {
.owner = THIS_MODULE,
.read = mmapper_read,
.write = mmapper_write,
.ioctl = mmapper_ioctl,
.unlocked_ioctl = mmapper_ioctl,
.mmap = mmapper_mmap,
.open = mmapper_open,
.release = mmapper_release,
Expand Down
8 changes: 5 additions & 3 deletions drivers/char/apm-emulation.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,15 +265,16 @@ 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;

if (!as->suser || !as->writer)
return -EPERM;

lock_kernel();
switch (cmd) {
case APM_IOC_SUSPEND:
mutex_lock(&state_lock);
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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,
};
Expand Down
13 changes: 8 additions & 5 deletions drivers/char/applicom.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -106,16 +107,15 @@ 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 = {
.owner = THIS_MODULE,
.llseek = no_llseek,
.read = ac_read,
.write = ac_write,
.ioctl = ac_ioctl,
.unlocked_ioctl = ac_ioctl,
};

static struct miscdevice ac_miscdev = {
Expand Down Expand Up @@ -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;
Expand All @@ -711,7 +711,8 @@ static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
kfree(adgl);
return -EFAULT;
}


lock_kernel();
IndexCard = adgl->num_card-1;

if(cmd != 6 && ((IndexCard >= MAX_BOARD) || !apbs[IndexCard].RamIO)) {
Expand All @@ -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;
}

Expand Down Expand Up @@ -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;
}

16 changes: 14 additions & 2 deletions drivers/char/ds1620.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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 = {
Expand Down
15 changes: 8 additions & 7 deletions drivers/char/dtlk.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,16 @@ 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,
unsigned int cmd, unsigned long arg);
static long dtlk_ioctl(struct file *file,
unsigned int cmd, unsigned long arg);

static const struct file_operations dtlk_fops =
{
.owner = THIS_MODULE,
.read = dtlk_read,
.write = dtlk_write,
.poll = dtlk_poll,
.ioctl = dtlk_ioctl,
.unlocked_ioctl = dtlk_ioctl,
.open = dtlk_open,
.release = dtlk_release,
};
Expand Down Expand Up @@ -263,10 +263,9 @@ static void dtlk_timer_tick(unsigned long data)
wake_up_interruptible(&dtlk_process_list);
}

static int dtlk_ioctl(struct inode *inode,
struct file *file,
unsigned int cmd,
unsigned long arg)
static long dtlk_ioctl(struct file *file,
unsigned int cmd,
unsigned long arg)
{
char __user *argp = (char __user *)arg;
struct dtlk_settings *sp;
Expand All @@ -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;
Expand Down
17 changes: 14 additions & 3 deletions drivers/char/generic_nvram.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 = {
Expand Down
16 changes: 14 additions & 2 deletions drivers/char/genrtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ static inline int gen_set_rtc_irq_bit(unsigned char bit)
#endif
}

static int gen_rtc_ioctl(struct inode *inode, struct file *file,
static int gen_rtc_ioctl(struct file *file,
unsigned int cmd, unsigned long arg)
{
struct rtc_time wtime;
Expand Down Expand Up @@ -332,6 +332,18 @@ static int gen_rtc_ioctl(struct inode *inode, struct file *file,
return -EINVAL;
}

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

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

return ret;
}

/*
* We enforce only one user at a time here with the open/close.
* Also clear the previous interrupt data on an open, and clean
Expand Down Expand Up @@ -482,7 +494,7 @@ static const struct file_operations gen_rtc_fops = {
.read = gen_rtc_read,
.poll = gen_rtc_poll,
#endif
.ioctl = gen_rtc_ioctl,
.unlocked_ioctl = gen_rtc_unlocked_ioctl,
.open = gen_rtc_open,
.release = gen_rtc_release,
};
Expand Down
Loading

0 comments on commit f137711

Please sign in to comment.