aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/ds1621.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2007-06-09 10:11:15 -0400
committerMark M. Hoffman <mhoffman@lightlink.com>2007-07-19 14:22:11 -0400
commit87f0f31baf9ea2cb273d7fb56b3ebf9df5096884 (patch)
treec23b7639b2925adef258e42ff3ad7471ba7ed4a7 /drivers/hwmon/ds1621.c
parent46a2e71ced949ecf238f796c178f85f03501ce88 (diff)
hwmon/ds1621: Create individual alarm files
Future versions of libsensors will need this. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'drivers/hwmon/ds1621.c')
-rw-r--r--drivers/hwmon/ds1621.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/hwmon/ds1621.c b/drivers/hwmon/ds1621.c
index 7ac156a1603e..1212d6b7f316 100644
--- a/drivers/hwmon/ds1621.c
+++ b/drivers/hwmon/ds1621.c
@@ -168,15 +168,29 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *da,
168 return sprintf(buf, "%d\n", ALARMS_FROM_REG(data->conf)); 168 return sprintf(buf, "%d\n", ALARMS_FROM_REG(data->conf));
169} 169}
170 170
171static ssize_t show_alarm(struct device *dev, struct device_attribute *da,
172 char *buf)
173{
174 struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
175 struct ds1621_data *data = ds1621_update_client(dev);
176 return sprintf(buf, "%d\n", !!(data->conf & attr->index));
177}
178
171static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); 179static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
172static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0); 180static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0);
173static SENSOR_DEVICE_ATTR(temp1_min, S_IWUSR | S_IRUGO, show_temp, set_temp, 1); 181static SENSOR_DEVICE_ATTR(temp1_min, S_IWUSR | S_IRUGO, show_temp, set_temp, 1);
174static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp, set_temp, 2); 182static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp, set_temp, 2);
183static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO, show_alarm, NULL,
184 DS1621_ALARM_TEMP_LOW);
185static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL,
186 DS1621_ALARM_TEMP_HIGH);
175 187
176static struct attribute *ds1621_attributes[] = { 188static struct attribute *ds1621_attributes[] = {
177 &sensor_dev_attr_temp1_input.dev_attr.attr, 189 &sensor_dev_attr_temp1_input.dev_attr.attr,
178 &sensor_dev_attr_temp1_min.dev_attr.attr, 190 &sensor_dev_attr_temp1_min.dev_attr.attr,
179 &sensor_dev_attr_temp1_max.dev_attr.attr, 191 &sensor_dev_attr_temp1_max.dev_attr.attr,
192 &sensor_dev_attr_temp1_min_alarm.dev_attr.attr,
193 &sensor_dev_attr_temp1_max_alarm.dev_attr.attr,
180 &dev_attr_alarms.attr, 194 &dev_attr_alarms.attr,
181 NULL 195 NULL
182}; 196};