aboutsummaryrefslogtreecommitdiffstats
path: root/arch/cris/arch-v32/drivers/mach-fs/gpio.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/cris/arch-v32/drivers/mach-fs/gpio.c')
-rw-r--r--arch/cris/arch-v32/drivers/mach-fs/gpio.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/arch/cris/arch-v32/drivers/mach-fs/gpio.c b/arch/cris/arch-v32/drivers/mach-fs/gpio.c
index 5ec8a7d4e7d7..ee90d2659be7 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}
@@ -870,6 +871,7 @@ static const struct file_operations gpio_fops = {
870 .write = gpio_write, 871 .write = gpio_write,
871 .open = gpio_open, 872 .open = gpio_open,
872 .release = gpio_release, 873 .release = gpio_release,
874 .llseek = noop_llseek,
873}; 875};
874 876
875#ifdef CONFIG_ETRAX_VIRTUAL_GPIO 877#ifdef CONFIG_ETRAX_VIRTUAL_GPIO