[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190412213042.GB3578@piout.net>
Date: Fri, 12 Apr 2019 23:30:42 +0200
From: Alexandre Belloni <alexandre.belloni@...tlin.com>
To: Han Nandor <nandor.han@...sala.com>
Cc: "a.zummo@...ertech.it" <a.zummo@...ertech.it>,
"linux-rtc@...r.kernel.org" <linux-rtc@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 1/1] rtc: ds3232: get SRAM access using NVMEM Framework
Hi,
On 08/04/2019 08:52:39+0000, Han Nandor wrote:
> static int ds3232_probe(struct device *dev, struct regmap *regmap, int irq,
> const char *name)
> {
> struct ds3232 *ds3232;
> int ret;
> + struct nvmem_config nvmem_cfg;
>
> ds3232 = devm_kzalloc(dev, sizeof(*ds3232), GFP_KERNEL);
> if (!ds3232)
> @@ -476,6 +499,15 @@ static int ds3232_probe(struct device *dev, struct regmap *regmap, int irq,
> ds3232->dev = dev;
> dev_set_drvdata(dev, ds3232);
>
> + nvmem_cfg.name = "ds3232_sram";
> + nvmem_cfg.stride = 1;
> + nvmem_cfg.size = DS3232_REG_SRAM_SIZE;
> + nvmem_cfg.word_size = 1;
> + nvmem_cfg.reg_read = ds3232_nvmem_read;
> + nvmem_cfg.reg_write = ds3232_nvmem_write;
> + nvmem_cfg.priv = ds3232;
> + nvmem_cfg.type = NVMEM_TYPE_BATTERY_BACKED;
> +
You have to either initialize at the declaration as done here:
https://elixir.bootlin.com/linux/v5.0/source/drivers/rtc/rtc-rv8803.c#L530
or memset the struct to 0. Else, this leaves members uninitialized.
--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Powered by blists - more mailing lists