On Wed, Jun 21, 2023 at 3:38 AM Paller, Kim Seer <KimSeer.Paller@xxxxxxxxxx> wrote: > > From: Andy Shevchenko <andy.shevchenko@xxxxxxxxx> > > Sent: Tuesday, June 20, 2023 11:15 PM > > On Tue, Jun 20, 2023 at 4:27 PM Kim Seer Paller > > <kimseer.paller@xxxxxxxxxx> wrote: ... > > > + /* > > > + * 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. And you should have __be16. > 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. You really have to get it correct on both LE and BE architectures. -- With Best Regards, Andy Shevchenko