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

From: Mark Brown
Date: Mon Jul 10 2023 - 13:30:54 EST


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: signature.asc
Description: PGP signature