From: Mark Brown Date: Mon, 15 Feb 2016 18:28:02 +0000 (+0000) Subject: spi: Add cond_resched() in main message processing loop X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=628269704f19fcfc765499b7158effccfc79b6cf;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git spi: Add cond_resched() in main message processing loop When a controller has only PIO support it is very likely that we will run into use cases where we spend a very large amount of time consuming CPU. Code that does this should call cond_resched() every once in a while to give other tasks more of a chance to run so do that in the main SPI loop, the overhead is negligable if it's not needed. Suggested-by: Arnd Bergmann Signed-off-by: Mark Brown --- diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index dcc6f6e92668..0b2bbf144460 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1184,6 +1184,9 @@ static void __spi_pump_messages(struct spi_master *master, bool in_kthread) return; } mutex_unlock(&master->bus_lock_mutex); + + /* Prod the scheduler in case transfer_one() was busy waiting */ + cond_resched(); } /**