mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-07 13:43:51 +00:00
rtc: pcf85363: put struct nvmem_config on the stack
Avoid allocating memory for struct nvmem_config. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
This commit is contained in:
parent
24849d177c
commit
0e7a412fa2
@ -80,7 +80,6 @@ static struct i2c_driver pcf85363_driver;
|
|||||||
struct pcf85363 {
|
struct pcf85363 {
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
struct rtc_device *rtc;
|
struct rtc_device *rtc;
|
||||||
struct nvmem_config nvmem_cfg;
|
|
||||||
struct regmap *regmap;
|
struct regmap *regmap;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -164,6 +163,14 @@ static int pcf85363_probe(struct i2c_client *client,
|
|||||||
const struct i2c_device_id *id)
|
const struct i2c_device_id *id)
|
||||||
{
|
{
|
||||||
struct pcf85363 *pcf85363;
|
struct pcf85363 *pcf85363;
|
||||||
|
struct nvmem_config nvmem_cfg = {
|
||||||
|
.name = "pcf85363-",
|
||||||
|
.word_size = 1,
|
||||||
|
.stride = 1,
|
||||||
|
.size = NVRAM_SIZE,
|
||||||
|
.reg_read = pcf85363_nvram_read,
|
||||||
|
.reg_write = pcf85363_nvram_write,
|
||||||
|
};
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
|
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
|
||||||
@ -187,18 +194,12 @@ static int pcf85363_probe(struct i2c_client *client,
|
|||||||
if (IS_ERR(pcf85363->rtc))
|
if (IS_ERR(pcf85363->rtc))
|
||||||
return PTR_ERR(pcf85363->rtc);
|
return PTR_ERR(pcf85363->rtc);
|
||||||
|
|
||||||
pcf85363->nvmem_cfg.name = "pcf85363-";
|
|
||||||
pcf85363->nvmem_cfg.word_size = 1;
|
|
||||||
pcf85363->nvmem_cfg.stride = 1;
|
|
||||||
pcf85363->nvmem_cfg.size = NVRAM_SIZE;
|
|
||||||
pcf85363->nvmem_cfg.reg_read = pcf85363_nvram_read;
|
|
||||||
pcf85363->nvmem_cfg.reg_write = pcf85363_nvram_write;
|
|
||||||
pcf85363->nvmem_cfg.priv = pcf85363;
|
|
||||||
pcf85363->rtc->ops = &rtc_ops;
|
pcf85363->rtc->ops = &rtc_ops;
|
||||||
|
|
||||||
ret = rtc_register_device(pcf85363->rtc);
|
ret = rtc_register_device(pcf85363->rtc);
|
||||||
|
|
||||||
rtc_nvmem_register(pcf85363->rtc, &pcf85363->nvmem_cfg);
|
nvmem_cfg.priv = pcf85363;
|
||||||
|
rtc_nvmem_register(pcf85363->rtc, &nvmem_cfg);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user