RE: [PATCH v7 2/2] iio: adc: max14001: New driver

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

 



> -----Original Message-----
> From: Andy Shevchenko <andy.shevchenko@xxxxxxxxx>
> Sent: Tuesday, June 20, 2023 11:15 PM
> To: Paller, Kim Seer <KimSeer.Paller@xxxxxxxxxx>
> Cc: jic23@xxxxxxxxxx; lars@xxxxxxxxxx; lgirdwood@xxxxxxxxx;
> broonie@xxxxxxxxxx; Hennerich, Michael <Michael.Hennerich@xxxxxxxxxx>;
> robh@xxxxxxxxxx; krzysztof.kozlowski@xxxxxxxxxx; conor+dt@xxxxxxxxxx; linux-
> iio@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; devicetree@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH v7 2/2] iio: adc: max14001: New driver
> 
> [External]
> 
> On Tue, Jun 20, 2023 at 4:27 PM Kim Seer Paller
> <kimseer.paller@xxxxxxxxxx> wrote:
> >
> > The MAX14001 is configurable, isolated 10-bit ADCs for multi-range
> > binary inputs.
> 
> ...
> 
> > +       /*
> > +        * Align received data from the receive buffer, reversing and reordering
> > +        * it to match the expected MSB-first format.
> > +        */
> > +       *data = (__force u16)(be16_to_cpu(bitrev16(st->spi_rx_buffer))) &
> > +                                                       MAX14001_DATA_MASK;
> 
> Using __force in the C files is somehow stinky.
> 
> ...
> 
> > +       /*
> > +        * Convert transmit buffer to big-endian format and reverse transmit
> > +        * buffer to align with the LSB-first input on SDI port.
> > +        */
> > +       st->spi_tx_buffer = (__force u16)(cpu_to_be16(bitrev16(
> 
> You have a different type of spi_tx_buffer than u16, don't you?

I have the same type of spi_tx_buffer as u16. 

Other than using force cast, is there any way to resolve the endian warning? I have 
actually swapped the order of bitrev16() and cpu_to_be16/be16_to_cpu() functions. 
I have tested and they also work fine.

Best regards,
Kim Seer Paller





[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