Commit 90276a1a authored by Jesper Nilsson's avatar Jesper Nilsson

cris: Pushdown the bkl from ioctl

From: Frederic Weisbecker <fweisbec@gmail.com>

Pushdown the bkl to the remaining drivers using the
deprecated .ioctl.
Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarJesper Nilsson <jesper.nilsson@axis.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
parent 3648bdf7
...@@ -46,8 +46,7 @@ static char gpio_name[] = "etrax gpio"; ...@@ -46,8 +46,7 @@ static char gpio_name[] = "etrax gpio";
static wait_queue_head_t *gpio_wq; static wait_queue_head_t *gpio_wq;
#endif #endif
static int gpio_ioctl(struct inode *inode, struct file *file, static int gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
unsigned int cmd, unsigned long arg);
static ssize_t gpio_write(struct file *file, const char __user *buf, static ssize_t gpio_write(struct file *file, const char __user *buf,
size_t count, loff_t *off); size_t count, loff_t *off);
static int gpio_open(struct inode *inode, struct file *filp); static int gpio_open(struct inode *inode, struct file *filp);
...@@ -505,8 +504,7 @@ static int ...@@ -505,8 +504,7 @@ static int
gpio_leds_ioctl(unsigned int cmd, unsigned long arg); gpio_leds_ioctl(unsigned int cmd, unsigned long arg);
static int static int
gpio_ioctl(struct inode *inode, struct file *file, gpio_ioctl_unlocked(struct file *file, unsigned int cmd, unsigned long arg)
unsigned int cmd, unsigned long arg)
{ {
unsigned long flags; unsigned long flags;
unsigned long val; unsigned long val;
...@@ -683,6 +681,18 @@ gpio_ioctl(struct inode *inode, struct file *file, ...@@ -683,6 +681,18 @@ gpio_ioctl(struct inode *inode, struct file *file,
return ret; return ret;
} }
static int
gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
long ret;
lock_kernel();
ret = gpio_ioctl_unlocked(file, cmd, arg);
unlock_kernel();
return ret;
}
static int static int
gpio_leds_ioctl(unsigned int cmd, unsigned long arg) gpio_leds_ioctl(unsigned int cmd, unsigned long arg)
{ {
...@@ -715,7 +725,7 @@ gpio_leds_ioctl(unsigned int cmd, unsigned long arg) ...@@ -715,7 +725,7 @@ gpio_leds_ioctl(unsigned int cmd, unsigned long arg)
static const struct file_operations gpio_fops = { static const struct file_operations gpio_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.poll = gpio_poll, .poll = gpio_poll,
.ioctl = gpio_ioctl, .unlocked_ioctl = gpio_ioctl,
.write = gpio_write, .write = gpio_write,
.open = gpio_open, .open = gpio_open,
.release = gpio_release, .release = gpio_release,
......
...@@ -580,8 +580,7 @@ i2c_release(struct inode *inode, struct file *filp) ...@@ -580,8 +580,7 @@ i2c_release(struct inode *inode, struct file *filp)
*/ */
static int static int
i2c_ioctl(struct inode *inode, struct file *file, i2c_ioctl_unlocked(struct file *file, unsigned int cmd, unsigned long arg)
unsigned int cmd, unsigned long arg)
{ {
if(_IOC_TYPE(cmd) != ETRAXI2C_IOCTYPE) { if(_IOC_TYPE(cmd) != ETRAXI2C_IOCTYPE) {
return -EINVAL; return -EINVAL;
...@@ -617,9 +616,20 @@ i2c_ioctl(struct inode *inode, struct file *file, ...@@ -617,9 +616,20 @@ i2c_ioctl(struct inode *inode, struct file *file,
return 0; return 0;
} }
static long i2c_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
long ret;
lock_kernel();
ret = i2c_ioctl_unlocked(file, cmd, arg);
unlock_kernel();
return ret;
}
static const struct file_operations i2c_fops = { static const struct file_operations i2c_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.ioctl = i2c_ioctl, .unlocked_ioctl = i2c_ioctl,
.open = i2c_open, .open = i2c_open,
.release = i2c_release, .release = i2c_release,
}; };
......
...@@ -157,7 +157,7 @@ static int sync_serial_open(struct inode *inode, struct file *file); ...@@ -157,7 +157,7 @@ static int sync_serial_open(struct inode *inode, struct file *file);
static int sync_serial_release(struct inode *inode, struct file *file); static int sync_serial_release(struct inode *inode, struct file *file);
static unsigned int sync_serial_poll(struct file *filp, poll_table *wait); static unsigned int sync_serial_poll(struct file *filp, poll_table *wait);
static int sync_serial_ioctl(struct inode *inode, struct file *file, static int sync_serial_ioctl(struct file *file,
unsigned int cmd, unsigned long arg); unsigned int cmd, unsigned long arg);
static ssize_t sync_serial_write(struct file *file, const char *buf, static ssize_t sync_serial_write(struct file *file, const char *buf,
size_t count, loff_t *ppos); size_t count, loff_t *ppos);
...@@ -248,7 +248,7 @@ static const struct file_operations sync_serial_fops = { ...@@ -248,7 +248,7 @@ static const struct file_operations sync_serial_fops = {
.write = sync_serial_write, .write = sync_serial_write,
.read = sync_serial_read, .read = sync_serial_read,
.poll = sync_serial_poll, .poll = sync_serial_poll,
.ioctl = sync_serial_ioctl, .unlocked_ioctl = sync_serial_ioctl,
.open = sync_serial_open, .open = sync_serial_open,
.release = sync_serial_release .release = sync_serial_release
}; };
...@@ -678,7 +678,7 @@ static unsigned int sync_serial_poll(struct file *file, poll_table *wait) ...@@ -678,7 +678,7 @@ static unsigned int sync_serial_poll(struct file *file, poll_table *wait)
return mask; return mask;
} }
static int sync_serial_ioctl(struct inode *inode, struct file *file, static int sync_serial_ioctl_unlocked(struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
int return_val = 0; int return_val = 0;
...@@ -956,6 +956,18 @@ static int sync_serial_ioctl(struct inode *inode, struct file *file, ...@@ -956,6 +956,18 @@ static int sync_serial_ioctl(struct inode *inode, struct file *file,
return return_val; return return_val;
} }
static long sync_serial_ioctl(struct file *file,
unsigned int cmd, unsigned long arg)
{
long ret;
lock_kernel();
ret = sync_serial_ioctl_unlocked(file, cmd, arg);
unlock_kernel();
return ret;
}
static ssize_t sync_serial_write(struct file *file, const char *buf, static ssize_t sync_serial_write(struct file *file, const char *buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
......
...@@ -217,7 +217,7 @@ static int cryptocop_open(struct inode *, struct file *); ...@@ -217,7 +217,7 @@ static int cryptocop_open(struct inode *, struct file *);
static int cryptocop_release(struct inode *, struct file *); static int cryptocop_release(struct inode *, struct file *);
static int cryptocop_ioctl(struct inode *inode, struct file *file, static long cryptocop_ioctl(struct file *file,
unsigned int cmd, unsigned long arg); unsigned int cmd, unsigned long arg);
static void cryptocop_start_job(void); static void cryptocop_start_job(void);
...@@ -282,7 +282,7 @@ const struct file_operations cryptocop_fops = { ...@@ -282,7 +282,7 @@ const struct file_operations cryptocop_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = cryptocop_open, .open = cryptocop_open,
.release = cryptocop_release, .release = cryptocop_release,
.ioctl = cryptocop_ioctl .unlocked_ioctl = cryptocop_ioctl
}; };
...@@ -3102,7 +3102,8 @@ static int cryptocop_ioctl_create_session(struct inode *inode, struct file *filp ...@@ -3102,7 +3102,8 @@ static int cryptocop_ioctl_create_session(struct inode *inode, struct file *filp
return 0; return 0;
} }
static int cryptocop_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) static long cryptocop_ioctl_unlocked(struct inode *inode,
struct file *filp, unsigned int cmd, unsigned long arg)
{ {
int err = 0; int err = 0;
if (_IOC_TYPE(cmd) != ETRAXCRYPTOCOP_IOCTYPE) { if (_IOC_TYPE(cmd) != ETRAXCRYPTOCOP_IOCTYPE) {
...@@ -3134,6 +3135,19 @@ static int cryptocop_ioctl(struct inode *inode, struct file *filp, unsigned int ...@@ -3134,6 +3135,19 @@ static int cryptocop_ioctl(struct inode *inode, struct file *filp, unsigned int
return 0; return 0;
} }
static long
cryptocop_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
struct inode *inode = file->f_path.dentry->d_inode;
long ret;
lock_kernel();
ret = cryptocop_ioctl_unlocked(inode, filp, cmd, arg);
unlock_kernel();
return ret;
}
#ifdef LDEBUG #ifdef LDEBUG
static void print_dma_descriptors(struct cryptocop_int_operation *iop) static void print_dma_descriptors(struct cryptocop_int_operation *iop)
......
...@@ -72,8 +72,7 @@ static char gpio_name[] = "etrax gpio"; ...@@ -72,8 +72,7 @@ static char gpio_name[] = "etrax gpio";
static int virtual_gpio_ioctl(struct file *file, unsigned int cmd, static int virtual_gpio_ioctl(struct file *file, unsigned int cmd,
unsigned long arg); unsigned long arg);
#endif #endif
static int gpio_ioctl(struct inode *inode, struct file *file, static long gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
unsigned int cmd, unsigned long arg);
static ssize_t gpio_write(struct file *file, const char __user *buf, static ssize_t gpio_write(struct file *file, const char __user *buf,
size_t count, loff_t *off); size_t count, loff_t *off);
static int gpio_open(struct inode *inode, struct file *filp); static int gpio_open(struct inode *inode, struct file *filp);
...@@ -521,7 +520,7 @@ static inline unsigned long setget_output(struct gpio_private *priv, ...@@ -521,7 +520,7 @@ static inline unsigned long setget_output(struct gpio_private *priv,
return dir_shadow; return dir_shadow;
} /* setget_output */ } /* setget_output */
static int gpio_ioctl(struct inode *inode, struct file *file, static long gpio_ioctl_unlocked(struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
unsigned long flags; unsigned long flags;
...@@ -664,6 +663,17 @@ static int gpio_ioctl(struct inode *inode, struct file *file, ...@@ -664,6 +663,17 @@ static int gpio_ioctl(struct inode *inode, struct file *file,
return 0; return 0;
} }
static long gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
long ret;
lock_kernel();
ret = gpio_ioctl_unlocked(file, cmd, arg);
unlock_kernel();
return ret;
}
#ifdef CONFIG_ETRAX_VIRTUAL_GPIO #ifdef CONFIG_ETRAX_VIRTUAL_GPIO
static int virtual_gpio_ioctl(struct file *file, unsigned int cmd, static int virtual_gpio_ioctl(struct file *file, unsigned int cmd,
unsigned long arg) unsigned long arg)
...@@ -879,7 +889,7 @@ static int gpio_pwm_ioctl(struct gpio_private *priv, unsigned int cmd, ...@@ -879,7 +889,7 @@ static int gpio_pwm_ioctl(struct gpio_private *priv, unsigned int cmd,
static const struct file_operations gpio_fops = { static const struct file_operations gpio_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.poll = gpio_poll, .poll = gpio_poll,
.ioctl = gpio_ioctl, .unlocked_ioctl = gpio_ioctl,
.write = gpio_write, .write = gpio_write,
.open = gpio_open, .open = gpio_open,
.release = gpio_release, .release = gpio_release,
......
...@@ -74,8 +74,7 @@ static wait_queue_head_t *gpio_wq; ...@@ -74,8 +74,7 @@ static wait_queue_head_t *gpio_wq;
static int virtual_gpio_ioctl(struct file *file, unsigned int cmd, static int virtual_gpio_ioctl(struct file *file, unsigned int cmd,
unsigned long arg); unsigned long arg);
#endif #endif
static int gpio_ioctl(struct inode *inode, struct file *file, static long gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
unsigned int cmd, unsigned long arg);
static ssize_t gpio_write(struct file *file, const char *buf, size_t count, static ssize_t gpio_write(struct file *file, const char *buf, size_t count,
loff_t *off); loff_t *off);
static int gpio_open(struct inode *inode, struct file *filp); static int gpio_open(struct inode *inode, struct file *filp);
...@@ -557,12 +556,10 @@ inline unsigned long setget_output(struct gpio_private *priv, unsigned long arg) ...@@ -557,12 +556,10 @@ inline unsigned long setget_output(struct gpio_private *priv, unsigned long arg)
return dir_shadow; return dir_shadow;
} /* setget_output */ } /* setget_output */
static int static int gpio_leds_ioctl(unsigned int cmd, unsigned long arg);
gpio_leds_ioctl(unsigned int cmd, unsigned long arg);
static int static int
gpio_ioctl(struct inode *inode, struct file *file, gpio_ioctl_unlocked(struct file *file, unsigned int cmd, unsigned long arg)
unsigned int cmd, unsigned long arg)
{ {
unsigned long flags; unsigned long flags;
unsigned long val; unsigned long val;
...@@ -707,6 +704,17 @@ gpio_ioctl(struct inode *inode, struct file *file, ...@@ -707,6 +704,17 @@ gpio_ioctl(struct inode *inode, struct file *file,
return 0; return 0;
} }
static long gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
long ret;
lock_kernel();
ret = gpio_ioctl_unlocked(file, cmd, arg);
unlock_kernel();
return ret;
}
#ifdef CONFIG_ETRAX_VIRTUAL_GPIO #ifdef CONFIG_ETRAX_VIRTUAL_GPIO
static int static int
virtual_gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg) virtual_gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
...@@ -858,7 +866,7 @@ gpio_leds_ioctl(unsigned int cmd, unsigned long arg) ...@@ -858,7 +866,7 @@ gpio_leds_ioctl(unsigned int cmd, unsigned long arg)
static const struct file_operations gpio_fops = { static const struct file_operations gpio_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.poll = gpio_poll, .poll = gpio_poll,
.ioctl = gpio_ioctl, .unlocked_ioctl = gpio_ioctl,
.write = gpio_write, .write = gpio_write,
.open = gpio_open, .open = gpio_open,
.release = gpio_release, .release = gpio_release,
......
...@@ -153,7 +153,7 @@ static int sync_serial_open(struct inode *, struct file*); ...@@ -153,7 +153,7 @@ static int sync_serial_open(struct inode *, struct file*);
static int sync_serial_release(struct inode*, struct file*); static int sync_serial_release(struct inode*, struct file*);
static unsigned int sync_serial_poll(struct file *filp, poll_table *wait); static unsigned int sync_serial_poll(struct file *filp, poll_table *wait);
static int sync_serial_ioctl(struct inode*, struct file*, static int sync_serial_ioctl(struct file *,
unsigned int cmd, unsigned long arg); unsigned int cmd, unsigned long arg);
static ssize_t sync_serial_write(struct file * file, const char * buf, static ssize_t sync_serial_write(struct file * file, const char * buf,
size_t count, loff_t *ppos); size_t count, loff_t *ppos);
...@@ -245,7 +245,7 @@ static const struct file_operations sync_serial_fops = { ...@@ -245,7 +245,7 @@ static const struct file_operations sync_serial_fops = {
.write = sync_serial_write, .write = sync_serial_write,
.read = sync_serial_read, .read = sync_serial_read,
.poll = sync_serial_poll, .poll = sync_serial_poll,
.ioctl = sync_serial_ioctl, .unlocked_ioctl = sync_serial_ioctl,
.open = sync_serial_open, .open = sync_serial_open,
.release = sync_serial_release .release = sync_serial_release
}; };
...@@ -650,7 +650,7 @@ static unsigned int sync_serial_poll(struct file *file, poll_table *wait) ...@@ -650,7 +650,7 @@ static unsigned int sync_serial_poll(struct file *file, poll_table *wait)
return mask; return mask;
} }
static int sync_serial_ioctl(struct inode *inode, struct file *file, static int sync_serial_ioctl(struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
int return_val = 0; int return_val = 0;
...@@ -961,6 +961,18 @@ static int sync_serial_ioctl(struct inode *inode, struct file *file, ...@@ -961,6 +961,18 @@ static int sync_serial_ioctl(struct inode *inode, struct file *file,
return return_val; return return_val;
} }
static long sync_serial_ioctl(struct file *file,
unsigned int cmd, unsigned long arg)
{
long ret;
lock_kernel();
ret = sync_serial_ioctl_unlocked(file, cmd, arg);
unlock_kernel();
return ret;
}
/* NOTE: sync_serial_write does not support concurrency */ /* NOTE: sync_serial_write does not support concurrency */
static ssize_t sync_serial_write(struct file *file, const char *buf, static ssize_t sync_serial_write(struct file *file, const char *buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment