Skip to content

Commit

Permalink
spi: limit reaches -1, tested 0
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Roel Kluin authored and Linus Torvalds committed Apr 7, 2009
1 parent 93b61bd commit c8fc657
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/spi/spi_imx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit c8fc657

Please sign in to comment.