From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Han Nandor <nandor.han@vaisala.com>
Cc: "a.zummo@towertech.it" <a.zummo@towertech.it>,
"linux-rtc@vger.kernel.org" <linux-rtc@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 1/1] rtc: ds3232: get SRAM access using NVMEM Framework
Date: Fri, 12 Apr 2019 23:30:42 +0200 [thread overview]
Message-ID: <20190412213042.GB3578@piout.net> (raw)
In-Reply-To: <20190408085141.21284-1-nandor.han@vaisala.com>
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
prev parent reply other threads:[~2019-04-12 21:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-08 8:52 Han Nandor
2019-04-12 21:30 ` Alexandre Belloni [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190412213042.GB3578@piout.net \
--to=alexandre.belloni@bootlin.com \
--cc=a.zummo@towertech.it \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=nandor.han@vaisala.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®