From: Guenter Roeck <linux@roeck-us.net>
To: Matti Vaittinen <mazziesaccount@gmail.com>
Cc: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
linux-kernel@vger.kernel.org, Aleksander Mazur <deweloper@wp.pl>
Subject: Re: [PATCH] regulator: change devm_regulator_get_enable_optional() stub to return Ok
Date: Tue, 23 Apr 2024 05:14:27 -0700 [thread overview]
Message-ID: <5309a7a9-e8d5-4168-9f4b-99011a3fc33c@roeck-us.net> (raw)
In-Reply-To: <ZiedtOE00Zozd3XO@fedora>
On Tue, Apr 23, 2024 at 02:38:28PM +0300, Matti Vaittinen wrote:
> The devm_regulator_get_enable_optional() should be a 'call and forget'
> API, meaning, when it is used to enable the regulators, the API does not
> provide a handle to do any further control of the regulators. It gives
> no real benefit to return an error from the stub if CONFIG_REGULATOR is
> not set.
>
> On the contrary, returning an error is causing problems to drivers when
> hardware is such it works out just fine with no regulator control.
> Returning an error forces drivers to specifically handle the case where
> CONFIG_REGULATOR is not set, making the mere existence of the stub
> questionalble.
>
> Change the stub implementation for the
> devm_regulator_get_enable_optional() to return Ok so drivers do not
> separately handle the case where the CONFIG_REGULATOR is not set.
>
> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
> Fixes: da279e6965b3 ("regulator: Add devm helpers for get and enable")
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> include/linux/regulator/consumer.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
> index 71232fb7dda3..ed180ca419da 100644
> --- a/include/linux/regulator/consumer.h
> +++ b/include/linux/regulator/consumer.h
> @@ -326,7 +326,7 @@ static inline int devm_regulator_get_enable(struct device *dev, const char *id)
> static inline int devm_regulator_get_enable_optional(struct device *dev,
> const char *id)
> {
> - return -ENODEV;
> + return 0;
> }
>
> static inline struct regulator *__must_check
>
> base-commit: f7638784bd0cf2ca9daebd47477983811f832300
> --
> 2.43.2
>
>
> --
> 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 =]
next prev parent reply other threads:[~2024-04-23 12:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-23 11:38 Matti Vaittinen
2024-04-23 12:14 ` Guenter Roeck [this message]
2024-04-24 14:05 ` Mark Brown
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=5309a7a9-e8d5-4168-9f4b-99011a3fc33c@roeck-us.net \
--to=linux@roeck-us.net \
--cc=broonie@kernel.org \
--cc=deweloper@wp.pl \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=matti.vaittinen@fi.rohmeurope.com \
--cc=mazziesaccount@gmail.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®