[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHp75Vdyz6Pr1xm0LjhttVAO2GsLhWwb=OndvguSAqWqqhpMXg@mail.gmail.com>
Date: Mon, 4 Aug 2025 10:33:37 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Matti Vaittinen <mazziesaccount@...il.com>
Cc: Jonathan Cameron <Jonathan.Cameron@...wei.com>,
Matti Vaittinen <matti.vaittinen@...rohmeurope.com>, Lars-Peter Clausen <lars@...afoo.de>,
Michael Hennerich <Michael.Hennerich@...log.com>, Jonathan Cameron <jic23@...nel.org>,
David Lechner <dlechner@...libre.com>, Nuno Sá <nuno.sa@...log.com>,
Andy Shevchenko <andy@...nel.org>, Liam Girdwood <lgirdwood@...il.com>, Mark Brown <broonie@...nel.org>,
linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 1/2] iio: adc: ad7476: Simplify chip type detection
On Mon, Aug 4, 2025 at 7:57 AM Matti Vaittinen <mazziesaccount@...il.com> wrote:
> On 01/08/2025 14:09, Jonathan Cameron wrote:
> > On Fri, 1 Aug 2025 13:07:13 +0300
> > Matti Vaittinen <mazziesaccount@...il.com> wrote:
...
> >> st = iio_priv(indio_dev);
> >> st->chip_info =
> >> - &ad7476_chip_info_tbl[spi_get_device_id(spi)->driver_data];
> >> + (struct ad7476_chip_info *)spi_get_device_id(spi)->driver_data;
> >
> > Switch to spi_get_device_match_data()
> > which checks via generic firmware paths first (so DT here) and then the
> > old school tables. Also returns a void * so gets rid of need to cast.
>
> Ah. Right! Thanks!
More importantly it returns _const_ void *. And qualifier makes a lot
of sense here.
> > Only works with all pointers (or a lot of care) because a value 0 is a
> > fail to match. So kind of enabled by your patch.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists