On Fri, May 22, 2020 at 02:52:35PM +0300, Serge Semin wrote: > On Fri, May 22, 2020 at 02:13:40PM +0300, Andy Shevchenko wrote: > > > Changelog v4: > > > - Get back ndelay() method to wait for an SPI transfer completion. > > > spi_delay_exec() isn't suitable for the atomic context. > > OTOH we may teach spi_delay_exec() to perform atomic sleeps. > Please, see it's implementation. It does atomic delay when the delay value > is less than 10us. But selectively gets to the usleep_range() if value is > greater than that. Yes, I hadn't realised this was in atomic context - _delay_exec() is just not safe to use there, it'll swich to a sleeping delay if the time is long enough. > > > + while (dw_spi_dma_tx_busy(dws) && retry--) > > > + ndelay(ns); > > I might be mistaken, but I think I told that this one misses to keep power > > management in mind. > Here we already in nearly atomic context due to the callback executed in the > tasklet. What power management could be during a tasklet execution? Again we > can't call sleeping methods in here. What do you suggest in substitution? You'd typically have a cpu_relax() in there as well as the ndelay().
Attachment:
signature.asc
Description: PGP signature