[PATCH v2 04/15] spi: Replace open coded spi_controller_xfer_timeout()
Andy Shevchenko
andriy.shevchenko at linux.intel.com
Tue Jul 11 04:01:13 PDT 2023
On Mon, Jul 10, 2023 at 06:30:32PM +0100, Mark Brown wrote:
> 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.
Okay, let's drop this change.
> > + u32 speed_hz = xfer->speed_hz ?: 100000;
>
> Not only the ternery operator, but the version without the second
> argument for extra clarity!
Elvis can be interpreted as "A _or_ B (if A is false/0)".
Some pieces related to SPI use Elvis already IIRC.
--
With Best Regards,
Andy Shevchenko
More information about the linux-riscv
mailing list