diff options
author | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2018-03-03 00:50:29 +0100 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2018-03-17 14:20:51 +0100 |
commit | 6735f6dcf71e722ee2fc4fb38ed14ae0e2c119b4 (patch) | |
tree | 5da92ceff3afec80a46e83895b958ace2ac555d4 /drivers/rtc/rtc-isl12026.c | |
parent | 4731a43169b799a9b4337579793a24fcc85943f5 (diff) |
rtc: isl12026: fixup nvmem registration
The probe function must not fail after rtc_register_device. Also, rename
the nvmem device so it is easily identifiable in /sys/bus/nvmem.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/rtc/rtc-isl12026.c')
-rw-r--r-- | drivers/rtc/rtc-isl12026.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/drivers/rtc/rtc-isl12026.c b/drivers/rtc/rtc-isl12026.c index ada9849d8d97..97f594f9667c 100644 --- a/drivers/rtc/rtc-isl12026.c +++ b/drivers/rtc/rtc-isl12026.c @@ -433,7 +433,15 @@ static int isl12026_probe_new(struct i2c_client *client) { struct isl12026 *priv; int ret; - struct nvmem_config nvm_cfg; + struct nvmem_config nvm_cfg = { + .name = "isl12026-", + .base_dev = &client->dev, + .stride = 1, + .word_size = 1, + .size = 512, + .reg_read = isl12026_nvm_read, + .reg_write = isl12026_nvm_write, + }; if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) return -ENODEV; @@ -456,24 +464,12 @@ static int isl12026_probe_new(struct i2c_client *client) return ret; priv->rtc->ops = &isl12026_rtc_ops; - priv->rtc->nvram_old_abi = false; - ret = rtc_register_device(priv->rtc); + nvm_cfg.priv = priv; + ret = rtc_nvmem_register(priv->rtc, &nvm_cfg); if (ret) return ret; - memset(&nvm_cfg, 0, sizeof(nvm_cfg)); - nvm_cfg.name = "eeprom"; - nvm_cfg.read_only = false; - nvm_cfg.root_only = true; - nvm_cfg.base_dev = &client->dev; - nvm_cfg.priv = priv; - nvm_cfg.stride = 1; - nvm_cfg.word_size = 1; - nvm_cfg.size = 512; - nvm_cfg.reg_read = isl12026_nvm_read; - nvm_cfg.reg_write = isl12026_nvm_write; - - return rtc_nvmem_register(priv->rtc, &nvm_cfg); + return rtc_register_device(priv->rtc); } static int isl12026_remove(struct i2c_client *client) |