From: Johan Hovold <johan@kernel.org>
To: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org,
Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Subject: Re: [RFC PATCH 2/5] gnss: ubx: use new helper to remove open coded regulator handling
Date: Tue, 20 Jun 2023 10:48:19 +0200 [thread overview]
Message-ID: <ZJFn04P7_JhC24ST@hovoldconsulting.com> (raw)
In-Reply-To: <20230523064310.3005-3-wsa+renesas@sang-engineering.com>
On Tue, May 23, 2023 at 08:43:07AM +0200, Wolfram Sang wrote:
> v_bckp shall always be enabled as long as the device exists. We now have
> a regulator helper for that, use it.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
> drivers/gnss/ubx.c | 26 ++++----------------------
> 1 file changed, 4 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/gnss/ubx.c b/drivers/gnss/ubx.c
> index c01e1e875727..c8d027973b85 100644
> --- a/drivers/gnss/ubx.c
> +++ b/drivers/gnss/ubx.c
> @@ -17,7 +17,6 @@
> #include "serial.h"
>
> struct ubx_data {
> - struct regulator *v_bckp;
> struct regulator *vcc;
> };
>
> @@ -106,30 +105,16 @@ static int ubx_probe(struct serdev_device *serdev)
> goto err_free_gserial;
> }
>
> - data->v_bckp = devm_regulator_get_optional(&serdev->dev, info->v_bckp_name);
> - if (IS_ERR(data->v_bckp)) {
> - ret = PTR_ERR(data->v_bckp);
> - if (ret == -ENODEV)
> - data->v_bckp = NULL;
> - else
> - goto err_free_gserial;
> - }
> -
> - if (data->v_bckp) {
> - ret = regulator_enable(data->v_bckp);
> - if (ret)
> - goto err_free_gserial;
> - }
> + ret = devm_regulator_get_enable_optional(&serdev->dev, info->v_bckp_name);
> + if (ret < 0 && ret != -ENODEV)
> + goto err_free_gserial;
I'm a bit torn about this one as I'm generally sceptical of devres and
especially helpers that enable or register resources, which just tends to
lead to subtle bugs.
But if there's one place where this new helper, which importantly does
not return a pointer to the regulator, may be useful I guess it's here.
Care to respin this one after dropping the merge patch?
Johan
next prev parent reply other threads:[~2023-06-20 8:48 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-23 6:43 [RFC PATCH 0/5] gnss: updates to support the Renesas KingFisher board Wolfram Sang
2023-05-23 6:43 ` [RFC PATCH 1/5] WIP: gnss: merge MTK driver into UBX driver Wolfram Sang
2023-06-12 11:35 ` Wolfram Sang
2023-06-20 7:13 ` Johan Hovold
2023-06-20 9:00 ` Wolfram Sang
2023-06-20 10:21 ` Wolfram Sang
2023-06-20 14:50 ` Johan Hovold
2023-05-23 6:43 ` [RFC PATCH 2/5] gnss: ubx: use new helper to remove open coded regulator handling Wolfram Sang
2023-06-20 8:48 ` Johan Hovold [this message]
2023-06-20 9:04 ` Wolfram Sang
2023-06-20 9:08 ` Johan Hovold
2023-05-23 6:43 ` [RFC PATCH 3/5] gnss: ubx: 'vcc' can be optional Wolfram Sang
2023-06-20 7:15 ` Johan Hovold
2023-06-20 9:04 ` Wolfram Sang
2023-05-23 6:43 ` [RFC PATCH 4/5] gnss: ubx: add support for the reset gpio Wolfram Sang
2023-06-20 7:17 ` Johan Hovold
2023-06-20 9:06 ` Wolfram Sang
2023-06-20 9:12 ` Johan Hovold
2023-06-20 9:41 ` Wolfram Sang
2023-06-20 10:05 ` Johan Hovold
2023-06-20 10:14 ` Wolfram Sang
2023-05-23 6:43 ` [RFC PATCH 5/5] arm64: dts: renesas: ulcb-kf: add node for GPS Wolfram Sang
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=ZJFn04P7_JhC24ST@hovoldconsulting.com \
--to=johan@kernel.org \
--cc=christophe.jaillet@wanadoo.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=wsa+renesas@sang-engineering.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