Re: [PATCH v9 2/2] iio: adc: max14001: New driver

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

 



On Mon, Jul 10, 2023 at 7:27 AM Kim Seer Paller
<kimseer.paller@xxxxxxxxxx> wrote:
>
> The MAX14001 is configurable, isolated 10-bit ADCs for multi-range
> binary inputs.

...

> 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));

...

> +       /*
> +        * 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




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux