Re: [PATCH v3 5/7] iio: accel: kionix-kx022a: Refactor driver and add chip_info structure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx> 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



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux