aboutsummaryrefslogtreecommitdiffstats
path: root/arch/cris/arch-v32/drivers/mach-a3/gpio.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/cris/arch-v32/drivers/mach-a3/gpio.c')
-rw-r--r--arch/cris/arch-v32/drivers/mach-a3/gpio.c11
1 files changed, 6 insertions, 5 deletions
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}