aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/class.c
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@free-electrons.com>2017-07-06 05:42:02 -0400
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>2017-07-07 07:14:14 -0400
commit697e5a47aa12cdab6f2a8b284cc923cdf704eafc (patch)
tree3c2a9a02d436c6499896b7c9800a91c2e8185891 /drivers/rtc/class.c
parent735ae2056b3c7296bb188d079c020f606a679c4a (diff)
rtc: add generic nvmem support
Many RTCs have an on board non volatile storage. It can be battery backed RAM or an EEPROM. Use the nvmem subsystem to export it to both userspace and in-kernel consumers. This stays compatible with the previous (non documented) ABI that was using /sys/class/rtc/rtcx/device/nvram to export that memory. But will warn about the deprecation. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Diffstat (limited to 'drivers/rtc/class.c')
-rw-r--r--drivers/rtc/class.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c
index 58e2a05765bb..2ed970d61da1 100644
--- a/drivers/rtc/class.c
+++ b/drivers/rtc/class.c
@@ -290,6 +290,8 @@ EXPORT_SYMBOL_GPL(rtc_device_register);
290 */ 290 */
291void rtc_device_unregister(struct rtc_device *rtc) 291void rtc_device_unregister(struct rtc_device *rtc)
292{ 292{
293 rtc_nvmem_unregister(rtc);
294
293 mutex_lock(&rtc->ops_lock); 295 mutex_lock(&rtc->ops_lock);
294 /* 296 /*
295 * Remove innards of this RTC, then disable it, before 297 * Remove innards of this RTC, then disable it, before
@@ -448,6 +450,8 @@ int __rtc_register_device(struct module *owner, struct rtc_device *rtc)
448 450
449 rtc_proc_add_device(rtc); 451 rtc_proc_add_device(rtc);
450 452
453 rtc_nvmem_register(rtc);
454
451 rtc->registered = true; 455 rtc->registered = true;
452 dev_info(rtc->dev.parent, "registered as %s\n", 456 dev_info(rtc->dev.parent, "registered as %s\n",
453 dev_name(&rtc->dev)); 457 dev_name(&rtc->dev));