From: Matti Vaittinen <mazziesaccount@gmail.com>
To: Matti Vaittinen <mazziesaccount@gmail.com>,
Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Cc: Jean Delvare <jdelvare@suse.com>,
Guenter Roeck <linux@roeck-us.net>,
linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 6/7] hwmon: lm90: simplify using devm_regulator_get_enable()
Date: Fri, 12 Aug 2022 13:11:46 +0300 [thread overview]
Message-ID: <8959965542d71bb5ea5a928b539ff804eaa58f42.1660292316.git.mazziesaccount@gmail.com> (raw)
In-Reply-To: <cover.1660292316.git.mazziesaccount@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2077 bytes --]
Drop open-coded pattern: 'devm_regulator_get(), regulator_enable(),
add_action_or_reset(regulator_disable)' and use the
devm_regulator_get_enable().
Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
---
RFCv1 => v2:
- No changes
---
drivers/hwmon/lm90.c | 21 ++-------------------
1 file changed, 2 insertions(+), 19 deletions(-)
diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
index 3820f0e61510..2ab561ec367c 100644
--- a/drivers/hwmon/lm90.c
+++ b/drivers/hwmon/lm90.c
@@ -1848,12 +1848,6 @@ static void lm90_remove_pec(void *dev)
device_remove_file(dev, &dev_attr_pec);
}
-static void lm90_regulator_disable(void *regulator)
-{
- regulator_disable(regulator);
-}
-
-
static const struct hwmon_ops lm90_ops = {
.is_visible = lm90_is_visible,
.read = lm90_read,
@@ -1865,24 +1859,13 @@ static int lm90_probe(struct i2c_client *client)
struct device *dev = &client->dev;
struct i2c_adapter *adapter = client->adapter;
struct hwmon_channel_info *info;
- struct regulator *regulator;
struct device *hwmon_dev;
struct lm90_data *data;
int err;
- regulator = devm_regulator_get(dev, "vcc");
- if (IS_ERR(regulator))
- return PTR_ERR(regulator);
-
- err = regulator_enable(regulator);
- if (err < 0) {
- dev_err(dev, "Failed to enable regulator: %d\n", err);
- return err;
- }
-
- err = devm_add_action_or_reset(dev, lm90_regulator_disable, regulator);
+ err = devm_regulator_get_enable(dev, "vcc");
if (err)
- return err;
+ return dev_err_probe(dev, err, "Failed to enable regulator\n");
data = devm_kzalloc(dev, sizeof(struct lm90_data), GFP_KERNEL);
if (!data)
--
2.37.1
--
Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND
~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~
Simon says - in Latin please.
~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~
Thanks to Simon Glass for the translation =]
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2022-08-12 10:12 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-12 10:08 [PATCH v2 0/7] Devm helpers for regulator get and enable Matti Vaittinen
2022-08-12 10:09 ` [PATCH v2 1/7] docs: devres: regulator: Add missing devm_* functions to devres.rst Matti Vaittinen
2022-08-12 10:10 ` [PATCH v2 2/7] regulator: Add devm helpers for get and enable Matti Vaittinen
2022-08-12 10:10 ` [PATCH v2 3/7] docs: devres: regulator: Add new get_enable functions to devres.rst Matti Vaittinen
2022-08-12 10:11 ` [PATCH v2 4/7] clk: cdce925: simplify using devm_regulator_get_enable() Matti Vaittinen
2022-08-12 10:11 ` [PATCH v2 5/7] gpu: drm: simplify drivers using devm_regulator_*get_enable*() Matti Vaittinen
2022-08-12 10:11 ` Matti Vaittinen [this message]
2022-08-12 10:12 ` [PATCH v2 7/7] iio: Simplify drivers using devm_regulator_*get_enable() Matti Vaittinen
[not found] ` <CAHp75Vcz_ufnLCE8TYBjM0b8BiS4W1AgXq8euNrUFo3WZy3=fA@mail.gmail.com>
2022-08-15 4:34 ` Matti Vaittinen
[not found] ` <166057828406.697572.228317501909350108.b4-ty@kernel.org>
2022-08-15 15:54 ` (subset) [PATCH v2 0/7] Devm helpers for regulator get and enable Laurent Pinchart
2022-08-15 16:33 ` Mark Brown
2022-08-15 18:52 ` Laurent Pinchart
2022-08-15 20:58 ` Stephen Boyd
2022-08-15 21:17 ` Laurent Pinchart
2022-08-15 22:55 ` Mark Brown
2022-08-16 4:56 ` Matti Vaittinen
2022-08-16 10:36 ` Mark Brown
2022-08-16 11:06 ` Vaittinen, Matti
2022-08-16 11:31 ` Mark Brown
2022-08-16 8:42 ` Andy Shevchenko
2022-08-15 22:07 ` Mark Brown
2022-08-30 19:42 ` Stephen Boyd
2022-08-16 8:23 ` Andy Shevchenko
2022-08-18 11:33 ` Matti Vaittinen
2022-08-18 11:54 ` Mark Brown
2022-08-18 12:04 ` Vaittinen, Matti
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=8959965542d71bb5ea5a928b539ff804eaa58f42.1660292316.git.mazziesaccount@gmail.com \
--to=mazziesaccount@gmail.com \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=matti.vaittinen@fi.rohmeurope.com \
/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
all inboxes | Powered by JetHome®