[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240328135003.3c200be3@jic23-huawei>
Date: Thu, 28 Mar 2024 13:50:03 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: David Lechner <dlechner@...libre.com>
Cc: Jonathan Corbet <corbet@....net>, Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>, Jean Delvare <jdelvare@...e.com>, Guenter
Roeck <linux@...ck-us.net>, Support Opensource
<support.opensource@...semi.com>, Cosmin Tanislav
<cosmin.tanislav@...log.com>, Lars-Peter Clausen <lars@...afoo.de>, Michael
Hennerich <Michael.Hennerich@...log.com>, Antoniu Miclaus
<antoniu.miclaus@...log.com>, Greg Kroah-Hartman
<gregkh@...uxfoundation.org>, Dmitry Torokhov <dmitry.torokhov@...il.com>,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-hwmon@...r.kernel.org, linux-iio@...r.kernel.org,
linux-staging@...ts.linux.dev, linux-input@...r.kernel.org
Subject: Re: [PATCH RFC 6/7] staging: iio: impedance-analyzer: admv1013: Use
devm_regulator_get_enable_get_voltage()
On Wed, 27 Mar 2024 18:18:55 -0500
David Lechner <dlechner@...libre.com> wrote:
> We can reduce boilerplate code by using
> devm_regulator_get_enable_get_voltage().
Wrong device in patch title. I thought it odd we had a driver for same part
number in staging and out of it!.
Otherwise LGTM
Not sure how we'll merge this set assuming everyone agrees it's a good idea.
Immutable branch probably. On off chance we don't do that, with the patch title
fixed.
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
Jonathan
>
> Signed-off-by: David Lechner <dlechner@...libre.com>
> ---
> drivers/staging/iio/impedance-analyzer/ad5933.c | 24 +-----------------------
> 1 file changed, 1 insertion(+), 23 deletions(-)
>
> diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c
> index 9149d41fe65b..e4942833b793 100644
> --- a/drivers/staging/iio/impedance-analyzer/ad5933.c
> +++ b/drivers/staging/iio/impedance-analyzer/ad5933.c
> @@ -84,7 +84,6 @@
>
> struct ad5933_state {
> struct i2c_client *client;
> - struct regulator *reg;
> struct clk *mclk;
> struct delayed_work work;
> struct mutex lock; /* Protect sensor state */
> @@ -660,13 +659,6 @@ static void ad5933_work(struct work_struct *work)
> }
> }
>
> -static void ad5933_reg_disable(void *data)
> -{
> - struct ad5933_state *st = data;
> -
> - regulator_disable(st->reg);
> -}
> -
> static int ad5933_probe(struct i2c_client *client)
> {
> const struct i2c_device_id *id = i2c_client_get_device_id(client);
> @@ -685,21 +677,7 @@ static int ad5933_probe(struct i2c_client *client)
>
> mutex_init(&st->lock);
>
> - st->reg = devm_regulator_get(&client->dev, "vdd");
> - if (IS_ERR(st->reg))
> - return PTR_ERR(st->reg);
> -
> - ret = regulator_enable(st->reg);
> - if (ret) {
> - dev_err(&client->dev, "Failed to enable specified VDD supply\n");
> - return ret;
> - }
> -
> - ret = devm_add_action_or_reset(&client->dev, ad5933_reg_disable, st);
> - if (ret)
> - return ret;
> -
> - ret = regulator_get_voltage(st->reg);
> + ret = devm_regulator_get_enable_get_voltage(&client->dev, "vdd");
> if (ret < 0)
> return ret;
>
>
Powered by blists - more mailing lists