summaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc/rtc-sysfs.c')
-rw-r--r--drivers/rtc/rtc-sysfs.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-sysfs.c b/drivers/rtc/rtc-sysfs.c
index 92ff2edb86a6..454da38c6012 100644
--- a/drivers/rtc/rtc-sysfs.c
+++ b/drivers/rtc/rtc-sysfs.c
@@ -248,6 +248,14 @@ offset_store(struct device *dev, struct device_attribute *attr,
248} 248}
249static DEVICE_ATTR_RW(offset); 249static DEVICE_ATTR_RW(offset);
250 250
251static ssize_t
252range_show(struct device *dev, struct device_attribute *attr, char *buf)
253{
254 return sprintf(buf, "[%lld,%llu]\n", to_rtc_device(dev)->range_min,
255 to_rtc_device(dev)->range_max);
256}
257static DEVICE_ATTR_RO(range);
258
251static struct attribute *rtc_attrs[] = { 259static struct attribute *rtc_attrs[] = {
252 &dev_attr_name.attr, 260 &dev_attr_name.attr,
253 &dev_attr_date.attr, 261 &dev_attr_date.attr,
@@ -257,6 +265,7 @@ static struct attribute *rtc_attrs[] = {
257 &dev_attr_hctosys.attr, 265 &dev_attr_hctosys.attr,
258 &dev_attr_wakealarm.attr, 266 &dev_attr_wakealarm.attr,
259 &dev_attr_offset.attr, 267 &dev_attr_offset.attr,
268 &dev_attr_range.attr,
260 NULL, 269 NULL,
261}; 270};
262 271
@@ -286,6 +295,9 @@ static umode_t rtc_attr_is_visible(struct kobject *kobj,
286 } else if (attr == &dev_attr_offset.attr) { 295 } else if (attr == &dev_attr_offset.attr) {
287 if (!rtc->ops->set_offset) 296 if (!rtc->ops->set_offset)
288 mode = 0; 297 mode = 0;
298 } else if (attr == &dev_attr_range.attr) {
299 if (!(rtc->range_max - rtc->range_min))
300 mode = 0;
289 } 301 }
290 302
291 return mode; 303 return mode;