aboutsummaryrefslogtreecommitdiffstats
path: root/arch/cris
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2010-09-11 12:18:22 -0400
committerArnd Bergmann <arnd@arndb.de>2010-09-26 10:25:55 -0400
commit0890b5880df6a4989336add11f3a22122b26d9e1 (patch)
treef35644d8e6730b72aeedb61a654a2d06e5610244 /arch/cris
parent80eb4a6f89bbf8e8318e108701bad11451efb2df (diff)
cris: autoconvert trivial BKL users
All uses of the big kernel lock in the cris architecture are for ioctl and open functions of character device drivers, which can be trivially converted to a per-driver mutex. Most of these are probably unnecessary, so it may make sense to audit them and eventually remove the extra mutex introduced by this patch. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: Mikael Starvik <starvik@axis.com> Cc: Jesper Nilsson <jesper.nilsson@axis.com> Cc: linux-cris-kernel@axis.com
Diffstat (limited to 'arch/cris')
-rw-r--r--arch/cris/arch-v10/drivers/ds1302.c7
-rw-r--r--arch/cris/arch-v10/drivers/pcf8563.c6
-rw-r--r--arch/cris/arch-v10/drivers/sync_serial.c11
-rw-r--r--arch/cris/arch-v32/drivers/cryptocop.c4
-rw-r--r--arch/cris/arch-v32/drivers/mach-a3/gpio.c11
-rw-r--r--arch/cris/arch-v32/drivers/mach-fs/gpio.c11
-rw-r--r--arch/cris/arch-v32/drivers/pcf8563.c6
-rw-r--r--arch/cris/arch-v32/drivers/sync_serial.c11
8 files changed, 36 insertions, 31 deletions
diff --git a/arch/cris/arch-v10/drivers/ds1302.c b/arch/cris/arch-v10/drivers/ds1302.c
index 884275629ef7..4b92ad08b0ff 100644
--- a/arch/cris/arch-v10/drivers/ds1302.c
+++ b/arch/cris/arch-v10/drivers/ds1302.c
@@ -19,7 +19,7 @@
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/miscdevice.h> 20#include <linux/miscdevice.h>
21#include <linux/delay.h> 21#include <linux/delay.h>
22#include <linux/smp_lock.h> 22#include <linux/mutex.h>
23#include <linux/bcd.h> 23#include <linux/bcd.h>
24#include <linux/capability.h> 24#include <linux/capability.h>
25 25
@@ -34,6 +34,7 @@
34 34
35#define RTC_MAJOR_NR 121 /* local major, change later */ 35#define RTC_MAJOR_NR 121 /* local major, change later */
36 36
37static DEFINE_MUTEX(ds1302_mutex);
37static const char ds1302_name[] = "ds1302"; 38static const char ds1302_name[] = "ds1302";
38 39
39/* The DS1302 might be connected to different bits on different products. 40/* The DS1302 might be connected to different bits on different products.
@@ -357,9 +358,9 @@ static long rtc_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned lon
357{ 358{
358 int ret; 359 int ret;
359 360
360 lock_kernel(); 361 mutex_lock(&ds1302_mutex);
361 ret = rtc_ioctl(file, cmd, arg); 362 ret = rtc_ioctl(file, cmd, arg);
362 unlock_kernel(); 363 mutex_unlock(&ds1302_mutex);
363 364
364 return ret; 365 return ret;
365} 366}
diff --git a/arch/cris/arch-v10/drivers/pcf8563.c b/arch/cris/arch-v10/drivers/pcf8563.c
index 7dcb1f85f42b..2f1ddedca2bd 100644
--- a/arch/cris/arch-v10/drivers/pcf8563.c
+++ b/arch/cris/arch-v10/drivers/pcf8563.c
@@ -27,7 +27,6 @@
27#include <linux/delay.h> 27#include <linux/delay.h>
28#include <linux/bcd.h> 28#include <linux/bcd.h>
29#include <linux/mutex.h> 29#include <linux/mutex.h>
30#include <linux/smp_lock.h>
31 30
32#include <asm/uaccess.h> 31#include <asm/uaccess.h>
33#include <asm/system.h> 32#include <asm/system.h>
@@ -49,6 +48,7 @@
49#define rtc_read(x) i2c_readreg(RTC_I2C_READ, x) 48#define rtc_read(x) i2c_readreg(RTC_I2C_READ, x)
50#define rtc_write(x,y) i2c_writereg(RTC_I2C_WRITE, x, y) 49#define rtc_write(x,y) i2c_writereg(RTC_I2C_WRITE, x, y)
51 50
51static DEFINE_MUTEX(pcf8563_mutex);
52static DEFINE_MUTEX(rtc_lock); /* Protect state etc */ 52static DEFINE_MUTEX(rtc_lock); /* Protect state etc */
53 53
54static const unsigned char days_in_month[] = 54static const unsigned char days_in_month[] =
@@ -343,9 +343,9 @@ static long pcf8563_unlocked_ioctl(struct file *filp, unsigned int cmd, unsigned
343{ 343{
344 int ret; 344 int ret;
345 345
346 lock_kernel(); 346 mutex_lock(&pcf8563_mutex);
347 return pcf8563_ioctl(filp, cmd, arg); 347 return pcf8563_ioctl(filp, cmd, arg);
348 unlock_kernel(); 348 mutex_unlock(&pcf8563_mutex);
349 349
350 return ret; 350 return ret;
351} 351}
diff --git a/arch/cris/arch-v10/drivers/sync_serial.c b/arch/cris/arch-v10/drivers/sync_serial.c
index ee2dd4323daf..3d9fa074a941 100644
--- a/arch/cris/arch-v10/drivers/sync_serial.c
+++ b/arch/cris/arch-v10/drivers/sync_serial.c
@@ -20,7 +20,7 @@
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/poll.h> 21#include <linux/poll.h>
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/smp_lock.h> 23#include <linux/mutex.h>
24#include <linux/timer.h> 24#include <linux/timer.h>
25#include <asm/irq.h> 25#include <asm/irq.h>
26#include <asm/dma.h> 26#include <asm/dma.h>
@@ -149,6 +149,7 @@ struct sync_port {
149}; 149};
150 150
151 151
152static DEFINE_MUTEX(sync_serial_mutex);
152static int etrax_sync_serial_init(void); 153static int etrax_sync_serial_init(void);
153static void initialize_port(int portnbr); 154static void initialize_port(int portnbr);
154static inline int sync_data_avail(struct sync_port *port); 155static inline int sync_data_avail(struct sync_port *port);
@@ -445,7 +446,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
445 int mode; 446 int mode;
446 int err = -EBUSY; 447 int err = -EBUSY;
447 448
448 lock_kernel(); 449 mutex_lock(&sync_serial_mutex);
449 DEBUG(printk(KERN_DEBUG "Open sync serial port %d\n", dev)); 450 DEBUG(printk(KERN_DEBUG "Open sync serial port %d\n", dev));
450 451
451 if (dev < 0 || dev >= NUMBER_OF_PORTS || !ports[dev].enabled) { 452 if (dev < 0 || dev >= NUMBER_OF_PORTS || !ports[dev].enabled) {
@@ -626,7 +627,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
626 ret = 0; 627 ret = 0;
627 628
628out: 629out:
629 unlock_kernel(); 630 mutex_unlock(&sync_serial_mutex);
630 return ret; 631 return ret;
631} 632}
632 633
@@ -961,9 +962,9 @@ static long sync_serial_ioctl(struct file *file,
961{ 962{
962 long ret; 963 long ret;
963 964
964 lock_kernel(); 965 mutex_lock(&sync_serial_mutex);
965 ret = sync_serial_ioctl_unlocked(file, cmd, arg); 966 ret = sync_serial_ioctl_unlocked(file, cmd, arg);
966 unlock_kernel(); 967 mutex_unlock(&sync_serial_mutex);
967 968
968 return ret; 969 return ret;
969} 970}
diff --git a/arch/cris/arch-v32/drivers/cryptocop.c b/arch/cris/arch-v32/drivers/cryptocop.c
index b07646a30509..0973d5a2780f 100644
--- a/arch/cris/arch-v32/drivers/cryptocop.c
+++ b/arch/cris/arch-v32/drivers/cryptocop.c
@@ -3139,9 +3139,9 @@ cryptocop_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
3139 struct inode *inode = file->f_path.dentry->d_inode; 3139 struct inode *inode = file->f_path.dentry->d_inode;
3140 long ret; 3140 long ret;
3141 3141
3142 lock_kernel(); 3142 mutex_lock(&cryptocop_mutex);
3143 ret = cryptocop_ioctl_unlocked(inode, filp, cmd, arg); 3143 ret = cryptocop_ioctl_unlocked(inode, filp, cmd, arg);
3144 unlock_kernel(); 3144 mutex_unlock(&cryptocop_mutex);
3145 3145
3146 return ret; 3146 return ret;
3147} 3147}
diff --git a/arch/cris/arch-v32/drivers/mach-a3/gpio.c b/arch/cris/arch-v32/drivers/mach-a3/gpio.c
index 2dcd27adbad4..50d1885c4794 100644
--- a/arch/cris/arch-v32/drivers/mach-a3/gpio.c
+++ b/arch/cris/arch-v32/drivers/mach-a3/gpio.c
@@ -23,7 +23,7 @@
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/spinlock.h> 25#include <linux/spinlock.h>
26#include <linux/smp_lock.h> 26#include <linux/mutex.h>
27 27
28#include <asm/etraxgpio.h> 28#include <asm/etraxgpio.h>
29#include <hwregs/reg_map.h> 29#include <hwregs/reg_map.h>
@@ -66,6 +66,7 @@ static int dp_cnt;
66#define DP(x) 66#define DP(x)
67#endif 67#endif
68 68
69static DEFINE_MUTEX(gpio_mutex);
69static char gpio_name[] = "etrax gpio"; 70static char gpio_name[] = "etrax gpio";
70 71
71#ifdef CONFIG_ETRAX_VIRTUAL_GPIO 72#ifdef CONFIG_ETRAX_VIRTUAL_GPIO
@@ -391,7 +392,7 @@ static int gpio_open(struct inode *inode, struct file *filp)
391 if (!priv) 392 if (!priv)
392 return -ENOMEM; 393 return -ENOMEM;
393 394
394 lock_kernel(); 395 mutex_lock(&gpio_mutex);
395 memset(priv, 0, sizeof(*priv)); 396 memset(priv, 0, sizeof(*priv));
396 397
397 priv->minor = p; 398 priv->minor = p;
@@ -414,7 +415,7 @@ static int gpio_open(struct inode *inode, struct file *filp)
414 spin_unlock_irq(&gpio_lock); 415 spin_unlock_irq(&gpio_lock);
415 } 416 }
416 417
417 unlock_kernel(); 418 mutex_unlock(&gpio_mutex);
418 return 0; 419 return 0;
419} 420}
420 421
@@ -667,9 +668,9 @@ static long gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
667{ 668{
668 long ret; 669 long ret;
669 670
670 lock_kernel(); 671 mutex_lock(&gpio_mutex);
671 ret = gpio_ioctl_unlocked(file, cmd, arg); 672 ret = gpio_ioctl_unlocked(file, cmd, arg);
672 unlock_kernel(); 673 mutex_unlock(&gpio_mutex);
673 674
674 return ret; 675 return ret;
675} 676}
diff --git a/arch/cris/arch-v32/drivers/mach-fs/gpio.c b/arch/cris/arch-v32/drivers/mach-fs/gpio.c
index 5ec8a7d4e7d7..de8dca0550f2 100644
--- a/arch/cris/arch-v32/drivers/mach-fs/gpio.c
+++ b/arch/cris/arch-v32/drivers/mach-fs/gpio.c
@@ -22,7 +22,7 @@
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/spinlock.h> 24#include <linux/spinlock.h>
25#include <linux/smp_lock.h> 25#include <linux/mutex.h>
26 26
27#include <asm/etraxgpio.h> 27#include <asm/etraxgpio.h>
28#include <hwregs/reg_map.h> 28#include <hwregs/reg_map.h>
@@ -64,6 +64,7 @@ static int dp_cnt;
64#define DP(x) 64#define DP(x)
65#endif 65#endif
66 66
67static DEFINE_MUTEX(gpio_mutex);
67static char gpio_name[] = "etrax gpio"; 68static char gpio_name[] = "etrax gpio";
68 69
69#if 0 70#if 0
@@ -429,7 +430,7 @@ gpio_open(struct inode *inode, struct file *filp)
429 if (!priv) 430 if (!priv)
430 return -ENOMEM; 431 return -ENOMEM;
431 432
432 lock_kernel(); 433 mutex_lock(&gpio_mutex);
433 memset(priv, 0, sizeof(*priv)); 434 memset(priv, 0, sizeof(*priv));
434 435
435 priv->minor = p; 436 priv->minor = p;
@@ -450,7 +451,7 @@ gpio_open(struct inode *inode, struct file *filp)
450 alarmlist = priv; 451 alarmlist = priv;
451 spin_unlock_irq(&alarm_lock); 452 spin_unlock_irq(&alarm_lock);
452 453
453 unlock_kernel(); 454 mutex_unlock(&gpio_mutex);
454 return 0; 455 return 0;
455} 456}
456 457
@@ -708,9 +709,9 @@ static long gpio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
708{ 709{
709 long ret; 710 long ret;
710 711
711 lock_kernel(); 712 mutex_lock(&gpio_mutex);
712 ret = gpio_ioctl_unlocked(file, cmd, arg); 713 ret = gpio_ioctl_unlocked(file, cmd, arg);
713 unlock_kernel(); 714 mutex_unlock(&gpio_mutex);
714 715
715 return ret; 716 return ret;
716} 717}
diff --git a/arch/cris/arch-v32/drivers/pcf8563.c b/arch/cris/arch-v32/drivers/pcf8563.c
index bef6eb53b153..bdcac9dec5cb 100644
--- a/arch/cris/arch-v32/drivers/pcf8563.c
+++ b/arch/cris/arch-v32/drivers/pcf8563.c
@@ -24,7 +24,6 @@
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/fs.h> 25#include <linux/fs.h>
26#include <linux/ioctl.h> 26#include <linux/ioctl.h>
27#include <linux/smp_lock.h>
28#include <linux/delay.h> 27#include <linux/delay.h>
29#include <linux/bcd.h> 28#include <linux/bcd.h>
30#include <linux/mutex.h> 29#include <linux/mutex.h>
@@ -45,6 +44,7 @@
45#define rtc_read(x) i2c_readreg(RTC_I2C_READ, x) 44#define rtc_read(x) i2c_readreg(RTC_I2C_READ, x)
46#define rtc_write(x,y) i2c_writereg(RTC_I2C_WRITE, x, y) 45#define rtc_write(x,y) i2c_writereg(RTC_I2C_WRITE, x, y)
47 46
47static DEFINE_MUTEX(pcf8563_mutex);
48static DEFINE_MUTEX(rtc_lock); /* Protect state etc */ 48static DEFINE_MUTEX(rtc_lock); /* Protect state etc */
49 49
50static const unsigned char days_in_month[] = 50static const unsigned char days_in_month[] =
@@ -339,9 +339,9 @@ static long pcf8563_unlocked_ioctl(struct file *filp, unsigned int cmd, unsigned
339{ 339{
340 int ret; 340 int ret;
341 341
342 lock_kernel(); 342 mutex_lock(&pcf8563_mutex);
343 return pcf8563_ioctl(filp, cmd, arg); 343 return pcf8563_ioctl(filp, cmd, arg);
344 unlock_kernel(); 344 mutex_unlock(&pcf8563_mutex);
345 345
346 return ret; 346 return ret;
347} 347}
diff --git a/arch/cris/arch-v32/drivers/sync_serial.c b/arch/cris/arch-v32/drivers/sync_serial.c
index ca248f3adb80..a01ae9f3b814 100644
--- a/arch/cris/arch-v32/drivers/sync_serial.c
+++ b/arch/cris/arch-v32/drivers/sync_serial.c
@@ -13,7 +13,7 @@
13#include <linux/errno.h> 13#include <linux/errno.h>
14#include <linux/major.h> 14#include <linux/major.h>
15#include <linux/sched.h> 15#include <linux/sched.h>
16#include <linux/smp_lock.h> 16#include <linux/mutex.h>
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/poll.h> 18#include <linux/poll.h>
19#include <linux/init.h> 19#include <linux/init.h>
@@ -145,6 +145,7 @@ typedef struct sync_port
145 spinlock_t lock; 145 spinlock_t lock;
146} sync_port; 146} sync_port;
147 147
148static DEFINE_MUTEX(sync_serial_mutex);
148static int etrax_sync_serial_init(void); 149static int etrax_sync_serial_init(void);
149static void initialize_port(int portnbr); 150static void initialize_port(int portnbr);
150static inline int sync_data_avail(struct sync_port *port); 151static inline int sync_data_avail(struct sync_port *port);
@@ -434,7 +435,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
434 reg_dma_rw_cfg cfg = {.en = regk_dma_yes}; 435 reg_dma_rw_cfg cfg = {.en = regk_dma_yes};
435 reg_dma_rw_intr_mask intr_mask = {.data = regk_dma_yes}; 436 reg_dma_rw_intr_mask intr_mask = {.data = regk_dma_yes};
436 437
437 lock_kernel(); 438 mutex_lock(&sync_serial_mutex);
438 DEBUG(printk(KERN_DEBUG "Open sync serial port %d\n", dev)); 439 DEBUG(printk(KERN_DEBUG "Open sync serial port %d\n", dev));
439 440
440 if (dev < 0 || dev >= NBR_PORTS || !ports[dev].enabled) 441 if (dev < 0 || dev >= NBR_PORTS || !ports[dev].enabled)
@@ -583,7 +584,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
583 port->busy++; 584 port->busy++;
584 ret = 0; 585 ret = 0;
585out: 586out:
586 unlock_kernel(); 587 mutex_unlock(&sync_serial_mutex);
587 return ret; 588 return ret;
588} 589}
589 590
@@ -966,9 +967,9 @@ static long sync_serial_ioctl(struct file *file,
966{ 967{
967 long ret; 968 long ret;
968 969
969 lock_kernel(); 970 mutex_lock(&sync_serial_mutex);
970 ret = sync_serial_ioctl_unlocked(file, cmd, arg); 971 ret = sync_serial_ioctl_unlocked(file, cmd, arg);
971 unlock_kernel(); 972 mutex_unlock(&sync_serial_mutex);
972 973
973 return ret; 974 return ret;
974} 975}