Re: [PATCH v2 04/15] spi: Replace open coded spi_controller_xfer_timeout()

Mark Brown
2023-07-10T17:30:53Z

[-- Attachment #1.1: Type: text/plain, Size: 666 bytes --]

On Mon, Jul 10, 2023 at 06:49:21PM +0300, Andy Shevchenko wrote:

> Since the new spi_controller_xfer_timeout() helper appeared,
> we may replace open coded variant in spi_transfer_wait().

> + * Assume speed to be 100 kHz if it's not defined at the time of invocation.
> + *

You didn't mention this bit in the changelog, and I'm not 100% convinced
it was the best idea in the first place. It's going to result in some
very big timeouts if it goes off, and we really should be doing
validation much earlier in the process.

> + u32 speed_hz = xfer->speed_hz ?: 100000;

Not only the ternery operator, but the version without the second
argument for extra clarity!

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 161 bytes --]