瀏覽代碼

spi: limit reaches -1, tested 0

With a postfix decrement limit will reach -1 rather than 0, so the warning
will not be issued.

Also, add a cpu_relax() into the busy-wait loop.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Cc: Mariusz Ceier <mceier@gmail.com>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Roel Kluin 16 年之前
父節點
當前提交
c8fc657e6a
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      drivers/spi/spi_imx.c

+ 2 - 1
drivers/spi/spi_imx.c

@@ -779,7 +779,8 @@ static irqreturn_t interrupt_transfer(struct driver_data *drv_data)
 
 			/* Read trailing bytes */
 			limit = loops_per_jiffy << 1;
-			while ((read(drv_data) == 0) && limit--);
+			while ((read(drv_data) == 0) && --limit)
+				cpu_relax();
 
 			if (limit == 0)
 				dev_err(&drv_data->pdev->dev,