lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 2 May 2023 22:41:31 +0300
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Jonathan Cameron <jic23@...nel.org>
Cc:     Mehdi Djait <mehdi.djait.k@...il.com>,
        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

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.

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ