diff options
Diffstat (limited to 'drivers/i2c/chips/pcf8591.c')
-rw-r--r-- | drivers/i2c/chips/pcf8591.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/i2c/chips/pcf8591.c b/drivers/i2c/chips/pcf8591.c index 6c7dc052bacd3..b6b927d8b3726 100644 --- a/drivers/i2c/chips/pcf8591.c +++ b/drivers/i2c/chips/pcf8591.c @@ -144,11 +144,15 @@ static ssize_t set_out0_enable(struct device *dev, const char *buf, size_t count { struct i2c_client *client = to_i2c_client(dev); struct pcf8591_data *data = i2c_get_clientdata(client); - if (simple_strtoul(buf, NULL, 10)) + unsigned long val = simple_strtoul(buf, NULL, 10); + + down(&data->update_lock); + if (val) data->control |= PCF8591_CONTROL_AOEF; else data->control &= ~PCF8591_CONTROL_AOEF; i2c_smbus_write_byte(client, data->control); + up(&data->update_lock); return count; } |