diff options
author | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2018-02-12 23:47:16 +0100 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2018-02-14 20:58:11 +0100 |
commit | 4cce9d3988ae33eb53742d9648ecc59046196e6f (patch) | |
tree | dc0bb10efbb3eb2e73a6a8939b71f69d6fbe2af4 /drivers/rtc/nvmem.c | |
parent | 7b21db9184a21b3ba479030dcfecaf3f2fa94b1f (diff) | |
download | lwn-4cce9d3988ae33eb53742d9648ecc59046196e6f.tar.gz lwn-4cce9d3988ae33eb53742d9648ecc59046196e6f.zip |
rtc: nvmem: pass nvmem_config to rtc_nvmem_register()
To be able to remove nvmem_config from struct rtc_device, pass it as a
parameter to rtc_nvmem_register.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/rtc/nvmem.c')
-rw-r--r-- | drivers/rtc/nvmem.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/rtc/nvmem.c b/drivers/rtc/nvmem.c index 8567b4ed9ac6..0a3522bcdd25 100644 --- a/drivers/rtc/nvmem.c +++ b/drivers/rtc/nvmem.c @@ -46,7 +46,7 @@ rtc_nvram_write(struct file *filp, struct kobject *kobj, return nvmem_device_write(rtc->nvmem, off, count, buf); } -static int rtc_nvram_register(struct rtc_device *rtc) +static int rtc_nvram_register(struct rtc_device *rtc, size_t size) { int err; @@ -64,7 +64,7 @@ static int rtc_nvram_register(struct rtc_device *rtc) rtc->nvram->read = rtc_nvram_read; rtc->nvram->write = rtc_nvram_write; - rtc->nvram->size = rtc->nvmem_config->size; + rtc->nvram->size = size; err = sysfs_create_bin_file(&rtc->dev.parent->kobj, rtc->nvram); @@ -84,20 +84,21 @@ static void rtc_nvram_unregister(struct rtc_device *rtc) /* * New ABI, uses nvmem */ -void rtc_nvmem_register(struct rtc_device *rtc) +void rtc_nvmem_register(struct rtc_device *rtc, + struct nvmem_config *nvmem_config) { - if (!rtc->nvmem_config) + if (!nvmem_config) return; - rtc->nvmem_config->dev = &rtc->dev; - rtc->nvmem_config->owner = rtc->owner; - rtc->nvmem = nvmem_register(rtc->nvmem_config); + nvmem_config->dev = &rtc->dev; + nvmem_config->owner = rtc->owner; + rtc->nvmem = nvmem_register(nvmem_config); if (IS_ERR_OR_NULL(rtc->nvmem)) return; /* Register the old ABI */ if (rtc->nvram_old_abi) - rtc_nvram_register(rtc); + rtc_nvram_register(rtc, nvmem_config->size); } void rtc_nvmem_unregister(struct rtc_device *rtc) |