]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/hwmon/adm9240.c
V4L/DVB (4608b): i2c deps fix on DVB
[linux-2.6-omap-h63xx.git] / drivers / hwmon / adm9240.c
index 11dc95f8a17ea5185637bdb5dc2f9fe85e841ac3..43f6991b588c6792b3e988f879afbce8c24cd3a1 100644 (file)
@@ -49,6 +49,7 @@
 #include <linux/hwmon.h>
 #include <linux/hwmon-vid.h>
 #include <linux/err.h>
+#include <linux/mutex.h>
 
 /* Addresses to scan */
 static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f,
@@ -137,10 +138,10 @@ static struct adm9240_data *adm9240_update_device(struct device *dev);
 
 /* driver data */
 static struct i2c_driver adm9240_driver = {
-       .owner          = THIS_MODULE,
-       .name           = "adm9240",
+       .driver = {
+               .name   = "adm9240",
+       },
        .id             = I2C_DRIVERID_ADM9240,
-       .flags          = I2C_DF_NOTIFY,
        .attach_adapter = adm9240_attach_adapter,
        .detach_client  = adm9240_detach_client,
 };
@@ -150,7 +151,7 @@ struct adm9240_data {
        enum chips type;
        struct i2c_client client;
        struct class_device *class_dev;
-       struct semaphore update_lock;
+       struct mutex update_lock;
        char valid;
        unsigned long last_updated_measure;
        unsigned long last_updated_config;
@@ -195,11 +196,11 @@ static ssize_t set_max(struct device *dev, struct device_attribute *devattr,
        struct adm9240_data *data = i2c_get_clientdata(client);
        long val = simple_strtol(buf, NULL, 10);
 
-       down(&data->update_lock);
+       mutex_lock(&data->update_lock);
        data->temp_max[attr->index] = TEMP_TO_REG(val);
        i2c_smbus_write_byte_data(client, ADM9240_REG_TEMP_MAX(attr->index),
                        data->temp_max[attr->index]);
-       up(&data->update_lock);
+       mutex_unlock(&data->update_lock);
        return count;
 }
 
@@ -246,11 +247,11 @@ static ssize_t set_in_min(struct device *dev,
        struct adm9240_data *data = i2c_get_clientdata(client);
        unsigned long val = simple_strtoul(buf, NULL, 10);
 
-       down(&data->update_lock);
+       mutex_lock(&data->update_lock);
        data->in_min[attr->index] = IN_TO_REG(val, attr->index);
        i2c_smbus_write_byte_data(client, ADM9240_REG_IN_MIN(attr->index),
                        data->in_min[attr->index]);
-       up(&data->update_lock);
+       mutex_unlock(&data->update_lock);
        return count;
 }
 
@@ -263,11 +264,11 @@ static ssize_t set_in_max(struct device *dev,
        struct adm9240_data *data = i2c_get_clientdata(client);
        unsigned long val = simple_strtoul(buf, NULL, 10);
 
-       down(&data->update_lock);
+       mutex_lock(&data->update_lock);
        data->in_max[attr->index] = IN_TO_REG(val, attr->index);
        i2c_smbus_write_byte_data(client, ADM9240_REG_IN_MAX(attr->index),
                        data->in_max[attr->index]);
-       up(&data->update_lock);
+       mutex_unlock(&data->update_lock);
        return count;
 }
 
@@ -350,7 +351,7 @@ static ssize_t set_fan_min(struct device *dev,
        int nr = attr->index;
        u8 new_div;
 
-       down(&data->update_lock);
+       mutex_lock(&data->update_lock);
 
        if (!val) {
                data->fan_min[nr] = 255;
@@ -390,7 +391,7 @@ static ssize_t set_fan_min(struct device *dev,
        i2c_smbus_write_byte_data(client, ADM9240_REG_FAN_MIN(nr),
                        data->fan_min[nr]);
 
-       up(&data->update_lock);
+       mutex_unlock(&data->update_lock);
        return count;
 }
 
@@ -439,10 +440,10 @@ static ssize_t set_aout(struct device *dev,
        struct adm9240_data *data = i2c_get_clientdata(client);
        unsigned long val = simple_strtol(buf, NULL, 10);
 
-       down(&data->update_lock);
+       mutex_lock(&data->update_lock);
        data->aout = AOUT_TO_REG(val);
        i2c_smbus_write_byte_data(client, ADM9240_REG_ANALOG_OUT, data->aout);
-       up(&data->update_lock);
+       mutex_unlock(&data->update_lock);
        return count;
 }
 static DEVICE_ATTR(aout_output, S_IRUGO | S_IWUSR, show_aout, set_aout);
@@ -539,7 +540,7 @@ static int adm9240_detect(struct i2c_adapter *adapter, int address, int kind)
        /* fill in the remaining client fields and attach */
        strlcpy(new_client->name, name, I2C_NAME_SIZE);
        data->type = kind;
-       init_MUTEX(&data->update_lock);
+       mutex_init(&data->update_lock);
 
        if ((err = i2c_attach_client(new_client)))
                goto exit_free;
@@ -691,7 +692,7 @@ static struct adm9240_data *adm9240_update_device(struct device *dev)
        struct adm9240_data *data = i2c_get_clientdata(client);
        int i;
 
-       down(&data->update_lock);
+       mutex_lock(&data->update_lock);
 
        /* minimum measurement cycle: 1.75 seconds */
        if (time_after(jiffies, data->last_updated_measure + (HZ * 7 / 4))
@@ -771,7 +772,7 @@ static struct adm9240_data *adm9240_update_device(struct device *dev)
                data->last_updated_config = jiffies;
                data->valid = 1;
        }
-       up(&data->update_lock);
+       mutex_unlock(&data->update_lock);
        return data;
 }