From: Lars-Peter Clausen <lars@metafoo.de>
To: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>,
Jonathan Cameron <jic23@kernel.org>
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4] iio: dac: mcp4922: get and enable vdd regulator
Date: Wed, 5 Apr 2023 07:21:00 -0700 [thread overview]
Message-ID: <ee6a428b-905c-82ac-48fd-0b440d90e014@metafoo.de> (raw)
In-Reply-To: <20230405140114.99011-3-frattaroli.nicolas@gmail.com>
On 4/5/23 07:01, Nicolas Frattaroli wrote:
> [...]
> + state->vdd_reg = devm_regulator_get(&spi->dev, "vdd");
> + if (IS_ERR(state->vdd_reg)) {
> + ret = dev_err_probe(&spi->dev, PTR_ERR(state->vdd_reg),
> + "vdd regulator not specified\n");
> + goto error_disable_vref_reg;
> + }
> + ret = regulator_enable(state->vdd_reg);
> + if (ret) {
> + dev_err(&spi->dev, "Failed to enable vdd regulator: %d\n",
> + ret);
> + goto error_disable_vref_reg;
> + }
The two above can be combined into `devm_regulator_get_enable()`. This
will also take care of automatically disabling the regulator on the
error path and on remove.
> +
> spi_set_drvdata(spi, indio_dev);
> id = spi_get_device_id(spi);
> indio_dev->info = &mcp4922_info;
> [...]
next prev parent reply other threads:[~2023-04-05 14:22 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-05 14:01 [PATCH 0/4] Add MCP48XX bindings and driver support Nicolas Frattaroli
2023-04-05 14:01 ` [PATCH 1/4] dt-bindings: iio: dac: mcp4922: add vdd-supply property Nicolas Frattaroli
2023-04-09 20:52 ` Michael Welling
2023-04-05 14:01 ` [PATCH 2/4] iio: dac: mcp4922: get and enable vdd regulator Nicolas Frattaroli
2023-04-05 14:21 ` Lars-Peter Clausen [this message]
2023-04-07 17:46 ` Jonathan Cameron
2023-04-07 17:44 ` Jonathan Cameron
2023-04-05 14:01 ` [PATCH 3/4] dt-bindings: iio: dac: add mcp4822 Nicolas Frattaroli
2023-04-05 14:10 ` Krzysztof Kozlowski
2023-04-05 14:17 ` Nicolas Frattaroli
2023-04-06 18:58 ` Krzysztof Kozlowski
2023-04-05 14:01 ` [PATCH 4/4] iio: dac: mcp4922: add support for mcp48xx series chips Nicolas Frattaroli
2023-04-05 14:18 ` Lars-Peter Clausen
2023-04-07 17:35 ` Jonathan Cameron
2023-04-07 17:40 ` 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=ee6a428b-905c-82ac-48fd-0b440d90e014@metafoo.de \
--to=lars@metafoo.de \
--cc=frattaroli.nicolas@gmail.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.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