[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b17dc4de-9fd2-410e-8c5e-f27e550d3eca@stanley.mountain>
Date: Tue, 22 Apr 2025 09:36:25 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Gabriel Shahrouzi <gshahrouzi@...il.com>
Cc: gregkh@...uxfoundation.org, jic23@...nel.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 3/5] staging: iio: adc: ad7816: Introduce chip_info and
use pointer matching
On Sat, Apr 19, 2025 at 09:56:36AM -0400, Gabriel Shahrouzi wrote:
> @@ -84,7 +98,7 @@ static int ad7816_spi_read(struct ad7816_state *chip, u16 *data)
> gpiod_set_value(chip->convert_pin, 1);
> }
>
> - if (chip->id == ID_AD7816 || chip->id == ID_AD7817) {
> + if (chip->chip_info == &ad7816_info_ad7816 || chip->chip_info == &ad7817_info_ad7817) {
> while (gpiod_get_value(chip->busy_pin))
> cpu_relax();
> }
> @@ -353,6 +367,7 @@ static int ad7816_probe(struct spi_device *spi_dev)
> {
> struct ad7816_state *chip;
> struct iio_dev *indio_dev;
> + const struct ad7816_chip_info *info;
> int i, ret;
>
> indio_dev = devm_iio_device_alloc(&spi_dev->dev, sizeof(*chip));
> @@ -362,11 +377,15 @@ static int ad7816_probe(struct spi_device *spi_dev)
> /* this is only used for device removal purposes */
> dev_set_drvdata(&spi_dev->dev, indio_dev);
>
> + info = device_get_match_data(&spi_dev->dev);
> + if (!info)
> + return -ENODEV;
> + chip->chip_info = info;
> +
> chip->spi_dev = spi_dev;
> for (i = 0; i <= AD7816_CS_MAX; i++)
> chip->oti_data[i] = 203;
>
> - chip->id = spi_get_device_id(spi_dev)->driver_data;
Delete the struct ad7816_state ->id member since you are no longer setting
or using it.
Btw, this patch didn't apply for me on linux-next.
regards,
dan carpenter
Powered by blists - more mailing lists