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

From: Andy Shevchenko
Date: Thu Dec 03 2020 - 09:24:17 EST


On Thu, Dec 3, 2020 at 4:00 PM Alexandru Ardelean
<alexandru.ardelean@xxxxxxxxxx> wrote:

> +#define SPI_MODE_USER_MASK \
> + (SPI_CPHA | SPI_CPOL | SPI_CS_HIGH | SPI_LSB_FIRST | \
> + SPI_3WIRE | SPI_LOOP | SPI_NO_CS | SPI_READY | \
> + SPI_TX_DUAL | SPI_TX_QUAD | SPI_RX_DUAL | SPI_RX_QUAD | \
> + SPI_CS_WORD | SPI_TX_OCTAL | SPI_RX_OCTAL | SPI_3WIRE_HIZ)

Forgot to comment on this. Since it's an uAPI we may not fill the
holes (if any) in the future with the different semantics of values.
And this huge list of names is rather hard to read.

#define SPI_MODE_USER_MASK (_BITUL(16) - 1)

would be sufficient.

For the record, I was thinking about providing MAX or LAST or
something like that instead of MASK and do the rest in kernel headers
/ modules, but it seems equally good/bad. Let's stick with mask as in
my initial propose and your current code.

--
With Best Regards,
Andy Shevchenko