Commit 409baf17 authored by Alexandre Belloni's avatar Alexandre Belloni

rtc: ds1307: put struct nvmem_config on the stack

Avoid allocating memory for struct nvmem_config as it is only necessary at
the nvmem registration.
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
parent e9fb7682
...@@ -114,7 +114,6 @@ enum ds_type { ...@@ -114,7 +114,6 @@ enum ds_type {
# define RX8025_BIT_XST 0x20 # define RX8025_BIT_XST 0x20
struct ds1307 { struct ds1307 {
struct nvmem_config nvmem_cfg;
enum ds_type type; enum ds_type type;
unsigned long flags; unsigned long flags;
#define HAS_NVRAM 0 /* bit 0 == sysfs file active */ #define HAS_NVRAM 0 /* bit 0 == sysfs file active */
...@@ -1702,16 +1701,18 @@ static int ds1307_probe(struct i2c_client *client, ...@@ -1702,16 +1701,18 @@ static int ds1307_probe(struct i2c_client *client,
return err; return err;
if (chip->nvram_size) { if (chip->nvram_size) {
ds1307->nvmem_cfg.name = "ds1307_nvram"; struct nvmem_config nvmem_cfg = {
ds1307->nvmem_cfg.word_size = 1; .name = "ds1307_nvram",
ds1307->nvmem_cfg.stride = 1; .word_size = 1,
ds1307->nvmem_cfg.size = chip->nvram_size; .stride = 1,
ds1307->nvmem_cfg.reg_read = ds1307_nvram_read; .size = chip->nvram_size,
ds1307->nvmem_cfg.reg_write = ds1307_nvram_write; .reg_read = ds1307_nvram_read,
ds1307->nvmem_cfg.priv = ds1307; .reg_write = ds1307_nvram_write,
.priv = ds1307,
};
ds1307->rtc->nvram_old_abi = true; ds1307->rtc->nvram_old_abi = true;
rtc_nvmem_register(ds1307->rtc, &ds1307->nvmem_cfg); rtc_nvmem_register(ds1307->rtc, &nvmem_cfg);
} }
ds1307_hwmon_register(ds1307); ds1307_hwmon_register(ds1307);
......
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