From: Jonathan Cameron <jic23@kernel.org>
To: Saalim Quadri <danascape@gmail.com>
Cc: lars@metafoo.de, Michael.Hennerich@analog.com,
gregkh@linuxfoundation.org, linux-iio@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev
Subject: Re: [PATCH] staging: iio: ad9834: Use devm_regulator_get_enable()
Date: Tue, 4 Mar 2025 14:36:35 +0000 [thread overview]
Message-ID: <20250304143635.3ff62fce@jic23-huawei> (raw)
In-Reply-To: <20250303222200.34339-1-danascape@gmail.com>
On Tue, 4 Mar 2025 03:52:00 +0530
Saalim Quadri <danascape@gmail.com> wrote:
> Use devm_regulator_get_enable() to simplify code.
>
> Signed-off-by: Saalim Quadri <danascape@gmail.com>
> ---
> drivers/staging/iio/frequency/ad9834.c | 22 ++--------------------
> 1 file changed, 2 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/staging/iio/frequency/ad9834.c b/drivers/staging/iio/frequency/ad9834.c
> index 6e99e008c5f4..5da2084c46c9 100644
> --- a/drivers/staging/iio/frequency/ad9834.c
> +++ b/drivers/staging/iio/frequency/ad9834.c
> @@ -387,33 +387,15 @@ static const struct iio_info ad9833_info = {
> .attrs = &ad9833_attribute_group,
> };
>
> -static void ad9834_disable_reg(void *data)
> -{
> - struct regulator *reg = data;
> -
> - regulator_disable(reg);
> -}
> -
> static int ad9834_probe(struct spi_device *spi)
> {
> struct ad9834_state *st;
> struct iio_dev *indio_dev;
> - struct regulator *reg;
> int ret;
>
> - reg = devm_regulator_get(&spi->dev, "avdd");
> - if (IS_ERR(reg))
> - return PTR_ERR(reg);
> -
> - ret = regulator_enable(reg);
> - if (ret) {
> - dev_err(&spi->dev, "Failed to enable specified AVDD supply\n");
> - return ret;
> - }
> -
> - ret = devm_add_action_or_reset(&spi->dev, ad9834_disable_reg, reg);
> + ret = devm_regulator_get_enable(&spi->dev, "avdd");
> if (ret)
> - return ret;
> + return dev_err_probe(&spi->dev, ret, "Failed to get AVDD voltage\n");
Hi,
You aren't getting the voltage, just turning the regulator on so this
error message is misleading.
>
> indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
> if (!indio_dev) {
prev parent reply other threads:[~2025-03-04 14:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-03 22:22 [PATCH] staging: iio: ad9834: Use devm_regulator_get_enable() Saalim Quadri
2025-03-04 14:36 ` Jonathan Cameron [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=20250304143635.3ff62fce@jic23-huawei \
--to=jic23@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=danascape@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
/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