mtd: st_spi_fsm: Allow loop to run at least once before giving up CPU

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Sat Apr 5 02:59:06 EDT 2014


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=ea7864bf44e1638c34b9eef95477a72ae68fbdc6
Commit:     ea7864bf44e1638c34b9eef95477a72ae68fbdc6
Parent:     f1919cb852c8f9e7fa667a446f253258a8a599f2
Author:     Lee Jones <lee.jones at linaro.org>
AuthorDate: Thu Mar 20 11:11:46 2014 +0000
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Thu Mar 20 04:56:52 2014 -0700

    mtd: st_spi_fsm: Allow loop to run at least once before giving up CPU
    
    Reported-by: Brian Norris <computersforpeace at gmail.com>
    Signed-off-by: Lee Jones <lee.jones at linaro.org>
    Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
 drivers/mtd/devices/st_spi_fsm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c
index ef9f9b8..4d6b58c 100644
--- a/drivers/mtd/devices/st_spi_fsm.c
+++ b/drivers/mtd/devices/st_spi_fsm.c
@@ -861,8 +861,6 @@ static uint8_t stfsm_wait_busy(struct stfsm *fsm)
 	 */
 	deadline = jiffies + FLASH_MAX_BUSY_WAIT;
 	while (!timeout) {
-		cond_resched();
-
 		if (time_after_eq(jiffies, deadline))
 			timeout = 1;
 
@@ -881,6 +879,8 @@ static uint8_t stfsm_wait_busy(struct stfsm *fsm)
 		if (!timeout)
 			/* Restart */
 			writel(seq->seq_cfg, fsm->base + SPI_FAST_SEQ_CFG);
+
+		cond_resched();
 	}
 
 	dev_err(fsm->dev, "timeout on wait_busy\n");



More information about the linux-mtd-cvs mailing list