Re: [PATCH v4 1/6] spi: Enable controllers to extend the SPI protocol with MOSI idle configuration

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

 



On 6/18/24 6:10 PM, Marcelo Schmitt wrote:

...

> @@ -3928,7 +3934,8 @@ int spi_setup(struct spi_device *spi)
>  	 * so it is ignored here.
>  	 */
>  	bad_bits = spi->mode & ~(spi->controller->mode_bits | SPI_CS_WORD |
> -				 SPI_NO_TX | SPI_NO_RX);
> +				 SPI_NO_TX | SPI_NO_RX | SPI_MOSI_IDLE_LOW |
> +				 SPI_MOSI_IDLE_HIGH);

This looks wrong to me. Adding flags here causes them to be ignored
rather than to be checked.

I also did a runtime check with a random driver and a SPI controller
that does not have the flag.

	spi->mode |= SPI_MOSI_IDLE_LOW;
	ret = spi_setup(spi);
	if (ret)
		return ret;

It incorrectly passes when used with this change but correctly fails
without this change.

>  	ugly_bits = bad_bits &
>  		    (SPI_TX_DUAL | SPI_TX_QUAD | SPI_TX_OCTAL |
>  		     SPI_RX_DUAL | SPI_RX_QUAD | SPI_RX_OCTAL);





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux