On 7/6/20 2:36 PM, Maxime Ripard wrote: > On Mon, Jul 06, 2020 at 09:17:57AM +0200, Marc Kleine-Budde wrote: >> This patch introduces the function sun6i_spi_get_rx_fifo_count(), similar to >> the existing sun6i_spi_get_tx_fifo_count(), to make the sun6i_spi_drain_fifo() >> function a bit easier to read. >> >> Signed-off-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx> >> --- >> drivers/spi/spi-sun6i.c | 15 +++++++++++---- >> 1 file changed, 11 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/spi/spi-sun6i.c b/drivers/spi/spi-sun6i.c >> index 882492774986..f70d14229483 100644 >> --- a/drivers/spi/spi-sun6i.c >> +++ b/drivers/spi/spi-sun6i.c >> @@ -106,6 +106,15 @@ static inline void sun6i_spi_write(struct sun6i_spi *sspi, u32 reg, u32 value) >> writel(value, sspi->base_addr + reg); >> } >> >> +static inline u32 sun6i_spi_get_rx_fifo_count(struct sun6i_spi *sspi) >> +{ >> + u32 reg = sun6i_spi_read(sspi, SUN6I_FIFO_STA_REG); >> + >> + reg >>= SUN6I_FIFO_STA_RF_CNT_BITS; >> + >> + return reg & SUN6I_FIFO_STA_RF_CNT_MASK; >> +} >> + > > I guess we could just use FIELD_GET here? > > Looks good otherwise, thanks! Will change in v2. Marc -- Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung West/Dortmund | Phone: +49-231-2826-924 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |