[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1ae2f7de-f1f9-4f45-b38f-b68089fc017c@kernel.org>
Date: Mon, 19 Jan 2026 15:47:46 +0100
From: Krzysztof Kozlowski <krzk@...nel.org>
To: rodrigo.alencar@...log.com, linux-kernel@...r.kernel.org,
linux-iio@...r.kernel.org, devicetree@...r.kernel.org
Cc: Michael Hennerich <Michael.Hennerich@...log.com>,
Lars-Peter Clausen <lars@...afoo.de>, Jonathan Cameron <jic23@...nel.org>,
David Lechner <dlechner@...libre.com>, Andy Shevchenko <andy@...nel.org>,
Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>
Subject: Re: [PATCH 7/7] iio: amplifiers: ad8366: add device tree support
On 19/01/2026 15:37, Rodrigo Alencar via B4 Relay wrote:
> + st->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
> + if (IS_ERR(st->reset_gpio))
> + return dev_err_probe(dev, PTR_ERR(st->reset_gpio),
> + "Failed to get reset GPIO\n");
>
> - st->enable_gpio = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_HIGH);
> - if (IS_ERR(st->enable_gpio))
> - return dev_err_probe(dev, PTR_ERR(st->enable_gpio),
> - "Failed to get enable GPIO\n");
> + st->enable_gpio = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_HIGH);
No, you are changing the same line *third* time. you need to organize
your patchset in logical way but also in a readable. You do not add
incorrect code just to change it later.
I do not see the reason behind removal of switch case. It's really
independent change of OF support which must come with its own
justification of affecting other platforms.
> + if (IS_ERR(st->enable_gpio))
> + return dev_err_probe(dev, PTR_ERR(st->enable_gpio),
> + "Failed to get enable GPIO\n");
>
> - indio_dev->channels = ada4961_channels;
> - indio_dev->num_channels = ARRAY_SIZE(ada4961_channels);
> - break;
> - default:
> - return dev_err_probe(dev, -EINVAL, "Invalid device ID\n");
> - }
> -
> - st->info = &ad8366_infos[st->type];
> indio_dev->name = spi_get_device_id(spi)->name;
> indio_dev->info = &ad8366_info;
> + indio_dev->channels = ad8366_channels;
> + indio_dev->num_channels = st->info->num_channels;
> indio_dev->modes = INDIO_DIRECT_MODE;
>
> - ret = ad8366_write(indio_dev, 0, 0);
> + ret = ad8366_write_code(st);
> if (ret < 0)
> return dev_err_probe(dev, ret, "failed to write initial gain\n");
>
> @@ -384,24 +322,41 @@ static int ad8366_probe(struct spi_device *spi)
> }
Best regards,
Krzysztof
Powered by blists - more mailing lists