aboutsummaryrefslogtreecommitdiffstats
path: root/arch/cris/arch-v32/drivers/i2c.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-08-08 13:08:26 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-08 13:08:26 -0400
commit53bcef60633086ad73683d01a4ef9ca678484d2d (patch)
tree8b14cc031124d0aa0da6cd3b60115bc7eaa80061 /arch/cris/arch-v32/drivers/i2c.c
parent4fd6c6bf83cb16321e9902b00e2af79054f4e0d6 (diff)
parent85d9865721c62a551547984e6cc8bd3ba732e294 (diff)
Merge branch 'for-linus' of git://www.jni.nu/cris
* 'for-linus' of git://www.jni.nu/cris: (51 commits) CRIS: Fix alignment problem for older ld CRIS: Always dump registers for segfaulting process. CRIS: Add config for pausing a seg-faulting process CRIS: Don't take faults while in_atomic CRIS: Fixup lookup for delay slot faults CRIS: Discard exit.text and .data at runtime CRIS: Add cache aligned and read mostly data sections CRIS: Return something from profile write CRIS: Add ARTPEC-3 and timestamps for sync-serial CRIS: Better ARTPEC-3 support for gpio CRIS: Add include guard CRIS: Better handling of pinmux settings CRIS: New DMA defines for ARTPEC-3 CRIS: __do_strncpy_from_user: Don't read the byte beyond the nil CRIS: Pagetable for ARTPEC-3 CRIS: Machine dependent memmap.h CRIS: Check if pointer is set before using it CRIS: Machine dependent dma.h CRIS: Define __read_mostly for CRISv32 CRIS: Discard .note.gnu.build-id section ...
Diffstat (limited to 'arch/cris/arch-v32/drivers/i2c.c')
-rw-r--r--arch/cris/arch-v32/drivers/i2c.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/arch/cris/arch-v32/drivers/i2c.c b/arch/cris/arch-v32/drivers/i2c.c
index 2fd6a740d895..5a3e900c9a78 100644
--- a/arch/cris/arch-v32/drivers/i2c.c
+++ b/arch/cris/arch-v32/drivers/i2c.c
@@ -32,7 +32,7 @@
32#include <linux/fs.h> 32#include <linux/fs.h>
33#include <linux/string.h> 33#include <linux/string.h>
34#include <linux/init.h> 34#include <linux/init.h>
35#include <linux/smp_lock.h> 35#include <linux/mutex.h>
36 36
37#include <asm/etraxi2c.h> 37#include <asm/etraxi2c.h>
38 38
@@ -47,6 +47,7 @@
47#define D(x) 47#define D(x)
48 48
49#define I2C_MAJOR 123 /* LOCAL/EXPERIMENTAL */ 49#define I2C_MAJOR 123 /* LOCAL/EXPERIMENTAL */
50static DEFINE_MUTEX(i2c_mutex);
50static const char i2c_name[] = "i2c"; 51static const char i2c_name[] = "i2c";
51 52
52#define CLOCK_LOW_TIME 8 53#define CLOCK_LOW_TIME 8
@@ -636,7 +637,6 @@ i2c_readreg(unsigned char theSlave, unsigned char theReg)
636static int 637static int
637i2c_open(struct inode *inode, struct file *filp) 638i2c_open(struct inode *inode, struct file *filp)
638{ 639{
639 cycle_kernel_lock();
640 return 0; 640 return 0;
641} 641}
642 642
@@ -665,11 +665,11 @@ i2c_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
665 I2C_ARGREG(arg), 665 I2C_ARGREG(arg),
666 I2C_ARGVALUE(arg))); 666 I2C_ARGVALUE(arg)));
667 667
668 lock_kernel(); 668 mutex_lock(&i2c_mutex);
669 ret = i2c_writereg(I2C_ARGSLAVE(arg), 669 ret = i2c_writereg(I2C_ARGSLAVE(arg),
670 I2C_ARGREG(arg), 670 I2C_ARGREG(arg),
671 I2C_ARGVALUE(arg)); 671 I2C_ARGVALUE(arg));
672 unlock_kernel(); 672 mutex_unlock(&i2c_mutex);
673 return ret; 673 return ret;
674 674
675 case I2C_READREG: 675 case I2C_READREG:
@@ -679,9 +679,9 @@ i2c_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
679 D(printk("i2cr %d %d ", 679 D(printk("i2cr %d %d ",
680 I2C_ARGSLAVE(arg), 680 I2C_ARGSLAVE(arg),
681 I2C_ARGREG(arg))); 681 I2C_ARGREG(arg)));
682 lock_kernel(); 682 mutex_lock(&i2c_mutex);
683 val = i2c_readreg(I2C_ARGSLAVE(arg), I2C_ARGREG(arg)); 683 val = i2c_readreg(I2C_ARGSLAVE(arg), I2C_ARGREG(arg));
684 unlock_kernel(); 684 mutex_unlock(&i2c_mutex);
685 D(printk("= %d\n", val)); 685 D(printk("= %d\n", val));
686 return val; 686 return val;
687 } 687 }