]> err.no Git - linux-2.6/blobdiff - drivers/hwmon/w83792d.c
[PATCH] libata: add missing finish_wait() call in ata_port_wait_eh()
[linux-2.6] / drivers / hwmon / w83792d.c
index c5b57c7a4a75d0c1ec6d9073879b50a4d7d892e1..958602e284124dbef22e18581c302f1f35334c9a 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,
@@ -1177,7 +1161,7 @@ w83792d_detect(struct i2c_adapter *adapter, int address, int kind)
           bank. */
        if (kind < 0) {
                if (w83792d_read_value(client, W83792D_REG_CONFIG) & 0x80) {
-                       dev_warn(dev, "Detection failed at step 3\n");
+                       dev_dbg(dev, "Detection failed at step 1\n");
                        goto ERROR1;
                }
                val1 = w83792d_read_value(client, W83792D_REG_BANK);
@@ -1186,6 +1170,7 @@ w83792d_detect(struct i2c_adapter *adapter, int address, int kind)
                if (!(val1 & 0x07)) {  /* is Bank0 */
                        if (((!(val1 & 0x80)) && (val2 != 0xa3)) ||
                             ((val1 & 0x80) && (val2 != 0x5c))) {
+                               dev_dbg(dev, "Detection failed at step 2\n");
                                goto ERROR1;
                        }
                }
@@ -1193,7 +1178,7 @@ w83792d_detect(struct i2c_adapter *adapter, int address, int kind)
                   should match */
                if (w83792d_read_value(client,
                                        W83792D_REG_I2C_ADDR) != address) {
-                       dev_warn(dev, "Detection failed at step 5\n");
+                       dev_dbg(dev, "Detection failed at step 3\n");
                        goto ERROR1;
                }
        }
@@ -1239,7 +1224,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 +1279,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 +1375,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 +1486,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);