[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 5 May 2023 20:12:50 +0200
From: Mehdi Djait <mehdi.djait.k@...il.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Jonathan Cameron <jic23@...nel.org>,
Andi Shyti <andi.shyti@...nel.org>, mazziesaccount@...il.com,
krzysztof.kozlowski+dt@...aro.org, robh+dt@...nel.org,
lars@...afoo.de, linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org, devicetree@...r.kernel.org
Subject: Re: [PATCH v3 5/7] iio: accel: kionix-kx022a: Refactor driver and
add chip_info structure
Hello Andy,
On Tue, May 02, 2023 at 10:41:31PM +0300, Andy Shevchenko wrote:
> On Sun, Apr 30, 2023 at 06:49:10PM +0100, Jonathan Cameron wrote:
> > On Sat, 29 Apr 2023 15:07:46 +0200
> > Mehdi Djait <mehdi.djait.k@...il.com> wrote:
> > > On Tue, Apr 25, 2023 at 05:57:34PM +0200, Andi Shyti wrote:
> > > > On Tue, Apr 25, 2023 at 12:22:25AM +0200, Mehdi Djait wrote:
>
> ...
>
> > > > > + chip_info = device_get_match_data(&spi->dev);
> > > > > + if (!chip_info) {
> > > > > + const struct spi_device_id *id = spi_get_device_id(spi);
> > > > > + chip_info = (const struct kx022a_chip_info *)id->driver_data;
> > > >
> > > > you don't need the cast here... if you don't find it messy, I
> > > > wouldn't mind this form... some hate it, I find it easier to
> > > > read:
> > > >
> > > > chip_info = spi_get_device_id(spi)->driver_data;
> > > >
> > > > your choice.
> > >
> > > I don't really have any strong opinion about this other than keeping the
> > > same style used in iio drivers
> > >
> > > Again thank you for the review
> >
> > I'm fairly sure the cast is needed because driver_data is (via defines)
> > an unsigned long, which you cannot implicitly cast to a pointer without
> > various warnings being generated.
>
> Instead we have a specific SPI provided helper for the above, please use it
> instead of open coded stuff.
I will change it in the next version
--
Kind Regards
Mehdi Djait
Powered by blists - more mailing lists