Re: [PATCH v4 2/3] spi: Add SPI_NO_TX/RX support

From: Andy Shevchenko
Date: Thu Dec 03 2020 - 09:10:21 EST


On Thu, Dec 3, 2020 at 4:00 PM Alexandru Ardelean
<alexandru.ardelean@xxxxxxxxxx> wrote:
> From: Dragos Bogdan <dragos.bogdan@xxxxxxxxxx>
>
> Transmit/receive only is a valid SPI mode. For example, the MOSI/TX line
> might be missing from an ADC while for a DAC the MISO/RX line may be
> optional. This patch adds these two new modes: SPI_NO_TX and
> SPI_NO_RX. This way, the drivers will be able to identify if any of
> these two lines is missing and to adjust the transfers accordingly.

...

> + BUILD_BUG_ON(SPI_MODE_USER_MASK & SPI_MODE_KERNEL_MASK);

Please, use static_assert() as I have been pointed out. It may be
located outside of a function scope. You may attach it directly to the
definition of the KERNEL_MASK (I haven't tried yet with header
though).

...

> +#define SPI_NO_TX BIT(31) /* no transmit wire */
> +#define SPI_NO_RX BIT(30) /* no receive wire */
> +#define SPI_MODE_KERNEL_MASK (SPI_NO_TX | SPI_NO_RX)

This needs a comment to explain what's going on with the flags (split).

--
With Best Regards,
Andy Shevchenko