|
@@ -46,7 +46,7 @@ rtc_nvram_write(struct file *filp, struct kobject *kobj,
|
|
return nvmem_device_write(rtc->nvmem, off, count, buf);
|
|
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;
|
|
int err;
|
|
|
|
|
|
@@ -64,7 +64,7 @@ static int rtc_nvram_register(struct rtc_device *rtc)
|
|
|
|
|
|
rtc->nvram->read = rtc_nvram_read;
|
|
rtc->nvram->read = rtc_nvram_read;
|
|
rtc->nvram->write = rtc_nvram_write;
|
|
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,
|
|
err = sysfs_create_bin_file(&rtc->dev.parent->kobj,
|
|
rtc->nvram);
|
|
rtc->nvram);
|
|
@@ -84,20 +84,21 @@ static void rtc_nvram_unregister(struct rtc_device *rtc)
|
|
/*
|
|
/*
|
|
* New ABI, uses nvmem
|
|
* 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;
|
|
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))
|
|
if (IS_ERR_OR_NULL(rtc->nvmem))
|
|
return;
|
|
return;
|
|
|
|
|
|
/* Register the old ABI */
|
|
/* Register the old ABI */
|
|
if (rtc->nvram_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)
|
|
void rtc_nvmem_unregister(struct rtc_device *rtc)
|