diff options
Diffstat (limited to 'drivers/i2c/busses/i2c-amd756-s4882.c')
-rw-r--r-- | drivers/i2c/busses/i2c-amd756-s4882.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/i2c/busses/i2c-amd756-s4882.c b/drivers/i2c/busses/i2c-amd756-s4882.c index 56c7d987590f..f7b4cb4e9c75 100644 --- a/drivers/i2c/busses/i2c-amd756-s4882.c +++ b/drivers/i2c/busses/i2c-amd756-s4882.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/slab.h> | 38 | #include <linux/slab.h> |
39 | #include <linux/init.h> | 39 | #include <linux/init.h> |
40 | #include <linux/i2c.h> | 40 | #include <linux/i2c.h> |
41 | #include <linux/mutex.h> | ||
41 | 42 | ||
42 | extern struct i2c_adapter amd756_smbus; | 43 | extern struct i2c_adapter amd756_smbus; |
43 | 44 | ||
@@ -45,7 +46,7 @@ static struct i2c_adapter *s4882_adapter; | |||
45 | static struct i2c_algorithm *s4882_algo; | 46 | static struct i2c_algorithm *s4882_algo; |
46 | 47 | ||
47 | /* Wrapper access functions for multiplexed SMBus */ | 48 | /* Wrapper access functions for multiplexed SMBus */ |
48 | static struct semaphore amd756_lock; | 49 | static struct mutex amd756_lock; |
49 | 50 | ||
50 | static s32 amd756_access_virt0(struct i2c_adapter * adap, u16 addr, | 51 | static s32 amd756_access_virt0(struct i2c_adapter * adap, u16 addr, |
51 | unsigned short flags, char read_write, | 52 | unsigned short flags, char read_write, |
@@ -59,12 +60,12 @@ static s32 amd756_access_virt0(struct i2c_adapter * adap, u16 addr, | |||
59 | || addr == 0x18) | 60 | || addr == 0x18) |
60 | return -1; | 61 | return -1; |
61 | 62 | ||
62 | down(&amd756_lock); | 63 | mutex_lock(&amd756_lock); |
63 | 64 | ||
64 | error = amd756_smbus.algo->smbus_xfer(adap, addr, flags, read_write, | 65 | error = amd756_smbus.algo->smbus_xfer(adap, addr, flags, read_write, |
65 | command, size, data); | 66 | command, size, data); |
66 | 67 | ||
67 | up(&amd756_lock); | 68 | mutex_unlock(&amd756_lock); |
68 | 69 | ||
69 | return error; | 70 | return error; |
70 | } | 71 | } |
@@ -87,7 +88,7 @@ static inline s32 amd756_access_channel(struct i2c_adapter * adap, u16 addr, | |||
87 | if (addr != 0x4c && (addr & 0xfc) != 0x50 && (addr & 0xfc) != 0x30) | 88 | if (addr != 0x4c && (addr & 0xfc) != 0x50 && (addr & 0xfc) != 0x30) |
88 | return -1; | 89 | return -1; |
89 | 90 | ||
90 | down(&amd756_lock); | 91 | mutex_lock(&amd756_lock); |
91 | 92 | ||
92 | if (last_channels != channels) { | 93 | if (last_channels != channels) { |
93 | union i2c_smbus_data mplxdata; | 94 | union i2c_smbus_data mplxdata; |
@@ -105,7 +106,7 @@ static inline s32 amd756_access_channel(struct i2c_adapter * adap, u16 addr, | |||
105 | command, size, data); | 106 | command, size, data); |
106 | 107 | ||
107 | UNLOCK: | 108 | UNLOCK: |
108 | up(&amd756_lock); | 109 | mutex_unlock(&amd756_lock); |
109 | return error; | 110 | return error; |
110 | } | 111 | } |
111 | 112 | ||
@@ -166,7 +167,7 @@ static int __init amd756_s4882_init(void) | |||
166 | } | 167 | } |
167 | 168 | ||
168 | printk(KERN_INFO "Enabling SMBus multiplexing for Tyan S4882\n"); | 169 | printk(KERN_INFO "Enabling SMBus multiplexing for Tyan S4882\n"); |
169 | init_MUTEX(&amd756_lock); | 170 | mutex_init(&amd756_lock); |
170 | 171 | ||
171 | /* Define the 5 virtual adapters and algorithms structures */ | 172 | /* Define the 5 virtual adapters and algorithms structures */ |
172 | if (!(s4882_adapter = kzalloc(5 * sizeof(struct i2c_adapter), | 173 | if (!(s4882_adapter = kzalloc(5 * sizeof(struct i2c_adapter), |