From: Svyatoslav Ryhel <clamor95@gmail.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: Guenter Roeck <linux@roeck-us.net>,
Jean Delvare <jdelvare@suse.com>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 2/2] hwmon: ina2xx: add optional regulator support
Date: Wed, 8 Mar 2023 12:35:54 +0200 [thread overview]
Message-ID: <CAPVz0n2KgUKi-m+kjvbxq8fA_G0+KNHtkNe4T0UGpmasMjWK2A@mail.gmail.com> (raw)
In-Reply-To: <378db0d7-4d5a-a445-3e1a-ee6d8da5a9e2@linaro.org>
ср, 8 бер. 2023 р. о 12:25 Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> пише:
>
> On 08/03/2023 10:40, Svyatoslav Ryhel wrote:
> > Some devices may need a specific supply provided
> > for this sensor to work properly, like p895 does.
> >
> > Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
> > ---
> > drivers/hwmon/ina2xx.c | 12 ++++++++++++
> > 1 file changed, 12 insertions(+)
> >
> > diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c
> > index 00fc70305a89..4a3e2b1bbe8b 100644
> > --- a/drivers/hwmon/ina2xx.c
> > +++ b/drivers/hwmon/ina2xx.c
> > @@ -119,6 +119,7 @@ struct ina2xx_data {
> > long power_lsb_uW;
> > struct mutex config_lock;
> > struct regmap *regmap;
> > + struct regulator *vdd_supply;
> >
> > const struct attribute_group *groups[INA2XX_MAX_ATTRIBUTE_GROUPS];
> > };
> > @@ -656,6 +657,17 @@ static int ina2xx_probe(struct i2c_client *client)
> > return PTR_ERR(data->regmap);
> > }
> >
> > + data->vdd_supply = devm_regulator_get_optional(dev, "vdd");
> > + if (IS_ERR(data->vdd_supply))
> > + return dev_err_probe(dev, PTR_ERR(data->vdd_supply),
> > + "failed to get vdd regulator\n");
> > +
> > + ret = regulator_enable(data->vdd_supply);
> > + if (ret < 0) {
> > + dev_err(dev, "failed to enable vdd power supply\n");
> > + return ret;
>
> And where is disable? On each error path, removal etc.
>
error path ok, should I create a remove function just to disable the regulator?
> Best regards,
> Krzysztof
>
next prev parent reply other threads:[~2023-03-08 10:36 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-08 9:40 [PATCH v1 0/2] Add optional power supply for INA2XX Svyatoslav Ryhel
2023-03-08 9:40 ` [PATCH v1 1/2] dt-bindings: hwmon: ina2xx: add supply property Svyatoslav Ryhel
2023-03-08 10:27 ` Krzysztof Kozlowski
2023-03-08 10:32 ` Svyatoslav Ryhel
2023-03-08 10:36 ` Krzysztof Kozlowski
2023-03-08 11:35 ` Guenter Roeck
2023-03-08 11:54 ` Svyatoslav Ryhel
2023-03-08 12:54 ` Mark Brown
2023-03-08 12:58 ` Svyatoslav Ryhel
2023-03-08 13:13 ` Krzysztof Kozlowski
2023-03-08 13:46 ` Mark Brown
2023-03-08 14:01 ` Svyatoslav Ryhel
2023-03-08 14:37 ` Krzysztof Kozlowski
2023-03-08 14:38 ` Mark Brown
2023-03-08 9:40 ` [PATCH v1 2/2] hwmon: ina2xx: add optional regulator support Svyatoslav Ryhel
2023-03-08 10:25 ` Krzysztof Kozlowski
2023-03-08 10:35 ` Svyatoslav Ryhel [this message]
2023-03-08 10:37 ` Krzysztof Kozlowski
2023-03-08 11:13 ` Guenter Roeck
2023-03-08 11:19 ` Svyatoslav Ryhel
2023-03-08 11:32 ` Lars-Peter Clausen
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=CAPVz0n2KgUKi-m+kjvbxq8fA_G0+KNHtkNe4T0UGpmasMjWK2A@mail.gmail.com \
--to=clamor95@gmail.com \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jdelvare@suse.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--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).