From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Alessandro Zummo <a.zummo@towertech.it>,
linux-rtc@vger.kernel.org, kernel@pengutronix.de
Subject: Re: [PATCH] rtc: pcf2127: add support for accessing internal static RAM
Date: Sun, 20 May 2018 20:05:20 +0200 [thread overview]
Message-ID: <20180520180520.GC23730@piout.net> (raw)
In-Reply-To: <20180520133723.30547-1-u.kleine-koenig@pengutronix.de>
Hi,
On 20/05/2018 15:37:23+0200, Uwe Kleine-König wrote:
> static int pcf2127_probe(struct device *dev, struct regmap *regmap,
> - const char *name)
> + const char *name, bool has_nvmem)
> {
> struct pcf2127 *pcf2127;
> + int ret = 0;
>
> dev_dbg(dev, "%s\n", __func__);
>
> @@ -200,8 +242,21 @@ static int pcf2127_probe(struct device *dev, struct regmap *regmap,
>
> pcf2127->rtc = devm_rtc_device_register(dev, name, &pcf2127_rtc_ops,
> THIS_MODULE);
> + if (IS_ERR(pcf2127->rtc))
> + return PTR_ERR(pcf2127->rtc);
> +
> + if (has_nvmem) {
> + struct nvmem_config nvmem_cfg = {
> + .priv = pcf2127,
> + .reg_read = pcf2127_nvmem_read,
> + .reg_write = pcf2127_nvmem_write,
> + .size = 512,
> + };
> +
> + ret = rtc_nvmem_register(pcf2127->rtc, &nvmem_cfg);
> + }
>
> - return PTR_ERR_OR_ZERO(pcf2127->rtc);
> + return ret;
You must not return an error here once devm_rtc_device_register has
succeeded. You have the choice between ignoring the nvmem registration
error or switching to devm_rtc_allocate_device/rtc_register_device().
--
Alexandre Belloni, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2018-05-20 18:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-20 13:37 [PATCH] rtc: pcf2127: add support for accessing internal static RAM Uwe Kleine-König
2018-05-20 18:05 ` Alexandre Belloni [this message]
2018-05-20 18:40 ` Uwe Kleine-König
2018-05-20 20:08 ` Alexandre Belloni
2018-05-21 8:39 ` race related to rtc_device_unregister [Was: Re: [PATCH] rtc: pcf2127: add support for accessing internal static] RAM Uwe Kleine-König
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=20180520180520.GC23730@piout.net \
--to=alexandre.belloni@bootlin.com \
--cc=a.zummo@towertech.it \
--cc=kernel@pengutronix.de \
--cc=linux-rtc@vger.kernel.org \
--cc=u.kleine-koenig@pengutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).