[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250421133526.29a562be@jic23-huawei>
Date: Mon, 21 Apr 2025 13:35:26 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Gabriel Shahrouzi <gshahrouzi@...il.com>
Cc: gregkh@...uxfoundation.org, lars@...afoo.de, linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-staging@...ts.linux.dev,
Michael.Hennerich@...log.com, sonic.zhang@...log.com, vapier@...too.org,
skhan@...uxfoundation.org, linux-kernel-mentees@...ts.linux.dev
Subject: Re: [PATCH v5 4/5] staging: iio: adc: ad7816: Use chip_info for
device capabilities
On Sat, 19 Apr 2025 21:49:09 -0400
Gabriel Shahrouzi <gshahrouzi@...il.com> wrote:
> Move device-specific capability information, like the presence of a
> BUSY pin, into the ad7816_chip_info structure.
>
> Signed-off-by: Gabriel Shahrouzi <gshahrouzi@...il.com>
> ---
> drivers/staging/iio/adc/ad7816.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c
> index 39310ade770d0..ab7520a8a3da9 100644
> --- a/drivers/staging/iio/adc/ad7816.c
> +++ b/drivers/staging/iio/adc/ad7816.c
> @@ -44,21 +44,25 @@
> struct ad7816_chip_info {
> const char *name;
> u8 max_channels;
> + bool has_busy_pin;
> };
>
> static const struct ad7816_chip_info ad7816_info_ad7816 = {
> .name = "ad7816",
> .max_channels = 0,
> + .has_busy_pin = true,
> };
>
> static const struct ad7816_chip_info ad7817_info_ad7817 = {
> .name = "ad7817",
> .max_channels = 3,
> + .has_busy_pin = true,
> };
>
> static const struct ad7816_chip_info ad7818_info_ad7818 = {
> .name = "ad7818",
> .max_channels = 1,
> + .has_busy_pin = false,
> };
>
> struct ad7816_state {
> @@ -98,7 +102,7 @@ static int ad7816_spi_read(struct ad7816_state *chip, u16 *data)
> gpiod_set_value(chip->convert_pin, 1);
> }
>
> - if (chip->chip_info == &ad7816_info_ad7816 || chip->chip_info == &ad7817_info_ad7817) {
> + if (chip->chip_info->has_busy_pin) {
There are two places in the previous patch that have this pattern, but only one is
being converted here. Why not replace the one in probe() as well?
> while (gpiod_get_value(chip->busy_pin))
> cpu_relax();
> }
Powered by blists - more mailing lists