It is enough to use chip_good() only so chip_ready() is not necessary. Since chip_good() is doing the same check chip_ready() is doing plus an extra check to make sure we end up with the data we wrote. For this change the order to check timeout also will be changed at same time. The order is not a hard requirement, it's just better to avoid the case where the data update happens just after the timeout has expired. Signed-off-by: Tokunori Ikegami <ikegami_to@xxxxxxxxxxx> Cc: Fabio Bettoni <fbettoni@xxxxxxxxx> Co: Hauke Mehrtens <hauke@xxxxxxxxxx> Co: Koen Vandeputte <koen.vandeputte@xxxxxxxxxxxx> Cc: Chris Packham <chris.packham@xxxxxxxxxxxxxxxxxxx> Cc: Joakim Tjernlund <Joakim.Tjernlund@xxxxxxxxxxxx> Cc: linux-mtd@xxxxxxxxxxxxxxxxxxx --- Changes since v3: - Update the commit message for the comment. - Change the email address of Tokunori Ikegami to ikegami_to@xxxxxxxxxxx. Changes since v2: - None. Changes since v1: - None. drivers/mtd/chips/cfi_cmdset_0002.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c index 91a491b..ca9d5fa 100755 --- a/drivers/mtd/chips/cfi_cmdset_0002.c +++ b/drivers/mtd/chips/cfi_cmdset_0002.c @@ -1878,14 +1878,14 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip, continue; } - if (time_after(jiffies, timeo) && !chip_ready(map, adr)) - break; - if (chip_good(map, adr, datum)) { xip_enable(map, chip, adr); goto op_done; } + if (time_after(jiffies, timeo)) + break; + /* Latency issues. Drop the lock, wait a while and retry */ UDELAY(map, chip, adr, 1); } -- 2.11.0 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/