On Fri, Nov 09, 2018 at 04:43:43PM +0100, Stefan Wahren wrote: > Am 08.11.18 um 08:06 schrieb Lukas Wunner: > > +/** > > + * bcm2835_wait_tx_fifo_empty() - busy-wait for TX FIFO to empty > > + * @bs: BCM2835 SPI controller > > + */ > > +static inline void bcm2835_wait_tx_fifo_empty(struct bcm2835_spi *bs) > > +{ > > + while (!(bcm2835_rd(bs, BCM2835_SPI_CS) & BCM2835_SPI_CS_DONE)) > > + cpu_relax(); > > +} > > Can we have some kind of timeout here, so we never spin forever in case > hw doesn't behave as expected? The only way for this to happen is if the RX FIFO cannot accommodate as many bytes as were written to the TX FIFO: Transmission is halted once the RX FIFO becomes full and then indeed the function would spin forever. Let me amend the function's kerneldoc to spell out this responsibility of the caller. The DONE flag is otherwise set reliably by the hardware, I honestly don't see a need to supervise that. Thanks, Lukas