spi: limit reaches -1, tested 0
authorRoel Kluin <[email protected]>
Tue, 7 Apr 2009 02:00:54 +0000 (19:00 -0700)
committerLinus Torvalds <[email protected]>
Tue, 7 Apr 2009 15:31:07 +0000 (08:31 -0700)
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 <[email protected]>
Cc: Mariusz Ceier <[email protected]>
Acked-by: David Brownell <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
drivers/spi/spi_imx.c

index 0480d8bb19d32b7a6d81b2b43efafc2a7fe8defd..014af69fc1bbba62ac386a1f147c7e816af14a0b 100644 (file)
@@ -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,