aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesper Nilsson <jesper.nilsson@axis.com>2010-07-30 13:04:37 -0400
committerJesper Nilsson <jesper.nilsson@axis.com>2010-08-04 06:58:57 -0400
commit90276a1a64e2ab732e26e3ac68febbf3ad04c517 (patch)
tree423dae23a180e282082e5346705022ad252d1c20
parent3648bdf79f7e020c3a28c9c842111879d8e506c0 (diff)
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: Frederic Weisbecker <fweisbec@gmail.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: John Kacur <jkacur@redhat.com>
-rw-r--r--arch/cris/arch-v10/drivers/gpio.c30
-rw-r--r--arch/cris/arch-v10/drivers/i2c.c22
-rw-r--r--arch/cris/arch-v10/drivers/sync_serial.c30
-rw-r--r--arch/cris/arch-v32/drivers/cryptocop.c26
-rw-r--r--arch/cris/arch-v32/drivers/mach-a3/gpio.c28
-rw-r--r--arch/cris/arch-v32/drivers/mach-fs/gpio.c32
-rw-r--r--arch/cris/arch-v32/drivers/sync_serial.c30
7 files changed, 137 insertions, 61 deletions
diff --git a/arch/cris/arch-v10/drivers/gpio.c b/arch/cris/arch-v10/drivers/gpio.c
index 4b0f65fac8e8..080927ffe63b 100644
--- a/arch/cris/arch-v10/drivers/gpio.c
+++ b/arch/cris/arch-v10/drivers/gpio.c
@@ -46,8 +46,7 @@ static char gpio_name[] = "etrax gpio";
46static wait_queue_head_t *gpio_wq; 46static wait_queue_head_t *gpio_wq;
47#endif 47#endif
48 48
49static int gpio_ioctl(struct inode *inode, struct file *file, 49static int gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
50 unsigned int cmd, unsigned long arg);
51static ssize_t gpio_write(struct file *file, const char __user *buf, 50static ssize_t gpio_write(struct file *file, const char __user *buf,
52 size_t count, loff_t *off); 51 size_t count, loff_t *off);
53static int gpio_open(struct inode *inode, struct file *filp); 52static int gpio_open(struct inode *inode, struct file *filp);
@@ -505,8 +504,7 @@ static int
505gpio_leds_ioctl(unsigned int cmd, unsigned long arg); 504gpio_leds_ioctl(unsigned int cmd, unsigned long arg);
506 505
507static int 506static int
508gpio_ioctl(struct inode *inode, struct file *file, 507gpio_ioctl_unlocked(struct file *file, unsigned int cmd, unsigned long arg)
509 unsigned int cmd, unsigned long arg)
510{ 508{
511 unsigned long flags; 509 unsigned long flags;
512 unsigned long val; 510 unsigned long val;
@@ -684,6 +682,18 @@ gpio_ioctl(struct inode *inode, struct file *file,
684} 682}
685 683
686static int 684static int
685gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
686{
687 long ret;
688
689 lock_kernel();
690 ret = gpio_ioctl_unlocked(file, cmd, arg);
691 unlock_kernel();
692
693 return ret;
694}
695
696static int
687gpio_leds_ioctl(unsigned int cmd, unsigned long arg) 697gpio_leds_ioctl(unsigned int cmd, unsigned long arg)
688{ 698{
689 unsigned char green; 699 unsigned char green;
@@ -713,12 +723,12 @@ gpio_leds_ioctl(unsigned int cmd, unsigned long arg)
713} 723}
714 724
715static const struct file_operations gpio_fops = { 725static const struct file_operations gpio_fops = {
716 .owner = THIS_MODULE, 726 .owner = THIS_MODULE,
717 .poll = gpio_poll, 727 .poll = gpio_poll,
718 .ioctl = gpio_ioctl, 728 .unlocked_ioctl = gpio_ioctl,
719 .write = gpio_write, 729 .write = gpio_write,
720 .open = gpio_open, 730 .open = gpio_open,
721 .release = gpio_release, 731 .release = gpio_release,
722}; 732};
723 733
724static void ioif_watcher(const unsigned int gpio_in_available, 734static void ioif_watcher(const unsigned int gpio_in_available,
diff --git a/arch/cris/arch-v10/drivers/i2c.c b/arch/cris/arch-v10/drivers/i2c.c
index a8737a8eb229..399e089bed7a 100644
--- a/arch/cris/arch-v10/drivers/i2c.c
+++ b/arch/cris/arch-v10/drivers/i2c.c
@@ -580,8 +580,7 @@ i2c_release(struct inode *inode, struct file *filp)
580 */ 580 */
581 581
582static int 582static int
583i2c_ioctl(struct inode *inode, struct file *file, 583i2c_ioctl_unlocked(struct file *file, unsigned int cmd, unsigned long arg)
584 unsigned int cmd, unsigned long arg)
585{ 584{
586 if(_IOC_TYPE(cmd) != ETRAXI2C_IOCTYPE) { 585 if(_IOC_TYPE(cmd) != ETRAXI2C_IOCTYPE) {
587 return -EINVAL; 586 return -EINVAL;
@@ -617,11 +616,22 @@ i2c_ioctl(struct inode *inode, struct file *file,
617 return 0; 616 return 0;
618} 617}
619 618
619static long i2c_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
620{
621 long ret;
622
623 lock_kernel();
624 ret = i2c_ioctl_unlocked(file, cmd, arg);
625 unlock_kernel();
626
627 return ret;
628}
629
620static const struct file_operations i2c_fops = { 630static const struct file_operations i2c_fops = {
621 .owner = THIS_MODULE, 631 .owner = THIS_MODULE,
622 .ioctl = i2c_ioctl, 632 .unlocked_ioctl = i2c_ioctl,
623 .open = i2c_open, 633 .open = i2c_open,
624 .release = i2c_release, 634 .release = i2c_release,
625}; 635};
626 636
627int __init 637int __init
diff --git a/arch/cris/arch-v10/drivers/sync_serial.c b/arch/cris/arch-v10/drivers/sync_serial.c
index 109dcd826d17..ee2dd4323daf 100644
--- a/arch/cris/arch-v10/drivers/sync_serial.c
+++ b/arch/cris/arch-v10/drivers/sync_serial.c
@@ -157,7 +157,7 @@ static int sync_serial_open(struct inode *inode, struct file *file);
157static int sync_serial_release(struct inode *inode, struct file *file); 157static int sync_serial_release(struct inode *inode, struct file *file);
158static unsigned int sync_serial_poll(struct file *filp, poll_table *wait); 158static unsigned int sync_serial_poll(struct file *filp, poll_table *wait);
159 159
160static int sync_serial_ioctl(struct inode *inode, struct file *file, 160static int sync_serial_ioctl(struct file *file,
161 unsigned int cmd, unsigned long arg); 161 unsigned int cmd, unsigned long arg);
162static ssize_t sync_serial_write(struct file *file, const char *buf, 162static ssize_t sync_serial_write(struct file *file, const char *buf,
163 size_t count, loff_t *ppos); 163 size_t count, loff_t *ppos);
@@ -244,13 +244,13 @@ static unsigned sync_serial_prescale_shadow;
244#define NUMBER_OF_PORTS 2 244#define NUMBER_OF_PORTS 2
245 245
246static const struct file_operations sync_serial_fops = { 246static const struct file_operations sync_serial_fops = {
247 .owner = THIS_MODULE, 247 .owner = THIS_MODULE,
248 .write = sync_serial_write, 248 .write = sync_serial_write,
249 .read = sync_serial_read, 249 .read = sync_serial_read,
250 .poll = sync_serial_poll, 250 .poll = sync_serial_poll,
251 .ioctl = sync_serial_ioctl, 251 .unlocked_ioctl = sync_serial_ioctl,
252 .open = sync_serial_open, 252 .open = sync_serial_open,
253 .release = sync_serial_release 253 .release = sync_serial_release
254}; 254};
255 255
256static int __init etrax_sync_serial_init(void) 256static int __init etrax_sync_serial_init(void)
@@ -678,7 +678,7 @@ static unsigned int sync_serial_poll(struct file *file, poll_table *wait)
678 return mask; 678 return mask;
679} 679}
680 680
681static int sync_serial_ioctl(struct inode *inode, struct file *file, 681static int sync_serial_ioctl_unlocked(struct file *file,
682 unsigned int cmd, unsigned long arg) 682 unsigned int cmd, unsigned long arg)
683{ 683{
684 int return_val = 0; 684 int return_val = 0;
@@ -956,6 +956,18 @@ static int sync_serial_ioctl(struct inode *inode, struct file *file,
956 return return_val; 956 return return_val;
957} 957}
958 958
959static long sync_serial_ioctl(struct file *file,
960 unsigned int cmd, unsigned long arg)
961{
962 long ret;
963
964 lock_kernel();
965 ret = sync_serial_ioctl_unlocked(file, cmd, arg);
966 unlock_kernel();
967
968 return ret;
969}
970
959 971
960static ssize_t sync_serial_write(struct file *file, const char *buf, 972static ssize_t sync_serial_write(struct file *file, const char *buf,
961 size_t count, loff_t *ppos) 973 size_t count, loff_t *ppos)
diff --git a/arch/cris/arch-v32/drivers/cryptocop.c b/arch/cris/arch-v32/drivers/cryptocop.c
index b70fb34939d9..9cfbfae107c7 100644
--- a/arch/cris/arch-v32/drivers/cryptocop.c
+++ b/arch/cris/arch-v32/drivers/cryptocop.c
@@ -217,7 +217,7 @@ static int cryptocop_open(struct inode *, struct file *);
217 217
218static int cryptocop_release(struct inode *, struct file *); 218static int cryptocop_release(struct inode *, struct file *);
219 219
220static int cryptocop_ioctl(struct inode *inode, struct file *file, 220static long cryptocop_ioctl(struct file *file,
221 unsigned int cmd, unsigned long arg); 221 unsigned int cmd, unsigned long arg);
222 222
223static void cryptocop_start_job(void); 223static void cryptocop_start_job(void);
@@ -279,10 +279,10 @@ static void print_user_dma_lists(struct cryptocop_dma_list_operation *dma_op);
279 279
280 280
281const struct file_operations cryptocop_fops = { 281const struct file_operations cryptocop_fops = {
282 .owner = THIS_MODULE, 282 .owner = THIS_MODULE,
283 .open = cryptocop_open, 283 .open = cryptocop_open,
284 .release = cryptocop_release, 284 .release = cryptocop_release,
285 .ioctl = cryptocop_ioctl 285 .unlocked_ioctl = cryptocop_ioctl
286}; 286};
287 287
288 288
@@ -3102,7 +3102,8 @@ static int cryptocop_ioctl_create_session(struct inode *inode, struct file *filp
3102 return 0; 3102 return 0;
3103} 3103}
3104 3104
3105static int cryptocop_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) 3105static long cryptocop_ioctl_unlocked(struct inode *inode,
3106 struct file *filp, unsigned int cmd, unsigned long arg)
3106{ 3107{
3107 int err = 0; 3108 int err = 0;
3108 if (_IOC_TYPE(cmd) != ETRAXCRYPTOCOP_IOCTYPE) { 3109 if (_IOC_TYPE(cmd) != ETRAXCRYPTOCOP_IOCTYPE) {
@@ -3134,6 +3135,19 @@ static int cryptocop_ioctl(struct inode *inode, struct file *filp, unsigned int
3134 return 0; 3135 return 0;
3135} 3136}
3136 3137
3138static long
3139cryptocop_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
3140{
3141 struct inode *inode = file->f_path.dentry->d_inode;
3142 long ret;
3143
3144 lock_kernel();
3145 ret = cryptocop_ioctl_unlocked(inode, filp, cmd, arg);
3146 unlock_kernel();
3147
3148 return ret;
3149}
3150
3137 3151
3138#ifdef LDEBUG 3152#ifdef LDEBUG
3139static void print_dma_descriptors(struct cryptocop_int_operation *iop) 3153static void print_dma_descriptors(struct cryptocop_int_operation *iop)
diff --git a/arch/cris/arch-v32/drivers/mach-a3/gpio.c b/arch/cris/arch-v32/drivers/mach-a3/gpio.c
index 97357cfd17bb..2dcd27adbad4 100644
--- a/arch/cris/arch-v32/drivers/mach-a3/gpio.c
+++ b/arch/cris/arch-v32/drivers/mach-a3/gpio.c
@@ -72,8 +72,7 @@ static char gpio_name[] = "etrax gpio";
72static int virtual_gpio_ioctl(struct file *file, unsigned int cmd, 72static int virtual_gpio_ioctl(struct file *file, unsigned int cmd,
73 unsigned long arg); 73 unsigned long arg);
74#endif 74#endif
75static int gpio_ioctl(struct inode *inode, struct file *file, 75static long gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
76 unsigned int cmd, unsigned long arg);
77static ssize_t gpio_write(struct file *file, const char __user *buf, 76static ssize_t gpio_write(struct file *file, const char __user *buf,
78 size_t count, loff_t *off); 77 size_t count, loff_t *off);
79static int gpio_open(struct inode *inode, struct file *filp); 78static int gpio_open(struct inode *inode, struct file *filp);
@@ -521,7 +520,7 @@ static inline unsigned long setget_output(struct gpio_private *priv,
521 return dir_shadow; 520 return dir_shadow;
522} /* setget_output */ 521} /* setget_output */
523 522
524static int gpio_ioctl(struct inode *inode, struct file *file, 523static long gpio_ioctl_unlocked(struct file *file,
525 unsigned int cmd, unsigned long arg) 524 unsigned int cmd, unsigned long arg)
526{ 525{
527 unsigned long flags; 526 unsigned long flags;
@@ -664,6 +663,17 @@ static int gpio_ioctl(struct inode *inode, struct file *file,
664 return 0; 663 return 0;
665} 664}
666 665
666static long gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
667{
668 long ret;
669
670 lock_kernel();
671 ret = gpio_ioctl_unlocked(file, cmd, arg);
672 unlock_kernel();
673
674 return ret;
675}
676
667#ifdef CONFIG_ETRAX_VIRTUAL_GPIO 677#ifdef CONFIG_ETRAX_VIRTUAL_GPIO
668static int virtual_gpio_ioctl(struct file *file, unsigned int cmd, 678static int virtual_gpio_ioctl(struct file *file, unsigned int cmd,
669 unsigned long arg) 679 unsigned long arg)
@@ -877,12 +887,12 @@ static int gpio_pwm_ioctl(struct gpio_private *priv, unsigned int cmd,
877} 887}
878 888
879static const struct file_operations gpio_fops = { 889static const struct file_operations gpio_fops = {
880 .owner = THIS_MODULE, 890 .owner = THIS_MODULE,
881 .poll = gpio_poll, 891 .poll = gpio_poll,
882 .ioctl = gpio_ioctl, 892 .unlocked_ioctl = gpio_ioctl,
883 .write = gpio_write, 893 .write = gpio_write,
884 .open = gpio_open, 894 .open = gpio_open,
885 .release = gpio_release, 895 .release = gpio_release,
886}; 896};
887 897
888#ifdef CONFIG_ETRAX_VIRTUAL_GPIO 898#ifdef CONFIG_ETRAX_VIRTUAL_GPIO
diff --git a/arch/cris/arch-v32/drivers/mach-fs/gpio.c b/arch/cris/arch-v32/drivers/mach-fs/gpio.c
index d89ab80498ed..3a12ce309e3b 100644
--- a/arch/cris/arch-v32/drivers/mach-fs/gpio.c
+++ b/arch/cris/arch-v32/drivers/mach-fs/gpio.c
@@ -74,8 +74,7 @@ static wait_queue_head_t *gpio_wq;
74static int virtual_gpio_ioctl(struct file *file, unsigned int cmd, 74static int virtual_gpio_ioctl(struct file *file, unsigned int cmd,
75 unsigned long arg); 75 unsigned long arg);
76#endif 76#endif
77static int gpio_ioctl(struct inode *inode, struct file *file, 77static long gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
78 unsigned int cmd, unsigned long arg);
79static ssize_t gpio_write(struct file *file, const char *buf, size_t count, 78static ssize_t gpio_write(struct file *file, const char *buf, size_t count,
80 loff_t *off); 79 loff_t *off);
81static int gpio_open(struct inode *inode, struct file *filp); 80static 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 return dir_shadow; 556 return dir_shadow;
558} /* setget_output */ 557} /* setget_output */
559 558
560static int 559static int gpio_leds_ioctl(unsigned int cmd, unsigned long arg);
561gpio_leds_ioctl(unsigned int cmd, unsigned long arg);
562 560
563static int 561static int
564gpio_ioctl(struct inode *inode, struct file *file, 562gpio_ioctl_unlocked(struct file *file, unsigned int cmd, unsigned long arg)
565 unsigned int cmd, unsigned long arg)
566{ 563{
567 unsigned long flags; 564 unsigned long flags;
568 unsigned long val; 565 unsigned long val;
@@ -707,6 +704,17 @@ gpio_ioctl(struct inode *inode, struct file *file,
707 return 0; 704 return 0;
708} 705}
709 706
707static long gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
708{
709 long ret;
710
711 lock_kernel();
712 ret = gpio_ioctl_unlocked(file, cmd, arg);
713 unlock_kernel();
714
715 return ret;
716}
717
710#ifdef CONFIG_ETRAX_VIRTUAL_GPIO 718#ifdef CONFIG_ETRAX_VIRTUAL_GPIO
711static int 719static int
712virtual_gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 720virtual_gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
@@ -856,12 +864,12 @@ gpio_leds_ioctl(unsigned int cmd, unsigned long arg)
856} 864}
857 865
858static const struct file_operations gpio_fops = { 866static const struct file_operations gpio_fops = {
859 .owner = THIS_MODULE, 867 .owner = THIS_MODULE,
860 .poll = gpio_poll, 868 .poll = gpio_poll,
861 .ioctl = gpio_ioctl, 869 .unlocked_ioctl = gpio_ioctl,
862 .write = gpio_write, 870 .write = gpio_write,
863 .open = gpio_open, 871 .open = gpio_open,
864 .release = gpio_release, 872 .release = gpio_release,
865}; 873};
866 874
867#ifdef CONFIG_ETRAX_VIRTUAL_GPIO 875#ifdef CONFIG_ETRAX_VIRTUAL_GPIO
diff --git a/arch/cris/arch-v32/drivers/sync_serial.c b/arch/cris/arch-v32/drivers/sync_serial.c
index 4889f196ecd6..ca248f3adb80 100644
--- a/arch/cris/arch-v32/drivers/sync_serial.c
+++ b/arch/cris/arch-v32/drivers/sync_serial.c
@@ -153,7 +153,7 @@ static int sync_serial_open(struct inode *, struct file*);
153static int sync_serial_release(struct inode*, struct file*); 153static int sync_serial_release(struct inode*, struct file*);
154static unsigned int sync_serial_poll(struct file *filp, poll_table *wait); 154static unsigned int sync_serial_poll(struct file *filp, poll_table *wait);
155 155
156static int sync_serial_ioctl(struct inode*, struct file*, 156static int sync_serial_ioctl(struct file *,
157 unsigned int cmd, unsigned long arg); 157 unsigned int cmd, unsigned long arg);
158static ssize_t sync_serial_write(struct file * file, const char * buf, 158static ssize_t sync_serial_write(struct file * file, const char * buf,
159 size_t count, loff_t *ppos); 159 size_t count, loff_t *ppos);
@@ -241,13 +241,13 @@ static struct sync_port ports[]=
241#define NBR_PORTS ARRAY_SIZE(ports) 241#define NBR_PORTS ARRAY_SIZE(ports)
242 242
243static const struct file_operations sync_serial_fops = { 243static const struct file_operations sync_serial_fops = {
244 .owner = THIS_MODULE, 244 .owner = THIS_MODULE,
245 .write = sync_serial_write, 245 .write = sync_serial_write,
246 .read = sync_serial_read, 246 .read = sync_serial_read,
247 .poll = sync_serial_poll, 247 .poll = sync_serial_poll,
248 .ioctl = sync_serial_ioctl, 248 .unlocked_ioctl = sync_serial_ioctl,
249 .open = sync_serial_open, 249 .open = sync_serial_open,
250 .release = sync_serial_release 250 .release = sync_serial_release
251}; 251};
252 252
253static int __init etrax_sync_serial_init(void) 253static int __init etrax_sync_serial_init(void)
@@ -650,7 +650,7 @@ static unsigned int sync_serial_poll(struct file *file, poll_table *wait)
650 return mask; 650 return mask;
651} 651}
652 652
653static int sync_serial_ioctl(struct inode *inode, struct file *file, 653static int sync_serial_ioctl(struct file *file,
654 unsigned int cmd, unsigned long arg) 654 unsigned int cmd, unsigned long arg)
655{ 655{
656 int return_val = 0; 656 int return_val = 0;
@@ -961,6 +961,18 @@ static int sync_serial_ioctl(struct inode *inode, struct file *file,
961 return return_val; 961 return return_val;
962} 962}
963 963
964static long sync_serial_ioctl(struct file *file,
965 unsigned int cmd, unsigned long arg)
966{
967 long ret;
968
969 lock_kernel();
970 ret = sync_serial_ioctl_unlocked(file, cmd, arg);
971 unlock_kernel();
972
973 return ret;
974}
975
964/* NOTE: sync_serial_write does not support concurrency */ 976/* NOTE: sync_serial_write does not support concurrency */
965static ssize_t sync_serial_write(struct file *file, const char *buf, 977static ssize_t sync_serial_write(struct file *file, const char *buf,
966 size_t count, loff_t *ppos) 978 size_t count, loff_t *ppos)