Messages in this thread | | | From | Andy Shevchenko <> | Date | Mon, 10 Jul 2023 10:38:02 +0300 | Subject | Re: [PATCH v9 2/2] iio: adc: max14001: New driver |
| |
On Mon, Jul 10, 2023 at 10:36 AM Andy Shevchenko <andy.shevchenko@gmail.com> wrote: > On Mon, Jul 10, 2023 at 7:27 AM Kim Seer Paller > <kimseer.paller@analog.com> wrote:
...
> > V8 -> V9: Changed SPI buffer data types to __le16, > > Why? > > ... > > > + __le16 spi_tx_buffer __aligned(IIO_DMA_MINALIGN); > > + __le16 spi_rx_buffer; > > ... > > > + /* > > + * Prepare SPI transmit buffer 16 bit-value to big-endian format and > > + * reverses bit order to align with the LSB-first input on SDI port. > > reverse > > > + */ > > + st->spi_tx_buffer = bitrev16(cpu_to_be16(FIELD_PREP(MAX14001_ADDR_MASK, > > + reg_addr))); > > ... > > > + /* > > + * Convert received 16-bit value from big-endian to little-endian format > > + * and reverses bit order. > > reverse > > > + */ > > + *data = bitrev16(be16_to_cpu(st->spi_rx_buffer));
On top of that, this left unfixed.
...
> > + /* > > + * Prepare SPI transmit buffer 16 bit-value to big-endian format and > > + * reverses bit order to align with the LSB-first input on SDI port. > > reverse > > > + */ > > + st->spi_tx_buffer = bitrev16(cpu_to_be16( > > + FIELD_PREP(MAX14001_ADDR_MASK, reg_addr) | > > + FIELD_PREP(MAX14001_SET_WRITE_BIT, 1) | > > + FIELD_PREP(MAX14001_DATA_MASK, data))); > > Obviously it's incorrect now even more than before. > The types are defined as __le, while ops are against __be.
-- With Best Regards, Andy Shevchenko
| |