Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelv...
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 13 Jan 2011 18:24:29 +0000 (10:24 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 13 Jan 2011 18:24:29 +0000 (10:24 -0800)
* 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
  hwmon: (dme1737) Minor cleanups
  hwmon: (dme1737) Add support for in7 for SCH5127
  hwmon: (emc1403) Add EMC1423 support
  hwmon: (w83627hf) Document W83627THF voltage pin mapping
  hwmon: (w83793) Drop useless mutex
  hwmon: (fschmd) Drop useless mutex
  hwmon: (w83781d) Use pr_fmt and pr_<level>
  hwmon: (pc87427) Use pr_fmt and pr_<level>
  hwmon: (pc87360) Use pr_fmt and pr_<level>
  hwmon: (lm78) Use pr_fmt and pr_<level>
  hwmon: (it87) Use pr_fmt and pr_<level>
  hwmon: Schedule the removal of the old intrusion detection interfaces
  hwmon: (w83793) Implement the standard intrusion detection interface
  hwmon: (w83792d) Implement the standard intrusion detection interface
  hwmon: (adm9240) Implement the standard intrusion detection interface
  hwmon: (via686a) Initialize fan_div values
  hwmon: (w83795) Silent false warning from gcc
  hwmon: (ads7828) Update email contact details

21 files changed:
Documentation/feature-removal-schedule.txt
Documentation/hwmon/adm9240
Documentation/hwmon/ads7828
Documentation/hwmon/dme1737
Documentation/hwmon/w83627hf
Documentation/hwmon/w83793
drivers/hwmon/Kconfig
drivers/hwmon/adm9240.c
drivers/hwmon/ads7828.c
drivers/hwmon/dme1737.c
drivers/hwmon/emc1403.c
drivers/hwmon/fschmd.c
drivers/hwmon/it87.c
drivers/hwmon/lm78.c
drivers/hwmon/pc87360.c
drivers/hwmon/pc87427.c
drivers/hwmon/via686a.c
drivers/hwmon/w83781d.c
drivers/hwmon/w83792d.c
drivers/hwmon/w83793.c
drivers/hwmon/w83795.c

index 07eb3f6..6cbbd20 100644 (file)
@@ -590,3 +590,13 @@ Why:       The functions have been superceded by cancel_delayed_work_sync()
 Who:   Tejun Heo <tj@kernel.org>
 
 ----------------------------
+
+What:  Legacy, non-standard chassis intrusion detection interface.
+When:  June 2011
+Why:   The adm9240, w83792d and w83793 hardware monitoring drivers have
+       legacy interfaces for chassis intrusion detection. A standard
+       interface has been added to each driver, so the legacy interface
+       can be removed.
+Who:   Jean Delvare <khali@linux-fr.org>
+
+----------------------------
index 2c6f1fe..36e8ec6 100644 (file)
@@ -155,7 +155,7 @@ connected to a normally open switch.
 The ADM9240 provides an internal open drain on this line, and may output
 a 20 ms active low pulse to reset an external Chassis Intrusion latch.
 
-Clear the CI latch by writing value 1 to the sysfs chassis_clear file.
+Clear the CI latch by writing value 0 to the sysfs intrusion0_alarm file.
 
 Alarm flags reported as 16-bit word
 
index 75bc4be..2bbebe6 100644 (file)
@@ -9,7 +9,7 @@ Supported chips:
                http://focus.ti.com/lit/ds/symlink/ads7828.pdf
 
 Authors:
-        Steve Hardy <steve@linuxrealtime.co.uk>
+        Steve Hardy <shardy@redhat.com>
 
 Module Parameters
 -----------------
index fc5df76..4d29351 100644 (file)
@@ -42,7 +42,7 @@ Description
 This driver implements support for the hardware monitoring capabilities of the
 SMSC DME1737 and Asus A8000 (which are the same), SMSC SCH5027, SCH311x,
 and SCH5127 Super-I/O chips. These chips feature monitoring of 3 temp sensors
-temp[1-3] (2 remote diodes and 1 internal), 7 voltages in[0-6] (6 external and
+temp[1-3] (2 remote diodes and 1 internal), 8 voltages in[0-7] (7 external and
 1 internal) and up to 6 fan speeds fan[1-6]. Additionally, the chips implement
 up to 5 PWM outputs pwm[1-3,5-6] for controlling fan speeds both manually and
 automatically.
@@ -105,6 +105,7 @@ SCH5127:
        in4: V1_IN                              0V - 1.5V
        in5: VTR        (+3.3V standby)         0V - 4.38V
        in6: Vbat       (+3.0V)                 0V - 4.38V
+       in7: Vtrip      (+1.5V)                 0V - 1.99V
 
 Each voltage input has associated min and max limits which trigger an alarm
 when crossed.
@@ -217,10 +218,10 @@ cpu0_vid                  RO      CPU core reference voltage in
 vrm                            RW      Voltage regulator module version
                                        number.
 
-in[0-6]_input                  RO      Measured voltage in millivolts.
-in[0-6]_min                    RW      Low limit for voltage input.
-in[0-6]_max                    RW      High limit for voltage input.
-in[0-6]_alarm                  RO      Voltage input alarm. Returns 1 if
+in[0-7]_input                  RO      Measured voltage in millivolts.
+in[0-7]_min                    RW      Low limit for voltage input.
+in[0-7]_max                    RW      High limit for voltage input.
+in[0-7]_alarm                  RO      Voltage input alarm. Returns 1 if
                                        voltage input is or went outside the
                                        associated min-max range, 0 otherwise.
 
@@ -324,3 +325,4 @@ fan5                        opt             opt
 pwm5                   opt             opt
 fan6                   opt             opt
 pwm6                   opt             opt
+in7                                            yes
index fb145e5..8432e11 100644 (file)
@@ -91,3 +91,25 @@ isaset -y -f 0x2e 0xaa
 
 The above sequence assumes a Super-I/O config space at 0x2e/0x2f, but
 0x4e/0x4f is also possible.
+
+Voltage pin mapping
+-------------------
+
+Here is a summary of the voltage pin mapping for the W83627THF. This
+can be useful to convert data provided by board manufacturers into
+working libsensors configuration statements.
+
+    W83627THF          |
+  Pin  | Name          | Register      | Sysfs attribute
+-----------------------------------------------------
+  100  | CPUVCORE      | 20h           | in0
+   99  | VIN0          | 21h           | in1
+   98  | VIN1          | 22h           | in2
+   97  | VIN2          | 24h           | in4
+  114  | AVCC          | 23h           | in3
+   61  | 5VSB          | 50h (bank 5)  | in7
+   74  | VBAT          | 51h (bank 5)  | in8
+
+For other supported devices, you'll have to take the hard path and
+look up the information in the datasheet yourself (and then add it
+to this document please.)
index 51171a8..6cc5f63 100644 (file)
@@ -92,7 +92,7 @@ This driver implements support for Winbond W83793G/W83793R chips.
 
 * Chassis
   If the case open alarm triggers, it will stay in this state unless cleared
-  by any write to the sysfs file "chassis".
+  by writing 0 to the sysfs file "intrusion0_alarm".
 
 * VID and VRM
   The VRM version is detected automatically, don't modify the it unless you
index bdc13d2..35f00da 100644 (file)
@@ -809,10 +809,10 @@ config SENSORS_DME1737
          will be called dme1737.
 
 config SENSORS_EMC1403
-       tristate "SMSC EMC1403 thermal sensor"
+       tristate "SMSC EMC1403/23 thermal sensor"
        depends on I2C
        help
-         If you say yes here you get support for the SMSC EMC1403
+         If you say yes here you get support for the SMSC EMC1403/23
          temperature monitoring chip.
 
          Threshold values can be configured using sysfs.
index 0727ad2..9e234b9 100644 (file)
@@ -20,7 +20,7 @@
  * Alarms      16-bit map of active alarms
  * Analog Out  0..1250 mV output
  *
- * Chassis Intrusion: clear CI latch with 'echo 1 > chassis_clear'
+ * Chassis Intrusion: clear CI latch with 'echo 0 > intrusion0_alarm'
  *
  * Test hardware: Intel SE440BX-2 desktop motherboard --Grant
  *
@@ -476,13 +476,16 @@ static ssize_t set_aout(struct device *dev,
 static DEVICE_ATTR(aout_output, S_IRUGO | S_IWUSR, show_aout, set_aout);
 
 /* chassis_clear */
-static ssize_t chassis_clear(struct device *dev,
+static ssize_t chassis_clear_legacy(struct device *dev,
                struct device_attribute *attr,
                const char *buf, size_t count)
 {
        struct i2c_client *client = to_i2c_client(dev);
        unsigned long val = simple_strtol(buf, NULL, 10);
 
+       dev_warn(dev, "Attribute chassis_clear is deprecated, "
+                "use intrusion0_alarm instead\n");
+
        if (val == 1) {
                i2c_smbus_write_byte_data(client,
                                ADM9240_REG_CHASSIS_CLEAR, 0x80);
@@ -490,7 +493,29 @@ static ssize_t chassis_clear(struct device *dev,
        }
        return count;
 }
-static DEVICE_ATTR(chassis_clear, S_IWUSR, NULL, chassis_clear);
+static DEVICE_ATTR(chassis_clear, S_IWUSR, NULL, chassis_clear_legacy);
+
+static ssize_t chassis_clear(struct device *dev,
+               struct device_attribute *attr,
+               const char *buf, size_t count)
+{
+       struct i2c_client *client = to_i2c_client(dev);
+       struct adm9240_data *data = i2c_get_clientdata(client);
+       unsigned long val;
+
+       if (strict_strtoul(buf, 10, &val) || val != 0)
+               return -EINVAL;
+
+       mutex_lock(&data->update_lock);
+       i2c_smbus_write_byte_data(client, ADM9240_REG_CHASSIS_CLEAR, 0x80);
+       data->valid = 0;                /* Force cache refresh */
+       mutex_unlock(&data->update_lock);
+       dev_dbg(&client->dev, "chassis intrusion latch cleared\n");
+
+       return count;
+}
+static SENSOR_DEVICE_ATTR(intrusion0_alarm, S_IRUGO | S_IWUSR, show_alarm,
+               chassis_clear, 12);
 
 static struct attribute *adm9240_attributes[] = {
        &sensor_dev_attr_in0_input.dev_attr.attr,
@@ -532,6 +557,7 @@ static struct attribute *adm9240_attributes[] = {
        &dev_attr_alarms.attr,
        &dev_attr_aout_output.attr,
        &dev_attr_chassis_clear.attr,
+       &sensor_dev_attr_intrusion0_alarm.dev_attr.attr,
        &dev_attr_cpu0_vid.attr,
        NULL
 };
index aac85f3..c42c5a6 100644 (file)
@@ -4,7 +4,7 @@
 
        This driver is based on the lm75 and other lm_sensors/hwmon drivers
 
-       Written by Steve Hardy <steve@linuxrealtime.co.uk>
+       Written by Steve Hardy <shardy@redhat.com>
 
        Datasheet available at: http://focus.ti.com/lit/ds/symlink/ads7828.pdf
 
@@ -271,7 +271,7 @@ static void __exit sensors_ads7828_exit(void)
        i2c_del_driver(&ads7828_driver);
 }
 
-MODULE_AUTHOR("Steve Hardy <steve@linuxrealtime.co.uk>");
+MODULE_AUTHOR("Steve Hardy <shardy@redhat.com>");
 MODULE_DESCRIPTION("ADS7828 driver");
 MODULE_LICENSE("GPL");
 
index e9a610b..d9c5927 100644 (file)
@@ -77,12 +77,14 @@ enum chips { dme1737, sch5027, sch311x, sch5127 };
  * in4   +12V
  * in5   VTR   (+3.3V stby)
  * in6   Vbat
+ * in7   Vtrip (sch5127 only)
  *
  * --------------------------------------------------------------------- */
 
-/* Voltages (in) numbered 0-6 (ix) */
-#define        DME1737_REG_IN(ix)              ((ix) < 5 ? 0x20 + (ix) \
-                                                 : 0x94 + (ix))
+/* Voltages (in) numbered 0-7 (ix) */
+#define        DME1737_REG_IN(ix)              ((ix) < 5 ? 0x20 + (ix) : \
+                                        (ix) < 7 ? 0x94 + (ix) : \
+                                                   0x1f)
 #define        DME1737_REG_IN_MIN(ix)          ((ix) < 5 ? 0x44 + (ix) * 2 \
                                                  : 0x91 + (ix) * 2)
 #define        DME1737_REG_IN_MAX(ix)          ((ix) < 5 ? 0x45 + (ix) * 2 \
@@ -101,10 +103,11 @@ enum chips { dme1737, sch5027, sch311x, sch5127 };
  *    IN_TEMP_LSB(1) = [temp3, temp1]
  *    IN_TEMP_LSB(2) = [in4, temp2]
  *    IN_TEMP_LSB(3) = [in3, in0]
- *    IN_TEMP_LSB(4) = [in2, in1] */
+ *    IN_TEMP_LSB(4) = [in2, in1]
+ *    IN_TEMP_LSB(5) = [res, in7] */
 #define DME1737_REG_IN_TEMP_LSB(ix)    (0x84 + (ix))
-static const u8 DME1737_REG_IN_LSB[] = {3, 4, 4, 3, 2, 0, 0};
-static const u8 DME1737_REG_IN_LSB_SHL[] = {4, 4, 0, 0, 0, 0, 4};
+static const u8 DME1737_REG_IN_LSB[] = {3, 4, 4, 3, 2, 0, 0, 5};
+static const u8 DME1737_REG_IN_LSB_SHL[] = {4, 4, 0, 0, 0, 0, 4, 4};
 static const u8 DME1737_REG_TEMP_LSB[] = {1, 2, 1};
 static const u8 DME1737_REG_TEMP_LSB_SHL[] = {4, 4, 0};
 
@@ -145,7 +148,7 @@ static const u8 DME1737_REG_TEMP_LSB_SHL[] = {4, 4, 0};
 #define DME1737_REG_ALARM1             0x41
 #define DME1737_REG_ALARM2             0x42
 #define DME1737_REG_ALARM3             0x83
-static const u8 DME1737_BIT_ALARM_IN[] = {0, 1, 2, 3, 8, 16, 17};
+static const u8 DME1737_BIT_ALARM_IN[] = {0, 1, 2, 3, 8, 16, 17, 18};
 static const u8 DME1737_BIT_ALARM_TEMP[] = {4, 5, 6};
 static const u8 DME1737_BIT_ALARM_FAN[] = {10, 11, 12, 13, 22, 23};
 
@@ -190,6 +193,7 @@ static const u8 DME1737_BIT_ALARM_FAN[] = {10, 11, 12, 13, 22, 23};
 #define HAS_PWM_MIN            (1 << 4)                /* bit 4 */
 #define HAS_FAN(ix)            (1 << ((ix) + 5))       /* bits 5-10 */
 #define HAS_PWM(ix)            (1 << ((ix) + 11))      /* bits 11-16 */
+#define HAS_IN7                        (1 << 17)               /* bit 17 */
 
 /* ---------------------------------------------------------------------
  * Data structures and manipulation thereof
@@ -213,9 +217,9 @@ struct dme1737_data {
        u32 has_features;
 
        /* Register values */
-       u16 in[7];
-       u8  in_min[7];
-       u8  in_max[7];
+       u16 in[8];
+       u8  in_min[8];
+       u8  in_max[8];
        s16 temp[3];
        s8  temp_min[3];
        s8  temp_max[3];
@@ -247,7 +251,7 @@ static const int IN_NOMINAL_SCH311x[] = {2500, 1500, 3300, 5000, 12000, 3300,
 static const int IN_NOMINAL_SCH5027[] = {5000, 2250, 3300, 1125, 1125, 3300,
                                         3300};
 static const int IN_NOMINAL_SCH5127[] = {2500, 2250, 3300, 1125, 1125, 3300,
-                                        3300};
+                                        3300, 1500};
 #define IN_NOMINAL(type)       ((type) == sch311x ? IN_NOMINAL_SCH311x : \
                                 (type) == sch5027 ? IN_NOMINAL_SCH5027 : \
                                 (type) == sch5127 ? IN_NOMINAL_SCH5127 : \
@@ -580,7 +584,7 @@ static struct dme1737_data *dme1737_update_device(struct device *dev)
 {
        struct dme1737_data *data = dev_get_drvdata(dev);
        int ix;
-       u8 lsb[5];
+       u8 lsb[6];
 
        mutex_lock(&data->update_lock);
 
@@ -603,6 +607,9 @@ static struct dme1737_data *dme1737_update_device(struct device *dev)
                        /* Voltage inputs are stored as 16 bit values even
                         * though they have only 12 bits resolution. This is
                         * to make it consistent with the temp inputs. */
+                       if (ix == 7 && !(data->has_features & HAS_IN7)) {
+                               continue;
+                       }
                        data->in[ix] = dme1737_read(data,
                                        DME1737_REG_IN(ix)) << 8;
                        data->in_min[ix] = dme1737_read(data,
@@ -635,10 +642,16 @@ static struct dme1737_data *dme1737_update_device(struct device *dev)
                 * which the registers are read (MSB first, then LSB) is
                 * important! */
                for (ix = 0; ix < ARRAY_SIZE(lsb); ix++) {
+                       if (ix == 5 && !(data->has_features & HAS_IN7)) {
+                               continue;
+                       }
                        lsb[ix] = dme1737_read(data,
                                        DME1737_REG_IN_TEMP_LSB(ix));
                }
                for (ix = 0; ix < ARRAY_SIZE(data->in); ix++) {
+                       if (ix == 7 && !(data->has_features & HAS_IN7)) {
+                               continue;
+                       }
                        data->in[ix] |= (lsb[DME1737_REG_IN_LSB[ix]] <<
                                        DME1737_REG_IN_LSB_SHL[ix]) & 0xf0;
                }
@@ -762,7 +775,7 @@ static struct dme1737_data *dme1737_update_device(struct device *dev)
 
 /* ---------------------------------------------------------------------
  * Voltage sysfs attributes
- * ix = [0-5]
+ * ix = [0-7]
  * --------------------------------------------------------------------- */
 
 #define SYS_IN_INPUT   0
@@ -1439,7 +1452,7 @@ static ssize_t show_name(struct device *dev, struct device_attribute *attr,
  * Sysfs device attribute defines and structs
  * --------------------------------------------------------------------- */
 
-/* Voltages 0-6 */
+/* Voltages 0-7 */
 
 #define SENSOR_DEVICE_ATTR_IN(ix) \
 static SENSOR_DEVICE_ATTR_2(in##ix##_input, S_IRUGO, \
@@ -1458,6 +1471,7 @@ SENSOR_DEVICE_ATTR_IN(3);
 SENSOR_DEVICE_ATTR_IN(4);
 SENSOR_DEVICE_ATTR_IN(5);
 SENSOR_DEVICE_ATTR_IN(6);
+SENSOR_DEVICE_ATTR_IN(7);
 
 /* Temperatures 1-3 */
 
@@ -1576,7 +1590,7 @@ static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);   /* for ISA devices */
  * created unconditionally. The attributes that need modification of their
  * permissions are created read-only and write permissions are added or removed
  * on the fly when required */
-static struct attribute *dme1737_attr[] ={
+static struct attribute *dme1737_attr[] = {
        /* Voltages */
        &sensor_dev_attr_in0_input.dev_attr.attr,
        &sensor_dev_attr_in0_min.dev_attr.attr,
@@ -1681,7 +1695,7 @@ static const struct attribute_group dme1737_zone3_group = {
 };
 
 
-/* The following struct holds temp zone hysteresis  related attributes, which
+/* The following struct holds temp zone hysteresis related attributes, which
  * are not available in all chips. The following chips support them:
  * DME1737, SCH311x */
 static struct attribute *dme1737_zone_hyst_attr[] = {
@@ -1695,6 +1709,21 @@ static const struct attribute_group dme1737_zone_hyst_group = {
        .attrs = dme1737_zone_hyst_attr,
 };
 
+/* The following struct holds voltage in7 related attributes, which
+ * are not available in all chips. The following chips support them:
+ * SCH5127 */
+static struct attribute *dme1737_in7_attr[] = {
+       &sensor_dev_attr_in7_input.dev_attr.attr,
+       &sensor_dev_attr_in7_min.dev_attr.attr,
+       &sensor_dev_attr_in7_max.dev_attr.attr,
+       &sensor_dev_attr_in7_alarm.dev_attr.attr,
+       NULL
+};
+
+static const struct attribute_group dme1737_in7_group = {
+       .attrs = dme1737_in7_attr,
+};
+
 /* The following structs hold the PWM attributes, some of which are optional.
  * Their creation depends on the chip configuration which is determined during
  * module load. */
@@ -1986,6 +2015,9 @@ static void dme1737_remove_files(struct device *dev)
        if (data->has_features & HAS_ZONE_HYST) {
                sysfs_remove_group(&dev->kobj, &dme1737_zone_hyst_group);
        }
+       if (data->has_features & HAS_IN7) {
+               sysfs_remove_group(&dev->kobj, &dme1737_in7_group);
+       }
        sysfs_remove_group(&dev->kobj, &dme1737_group);
 
        if (!data->client) {
@@ -1999,43 +2031,58 @@ static int dme1737_create_files(struct device *dev)
        int err, ix;
 
        /* Create a name attribute for ISA devices */
-       if (!data->client &&
-           (err = sysfs_create_file(&dev->kobj, &dev_attr_name.attr))) {
-               goto exit;
+       if (!data->client) {
+               err = sysfs_create_file(&dev->kobj, &dev_attr_name.attr);
+               if (err) {
+                       goto exit;
+               }
        }
 
        /* Create standard sysfs attributes */
-       if ((err = sysfs_create_group(&dev->kobj, &dme1737_group))) {
+       err = sysfs_create_group(&dev->kobj, &dme1737_group);
+       if (err) {
                goto exit_remove;
        }
 
        /* Create chip-dependent sysfs attributes */
-       if ((data->has_features & HAS_TEMP_OFFSET) &&
-           (err = sysfs_create_group(&dev->kobj,
-                                     &dme1737_temp_offset_group))) {
-               goto exit_remove;
+       if (data->has_features & HAS_TEMP_OFFSET) {
+               err = sysfs_create_group(&dev->kobj,
+                                        &dme1737_temp_offset_group);
+               if (err) {
+                       goto exit_remove;
+               }
        }
-       if ((data->has_features & HAS_VID) &&
-           (err = sysfs_create_group(&dev->kobj,
-                                     &dme1737_vid_group))) {
-               goto exit_remove;
+       if (data->has_features & HAS_VID) {
+               err = sysfs_create_group(&dev->kobj, &dme1737_vid_group);
+               if (err) {
+                       goto exit_remove;
+               }
        }
-       if ((data->has_features & HAS_ZONE3) &&
-           (err = sysfs_create_group(&dev->kobj,
-                                     &dme1737_zone3_group))) {
-               goto exit_remove;
+       if (data->has_features & HAS_ZONE3) {
+               err = sysfs_create_group(&dev->kobj, &dme1737_zone3_group);
+               if (err) {
+                       goto exit_remove;
+               }
        }
-       if ((data->has_features & HAS_ZONE_HYST) &&
-           (err = sysfs_create_group(&dev->kobj,
-                                     &dme1737_zone_hyst_group))) {
-               goto exit_remove;
+       if (data->has_features & HAS_ZONE_HYST) {
+               err = sysfs_create_group(&dev->kobj, &dme1737_zone_hyst_group);
+               if (err) {
+                       goto exit_remove;
+               }
+       }
+       if (data->has_features & HAS_IN7) {
+               err = sysfs_create_group(&dev->kobj, &dme1737_in7_group);
+               if (err) {
+                       goto exit_remove;
+               }
        }
 
        /* Create fan sysfs attributes */
        for (ix = 0; ix < ARRAY_SIZE(dme1737_fan_group); ix++) {
                if (data->has_features & HAS_FAN(ix)) {
-                       if ((err = sysfs_create_group(&dev->kobj,
-                                               &dme1737_fan_group[ix]))) {
+                       err = sysfs_create_group(&dev->kobj,
+                                                &dme1737_fan_group[ix]);
+                       if (err) {
                                goto exit_remove;
                        }
                }
@@ -2044,14 +2091,17 @@ static int dme1737_create_files(struct device *dev)
        /* Create PWM sysfs attributes */
        for (ix = 0; ix < ARRAY_SIZE(dme1737_pwm_group); ix++) {
                if (data->has_features & HAS_PWM(ix)) {
-                       if ((err = sysfs_create_group(&dev->kobj,
-                                               &dme1737_pwm_group[ix]))) {
+                       err = sysfs_create_group(&dev->kobj,
+                                                &dme1737_pwm_group[ix]);
+                       if (err) {
                                goto exit_remove;
                        }
-                       if ((data->has_features & HAS_PWM_MIN) && ix < 3 &&
-                           (err = sysfs_create_file(&dev->kobj,
-                                       dme1737_auto_pwm_min_attr[ix]))) {
-                               goto exit_remove;
+                       if ((data->has_features & HAS_PWM_MIN) && (ix < 3)) {
+                               err = sysfs_create_file(&dev->kobj,
+                                               dme1737_auto_pwm_min_attr[ix]);
+                               if (err) {
+                                       goto exit_remove;
+                               }
                        }
                }
        }
@@ -2188,7 +2238,7 @@ static int dme1737_init_device(struct device *dev)
                data->has_features |= HAS_ZONE3;
                break;
        case sch5127:
-               data->has_features |= HAS_FAN(2) | HAS_PWM(2);
+               data->has_features |= HAS_FAN(2) | HAS_PWM(2) | HAS_IN7;
                break;
        default:
                break;
@@ -2281,8 +2331,9 @@ static int dme1737_i2c_get_features(int sio_cip, struct dme1737_data *data)
        dme1737_sio_outb(sio_cip, 0x07, 0x0a);
 
        /* Get the base address of the runtime registers */
-       if (!(addr = (dme1737_sio_inb(sio_cip, 0x60) << 8) |
-                     dme1737_sio_inb(sio_cip, 0x61))) {
+       addr = (dme1737_sio_inb(sio_cip, 0x60) << 8) |
+               dme1737_sio_inb(sio_cip, 0x61);
+       if (!addr) {
                err = -ENODEV;
                goto exit;
        }
@@ -2363,13 +2414,15 @@ static int dme1737_i2c_probe(struct i2c_client *client,
        mutex_init(&data->update_lock);
 
        /* Initialize the DME1737 chip */
-       if ((err = dme1737_init_device(dev))) {
+       err = dme1737_init_device(dev);
+       if (err) {
                dev_err(dev, "Failed to initialize device.\n");
                goto exit_kfree;
        }
 
        /* Create sysfs files */
-       if ((err = dme1737_create_files(dev))) {
+       err = dme1737_create_files(dev);
+       if (err) {
                dev_err(dev, "Failed to create sysfs files.\n");
                goto exit_kfree;
        }
@@ -2446,8 +2499,9 @@ static int __init dme1737_isa_detect(int sio_cip, unsigned short *addr)
        dme1737_sio_outb(sio_cip, 0x07, 0x0a);
 
        /* Get the base address of the runtime registers */
-       if (!(base_addr = (dme1737_sio_inb(sio_cip, 0x60) << 8) |
-                          dme1737_sio_inb(sio_cip, 0x61))) {
+       base_addr = (dme1737_sio_inb(sio_cip, 0x60) << 8) |
+                    dme1737_sio_inb(sio_cip, 0x61);
+       if (!base_addr) {
                pr_err("Base address not set\n");
                err = -ENODEV;
                goto exit;
@@ -2476,18 +2530,21 @@ static int __init dme1737_isa_device_add(unsigned short addr)
        if (err)
                goto exit;
 
-       if (!(pdev = platform_device_alloc("dme1737", addr))) {
+       pdev = platform_device_alloc("dme1737", addr);
+       if (!pdev) {
                pr_err("Failed to allocate device\n");
                err = -ENOMEM;
                goto exit;
        }
 
-       if ((err = platform_device_add_resources(pdev, &res, 1))) {
+       err = platform_device_add_resources(pdev, &res, 1);
+       if (err) {
                pr_err("Failed to add device resource (err = %d)\n", err);
                goto exit_device_put;
        }
 
-       if ((err = platform_device_add(pdev))) {
+       err = platform_device_add(pdev);
+       if (err) {
                pr_err("Failed to add device (err = %d)\n", err);
                goto exit_device_put;
        }
@@ -2514,11 +2571,12 @@ static int __devinit dme1737_isa_probe(struct platform_device *pdev)
                dev_err(dev, "Failed to request region 0x%04x-0x%04x.\n",
                        (unsigned short)res->start,
                        (unsigned short)res->start + DME1737_EXTENT - 1);
-                err = -EBUSY;
-                goto exit;
-        }
+               err = -EBUSY;
+               goto exit;
+       }
 
-       if (!(data = kzalloc(sizeof(struct dme1737_data), GFP_KERNEL))) {
+       data = kzalloc(sizeof(struct dme1737_data), GFP_KERNEL);
+       if (!data) {
                err = -ENOMEM;
                goto exit_release_region;
        }
@@ -2565,13 +2623,15 @@ static int __devinit dme1737_isa_probe(struct platform_device *pdev)
                 data->type == sch5127 ? "SCH5127" : "SCH311x", data->addr);
 
        /* Initialize the chip */
-       if ((err = dme1737_init_device(dev))) {
+       err = dme1737_init_device(dev);
+       if (err) {
                dev_err(dev, "Failed to initialize device.\n");
                goto exit_kfree;
        }
 
        /* Create sysfs files */
-       if ((err = dme1737_create_files(dev))) {
+       err = dme1737_create_files(dev);
+       if (err) {
                dev_err(dev, "Failed to create sysfs files.\n");
                goto exit_kfree;
        }
@@ -2628,7 +2688,8 @@ static int __init dme1737_init(void)
        int err;
        unsigned short addr;
 
-       if ((err = i2c_add_driver(&dme1737_i2c_driver))) {
+       err = i2c_add_driver(&dme1737_i2c_driver);
+       if (err) {
                goto exit;
        }
 
@@ -2641,12 +2702,14 @@ static int __init dme1737_init(void)
                return 0;
        }
 
-       if ((err = platform_driver_register(&dme1737_isa_driver))) {
+       err = platform_driver_register(&dme1737_isa_driver);
+       if (err) {
                goto exit_del_i2c_driver;
        }
 
        /* Sets global pdev as a side effect */
-       if ((err = dme1737_isa_device_add(addr))) {
+       err = dme1737_isa_device_add(addr);
+       if (err) {
                goto exit_del_isa_driver;
        }
 
index 8dee3f3..5dea9fa 100644 (file)
@@ -269,23 +269,30 @@ static int emc1403_detect(struct i2c_client *client,
                        struct i2c_board_info *info)
 {
        int id;
-       /* Check if thermal chip is SMSC and EMC1403 */
+       /* Check if thermal chip is SMSC and EMC1403 or EMC1423 */
 
        id = i2c_smbus_read_byte_data(client, THERMAL_SMSC_ID_REG);
        if (id != 0x5d)
                return -ENODEV;
 
+       id = i2c_smbus_read_byte_data(client, THERMAL_PID_REG);
+       switch (id) {
+       case 0x21:
+               strlcpy(info->type, "emc1403", I2C_NAME_SIZE);
+               break;
+       case 0x23:
+               strlcpy(info->type, "emc1423", I2C_NAME_SIZE);
+               break;
        /* Note: 0x25 is the 1404 which is very similar and this
           driver could be extended */
-       id = i2c_smbus_read_byte_data(client, THERMAL_PID_REG);
-       if (id != 0x21)
+       default:
                return -ENODEV;
+       }
 
        id = i2c_smbus_read_byte_data(client, THERMAL_REVISION_REG);
        if (id != 0x01)
                return -ENODEV;
 
-       strlcpy(info->type, "emc1403", I2C_NAME_SIZE);
        return 0;
 }
 
@@ -342,6 +349,7 @@ static const unsigned short emc1403_address_list[] = {
 
 static const struct i2c_device_id emc1403_idtable[] = {
        { "emc1403", 0 },
+       { "emc1423", 0 },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, emc1403_idtable);
index d4d4ca6..aa6d8b6 100644 (file)
@@ -49,7 +49,6 @@
 #include <linux/kref.h>
 
 /* Addresses to scan */
-static DEFINE_MUTEX(watchdog_mutex);
 static const unsigned short normal_i2c[] = { 0x73, I2C_CLIENT_END };
 
 /* Insmod parameters */
@@ -850,7 +849,7 @@ static ssize_t watchdog_write(struct file *filp, const char __user *buf,
 
 static long watchdog_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 {
-       static struct watchdog_info ident = {
+       struct watchdog_info ident = {
                .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT |
                                WDIOF_CARDRESET,
                .identity = "FSC watchdog"
@@ -858,7 +857,6 @@ static long watchdog_ioctl(struct file *filp, unsigned int cmd, unsigned long ar
        int i, ret = 0;
        struct fschmd_data *data = filp->private_data;
 
-       mutex_lock(&watchdog_mutex);
        switch (cmd) {
        case WDIOC_GETSUPPORT:
                ident.firmware_version = data->revision;
@@ -915,7 +913,6 @@ static long watchdog_ioctl(struct file *filp, unsigned int cmd, unsigned long ar
        default:
                ret = -ENOTTY;
        }
-       mutex_unlock(&watchdog_mutex);
        return ret;
 }
 
index a428a92..316b648 100644 (file)
@@ -38,6 +38,8 @@
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
@@ -1570,26 +1572,25 @@ static int __init it87_find(unsigned short *address,
        case 0xffff:    /* No device at all */
                goto exit;
        default:
-               pr_debug(DRVNAME ": Unsupported chip (DEVID=0x%x)\n",
-                        chip_type);
+               pr_debug("Unsupported chip (DEVID=0x%x)\n", chip_type);
                goto exit;
        }
 
        superio_select(PME);
        if (!(superio_inb(IT87_ACT_REG) & 0x01)) {
-               pr_info("it87: Device not activated, skipping\n");
+               pr_info("Device not activated, skipping\n");
                goto exit;
        }
 
        *address = superio_inw(IT87_BASE_REG) & ~(IT87_EXTENT - 1);
        if (*address == 0) {
-               pr_info("it87: Base address not set, skipping\n");
+               pr_info("Base address not set, skipping\n");
                goto exit;
        }
 
        err = 0;
        sio_data->revision = superio_inb(DEVREV) & 0x0f;
-       pr_info("it87: Found IT%04xF chip at 0x%x, revision %d\n",
+       pr_info("Found IT%04xF chip at 0x%x, revision %d\n",
                chip_type, *address, sio_data->revision);
 
        /* in8 (Vbat) is always internal */
@@ -1615,7 +1616,7 @@ static int __init it87_find(unsigned short *address,
                } else {
                        /* We need at least 4 VID pins */
                        if (reg & 0x0f) {
-                               pr_info("it87: VID is disabled (pins used for GPIO)\n");
+                               pr_info("VID is disabled (pins used for GPIO)\n");
                                sio_data->skip_vid = 1;
                        }
                }
@@ -1651,7 +1652,7 @@ static int __init it87_find(unsigned short *address,
                if (sio_data->type == it8720 && !(reg & (1 << 1))) {
                        reg |= (1 << 1);
                        superio_outb(IT87_SIO_PINX2_REG, reg);
-                       pr_notice("it87: Routing internal VCCH to in7\n");
+                       pr_notice("Routing internal VCCH to in7\n");
                }
                if (reg & (1 << 0))
                        sio_data->internal |= (1 << 0);
@@ -1661,7 +1662,7 @@ static int __init it87_find(unsigned short *address,
                sio_data->beep_pin = superio_inb(IT87_SIO_BEEP_PIN_REG) & 0x3f;
        }
        if (sio_data->beep_pin)
-               pr_info("it87: Beeping is supported\n");
+               pr_info("Beeping is supported\n");
 
        /* Disable specific features based on DMI strings */
        board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR);
@@ -1675,8 +1676,7 @@ static int __init it87_find(unsigned short *address,
                           the PWM2 duty cycle, so we disable it.
                           I use the board name string as the trigger in case
                           the same board is ever used in other systems. */
-                       pr_info("it87: Disabling pwm2 due to "
-                               "hardware constraints\n");
+                       pr_info("Disabling pwm2 due to hardware constraints\n");
                        sio_data->skip_pwm = (1 << 1);
                }
        }
@@ -2189,28 +2189,26 @@ static int __init it87_device_add(unsigned short address,
        pdev = platform_device_alloc(DRVNAME, address);
        if (!pdev) {
                err = -ENOMEM;
-               printk(KERN_ERR DRVNAME ": Device allocation failed\n");
+               pr_err("Device allocation failed\n");
                goto exit;
        }
 
        err = platform_device_add_resources(pdev, &res, 1);
        if (err) {
-               printk(KERN_ERR DRVNAME ": Device resource addition failed "
-                      "(%d)\n", err);
+               pr_err("Device resource addition failed (%d)\n", err);
                goto exit_device_put;
        }
 
        err = platform_device_add_data(pdev, sio_data,
                                       sizeof(struct it87_sio_data));
        if (err) {
-               printk(KERN_ERR DRVNAME ": Platform data allocation failed\n");
+               pr_err("Platform data allocation failed\n");
                goto exit_device_put;
        }
 
        err = platform_device_add(pdev);
        if (err) {
-               printk(KERN_ERR DRVNAME ": Device addition failed (%d)\n",
-                      err);
+               pr_err("Device addition failed (%d)\n", err);
                goto exit_device_put;
        }
 
index 72ff2c4..4cb24ea 100644 (file)
@@ -19,6 +19,8 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
@@ -858,7 +860,7 @@ static int __init lm78_isa_found(unsigned short address)
         * individually for the probing phase. */
        for (port = address; port < address + LM78_EXTENT; port++) {
                if (!request_region(port, 1, "lm78")) {
-                       pr_debug("lm78: Failed to request port 0x%x\n", port);
+                       pr_debug("Failed to request port 0x%x\n", port);
                        goto release;
                }
        }
@@ -920,7 +922,7 @@ static int __init lm78_isa_found(unsigned short address)
                found = 1;
 
        if (found)
-               pr_info("lm78: Found an %s chip at %#x\n",
+               pr_info("Found an %s chip at %#x\n",
                        val & 0x80 ? "LM79" : "LM78", (int)address);
 
  release:
@@ -942,21 +944,19 @@ static int __init lm78_isa_device_add(unsigned short address)
        pdev = platform_device_alloc("lm78", address);
        if (!pdev) {
                err = -ENOMEM;
-               printk(KERN_ERR "lm78: Device allocation failed\n");
+               pr_err("Device allocation failed\n");
                goto exit;
        }
 
        err = platform_device_add_resources(pdev, &res, 1);
        if (err) {
-               printk(KERN_ERR "lm78: Device resource addition failed "
-                      "(%d)\n", err);
+               pr_err("Device resource addition failed (%d)\n", err);
                goto exit_device_put;
        }
 
        err = platform_device_add(pdev);
        if (err) {
-               printk(KERN_ERR "lm78: Device addition failed (%d)\n",
-                      err);
+               pr_err("Device addition failed (%d)\n", err);
                goto exit_device_put;
        }
 
index 68e69a4..3d99b88 100644 (file)
@@ -33,6 +33,8 @@
  *  the standard Super-I/O addresses is used (0x2E/0x2F or 0x4E/0x4F).
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
@@ -1031,16 +1033,15 @@ static int __init pc87360_find(int sioaddr, u8 *devid, unsigned short *addresses
 
                val = superio_inb(sioaddr, ACT);
                if (!(val & 0x01)) {
-                       printk(KERN_INFO "pc87360: Device 0x%02x not "
-                              "activated\n", logdev[i]);
+                       pr_info("Device 0x%02x not activated\n", logdev[i]);
                        continue;
                }
 
                val = (superio_inb(sioaddr, BASE) << 8)
                    | superio_inb(sioaddr, BASE + 1);
                if (!val) {
-                       printk(KERN_INFO "pc87360: Base address not set for "
-                              "device 0x%02x\n", logdev[i]);
+                       pr_info("Base address not set for device 0x%02x\n",
+                               logdev[i]);
                        continue;
                }
 
@@ -1050,17 +1051,15 @@ static int __init pc87360_find(int sioaddr, u8 *devid, unsigned short *addresses
                        confreg[0] = superio_inb(sioaddr, 0xF0);
                        confreg[1] = superio_inb(sioaddr, 0xF1);
 
-#ifdef DEBUG
-                       printk(KERN_DEBUG "pc87360: Fan 1: mon=%d "
-                              "ctrl=%d inv=%d\n", (confreg[0]>>2)&1,
-                              (confreg[0]>>3)&1, (confreg[0]>>4)&1);
-                       printk(KERN_DEBUG "pc87360: Fan 2: mon=%d "
-                              "ctrl=%d inv=%d\n", (confreg[0]>>5)&1,
-                              (confreg[0]>>6)&1, (confreg[0]>>7)&1);
-                       printk(KERN_DEBUG "pc87360: Fan 3: mon=%d "
-                              "ctrl=%d inv=%d\n", confreg[1]&1,
-                              (confreg[1]>>1)&1, (confreg[1]>>2)&1);
-#endif
+                       pr_debug("Fan %d: mon=%d ctrl=%d inv=%d\n", 1,
+                                (confreg[0] >> 2) & 1, (confreg[0] >> 3) & 1,
+                                (confreg[0] >> 4) & 1);
+                       pr_debug("Fan %d: mon=%d ctrl=%d inv=%d\n", 2,
+                                (confreg[0] >> 5) & 1, (confreg[0] >> 6) & 1,
+                                (confreg[0] >> 7) & 1);
+                       pr_debug("Fan %d: mon=%d ctrl=%d inv=%d\n", 3,
+                                confreg[1] & 1, (confreg[1] >> 1) & 1,
+                                (confreg[1] >> 2) & 1);
                } else if (i==1) { /* Voltages */
                        /* Are we using thermistors? */
                        if (*devid == 0xE9) { /* PC87366 */
@@ -1071,14 +1070,12 @@ static int __init pc87360_find(int sioaddr, u8 *devid, unsigned short *addresses
                                confreg[3] = superio_inb(sioaddr, 0x25);
 
                                if (confreg[2] & 0x40) {
-                                       printk(KERN_INFO "pc87360: Using "
-                                              "thermistors for temperature "
-                                              "monitoring\n");
+                                       pr_info("Using thermistors for "
+                                               "temperature monitoring\n");
                                }
                                if (confreg[3] & 0xE0) {
-                                       printk(KERN_INFO "pc87360: VID "
-                                              "inputs routed (mode %u)\n",
-                                              confreg[3] >> 5);
+                                       pr_info("VID inputs routed (mode %u)\n",
+                                               confreg[3] >> 5);
                                }
                        }
                }
@@ -1616,7 +1613,7 @@ static int __init pc87360_device_add(unsigned short address)
        pdev = platform_device_alloc("pc87360", address);
        if (!pdev) {
                err = -ENOMEM;
-               printk(KERN_ERR "pc87360: Device allocation failed\n");
+               pr_err("Device allocation failed\n");
                goto exit;
        }
 
@@ -1639,15 +1636,13 @@ static int __init pc87360_device_add(unsigned short address)
 
        err = platform_device_add_resources(pdev, res, res_count);
        if (err) {
-               printk(KERN_ERR "pc87360: Device resources addition failed "
-                      "(%d)\n", err);
+               pr_err("Device resources addition failed (%d)\n", err);
                goto exit_device_put;
        }
 
        err = platform_device_add(pdev);
        if (err) {
-               printk(KERN_ERR "pc87360: Device addition failed (%d)\n",
-                      err);
+               pr_err("Device addition failed (%d)\n", err);
                goto exit_device_put;
        }
 
@@ -1666,8 +1661,7 @@ static int __init pc87360_init(void)
 
        if (pc87360_find(0x2e, &devid, extra_isa)
         && pc87360_find(0x4e, &devid, extra_isa)) {
-               printk(KERN_WARNING "pc87360: PC8736x not detected, "
-                      "module not inserted.\n");
+               pr_warn("PC8736x not detected, module not inserted\n");
                return -ENODEV;
        }
 
@@ -1680,8 +1674,7 @@ static int __init pc87360_init(void)
        }
 
        if (address == 0x0000) {
-               printk(KERN_WARNING "pc87360: No active logical device, "
-                      "module not inserted.\n");
+               pr_warn("No active logical device, module not inserted\n");
                return -ENODEV;
        }
 
index 9ec4daa..8da2181 100644 (file)
@@ -22,6 +22,8 @@
  *  mode, and voltages aren't supported at all.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
@@ -1077,7 +1079,7 @@ static int __devinit pc87427_probe(struct platform_device *pdev)
        data = kzalloc(sizeof(struct pc87427_data), GFP_KERNEL);
        if (!data) {
                err = -ENOMEM;
-               printk(KERN_ERR DRVNAME ": Out of memory\n");
+               pr_err("Out of memory\n");
                goto exit;
        }
 
@@ -1196,28 +1198,26 @@ static int __init pc87427_device_add(const struct pc87427_sio_data *sio_data)
        pdev = platform_device_alloc(DRVNAME, res[0].start);
        if (!pdev) {
                err = -ENOMEM;
-               printk(KERN_ERR DRVNAME ": Device allocation failed\n");
+               pr_err("Device allocation failed\n");
                goto exit;
        }
 
        err = platform_device_add_resources(pdev, res, res_count);
        if (err) {
-               printk(KERN_ERR DRVNAME ": Device resource addition failed "
-                      "(%d)\n", err);
+               pr_err("Device resource addition failed (%d)\n", err);
                goto exit_device_put;
        }
 
        err = platform_device_add_data(pdev, sio_data,
                                       sizeof(struct pc87427_sio_data));
        if (err) {
-               printk(KERN_ERR DRVNAME ": Platform data allocation failed\n");
+               pr_err("Platform data allocation failed\n");
                goto exit_device_put;
        }
 
        err = platform_device_add(pdev);
        if (err) {
-               printk(KERN_ERR DRVNAME ": Device addition failed (%d)\n",
-                      err);
+               pr_err("Device addition failed (%d)\n", err);
                goto exit_device_put;
        }
 
@@ -1249,23 +1249,23 @@ static int __init pc87427_find(int sioaddr, struct pc87427_sio_data *sio_data)
 
                val = superio_inb(sioaddr, SIOREG_ACT);
                if (!(val & 0x01)) {
-                       printk(KERN_INFO DRVNAME ": Logical device 0x%02x "
-                              "not activated\n", logdev[i]);
+                       pr_info("Logical device 0x%02x not activated\n",
+                               logdev[i]);
                        continue;
                }
 
                val = superio_inb(sioaddr, SIOREG_MAP);
                if (val & 0x01) {
-                       printk(KERN_WARNING DRVNAME ": Logical device 0x%02x "
-                              "is memory-mapped, can't use\n", logdev[i]);
+                       pr_warn("Logical device 0x%02x is memory-mapped, "
+                               "can't use\n", logdev[i]);
                        continue;
                }
 
                val = (superio_inb(sioaddr, SIOREG_IOBASE) << 8)
                    | superio_inb(sioaddr, SIOREG_IOBASE + 1);
                if (!val) {
-                       printk(KERN_INFO DRVNAME ": I/O base address not set "
-                              "for logical device 0x%02x\n", logdev[i]);
+                       pr_info("I/O base address not set for logical device "
+                               "0x%02x\n", logdev[i]);
                        continue;
                }
                sio_data->address[i] = val;
index 13e8d21..25e9166 100644 (file)
@@ -689,6 +689,13 @@ static int __devexit via686a_remove(struct platform_device *pdev)
        return 0;
 }
 
+static void via686a_update_fan_div(struct via686a_data *data)
+{
+       int reg = via686a_read_value(data, VIA686A_REG_FANDIV);
+       data->fan_div[0] = (reg >> 4) & 0x03;
+       data->fan_div[1] = reg >> 6;
+}
+
 static void __devinit via686a_init_device(struct via686a_data *data)
 {
        u8 reg;
@@ -702,6 +709,9 @@ static void __devinit via686a_init_device(struct via686a_data *data)
        via686a_write_value(data, VIA686A_REG_TEMP_MODE,
                            (reg & ~VIA686A_TEMP_MODE_MASK)
                            | VIA686A_TEMP_MODE_CONTINUOUS);
+
+       /* Pre-read fan clock divisor values */
+       via686a_update_fan_div(data);
 }
 
 static struct via686a_data *via686a_update_device(struct device *dev)
@@ -753,9 +763,7 @@ static struct via686a_data *via686a_update_device(struct device *dev)
                    (via686a_read_value(data, VIA686A_REG_TEMP_LOW23) &
                     0xc0) >> 6;
 
-               i = via686a_read_value(data, VIA686A_REG_FANDIV);
-               data->fan_div[0] = (i >> 4) & 0x03;
-               data->fan_div[1] = i >> 6;
+               via686a_update_fan_div(data);
                data->alarms =
                    via686a_read_value(data,
                                       VIA686A_REG_ALARM1) |
index c84b9b4..eed43a0 100644 (file)
@@ -33,6 +33,8 @@
 
 */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
@@ -1798,8 +1800,7 @@ w83781d_isa_found(unsigned short address)
         * individually for the probing phase. */
        for (port = address; port < address + W83781D_EXTENT; port++) {
                if (!request_region(port, 1, "w83781d")) {
-                       pr_debug("w83781d: Failed to request port 0x%x\n",
-                                port);
+                       pr_debug("Failed to request port 0x%x\n", port);
                        goto release;
                }
        }
@@ -1811,7 +1812,7 @@ w83781d_isa_found(unsigned short address)
        if (inb_p(address + 2) != val
         || inb_p(address + 3) != val
         || inb_p(address + 7) != val) {
-               pr_debug("w83781d: Detection failed at step 1\n");
+               pr_debug("Detection failed at step %d\n", 1);
                goto release;
        }
 #undef REALLY_SLOW_IO
@@ -1820,14 +1821,14 @@ w83781d_isa_found(unsigned short address)
           MSB (busy flag) should be clear initially, set after the write. */
        save = inb_p(address + W83781D_ADDR_REG_OFFSET);
        if (save & 0x80) {
-               pr_debug("w83781d: Detection failed at step 2\n");
+               pr_debug("Detection failed at step %d\n", 2);
                goto release;
        }
        val = ~save & 0x7f;
        outb_p(val, address + W83781D_ADDR_REG_OFFSET);
        if (inb_p(address + W83781D_ADDR_REG_OFFSET) != (val | 0x80)) {
                outb_p(save, address + W83781D_ADDR_REG_OFFSET);
-               pr_debug("w83781d: Detection failed at step 3\n");
+               pr_debug("Detection failed at step %d\n", 3);
                goto release;
        }
 
@@ -1835,7 +1836,7 @@ w83781d_isa_found(unsigned short address)
        outb_p(W83781D_REG_CONFIG, address + W83781D_ADDR_REG_OFFSET);
        val = inb_p(address + W83781D_DATA_REG_OFFSET);
        if (val & 0x80) {
-               pr_debug("w83781d: Detection failed at step 4\n");
+               pr_debug("Detection failed at step %d\n", 4);
                goto release;
        }
        outb_p(W83781D_REG_BANK, address + W83781D_ADDR_REG_OFFSET);
@@ -1844,19 +1845,19 @@ w83781d_isa_found(unsigned short address)
        val = inb_p(address + W83781D_DATA_REG_OFFSET);
        if ((!(save & 0x80) && (val != 0xa3))
         || ((save & 0x80) && (val != 0x5c))) {
-               pr_debug("w83781d: Detection failed at step 5\n");
+               pr_debug("Detection failed at step %d\n", 5);
                goto release;
        }
        outb_p(W83781D_REG_I2C_ADDR, address + W83781D_ADDR_REG_OFFSET);
        val = inb_p(address + W83781D_DATA_REG_OFFSET);
        if (val < 0x03 || val > 0x77) { /* Not a valid I2C address */
-               pr_debug("w83781d: Detection failed at step 6\n");
+               pr_debug("Detection failed at step %d\n", 6);
                goto release;
        }
 
        /* The busy flag should be clear again */
        if (inb_p(address + W83781D_ADDR_REG_OFFSET) & 0x80) {
-               pr_debug("w83781d: Detection failed at step 7\n");
+               pr_debug("Detection failed at step %d\n", 7);
                goto release;
        }
 
@@ -1871,7 +1872,7 @@ w83781d_isa_found(unsigned short address)
                found = 1;
 
        if (found)
-               pr_info("w83781d: Found a %s chip at %#x\n",
+               pr_info("Found a %s chip at %#x\n",
                        val == 0x30 ? "W83782D" : "W83781D", (int)address);
 
  release:
@@ -1894,21 +1895,19 @@ w83781d_isa_device_add(unsigned short address)
        pdev = platform_device_alloc("w83781d", address);
        if (!pdev) {
                err = -ENOMEM;
-               printk(KERN_ERR "w83781d: Device allocation failed\n");
+               pr_err("Device allocation failed\n");
                goto exit;
        }
 
        err = platform_device_add_resources(pdev, &res, 1);
        if (err) {
-               printk(KERN_ERR "w83781d: Device resource addition failed "
-                      "(%d)\n", err);
+               pr_err("Device resource addition failed (%d)\n", err);
                goto exit_device_put;
        }
 
        err = platform_device_add(pdev);
        if (err) {
-               printk(KERN_ERR "w83781d: Device addition failed (%d)\n",
-                      err);
+               pr_err("Device addition failed (%d)\n", err);
                goto exit_device_put;
        }
 
index 679718e..63841f8 100644 (file)
@@ -691,7 +691,7 @@ store_pwm_mode(struct device *dev, struct device_attribute *attr,
 }
 
 static ssize_t
-show_regs_chassis(struct device *dev, struct device_attribute *attr,
+show_chassis(struct device *dev, struct device_attribute *attr,
                        char *buf)
 {
        struct w83792d_data *data = w83792d_update_device(dev);
@@ -699,6 +699,16 @@ show_regs_chassis(struct device *dev, struct device_attribute *attr,
 }
 
 static ssize_t
+show_regs_chassis(struct device *dev, struct device_attribute *attr,
+                       char *buf)
+{
+       dev_warn(dev,
+                "Attribute %s is deprecated, use intrusion0_alarm instead\n",
+                "chassis");
+       return show_chassis(dev, attr, buf);
+}
+
+static ssize_t
 show_chassis_clear(struct device *dev, struct device_attribute *attr, char *buf)
 {
        struct w83792d_data *data = w83792d_update_device(dev);
@@ -706,7 +716,7 @@ show_chassis_clear(struct device *dev, struct device_attribute *attr, char *buf)
 }
 
 static ssize_t
-store_chassis_clear(struct device *dev, struct device_attribute *attr,
+store_chassis_clear_legacy(struct device *dev, struct device_attribute *attr,
                        const char *buf, size_t count)
 {
        struct i2c_client *client = to_i2c_client(dev);
@@ -714,6 +724,10 @@ store_chassis_clear(struct device *dev, struct device_attribute *attr,
        u32 val;
        u8 temp1 = 0, temp2 = 0;
 
+       dev_warn(dev,
+                "Attribute %s is deprecated, use intrusion0_alarm instead\n",
+                "chassis_clear");
+
        val = simple_strtoul(buf, NULL, 10);
        mutex_lock(&data->update_lock);
        data->chassis_clear = SENSORS_LIMIT(val, 0 ,1);
@@ -726,6 +740,27 @@ store_chassis_clear(struct device *dev, struct device_attribute *attr,
        return count;
 }
 
+static ssize_t
+store_chassis_clear(struct device *dev, struct device_attribute *attr,
+                       const char *buf, size_t count)
+{
+       struct i2c_client *client = to_i2c_client(dev);
+       struct w83792d_data *data = i2c_get_clientdata(client);
+       unsigned long val;
+       u8 reg;
+
+       if (strict_strtoul(buf, 10, &val) || val != 0)
+               return -EINVAL;
+
+       mutex_lock(&data->update_lock);
+       reg = w83792d_read_value(client, W83792D_REG_CHASSIS_CLR);
+       w83792d_write_value(client, W83792D_REG_CHASSIS_CLR, reg | 0x80);
+       data->valid = 0;                /* Force cache refresh */
+       mutex_unlock(&data->update_lock);
+
+       return count;
+}
+
 /* For Smart Fan I / Thermal Cruise */
 static ssize_t
 show_thermal_cruise(struct device *dev, struct device_attribute *attr,
@@ -1012,7 +1047,9 @@ static SENSOR_DEVICE_ATTR(fan5_alarm, S_IRUGO, show_alarm, NULL, 22);
 static SENSOR_DEVICE_ATTR(fan6_alarm, S_IRUGO, show_alarm, NULL, 23);
 static DEVICE_ATTR(chassis, S_IRUGO, show_regs_chassis, NULL);
 static DEVICE_ATTR(chassis_clear, S_IRUGO | S_IWUSR,
-                       show_chassis_clear, store_chassis_clear);
+                       show_chassis_clear, store_chassis_clear_legacy);
+static DEVICE_ATTR(intrusion0_alarm, S_IRUGO | S_IWUSR,
+                       show_chassis, store_chassis_clear);
 static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm, store_pwm, 0);
 static SENSOR_DEVICE_ATTR(pwm2, S_IWUSR | S_IRUGO, show_pwm, store_pwm, 1);
 static SENSOR_DEVICE_ATTR(pwm3, S_IWUSR | S_IRUGO, show_pwm, store_pwm, 2);
@@ -1214,6 +1251,7 @@ static struct attribute *w83792d_attributes[] = {
        &dev_attr_alarms.attr,
        &dev_attr_chassis.attr,
        &dev_attr_chassis_clear.attr,
+       &dev_attr_intrusion0_alarm.attr,
        &sensor_dev_attr_tolerance1.dev_attr.attr,
        &sensor_dev_attr_thermal_cruise1.dev_attr.attr,
        &sensor_dev_attr_tolerance2.dev_attr.attr,
index 8e540ad..e3bdedf 100644 (file)
@@ -51,7 +51,6 @@
 #define WATCHDOG_TIMEOUT 2     /* 2 minute default timeout */
 
 /* Addresses to scan */
-static DEFINE_MUTEX(watchdog_mutex);
 static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f,
                                                I2C_CLIENT_END };
 
@@ -421,14 +420,17 @@ store_beep_enable(struct device *dev, struct device_attribute *attr,
 
 /* Write any value to clear chassis alarm */
 static ssize_t
-store_chassis_clear(struct device *dev,
-                   struct device_attribute *attr, const char *buf,
-                   size_t count)
+store_chassis_clear_legacy(struct device *dev,
+                          struct device_attribute *attr, const char *buf,
+                          size_t count)
 {
        struct i2c_client *client = to_i2c_client(dev);
        struct w83793_data *data = i2c_get_clientdata(client);
        u8 val;
 
+       dev_warn(dev, "Attribute chassis is deprecated, "
+                "use intrusion0_alarm instead\n");
+
        mutex_lock(&data->update_lock);
        val = w83793_read_value(client, W83793_REG_CLR_CHASSIS);
        val |= 0x80;
@@ -437,6 +439,28 @@ store_chassis_clear(struct device *dev,
        return count;
 }
 
+/* Write 0 to clear chassis alarm */
+static ssize_t
+store_chassis_clear(struct device *dev,
+                   struct device_attribute *attr, const char *buf,
+                   size_t count)
+{
+       struct i2c_client *client = to_i2c_client(dev);
+       struct w83793_data *data = i2c_get_clientdata(client);
+       unsigned long val;
+       u8 reg;
+
+       if (strict_strtoul(buf, 10, &val) || val != 0)
+               return -EINVAL;
+
+       mutex_lock(&data->update_lock);
+       reg = w83793_read_value(client, W83793_REG_CLR_CHASSIS);
+       w83793_write_value(client, W83793_REG_CLR_CHASSIS, reg | 0x80);
+       data->valid = 0;                /* Force cache refresh */
+       mutex_unlock(&data->update_lock);
+       return count;
+}
+
 #define FAN_INPUT                      0
 #define FAN_MIN                                1
 static ssize_t
@@ -1102,6 +1126,8 @@ static DEVICE_ATTR(vrm, S_IWUSR | S_IRUGO, show_vrm, store_vrm);
 
 static struct sensor_device_attribute_2 sda_single_files[] = {
        SENSOR_ATTR_2(chassis, S_IWUSR | S_IRUGO, show_alarm_beep,
+                     store_chassis_clear_legacy, ALARM_STATUS, 30),
+       SENSOR_ATTR_2(intrusion0_alarm, S_IWUSR | S_IRUGO, show_alarm_beep,
                      store_chassis_clear, ALARM_STATUS, 30),
        SENSOR_ATTR_2(beep_enable, S_IWUSR | S_IRUGO, show_beep_enable,
                      store_beep_enable, NOT_USED, NOT_USED),
@@ -1323,7 +1349,7 @@ static ssize_t watchdog_write(struct file *filp, const char __user *buf,
 static long watchdog_ioctl(struct file *filp, unsigned int cmd,
                           unsigned long arg)
 {
-       static struct watchdog_info ident = {
+       struct watchdog_info ident = {
                .options = WDIOF_KEEPALIVEPING |
                           WDIOF_SETTIMEOUT |
                           WDIOF_CARDRESET,
@@ -1333,7 +1359,6 @@ static long watchdog_ioctl(struct file *filp, unsigned int cmd,
        int val, ret = 0;
        struct w83793_data *data = filp->private_data;
 
-       mutex_lock(&watchdog_mutex);
        switch (cmd) {
        case WDIOC_GETSUPPORT:
                if (!nowayout)
@@ -1387,7 +1412,6 @@ static long watchdog_ioctl(struct file *filp, unsigned int cmd,
        default:
                ret = -ENOTTY;
        }
-       mutex_unlock(&watchdog_mutex);
        return ret;
 }
 
index cdbc744..845232d 100644 (file)
@@ -458,6 +458,7 @@ static void w83795_update_limits(struct i2c_client *client)
 {
        struct w83795_data *data = i2c_get_clientdata(client);
        int i, limit;
+       u8 lsb;
 
        /* Read the voltage limits */
        for (i = 0; i < ARRAY_SIZE(data->in); i++) {
@@ -479,9 +480,8 @@ static void w83795_update_limits(struct i2c_client *client)
        }
 
        /* Read the fan limits */
+       lsb = 0; /* Silent false gcc warning */
        for (i = 0; i < ARRAY_SIZE(data->fan); i++) {
-               u8 lsb;
-
                /* Each register contains LSB for 2 fans, but we want to
                 * read it only once to save time */
                if ((i & 1) == 0 && (data->has_fan & (3 << i)))