Commit c07fd9de authored by Alexandre Belloni's avatar Alexandre Belloni

rtc: rv8803: put struct nvmem_config on the stack

Avoid allocating memory for struct nvmem_config.
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
parent 88d3aade
...@@ -68,7 +68,6 @@ struct rv8803_data { ...@@ -68,7 +68,6 @@ struct rv8803_data {
struct mutex flags_lock; struct mutex flags_lock;
u8 ctrl; u8 ctrl;
enum rv8803_type type; enum rv8803_type type;
struct nvmem_config nvmem_cfg;
}; };
static int rv8803_read_reg(const struct i2c_client *client, u8 reg) static int rv8803_read_reg(const struct i2c_client *client, u8 reg)
...@@ -528,6 +527,15 @@ static int rv8803_probe(struct i2c_client *client, ...@@ -528,6 +527,15 @@ static int rv8803_probe(struct i2c_client *client,
struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
struct rv8803_data *rv8803; struct rv8803_data *rv8803;
int err, flags; int err, flags;
struct nvmem_config nvmem_cfg = {
.name = "rv8803_nvram",
.word_size = 1,
.stride = 1,
.size = 1,
.reg_read = rv8803_nvram_read,
.reg_write = rv8803_nvram_write,
.priv = client,
};
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA |
I2C_FUNC_SMBUS_I2C_BLOCK)) { I2C_FUNC_SMBUS_I2C_BLOCK)) {
...@@ -582,21 +590,13 @@ static int rv8803_probe(struct i2c_client *client, ...@@ -582,21 +590,13 @@ static int rv8803_probe(struct i2c_client *client,
} }
} }
rv8803->nvmem_cfg.name = "rv8803_nvram",
rv8803->nvmem_cfg.word_size = 1,
rv8803->nvmem_cfg.stride = 1,
rv8803->nvmem_cfg.size = 1,
rv8803->nvmem_cfg.reg_read = rv8803_nvram_read,
rv8803->nvmem_cfg.reg_write = rv8803_nvram_write,
rv8803->nvmem_cfg.priv = client;
rv8803->rtc->ops = &rv8803_rtc_ops; rv8803->rtc->ops = &rv8803_rtc_ops;
rv8803->rtc->nvram_old_abi = true; rv8803->rtc->nvram_old_abi = true;
err = rtc_register_device(rv8803->rtc); err = rtc_register_device(rv8803->rtc);
if (err) if (err)
return err; return err;
rtc_nvmem_register(rv8803->rtc, &rv8803->nvmem_cfg); rtc_nvmem_register(rv8803->rtc, &nvmem_cfg);
err = rv8803_write_reg(rv8803->client, RV8803_EXT, RV8803_EXT_WADA); err = rv8803_write_reg(rv8803->client, RV8803_EXT, RV8803_EXT_WADA);
if (err) if (err)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment