mac80211: enable build with linux 4.4
[openwrt/openwrt.git] / target / linux / lantiq / patches-3.18 / 0015-MTD-lantiq-xway-remove-endless-loop.patch
1 From 76e153079f02d26e3357302d2886a0c8aaaec64d Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Sun, 28 Jul 2013 18:02:06 +0200
4 Subject: [PATCH 15/36] MTD: lantiq: xway: remove endless loop
5
6 The reset loop logic could run into a endless loop. Lets fix it as requested.
7
8 --> http://lists.infradead.org/pipermail/linux-mtd/2012-September/044240.html
9
10 Signed-off-by: John Crispin <blogic@openwrt.org>
11 ---
12 drivers/mtd/nand/xway_nand.c | 10 ++++++++--
13 1 file changed, 8 insertions(+), 2 deletions(-)
14
15 --- a/drivers/mtd/nand/xway_nand.c
16 +++ b/drivers/mtd/nand/xway_nand.c
17 @@ -59,16 +59,22 @@ static u32 xway_latchcmd;
18 static void xway_reset_chip(struct nand_chip *chip)
19 {
20 unsigned long nandaddr = (unsigned long) chip->IO_ADDR_W;
21 + unsigned long timeout;
22 unsigned long flags;
23
24 nandaddr &= ~NAND_WRITE_ADDR;
25 nandaddr |= NAND_WRITE_CMD;
26
27 /* finish with a reset */
28 + timeout = jiffies + msecs_to_jiffies(20);
29 +
30 spin_lock_irqsave(&ebu_lock, flags);
31 writeb(NAND_WRITE_CMD_RESET, (void __iomem *) nandaddr);
32 - while ((ltq_ebu_r32(EBU_NAND_WAIT) & NAND_WAIT_WR_C) == 0)
33 - ;
34 + do {
35 + if ((ltq_ebu_r32(EBU_NAND_WAIT) & NAND_WAIT_WR_C) == 0)
36 + break;
37 + cond_resched();
38 + } while (!time_after_eq(jiffies, timeout));
39 spin_unlock_irqrestore(&ebu_lock, flags);
40 }
41