From: Vadym Kochan <vadym.kochan@plvision.eu>
To: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
Maxime Ripard <maxime.ripard@free-electrons.com>,
linux-i2c <linux-i2c@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 3/3] misc: eeprom: at24: register nvmem only after eeprom is ready to use
Date: Mon, 31 Aug 2020 20:24:43 +0300 [thread overview]
Message-ID: <20200831172443.GD2568@plvision.eu> (raw)
In-Reply-To: <CAMpxmJXzGPXwMYg6e+eCYck+nXnNqxSEBOwm5G-vmLYQA7cDpg@mail.gmail.com>
Hi Bartosz,
On Mon, Aug 31, 2020 at 07:21:39PM +0200, Bartosz Golaszewski wrote:
> On Mon, Aug 31, 2020 at 3:56 AM Vadym Kochan <vadym.kochan@plvision.eu> wrote:
> >
> > During nvmem_register() the nvmem core sends notifications when:
> >
> > - cell added
> > - nvmem added
> >
> > and during these notifications some callback func may access the nvmem
> > device, which will fail in case of at24 eeprom because regulator and pm
> > are enabled after nvmem_register().
> >
> > Signed-off-by: Vadym Kochan <vadym.kochan@plvision.eu>
> > ---
> > v3:
> > 1) at24 driver enables regulator and pm state machine after nvmem
> > registration which does not allow to use it on handing NVMEM_PRE_ADD event.
> >
> > drivers/misc/eeprom/at24.c | 11 +++++++----
> > 1 file changed, 7 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
> > index 2591c21b2b5d..26a23abc053d 100644
> > --- a/drivers/misc/eeprom/at24.c
> > +++ b/drivers/misc/eeprom/at24.c
> > @@ -692,10 +692,6 @@ static int at24_probe(struct i2c_client *client)
> > nvmem_config.word_size = 1;
> > nvmem_config.size = byte_len;
> >
> > - at24->nvmem = devm_nvmem_register(dev, &nvmem_config);
> > - if (IS_ERR(at24->nvmem))
> > - return PTR_ERR(at24->nvmem);
> > -
> > i2c_set_clientdata(client, at24);
> >
> > err = regulator_enable(at24->vcc_reg);
> > @@ -708,6 +704,13 @@ static int at24_probe(struct i2c_client *client)
> > pm_runtime_set_active(dev);
> > pm_runtime_enable(dev);
> >
> > + at24->nvmem = devm_nvmem_register(dev, &nvmem_config);
> > + if (IS_ERR(at24->nvmem)) {
> > + pm_runtime_disable(dev);
> > + regulator_disable(at24->vcc_reg);
> > + return PTR_ERR(at24->nvmem);
> > + }
> > +
> > /*
> > * Perform a one-byte test read to verify that the
> > * chip is functional.
> > --
> > 2.17.1
> >
>
> Good catch! Thanks for the patch. Can I queue it for fixes
> independently from the earlier patches in this series?
>
> Bart
Sure.
Regards,
Vadym Kochan
next prev parent reply other threads:[~2020-08-31 17:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-31 1:55 [PATCH v3 0/3] nvmem: add ONIE NVMEM cells provider Vadym Kochan
2020-08-31 1:55 ` [PATCH v3 1/3] nvmem: core: allow to register cells during nvmem registration Vadym Kochan
2020-09-04 11:02 ` Srinivas Kandagatla
2020-09-04 11:23 ` Vadym Kochan
2020-09-11 16:59 ` Vadym Kochan
2020-08-31 1:55 ` [PATCH v3 2/3] nvmem: add ONIE NVMEM cells support Vadym Kochan
2020-09-04 11:02 ` Srinivas Kandagatla
2020-08-31 1:55 ` [PATCH v3 3/3] misc: eeprom: at24: register nvmem only after eeprom is ready to use Vadym Kochan
2020-08-31 17:21 ` Bartosz Golaszewski
2020-08-31 17:24 ` Vadym Kochan [this message]
2020-09-01 8:06 ` Bartosz Golaszewski
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=20200831172443.GD2568@plvision.eu \
--to=vadym.kochan@plvision.eu \
--cc=arnd@arndb.de \
--cc=bgolaszewski@baylibre.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maxime.ripard@free-electrons.com \
--cc=srinivas.kandagatla@linaro.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.