aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/scx200_acb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c/busses/scx200_acb.c')
-rw-r--r--drivers/i2c/busses/scx200_acb.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/i2c/busses/scx200_acb.c b/drivers/i2c/busses/scx200_acb.c
index 8e646bdb556c..8bd305e47f0d 100644
--- a/drivers/i2c/busses/scx200_acb.c
+++ b/drivers/i2c/busses/scx200_acb.c
@@ -31,6 +31,7 @@
31#include <linux/smp_lock.h> 31#include <linux/smp_lock.h>
32#include <linux/pci.h> 32#include <linux/pci.h>
33#include <linux/delay.h> 33#include <linux/delay.h>
34#include <linux/mutex.h>
34#include <asm/io.h> 35#include <asm/io.h>
35#include <asm/msr.h> 36#include <asm/msr.h>
36 37
@@ -74,7 +75,7 @@ struct scx200_acb_iface {
74 struct scx200_acb_iface *next; 75 struct scx200_acb_iface *next;
75 struct i2c_adapter adapter; 76 struct i2c_adapter adapter;
76 unsigned base; 77 unsigned base;
77 struct semaphore sem; 78 struct mutex mutex;
78 79
79 /* State machine data */ 80 /* State machine data */
80 enum scx200_acb_state state; 81 enum scx200_acb_state state;
@@ -314,7 +315,7 @@ static s32 scx200_acb_smbus_xfer(struct i2c_adapter *adapter,
314 return -EINVAL; 315 return -EINVAL;
315 } 316 }
316 317
317 down(&iface->sem); 318 mutex_lock(&iface->mutex);
318 319
319 iface->address_byte = (address << 1) | rw; 320 iface->address_byte = (address << 1) | rw;
320 iface->command = command; 321 iface->command = command;
@@ -338,7 +339,7 @@ static s32 scx200_acb_smbus_xfer(struct i2c_adapter *adapter,
338 339
339 rc = iface->result; 340 rc = iface->result;
340 341
341 up(&iface->sem); 342 mutex_unlock(&iface->mutex);
342 343
343 if (rc == 0 && size == I2C_SMBUS_WORD_DATA && rw == I2C_SMBUS_READ) 344 if (rc == 0 && size == I2C_SMBUS_WORD_DATA && rw == I2C_SMBUS_READ)
344 data->word = le16_to_cpu(cur_word); 345 data->word = le16_to_cpu(cur_word);
@@ -431,7 +432,7 @@ static int __init scx200_acb_create(const char *text, int base, int index)
431 adapter->algo = &scx200_acb_algorithm; 432 adapter->algo = &scx200_acb_algorithm;
432 adapter->class = I2C_CLASS_HWMON; 433 adapter->class = I2C_CLASS_HWMON;
433 434
434 init_MUTEX(&iface->sem); 435 mutex_init(&iface->mutex);
435 436
436 snprintf(description, sizeof(description), "%s ACCESS.bus [%s]", 437 snprintf(description, sizeof(description), "%s ACCESS.bus [%s]",
437 text, adapter->name); 438 text, adapter->name);