linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / drivers / hwmon / lm92.c
index 197f772..b0c4cb7 100644 (file)
@@ -46,7 +46,6 @@
 #include <linux/i2c.h>
 #include <linux/hwmon.h>
 #include <linux/err.h>
-#include <linux/mutex.h>
 
 /* The LM92 and MAX6635 have 2 two-state pins for address selection,
    resulting in 4 possible addresses. */
@@ -97,7 +96,7 @@ static struct i2c_driver lm92_driver;
 struct lm92_data {
        struct i2c_client client;
        struct class_device *class_dev;
-       struct mutex update_lock;
+       struct semaphore update_lock;
        char valid; /* zero until following fields are valid */
        unsigned long last_updated; /* in jiffies */
 
@@ -115,7 +114,7 @@ static struct lm92_data *lm92_update_device(struct device *dev)
        struct i2c_client *client = to_i2c_client(dev);
        struct lm92_data *data = i2c_get_clientdata(client);
 
-       mutex_lock(&data->update_lock);
+       down(&data->update_lock);
 
        if (time_after(jiffies, data->last_updated + HZ)
         || !data->valid) {
@@ -135,7 +134,7 @@ static struct lm92_data *lm92_update_device(struct device *dev)
                data->valid = 1;
        }
 
-       mutex_unlock(&data->update_lock);
+       up(&data->update_lock);
 
        return data;
 }
@@ -159,10 +158,10 @@ static ssize_t set_##value(struct device *dev, struct device_attribute *attr, co
        struct lm92_data *data = i2c_get_clientdata(client); \
        long val = simple_strtol(buf, NULL, 10); \
  \
-       mutex_lock(&data->update_lock); \
+       down(&data->update_lock); \
        data->value = TEMP_TO_REG(val); \
        i2c_smbus_write_word_data(client, reg, swab16(data->value)); \
-       mutex_unlock(&data->update_lock); \
+       up(&data->update_lock); \
        return count; \
 }
 set_temp(temp1_crit, LM92_REG_TEMP_CRIT);
@@ -195,11 +194,11 @@ static ssize_t set_temp1_crit_hyst(struct device *dev, struct device_attribute *
        struct lm92_data *data = i2c_get_clientdata(client);
        long val = simple_strtol(buf, NULL, 10);
 
-       mutex_lock(&data->update_lock);
+       down(&data->update_lock);
        data->temp1_hyst = TEMP_FROM_REG(data->temp1_crit) - val;
        i2c_smbus_write_word_data(client, LM92_REG_TEMP_HYST,
                                  swab16(TEMP_TO_REG(data->temp1_hyst)));
-       mutex_unlock(&data->update_lock);
+       up(&data->update_lock);
        return count;
 }
 
@@ -349,7 +348,7 @@ static int lm92_detect(struct i2c_adapter *adapter, int address, int kind)
        /* Fill in the remaining client fields */
        strlcpy(new_client->name, name, I2C_NAME_SIZE);
        data->valid = 0;
-       mutex_init(&data->update_lock);
+       init_MUTEX(&data->update_lock);
 
        /* Tell the i2c subsystem a new client has arrived */
        if ((err = i2c_attach_client(new_client)))