aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-12-09 11:07:38 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-09 11:07:38 -0500
commit18821b0408efc92ec2804128ba9382a3bcebf132 (patch)
treef98fbf75e8e8f33965e489879505fb621e2f11bb /drivers/char
parent3b8ecd22447c4266500c0bcf97f035310543e494 (diff)
parent55e858c8483af427144f33b42b818b30612b82b0 (diff)
Merge branch 'bkl-drivers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'bkl-drivers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: agp: Remove the BKL from agp_open inifiband: Remove BKL from ipath_open() mips: Remove BKL from tb0219 drivers: Remove BKL from scx200_gpio drivers: Remove BKL from pc8736x_gpio parisc: Remove BKL from eisa_eeprom rtc: Remove BKL from efirtc input: Remove BKL from hp_sdc_rtc hw_random: Remove BKL from core macintosh: Remove BKL from ans-lcd nvram: Drop the bkl from non-generic nvram_llseek() nvram: Drop the bkl from nvram_llseek() mem_class: Drop the bkl from memory_open() spi: Remove BKL from spidev_open drivers: Remove BKL from cs5535_gpio drivers: Remove BKL from misc_open
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/agp/frontend.c28
-rw-r--r--drivers/char/cs5535_gpio.c3
-rw-r--r--drivers/char/efirtc.c12
-rw-r--r--drivers/char/generic_nvram.c9
-rw-r--r--drivers/char/hw_random/core.c1
-rw-r--r--drivers/char/mem.c17
-rw-r--r--drivers/char/misc.c5
-rw-r--r--drivers/char/nvram.c4
-rw-r--r--drivers/char/pc8736x_gpio.c2
-rw-r--r--drivers/char/scx200_gpio.c2
-rw-r--r--drivers/char/tb0219.c6
11 files changed, 24 insertions, 65 deletions
diff --git a/drivers/char/agp/frontend.c b/drivers/char/agp/frontend.c
index a96f3197e60f..43412c03969e 100644
--- a/drivers/char/agp/frontend.c
+++ b/drivers/char/agp/frontend.c
@@ -676,25 +676,25 @@ static int agp_open(struct inode *inode, struct file *file)
676 int minor = iminor(inode); 676 int minor = iminor(inode);
677 struct agp_file_private *priv; 677 struct agp_file_private *priv;
678 struct agp_client *client; 678 struct agp_client *client;
679 int rc = -ENXIO;
680
681 lock_kernel();
682 mutex_lock(&(agp_fe.agp_mutex));
683 679
684 if (minor != AGPGART_MINOR) 680 if (minor != AGPGART_MINOR)
685 goto err_out; 681 return -ENXIO;
682
683 mutex_lock(&(agp_fe.agp_mutex));
686 684
687 priv = kzalloc(sizeof(struct agp_file_private), GFP_KERNEL); 685 priv = kzalloc(sizeof(struct agp_file_private), GFP_KERNEL);
688 if (priv == NULL) 686 if (priv == NULL) {
689 goto err_out_nomem; 687 mutex_unlock(&(agp_fe.agp_mutex));
688 return -ENOMEM;
689 }
690 690
691 set_bit(AGP_FF_ALLOW_CLIENT, &priv->access_flags); 691 set_bit(AGP_FF_ALLOW_CLIENT, &priv->access_flags);
692 priv->my_pid = current->pid; 692 priv->my_pid = current->pid;
693 693
694 if (capable(CAP_SYS_RAWIO)) { 694 if (capable(CAP_SYS_RAWIO))
695 /* Root priv, can be controller */ 695 /* Root priv, can be controller */
696 set_bit(AGP_FF_ALLOW_CONTROLLER, &priv->access_flags); 696 set_bit(AGP_FF_ALLOW_CONTROLLER, &priv->access_flags);
697 } 697
698 client = agp_find_client_by_pid(current->pid); 698 client = agp_find_client_by_pid(current->pid);
699 699
700 if (client != NULL) { 700 if (client != NULL) {
@@ -704,16 +704,10 @@ static int agp_open(struct inode *inode, struct file *file)
704 file->private_data = (void *) priv; 704 file->private_data = (void *) priv;
705 agp_insert_file_private(priv); 705 agp_insert_file_private(priv);
706 DBG("private=%p, client=%p", priv, client); 706 DBG("private=%p, client=%p", priv, client);
707 mutex_unlock(&(agp_fe.agp_mutex));
708 unlock_kernel();
709 return 0;
710 707
711err_out_nomem:
712 rc = -ENOMEM;
713err_out:
714 mutex_unlock(&(agp_fe.agp_mutex)); 708 mutex_unlock(&(agp_fe.agp_mutex));
715 unlock_kernel(); 709
716 return rc; 710 return 0;
717} 711}
718 712
719 713
diff --git a/drivers/char/cs5535_gpio.c b/drivers/char/cs5535_gpio.c
index 04ba906b4880..4d830dc482ef 100644
--- a/drivers/char/cs5535_gpio.c
+++ b/drivers/char/cs5535_gpio.c
@@ -17,7 +17,7 @@
17#include <linux/cdev.h> 17#include <linux/cdev.h>
18#include <linux/ioport.h> 18#include <linux/ioport.h>
19#include <linux/pci.h> 19#include <linux/pci.h>
20#include <linux/smp_lock.h> 20
21#include <asm/uaccess.h> 21#include <asm/uaccess.h>
22#include <asm/io.h> 22#include <asm/io.h>
23 23
@@ -158,7 +158,6 @@ static int cs5535_gpio_open(struct inode *inode, struct file *file)
158{ 158{
159 u32 m = iminor(inode); 159 u32 m = iminor(inode);
160 160
161 cycle_kernel_lock();
162 /* the mask says which pins are usable by this driver */ 161 /* the mask says which pins are usable by this driver */
163 if ((mask & (1 << m)) == 0) 162 if ((mask & (1 << m)) == 0)
164 return -EINVAL; 163 return -EINVAL;
diff --git a/drivers/char/efirtc.c b/drivers/char/efirtc.c
index 34d15d548236..26a47dc88f61 100644
--- a/drivers/char/efirtc.c
+++ b/drivers/char/efirtc.c
@@ -27,8 +27,6 @@
27 * - Add module support 27 * - Add module support
28 */ 28 */
29 29
30
31#include <linux/smp_lock.h>
32#include <linux/types.h> 30#include <linux/types.h>
33#include <linux/errno.h> 31#include <linux/errno.h>
34#include <linux/miscdevice.h> 32#include <linux/miscdevice.h>
@@ -174,13 +172,12 @@ static long efi_rtc_ioctl(struct file *file, unsigned int cmd,
174 return -EINVAL; 172 return -EINVAL;
175 173
176 case RTC_RD_TIME: 174 case RTC_RD_TIME:
177 lock_kernel();
178 spin_lock_irqsave(&efi_rtc_lock, flags); 175 spin_lock_irqsave(&efi_rtc_lock, flags);
179 176
180 status = efi.get_time(&eft, &cap); 177 status = efi.get_time(&eft, &cap);
181 178
182 spin_unlock_irqrestore(&efi_rtc_lock,flags); 179 spin_unlock_irqrestore(&efi_rtc_lock,flags);
183 unlock_kernel(); 180
184 if (status != EFI_SUCCESS) { 181 if (status != EFI_SUCCESS) {
185 /* should never happen */ 182 /* should never happen */
186 printk(KERN_ERR "efitime: can't read time\n"); 183 printk(KERN_ERR "efitime: can't read time\n");
@@ -202,13 +199,11 @@ static long efi_rtc_ioctl(struct file *file, unsigned int cmd,
202 199
203 convert_to_efi_time(&wtime, &eft); 200 convert_to_efi_time(&wtime, &eft);
204 201
205 lock_kernel();
206 spin_lock_irqsave(&efi_rtc_lock, flags); 202 spin_lock_irqsave(&efi_rtc_lock, flags);
207 203
208 status = efi.set_time(&eft); 204 status = efi.set_time(&eft);
209 205
210 spin_unlock_irqrestore(&efi_rtc_lock,flags); 206 spin_unlock_irqrestore(&efi_rtc_lock,flags);
211 unlock_kernel();
212 207
213 return status == EFI_SUCCESS ? 0 : -EINVAL; 208 return status == EFI_SUCCESS ? 0 : -EINVAL;
214 209
@@ -224,7 +219,6 @@ static long efi_rtc_ioctl(struct file *file, unsigned int cmd,
224 219
225 convert_to_efi_time(&wtime, &eft); 220 convert_to_efi_time(&wtime, &eft);
226 221
227 lock_kernel();
228 spin_lock_irqsave(&efi_rtc_lock, flags); 222 spin_lock_irqsave(&efi_rtc_lock, flags);
229 /* 223 /*
230 * XXX Fixme: 224 * XXX Fixme:
@@ -235,19 +229,16 @@ static long efi_rtc_ioctl(struct file *file, unsigned int cmd,
235 status = efi.set_wakeup_time((efi_bool_t)enabled, &eft); 229 status = efi.set_wakeup_time((efi_bool_t)enabled, &eft);
236 230
237 spin_unlock_irqrestore(&efi_rtc_lock,flags); 231 spin_unlock_irqrestore(&efi_rtc_lock,flags);
238 unlock_kernel();
239 232
240 return status == EFI_SUCCESS ? 0 : -EINVAL; 233 return status == EFI_SUCCESS ? 0 : -EINVAL;
241 234
242 case RTC_WKALM_RD: 235 case RTC_WKALM_RD:
243 236
244 lock_kernel();
245 spin_lock_irqsave(&efi_rtc_lock, flags); 237 spin_lock_irqsave(&efi_rtc_lock, flags);
246 238
247 status = efi.get_wakeup_time((efi_bool_t *)&enabled, (efi_bool_t *)&pending, &eft); 239 status = efi.get_wakeup_time((efi_bool_t *)&enabled, (efi_bool_t *)&pending, &eft);
248 240
249 spin_unlock_irqrestore(&efi_rtc_lock,flags); 241 spin_unlock_irqrestore(&efi_rtc_lock,flags);
250 unlock_kernel();
251 242
252 if (status != EFI_SUCCESS) return -EINVAL; 243 if (status != EFI_SUCCESS) return -EINVAL;
253 244
@@ -277,7 +268,6 @@ static int efi_rtc_open(struct inode *inode, struct file *file)
277 * We do accept multiple open files at the same time as we 268 * We do accept multiple open files at the same time as we
278 * synchronize on the per call operation. 269 * synchronize on the per call operation.
279 */ 270 */
280 cycle_kernel_lock();
281 return 0; 271 return 0;
282} 272}
283 273
diff --git a/drivers/char/generic_nvram.c b/drivers/char/generic_nvram.c
index ef31738c2cbe..fda4181b5e67 100644
--- a/drivers/char/generic_nvram.c
+++ b/drivers/char/generic_nvram.c
@@ -19,7 +19,6 @@
19#include <linux/miscdevice.h> 19#include <linux/miscdevice.h>
20#include <linux/fcntl.h> 20#include <linux/fcntl.h>
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/smp_lock.h>
23#include <asm/uaccess.h> 22#include <asm/uaccess.h>
24#include <asm/nvram.h> 23#include <asm/nvram.h>
25#ifdef CONFIG_PPC_PMAC 24#ifdef CONFIG_PPC_PMAC
@@ -32,7 +31,6 @@ static ssize_t nvram_len;
32 31
33static loff_t nvram_llseek(struct file *file, loff_t offset, int origin) 32static loff_t nvram_llseek(struct file *file, loff_t offset, int origin)
34{ 33{
35 lock_kernel();
36 switch (origin) { 34 switch (origin) {
37 case 1: 35 case 1:
38 offset += file->f_pos; 36 offset += file->f_pos;
@@ -41,12 +39,11 @@ static loff_t nvram_llseek(struct file *file, loff_t offset, int origin)
41 offset += nvram_len; 39 offset += nvram_len;
42 break; 40 break;
43 } 41 }
44 if (offset < 0) { 42 if (offset < 0)
45 unlock_kernel();
46 return -EINVAL; 43 return -EINVAL;
47 } 44
48 file->f_pos = offset; 45 file->f_pos = offset;
49 unlock_kernel(); 46
50 return file->f_pos; 47 return file->f_pos;
51} 48}
52 49
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index 8b7d56a0fe3a..e989f67bb61f 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -76,7 +76,6 @@ static int rng_dev_open(struct inode *inode, struct file *filp)
76 return -EINVAL; 76 return -EINVAL;
77 if (filp->f_mode & FMODE_WRITE) 77 if (filp->f_mode & FMODE_WRITE)
78 return -EINVAL; 78 return -EINVAL;
79 cycle_kernel_lock();
80 return 0; 79 return 0;
81} 80}
82 81
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index a074fceb67d3..ad82ec92ebd4 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -26,7 +26,6 @@
26#include <linux/bootmem.h> 26#include <linux/bootmem.h>
27#include <linux/splice.h> 27#include <linux/splice.h>
28#include <linux/pfn.h> 28#include <linux/pfn.h>
29#include <linux/smp_lock.h>
30 29
31#include <asm/uaccess.h> 30#include <asm/uaccess.h>
32#include <asm/io.h> 31#include <asm/io.h>
@@ -892,29 +891,23 @@ static int memory_open(struct inode *inode, struct file *filp)
892{ 891{
893 int minor; 892 int minor;
894 const struct memdev *dev; 893 const struct memdev *dev;
895 int ret = -ENXIO;
896
897 lock_kernel();
898 894
899 minor = iminor(inode); 895 minor = iminor(inode);
900 if (minor >= ARRAY_SIZE(devlist)) 896 if (minor >= ARRAY_SIZE(devlist))
901 goto out; 897 return -ENXIO;
902 898
903 dev = &devlist[minor]; 899 dev = &devlist[minor];
904 if (!dev->fops) 900 if (!dev->fops)
905 goto out; 901 return -ENXIO;
906 902
907 filp->f_op = dev->fops; 903 filp->f_op = dev->fops;
908 if (dev->dev_info) 904 if (dev->dev_info)
909 filp->f_mapping->backing_dev_info = dev->dev_info; 905 filp->f_mapping->backing_dev_info = dev->dev_info;
910 906
911 if (dev->fops->open) 907 if (dev->fops->open)
912 ret = dev->fops->open(inode, filp); 908 return dev->fops->open(inode, filp);
913 else 909
914 ret = 0; 910 return 0;
915out:
916 unlock_kernel();
917 return ret;
918} 911}
919 912
920static const struct file_operations memory_fops = { 913static const struct file_operations memory_fops = {
diff --git a/drivers/char/misc.c b/drivers/char/misc.c
index 07fa612a58d5..96f1cd086dd2 100644
--- a/drivers/char/misc.c
+++ b/drivers/char/misc.c
@@ -49,7 +49,6 @@
49#include <linux/device.h> 49#include <linux/device.h>
50#include <linux/tty.h> 50#include <linux/tty.h>
51#include <linux/kmod.h> 51#include <linux/kmod.h>
52#include <linux/smp_lock.h>
53 52
54/* 53/*
55 * Head entry for the doubly linked miscdevice list 54 * Head entry for the doubly linked miscdevice list
@@ -118,8 +117,7 @@ static int misc_open(struct inode * inode, struct file * file)
118 struct miscdevice *c; 117 struct miscdevice *c;
119 int err = -ENODEV; 118 int err = -ENODEV;
120 const struct file_operations *old_fops, *new_fops = NULL; 119 const struct file_operations *old_fops, *new_fops = NULL;
121 120
122 lock_kernel();
123 mutex_lock(&misc_mtx); 121 mutex_lock(&misc_mtx);
124 122
125 list_for_each_entry(c, &misc_list, list) { 123 list_for_each_entry(c, &misc_list, list) {
@@ -157,7 +155,6 @@ static int misc_open(struct inode * inode, struct file * file)
157 fops_put(old_fops); 155 fops_put(old_fops);
158fail: 156fail:
159 mutex_unlock(&misc_mtx); 157 mutex_unlock(&misc_mtx);
160 unlock_kernel();
161 return err; 158 return err;
162} 159}
163 160
diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c
index 88cee4099be9..2100a8f7bd86 100644
--- a/drivers/char/nvram.c
+++ b/drivers/char/nvram.c
@@ -38,7 +38,6 @@
38#define NVRAM_VERSION "1.3" 38#define NVRAM_VERSION "1.3"
39 39
40#include <linux/module.h> 40#include <linux/module.h>
41#include <linux/smp_lock.h>
42#include <linux/nvram.h> 41#include <linux/nvram.h>
43 42
44#define PC 1 43#define PC 1
@@ -214,7 +213,6 @@ void nvram_set_checksum(void)
214 213
215static loff_t nvram_llseek(struct file *file, loff_t offset, int origin) 214static loff_t nvram_llseek(struct file *file, loff_t offset, int origin)
216{ 215{
217 lock_kernel();
218 switch (origin) { 216 switch (origin) {
219 case 0: 217 case 0:
220 /* nothing to do */ 218 /* nothing to do */
@@ -226,7 +224,7 @@ static loff_t nvram_llseek(struct file *file, loff_t offset, int origin)
226 offset += NVRAM_BYTES; 224 offset += NVRAM_BYTES;
227 break; 225 break;
228 } 226 }
229 unlock_kernel(); 227
230 return (offset >= 0) ? (file->f_pos = offset) : -EINVAL; 228 return (offset >= 0) ? (file->f_pos = offset) : -EINVAL;
231} 229}
232 230
diff --git a/drivers/char/pc8736x_gpio.c b/drivers/char/pc8736x_gpio.c
index 3f7da8cf3a80..8ecbcc174c15 100644
--- a/drivers/char/pc8736x_gpio.c
+++ b/drivers/char/pc8736x_gpio.c
@@ -20,7 +20,6 @@
20#include <linux/mutex.h> 20#include <linux/mutex.h>
21#include <linux/nsc_gpio.h> 21#include <linux/nsc_gpio.h>
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/smp_lock.h>
24#include <asm/uaccess.h> 23#include <asm/uaccess.h>
25 24
26#define DEVNAME "pc8736x_gpio" 25#define DEVNAME "pc8736x_gpio"
@@ -223,7 +222,6 @@ static int pc8736x_gpio_open(struct inode *inode, struct file *file)
223 unsigned m = iminor(inode); 222 unsigned m = iminor(inode);
224 file->private_data = &pc8736x_gpio_ops; 223 file->private_data = &pc8736x_gpio_ops;
225 224
226 cycle_kernel_lock();
227 dev_dbg(&pdev->dev, "open %d\n", m); 225 dev_dbg(&pdev->dev, "open %d\n", m);
228 226
229 if (m >= PC8736X_GPIO_CT) 227 if (m >= PC8736X_GPIO_CT)
diff --git a/drivers/char/scx200_gpio.c b/drivers/char/scx200_gpio.c
index 1d9100561c8a..99e5272e3c53 100644
--- a/drivers/char/scx200_gpio.c
+++ b/drivers/char/scx200_gpio.c
@@ -12,7 +12,6 @@
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/smp_lock.h>
16#include <asm/uaccess.h> 15#include <asm/uaccess.h>
17#include <asm/io.h> 16#include <asm/io.h>
18 17
@@ -52,7 +51,6 @@ static int scx200_gpio_open(struct inode *inode, struct file *file)
52 unsigned m = iminor(inode); 51 unsigned m = iminor(inode);
53 file->private_data = &scx200_gpio_ops; 52 file->private_data = &scx200_gpio_ops;
54 53
55 cycle_kernel_lock();
56 if (m >= MAX_PINS) 54 if (m >= MAX_PINS)
57 return -EINVAL; 55 return -EINVAL;
58 return nonseekable_open(inode, file); 56 return nonseekable_open(inode, file);
diff --git a/drivers/char/tb0219.c b/drivers/char/tb0219.c
index b3ec9b10e292..cad4eb65f13d 100644
--- a/drivers/char/tb0219.c
+++ b/drivers/char/tb0219.c
@@ -21,7 +21,6 @@
21#include <linux/fs.h> 21#include <linux/fs.h>
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/smp_lock.h>
25 24
26#include <asm/io.h> 25#include <asm/io.h>
27#include <asm/reboot.h> 26#include <asm/reboot.h>
@@ -38,7 +37,7 @@ MODULE_PARM_DESC(major, "Major device number");
38 37
39static void (*old_machine_restart)(char *command); 38static void (*old_machine_restart)(char *command);
40static void __iomem *tb0219_base; 39static void __iomem *tb0219_base;
41static spinlock_t tb0219_lock; 40static DEFINE_SPINLOCK(tb0219_lock);
42 41
43#define tb0219_read(offset) readw(tb0219_base + (offset)) 42#define tb0219_read(offset) readw(tb0219_base + (offset))
44#define tb0219_write(offset, value) writew((value), tb0219_base + (offset)) 43#define tb0219_write(offset, value) writew((value), tb0219_base + (offset))
@@ -237,7 +236,6 @@ static int tanbac_tb0219_open(struct inode *inode, struct file *file)
237{ 236{
238 unsigned int minor; 237 unsigned int minor;
239 238
240 cycle_kernel_lock();
241 minor = iminor(inode); 239 minor = iminor(inode);
242 switch (minor) { 240 switch (minor) {
243 case 0: 241 case 0:
@@ -306,8 +304,6 @@ static int __devinit tb0219_probe(struct platform_device *dev)
306 return retval; 304 return retval;
307 } 305 }
308 306
309 spin_lock_init(&tb0219_lock);
310
311 old_machine_restart = _machine_restart; 307 old_machine_restart = _machine_restart;
312 _machine_restart = tb0219_restart; 308 _machine_restart = tb0219_restart;
313 309