diff options
author | Anil Veliyankara Madam <aveliyan@cisco.com> | 2016-01-07 21:18:52 -0800 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2016-01-08 10:36:57 -0500 |
commit | 848c3920866fdb7b8b353408348df7929306e9be (patch) | |
tree | cbb86365742718165a97a1df062677b35347f072 | |
parent | 427cc61a4486fa80eccaad2bdfcc50cfd1b46625 (diff) | |
download | linux-848c3920866fdb7b8b353408348df7929306e9be.tar.bz2 |
drivers: libata-core: Use usleep_range() instead of msleep() for short sleeps (<20 ms)
Since msleep() may sleep longer than intended time for values less
than 20ms, this patch allows the use of usleep_range for waits less
that 20ms. usleep_range is a finer precision implementation of
msleep and is designed to be a drop-in replacement for udelay
where a precise sleep/busy-wait is unnecessary.
More details can be found at http://lkml.org/lkml/2007/8/3/250
and in Documentation/timers/timers-howto.txt.
This change has been done to improve the performace in PIO6 mode
which is used by viking flash.
Cc: xe-kernel@external.cisco.com
Signed-off-by: Anil Veliyankara Madam <aveliyan@cisco.com>
Signed-off-by: Shikha Jain <shikjain@cisco.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
-rw-r--r-- | drivers/ata/libata-core.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 60e368610c74..f5ae6f43b659 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -50,6 +50,7 @@ #include <linux/blkdev.h> #include <linux/delay.h> #include <linux/timer.h> +#include <linux/time.h> #include <linux/interrupt.h> #include <linux/completion.h> #include <linux/suspend.h> @@ -6704,7 +6705,12 @@ void ata_msleep(struct ata_port *ap, unsigned int msecs) if (owns_eh) ata_eh_release(ap); - msleep(msecs); + if (msecs < 20) { + unsigned long usecs = msecs * USEC_PER_MSEC; + usleep_range(usecs, usecs + 50); + } else { + msleep(msecs); + } if (owns_eh) ata_eh_acquire(ap); |