[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1524043588-25816-1-git-send-email-luca.ellero@brickedbrain.com>
Date: Wed, 18 Apr 2018 11:26:26 +0200
From: Luca Ellero <luca.ellero@...ckedbrain.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Luca Ellero <luca.ellero@...ckedbrain.com>,
David Woodhouse <dwmw2@...radead.org>,
Brian Norris <computersforpeace@...il.com>,
Boris Brezillon <boris.brezillon@...tlin.com>,
Marek Vasut <marek.vasut@...il.com>,
Richard Weinberger <richard@....at>,
Andrey Smirnov <andrew.smirnov@...il.com>,
Miquel Raynal <miquel.raynal@...tlin.com>,
linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: [PATCH] mtd: dataflash: replace msleep with usleep_range
Since msleep is based on jiffies, this 3 ms sleep becomes actually 20 ms.
Worst of all, since this sleep is used in a loop when writing, a single page
write (256 to 1024 bytes) causes 17 ms extra time.
When writing large files (for example u-boot is usually 512 KB) this delay
adds up to minutes.
See Documentation/timers/timers-howto.txt "Why not msleep for (1ms - 20ms)".
Signed-off-by: Luca Ellero <luca.ellero@...ckedbrain.com>
---
drivers/mtd/devices/mtd_dataflash.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
index aaaeaae..3a6f450 100644
--- a/drivers/mtd/devices/mtd_dataflash.c
+++ b/drivers/mtd/devices/mtd_dataflash.c
@@ -140,7 +140,7 @@ static int dataflash_waitready(struct spi_device *spi)
if (status & (1 << 7)) /* RDY/nBSY */
return status;
- msleep(3);
+ usleep_range(3000, 4000);
}
}
--
2.7.4
Powered by blists - more mailing lists