rtc: switch to using is_visible() to control sysfs attributes
Instead of creating wakealarm attribute manually, after the device has been registered, let's rely on facilities provided by the attribute groups to control which attributes are visible and which are not. This allows to create all needed attributes at once, at the same time that we register RTC class device. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
This commit is contained in:

committed by
Alexandre Belloni

parent
a17ccd1c6a
commit
3ee2c40b7a
@@ -202,6 +202,7 @@ struct rtc_device *rtc_device_register(const char *name, struct device *dev,
|
||||
rtc->max_user_freq = 64;
|
||||
rtc->dev.parent = dev;
|
||||
rtc->dev.class = rtc_class;
|
||||
rtc->dev.groups = rtc_get_dev_attribute_groups();
|
||||
rtc->dev.release = rtc_device_release;
|
||||
|
||||
mutex_init(&rtc->ops_lock);
|
||||
@@ -240,7 +241,6 @@ struct rtc_device *rtc_device_register(const char *name, struct device *dev,
|
||||
}
|
||||
|
||||
rtc_dev_add_device(rtc);
|
||||
rtc_sysfs_add_device(rtc);
|
||||
rtc_proc_add_device(rtc);
|
||||
|
||||
dev_info(dev, "rtc core: registered %s as %s\n",
|
||||
@@ -271,7 +271,6 @@ void rtc_device_unregister(struct rtc_device *rtc)
|
||||
* Remove innards of this RTC, then disable it, before
|
||||
* letting any rtc_class_open() users access it again
|
||||
*/
|
||||
rtc_sysfs_del_device(rtc);
|
||||
rtc_dev_del_device(rtc);
|
||||
rtc_proc_del_device(rtc);
|
||||
device_del(&rtc->dev);
|
||||
@@ -360,7 +359,6 @@ static int __init rtc_init(void)
|
||||
}
|
||||
rtc_class->pm = RTC_CLASS_DEV_PM_OPS;
|
||||
rtc_dev_init();
|
||||
rtc_sysfs_init(rtc_class);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user