Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1f08af7ea95e0f4ec632664b9f21a687426df658
Commit:     1f08af7ea95e0f4ec632664b9f21a687426df658
Parent:     71062ffcd5173b8291ee80e84711b619b34a64eb
Author:     Jean Delvare <[EMAIL PROTECTED]>
AuthorDate: Sun Jan 6 15:36:13 2008 +0100
Committer:  Mark M. Hoffman <[EMAIL PROTECTED]>
CommitDate: Sun Feb 17 09:27:18 2008 -0500

    hwmon: (smsc47m1) Add individual alarm files
    
    The new libsensors needs these individual alarm files.
    
    Signed-off-by: Jean Delvare <[EMAIL PROTECTED]>
    Acked-by: Juerg Haefliger <juergh at gmail.com>
    Signed-off-by: Mark M. Hoffman <[EMAIL PROTECTED]>
---
 drivers/hwmon/smsc47m1.c |   25 ++++++++++++++++++++++---
 1 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c
index 0d7f0c4..d1b4985 100644
--- a/drivers/hwmon/smsc47m1.c
+++ b/drivers/hwmon/smsc47m1.c
@@ -198,6 +198,14 @@ static ssize_t get_fan_div(struct device *dev, struct 
device_attribute
        return sprintf(buf, "%d\n", DIV_FROM_REG(data->fan_div[attr->index]));
 }
 
+static ssize_t get_fan_alarm(struct device *dev, struct device_attribute
+                            *devattr, char *buf)
+{
+       int bitnr = to_sensor_dev_attr(devattr)->index;
+       struct smsc47m1_data *data = smsc47m1_update_device(dev, 0);
+       return sprintf(buf, "%u\n", (data->alarms >> bitnr) & 1);
+}
+
 static ssize_t get_pwm(struct device *dev, struct device_attribute
                       *devattr, char *buf)
 {
@@ -347,6 +355,8 @@ static SENSOR_DEVICE_ATTR(fan##offset##_min, S_IRUGO | 
S_IWUSR,             \
                get_fan_min, set_fan_min, offset - 1);                  \
 static SENSOR_DEVICE_ATTR(fan##offset##_div, S_IRUGO | S_IWUSR,                
\
                get_fan_div, set_fan_div, offset - 1);                  \
+static SENSOR_DEVICE_ATTR(fan##offset##_alarm, S_IRUGO, get_fan_alarm, \
+               NULL, offset - 1);                                      \
 static SENSOR_DEVICE_ATTR(pwm##offset, S_IRUGO | S_IWUSR,              \
                get_pwm, set_pwm, offset - 1);                          \
 static SENSOR_DEVICE_ATTR(pwm##offset##_enable, S_IRUGO | S_IWUSR,     \
@@ -374,12 +384,15 @@ static struct attribute *smsc47m1_attributes[] = {
        &sensor_dev_attr_fan1_input.dev_attr.attr,
        &sensor_dev_attr_fan1_min.dev_attr.attr,
        &sensor_dev_attr_fan1_div.dev_attr.attr,
+       &sensor_dev_attr_fan1_alarm.dev_attr.attr,
        &sensor_dev_attr_fan2_input.dev_attr.attr,
        &sensor_dev_attr_fan2_min.dev_attr.attr,
        &sensor_dev_attr_fan2_div.dev_attr.attr,
+       &sensor_dev_attr_fan2_alarm.dev_attr.attr,
        &sensor_dev_attr_fan3_input.dev_attr.attr,
        &sensor_dev_attr_fan3_min.dev_attr.attr,
        &sensor_dev_attr_fan3_div.dev_attr.attr,
+       &sensor_dev_attr_fan3_alarm.dev_attr.attr,
 
        &sensor_dev_attr_pwm1.dev_attr.attr,
        &sensor_dev_attr_pwm1_enable.dev_attr.attr,
@@ -533,7 +546,9 @@ static int __devinit smsc47m1_probe(struct platform_device 
*pdev)
                 || (err = device_create_file(dev,
                                &sensor_dev_attr_fan1_min.dev_attr))
                 || (err = device_create_file(dev,
-                               &sensor_dev_attr_fan1_div.dev_attr)))
+                               &sensor_dev_attr_fan1_div.dev_attr))
+                || (err = device_create_file(dev,
+                               &sensor_dev_attr_fan1_alarm.dev_attr)))
                        goto error_remove_files;
        } else
                dev_dbg(dev, "Fan 1 not enabled by hardware, skipping\n");
@@ -544,7 +559,9 @@ static int __devinit smsc47m1_probe(struct platform_device 
*pdev)
                 || (err = device_create_file(dev,
                                &sensor_dev_attr_fan2_min.dev_attr))
                 || (err = device_create_file(dev,
-                               &sensor_dev_attr_fan2_div.dev_attr)))
+                               &sensor_dev_attr_fan2_div.dev_attr))
+                || (err = device_create_file(dev,
+                               &sensor_dev_attr_fan2_alarm.dev_attr)))
                        goto error_remove_files;
        } else
                dev_dbg(dev, "Fan 2 not enabled by hardware, skipping\n");
@@ -555,7 +572,9 @@ static int __devinit smsc47m1_probe(struct platform_device 
*pdev)
                 || (err = device_create_file(dev,
                                &sensor_dev_attr_fan3_min.dev_attr))
                 || (err = device_create_file(dev,
-                               &sensor_dev_attr_fan3_div.dev_attr)))
+                               &sensor_dev_attr_fan3_div.dev_attr))
+                || (err = device_create_file(dev,
+                               &sensor_dev_attr_fan3_alarm.dev_attr)))
                        goto error_remove_files;
        } else if (data->type == smsc47m2)
                dev_dbg(dev, "Fan 3 not enabled by hardware, skipping\n");
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to