From: Jonathan Cameron <jic23@kernel.org>
To: "Bolboaca, Ramona" <Ramona.Bolboaca@analog.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
linux-iio <linux-iio@vger.kernel.org>,
devicetree <devicetree@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 2/2] iio: adc: add max11205 adc driver
Date: Sun, 4 Sep 2022 16:37:38 +0100 [thread overview]
Message-ID: <20220904163738.2bebf51f@jic23-huawei> (raw)
In-Reply-To: <BL1PR03MB59923C7F3907FA7A71CBA623807B9@BL1PR03MB5992.namprd03.prod.outlook.com>
> >
> > > + if (!st->chip_info)
> > > + st->chip_info = (const struct chip_info *)spi_get_device_id(spi)->driver_data;
> > > +
> > > + indio_dev->name = st->chip_info->name;
> > > + indio_dev->modes = INDIO_DIRECT_MODE;
> > > + indio_dev->channels = max11205_channels;
> > > + indio_dev->num_channels = 1;
> > > + indio_dev->info = &max11205_iio_info;
> > > +
> > > + st->vref = devm_regulator_get(&spi->dev, "vref");
> >
> > devm_regulator_get_enable() ?
> I found the patches which implement devm_regulator_get_enable.
> However, I need to get the voltage of the regulator using
> regulator_get_voltage(struct regulator *regulator) and if I use
> devm_regulator_get_enable I do not have access to the regulator
> pointer. What should I do in this case? Is there an API which works
> like devm_regulator_get_enable but also gives access to the
> regulator's pointer? Thank you for you review!
Ah. You've run into a fun long running 'discussion'. There was
great resistance to adding devm_regulator_get_enable() because it
was felt that it was too easy to get the handling wrong and end up
with underflowing reference counters etc. So the 'solution' was
to make it less useful than it would otherwise have been by making
sure it could not be combined with other accesses to the regulator.
Upshot is you are correct that it cannot be applied in this case.
Also relevant is that the patch in question is going through the
regulator tree so won't be generally available to the rest of the
kernel until next cycle. As such we'd have had to make such a
change as a follow up patch if it were possible.
Jonathan
p.s. Wrap your replies at 80 chars as well as the code.
Kernel developers have an annoying habit of reading their email in
one small window even when they have very large monitors :)
Also, where sensible crop unnecessary parts of the email to only
include the bit you are responding to. Saves on lots of scrolling..
> Kind Regards, Ramona
> Bolboaca
next prev parent reply other threads:[~2022-09-04 16:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-31 13:30 [PATCH v2 1/2] bindings: iio: adc: Add max11205 documentation file Ramona Bolboaca
2022-08-31 13:30 ` [PATCH v2 2/2] iio: adc: add max11205 adc driver Ramona Bolboaca
2022-08-31 20:20 ` Andy Shevchenko
2022-09-01 8:04 ` Bolboaca, Ramona
2022-09-04 15:37 ` Jonathan Cameron [this message]
2022-09-04 15:50 ` Jonathan Cameron
2022-09-04 15:51 ` Jonathan Cameron
2022-09-04 19:49 ` Andy Shevchenko
2022-08-31 13:36 ` [PATCH v2 1/2] bindings: iio: adc: Add max11205 documentation file Krzysztof Kozlowski
2022-09-04 15:44 ` Jonathan Cameron
2022-09-04 15:43 ` Jonathan Cameron
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=20220904163738.2bebf51f@jic23-huawei \
--to=jic23@kernel.org \
--cc=Ramona.Bolboaca@analog.com \
--cc=andy.shevchenko@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@kernel.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 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).