]> err.no Git - linux-2.6/blobdiff - drivers/hwmon/w83792d.c
[PATCH] mtd: fix broken name_to_dev_t() declaration
[linux-2.6] / drivers / hwmon / w83792d.c
index c5b57c7a4a75d0c1ec6d9073879b50a4d7d892e1..6865c64d8a51d47b071b7930570e36dbf3c1fba1 100644 (file)
@@ -43,6 +43,7 @@
 #include <linux/hwmon.h>
 #include <linux/hwmon-sysfs.h>
 #include <linux/err.h>
+#include <linux/mutex.h>
 
 /* Addresses to scan */
 static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f, I2C_CLIENT_END };
@@ -271,7 +272,7 @@ struct w83792d_data {
        struct class_device *class_dev;
        enum chips type;
 
-       struct semaphore update_lock;
+       struct mutex update_lock;
        char valid;             /* !=0 if following fields are valid */
        unsigned long last_updated;     /* In jiffies */
 
@@ -618,10 +619,6 @@ show_alarms_reg(struct device *dev, struct device_attribute *attr, char *buf)
 
 static
 DEVICE_ATTR(alarms, S_IRUGO, show_alarms_reg, NULL);
-#define device_create_file_alarms() \
-device_create_file(dev, &dev_attr_alarms);
-
-
 
 static ssize_t
 show_pwm(struct device *dev, struct device_attribute *attr,
@@ -775,12 +772,6 @@ show_regs_chassis(struct device *dev, struct device_attribute *attr,
 
 static DEVICE_ATTR(chassis, S_IRUGO, show_regs_chassis, NULL);
 
-#define device_create_file_chassis() \
-do { \
-device_create_file(dev, &dev_attr_chassis); \
-} while (0)
-
-
 static ssize_t
 show_chassis_clear(struct device *dev, struct device_attribute *attr, char *buf)
 {
@@ -811,13 +802,6 @@ store_chassis_clear(struct device *dev, struct device_attribute *attr,
 static DEVICE_ATTR(chassis_clear, S_IRUGO | S_IWUSR,
                show_chassis_clear, store_chassis_clear);
 
-#define device_create_file_chassis_clear() \
-do { \
-device_create_file(dev, &dev_attr_chassis_clear); \
-} while (0)
-
-
-
 /* For Smart Fan I / Thermal Cruise */
 static ssize_t
 show_thermal_cruise(struct device *dev, struct device_attribute *attr,
@@ -1239,7 +1223,7 @@ w83792d_detect(struct i2c_adapter *adapter, int address, int kind)
        data->type = kind;
 
        data->valid = 0;
-       init_MUTEX(&data->update_lock);
+       mutex_init(&data->update_lock);
 
        /* Tell the I2C layer a new client has arrived */
        if ((err = i2c_attach_client(client)))
@@ -1294,16 +1278,15 @@ w83792d_detect(struct i2c_adapter *adapter, int address, int kind)
                device_create_file(dev, &sda_tolerance[i].dev_attr);
        }
 
-       device_create_file_alarms();
-
        for (i = 0; i < ARRAY_SIZE(sda_pwm); i++) {
                device_create_file(dev, &sda_pwm[i].dev_attr);
                device_create_file(dev, &sda_pwm_enable[i].dev_attr);
                device_create_file(dev, &sda_pwm_mode[i].dev_attr);
        }
 
-       device_create_file_chassis();
-       device_create_file_chassis_clear();
+       device_create_file(dev, &dev_attr_alarms);
+       device_create_file(dev, &dev_attr_chassis);
+       device_create_file(dev, &dev_attr_chassis_clear);
 
        for (i = 0; i < ARRAY_SIZE(sda_sf2_point); i++)
                device_create_file(dev, &sda_sf2_point[i].dev_attr);
@@ -1391,7 +1374,7 @@ static struct w83792d_data *w83792d_update_device(struct device *dev)
        int i, j;
        u8 reg_array_tmp[4], pwm_array_tmp[7], reg_tmp;
 
-       down(&data->update_lock);
+       mutex_lock(&data->update_lock);
 
        if (time_after
            (jiffies - data->last_updated, (unsigned long) (HZ * 3))
@@ -1502,7 +1485,7 @@ static struct w83792d_data *w83792d_update_device(struct device *dev)
                data->valid = 1;
        }
 
-       up(&data->update_lock);
+       mutex_unlock(&data->update_lock);
 
 #ifdef DEBUG
        w83792d_print_debug(data, dev);