LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] mtd: dataflash: replace msleep with usleep_range
@ 2018-04-18 9:26 Luca Ellero
2018-04-26 18:03 ` Boris Brezillon
0 siblings, 1 reply; 2+ messages in thread
From: Luca Ellero @ 2018-04-18 9:26 UTC (permalink / raw)
Cc: Luca Ellero, David Woodhouse, Brian Norris, Boris Brezillon,
Marek Vasut, Richard Weinberger, Andrey Smirnov, Miquel Raynal,
linux-mtd, linux-kernel
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@brickedbrain.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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] mtd: dataflash: replace msleep with usleep_range
2018-04-18 9:26 [PATCH] mtd: dataflash: replace msleep with usleep_range Luca Ellero
@ 2018-04-26 18:03 ` Boris Brezillon
0 siblings, 0 replies; 2+ messages in thread
From: Boris Brezillon @ 2018-04-26 18:03 UTC (permalink / raw)
To: Luca Ellero
Cc: Marek Vasut, Andrey Smirnov, Richard Weinberger, linux-kernel,
linux-mtd, Miquel Raynal, Brian Norris, David Woodhouse
On Wed, 18 Apr 2018 11:26:26 +0200
Luca Ellero <luca.ellero@brickedbrain.com> wrote:
> 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@brickedbrain.com>
Applied.
Thanks,
Boris
> ---
> 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);
> }
> }
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-04-26 18:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-18 9:26 [PATCH] mtd: dataflash: replace msleep with usleep_range Luca Ellero
2018-04-26 18:03 ` Boris Brezillon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).