X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fhwmon%2Fds1621.c;fp=drivers%2Fhwmon%2Fds1621.c;h=203f9c7abb20a78825de40e7d502d1c5a05d133a;hb=64ba3f394c830ec48a1c31b53dcae312c56f1604;hp=478eb4bb8570958464f57f582c8ee6d52c4edadb;hpb=be1e6109ac94a859551f8e1774eb9a8469fe055c;p=linux-2.6.git diff --git a/drivers/hwmon/ds1621.c b/drivers/hwmon/ds1621.c index 478eb4bb8..203f9c7ab 100644 --- a/drivers/hwmon/ds1621.c +++ b/drivers/hwmon/ds1621.c @@ -28,7 +28,6 @@ #include #include #include -#include #include "lm75.h" /* Addresses to scan */ @@ -73,7 +72,7 @@ MODULE_PARM_DESC(polarity, "Output's polarity: 0 = active high, 1 = active low") struct ds1621_data { struct i2c_client client; struct class_device *class_dev; - struct mutex update_lock; + struct semaphore update_lock; char valid; /* !=0 if following fields are valid */ unsigned long last_updated; /* In jiffies */ @@ -157,10 +156,10 @@ static ssize_t set_temp_##suffix(struct device *dev, struct device_attribute *at struct ds1621_data *data = ds1621_update_client(dev); \ u16 val = LM75_TEMP_TO_REG(simple_strtoul(buf, NULL, 10)); \ \ - mutex_lock(&data->update_lock); \ + down(&data->update_lock); \ data->value = val; \ ds1621_write_value(client, reg, data->value); \ - mutex_unlock(&data->update_lock); \ + up(&data->update_lock); \ return count; \ } @@ -243,7 +242,7 @@ static int ds1621_detect(struct i2c_adapter *adapter, int address, /* Fill in remaining client fields and put it into the global list */ strlcpy(new_client->name, "ds1621", I2C_NAME_SIZE); data->valid = 0; - 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))) @@ -298,7 +297,7 @@ static struct ds1621_data *ds1621_update_client(struct device *dev) struct ds1621_data *data = i2c_get_clientdata(client); u8 new_conf; - mutex_lock(&data->update_lock); + down(&data->update_lock); if (time_after(jiffies, data->last_updated + HZ + HZ / 2) || !data->valid) { @@ -328,7 +327,7 @@ static struct ds1621_data *ds1621_update_client(struct device *dev) data->valid = 1; } - mutex_unlock(&data->update_lock); + up(&data->update_lock); return data; }