Re: [PATCH v4 06/11] iio: amplifiers: ad8366: replace reset-gpio with reset controller

Jonathan Cameron
2026-02-14T18:38:00Z

On Tue, 10 Feb 2026 19:42:06 +0000
Rodrigo Alencar via B4 Relay <devnull+rodrigo.alencar.analog.com@kernel.org> wrote:

> From: Rodrigo Alencar <rodrigo.alencar@analog.com>
>
> Remove reset_gpio from the device state struct and use the
> reset_control interface instead, using a local variable,
Prefer commit descriptions wrapped to 75 chars.

Remove reset_gpio from the device state struct and use the reset_control
interface instead, using a local variable, as it is not being used anywhere
else.

> as it is not being used anywhere else.

>
> Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
> ---
> drivers/iio/amplifiers/ad8366.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/iio/amplifiers/ad8366.c b/drivers/iio/amplifiers/ad8366.c
> index f0053a09cbb6..67817dedd75d 100644
> --- a/drivers/iio/amplifiers/ad8366.c
> +++ b/drivers/iio/amplifiers/ad8366.c
> @@ -17,6 +17,7 @@
> #include <linux/module.h>
> #include <linux/mutex.h>
> #include <linux/regulator/consumer.h>
> +#include <linux/reset.h>
> #include <linux/spi/spi.h>
>
> #include <linux/iio/iio.h>
> @@ -38,7 +39,6 @@ struct ad8366_state {
> struct spi_device *spi;
> struct regulator *reg;
> struct mutex lock; /* protect sensor state */
> - struct gpio_desc *reset_gpio;
> unsigned char ch[2];
> enum ad8366_type type;
> const struct ad8366_info *info;
> @@ -242,6 +242,7 @@ static const struct iio_chan_spec ada4961_channels[] = {
> static int ad8366_probe(struct spi_device *spi)
> {
> struct device *dev = &spi->dev;
> + struct reset_control *rstc;
> struct iio_dev *indio_dev;
> struct ad8366_state *st;
> int ret;
> @@ -276,9 +277,9 @@ static int ad8366_probe(struct spi_device *spi)
> case ID_ADL5240:
> case ID_HMC792:
> case ID_HMC1119:
> - st->reset_gpio = devm_gpiod_get_optional(&spi->dev, "reset", GPIOD_OUT_HIGH);
> - if (IS_ERR(st->reset_gpio)) {
> - ret = PTR_ERR(st->reset_gpio);
> + rstc = devm_reset_control_get_optional_exclusive_deasserted(dev, NULL);
> + if (IS_ERR(rstc)) {
> + ret = PTR_ERR(rstc);
> goto error_disable_reg;
> }
> indio_dev->channels = ada4961_channels;
>