summaryrefslogtreecommitdiff
path: root/drivers/rtc/class.c
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@free-electrons.com>2017-07-06 11:42:02 +0200
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>2017-07-07 13:14:14 +0200
commit697e5a47aa12cdab6f2a8b284cc923cdf704eafc (patch)
tree3c2a9a02d436c6499896b7c9800a91c2e8185891 /drivers/rtc/class.c
parent735ae2056b3c7296bb188d079c020f606a679c4a (diff)
downloadlwn-697e5a47aa12cdab6f2a8b284cc923cdf704eafc.tar.gz
lwn-697e5a47aa12cdab6f2a8b284cc923cdf704eafc.zip
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);
*/
void rtc_device_unregister(struct rtc_device *rtc)
{
+ rtc_nvmem_unregister(rtc);
+
mutex_lock(&rtc->ops_lock);
/*
* Remove innards of this RTC, then disable it, before
@@ -448,6 +450,8 @@ int __rtc_register_device(struct module *owner, struct rtc_device *rtc)
rtc_proc_add_device(rtc);
+ rtc_nvmem_register(rtc);
+
rtc->registered = true;
dev_info(rtc->dev.parent, "registered as %s\n",
dev_name(&rtc->dev));