[PATCH v3 4/9] iio: amplifiers: ad8366: drop reset_gpio from private struct

Rodrigo Alencar via B4 Relay posted 9 patches 6 days, 5 hours ago
[PATCH v3 4/9] iio: amplifiers: ad8366: drop reset_gpio from private struct
Posted by Rodrigo Alencar via B4 Relay 6 days, 5 hours ago
From: Rodrigo Alencar <rodrigo.alencar@analog.com>

Remove reset_gpio from the device state struct and turn it
into a local variable, as it is not being used anywhere else.

Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
---
 drivers/iio/amplifiers/ad8366.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/amplifiers/ad8366.c b/drivers/iio/amplifiers/ad8366.c
index f0d44f2769ca..d6e18eb71bc8 100644
--- a/drivers/iio/amplifiers/ad8366.c
+++ b/drivers/iio/amplifiers/ad8366.c
@@ -42,7 +42,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;
@@ -245,6 +244,7 @@ static const struct iio_chan_spec ada4961_channels[] = {
 
 static int ad8366_probe(struct spi_device *spi)
 {
+	struct gpio_desc *reset_gpio;
 	struct iio_dev *indio_dev;
 	struct ad8366_state *st;
 	int ret;
@@ -279,9 +279,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);
+		reset_gpio = devm_gpiod_get_optional(&spi->dev, "reset", GPIOD_OUT_HIGH);
+		if (IS_ERR(reset_gpio)) {
+			ret = PTR_ERR(reset_gpio);
 			goto error_disable_reg;
 		}
 		indio_dev->channels = ada4961_channels;

-- 
2.43.0
Re: [PATCH v3 4/9] iio: amplifiers: ad8366: drop reset_gpio from private struct
Posted by Andy Shevchenko 5 days, 14 hours ago
On Tue, Feb 03, 2026 at 11:24:10AM +0000, Rodrigo Alencar via B4 Relay wrote:

> Remove reset_gpio from the device state struct and turn it
> into a local variable, as it is not being used anywhere else.

Why not switching to reset-gpio driver to begin with?

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH v3 4/9] iio: amplifiers: ad8366: drop reset_gpio from private struct
Posted by Rodrigo Alencar 3 days, 22 hours ago
On 26/02/04 03:55AM, Andy Shevchenko wrote:
> On Tue, Feb 03, 2026 at 11:24:10AM +0000, Rodrigo Alencar via B4 Relay wrote:
> 
> > Remove reset_gpio from the device state struct and turn it
> > into a local variable, as it is not being used anywhere else.
> 
> Why not switching to reset-gpio driver to begin with?

No particular reason, consuming it as gpio was already there!
Is this a suggestion/recommendation or a mandatory thing for
now on?

looked over some examples, some are not updating dt-bindings with resets,
others don't have Kconfig requiring POWER_RESET or POWER_RESET_GPIO config.
Those things are necessary, right?
 
-- 
Kind regards,

Rodrigo Alencar
Re: [PATCH v3 4/9] iio: amplifiers: ad8366: drop reset_gpio from private struct
Posted by Andy Shevchenko 3 days, 8 hours ago
On Thu, Feb 05, 2026 at 06:12:23PM +0000, Rodrigo Alencar wrote:
> On 26/02/04 03:55AM, Andy Shevchenko wrote:
> > On Tue, Feb 03, 2026 at 11:24:10AM +0000, Rodrigo Alencar via B4 Relay wrote:
> > 
> > > Remove reset_gpio from the device state struct and turn it
> > > into a local variable, as it is not being used anywhere else.
> > 
> > Why not switching to reset-gpio driver to begin with?
> 
> No particular reason, consuming it as gpio was already there!
> Is this a suggestion/recommendation or a mandatory thing for
> now on?

Not mandatory, just preferable since the reset line might be shared in some
(future) PCB designs, with the reset-gpio in place, there will be no need
to take care of that in the driver.

> looked over some examples, some are not updating dt-bindings with resets,
> others don't have Kconfig requiring POWER_RESET or POWER_RESET_GPIO config.
> Those things are necessary, right?

Depends on the optionality. If this resource is mandatory to have,
the mentioned options will be needed, indeed.

-- 
With Best Regards,
Andy Shevchenko