diff options
author | Guenter Roeck <linux@roeck-us.net> | 2016-06-19 20:56:22 -0400 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2016-07-09 11:33:47 -0400 |
commit | 5f7e5e29ab60967a009d307dc4fdecce57efaa9c (patch) | |
tree | af962fec6073ea173b8e16b04fa6a80afb65d3d9 | |
parent | 38aefb41b3803873dc366918a2e22f22dca78eac (diff) |
hwmon: (lm75) Add update_interval attribute
Since we know the chip's update interval, let's make it available
to the user.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r-- | drivers/hwmon/lm75.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c index 7b18cbd4a5ec..fe83f70ba62a 100644 --- a/drivers/hwmon/lm75.c +++ b/drivers/hwmon/lm75.c | |||
@@ -159,16 +159,29 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *da, | |||
159 | return count; | 159 | return count; |
160 | } | 160 | } |
161 | 161 | ||
162 | static ssize_t show_update_interval(struct device *dev, | ||
163 | struct device_attribute *da, char *buf) | ||
164 | { | ||
165 | struct lm75_data *data = lm75_update_device(dev); | ||
166 | |||
167 | if (IS_ERR(data)) | ||
168 | return PTR_ERR(data); | ||
169 | |||
170 | return sprintf(buf, "%u\n", jiffies_to_msecs(data->sample_time)); | ||
171 | } | ||
172 | |||
162 | static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, | 173 | static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, |
163 | show_temp, set_temp, 1); | 174 | show_temp, set_temp, 1); |
164 | static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IWUSR | S_IRUGO, | 175 | static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IWUSR | S_IRUGO, |
165 | show_temp, set_temp, 2); | 176 | show_temp, set_temp, 2); |
166 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0); | 177 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0); |
178 | static DEVICE_ATTR(update_interval, S_IRUGO, show_update_interval, NULL); | ||
167 | 179 | ||
168 | static struct attribute *lm75_attrs[] = { | 180 | static struct attribute *lm75_attrs[] = { |
169 | &sensor_dev_attr_temp1_input.dev_attr.attr, | 181 | &sensor_dev_attr_temp1_input.dev_attr.attr, |
170 | &sensor_dev_attr_temp1_max.dev_attr.attr, | 182 | &sensor_dev_attr_temp1_max.dev_attr.attr, |
171 | &sensor_dev_attr_temp1_max_hyst.dev_attr.attr, | 183 | &sensor_dev_attr_temp1_max_hyst.dev_attr.attr, |
184 | &dev_attr_update_interval.attr, | ||
172 | 185 | ||
173 | NULL | 186 | NULL |
174 | }; | 187 | }; |