#include <linux/init.h>
#include <linux/slab.h>
#include <linux/i2c.h>
-#include <linux/mutex.h>
/* Addresses to scan */
static unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, 0x4c,
struct pcf8591_data {
struct i2c_client client;
- struct mutex update_lock;
+ struct semaphore update_lock;
u8 control;
u8 aout;
struct pcf8591_data *data = i2c_get_clientdata(client);
unsigned long val = simple_strtoul(buf, NULL, 10);
- mutex_lock(&data->update_lock);
+ down(&data->update_lock);
if (val)
data->control |= PCF8591_CONTROL_AOEF;
else
data->control &= ~PCF8591_CONTROL_AOEF;
i2c_smbus_write_byte(client, data->control);
- mutex_unlock(&data->update_lock);
+ up(&data->update_lock);
return count;
}
/* Fill in the remaining client fields and put it into the global
list */
strlcpy(new_client->name, "pcf8591", I2C_NAME_SIZE);
- mutex_init(&data->update_lock);
+ init_MUTEX(&data->update_lock);
/* Tell the I2C layer a new client has arrived */
if ((err = i2c_attach_client(new_client)))
struct i2c_client *client = to_i2c_client(dev);
struct pcf8591_data *data = i2c_get_clientdata(client);
- mutex_lock(&data->update_lock);
+ down(&data->update_lock);
if ((data->control & PCF8591_CONTROL_AICH_MASK) != channel) {
data->control = (data->control & ~PCF8591_CONTROL_AICH_MASK)
}
value = i2c_smbus_read_byte(client);
- mutex_unlock(&data->update_lock);
+ up(&data->update_lock);
if ((channel == 2 && input_mode == 2) ||
(channel != 3 && (input_mode == 1 || input_mode == 3)))