[2/2] ahci: Use usleep_range() in ahci_start_port()

Message ID 20180111125551.61877-2-mika.westerberg@linux.intel.com
State Not Applicable
Delegated to: David Miller
Headers show
Series
  • [1/2] ahci: Add Intel Cannon Lake PCH-H PCI ID
Related show

Commit Message

Mika Westerberg Jan. 11, 2018, 12:55 p.m.
Using msleep(1) may actually sleep much longer than 1 msecs (~20 msecs)
which unnecessarily slows down system startup. Avoid that and use
usleep_range() instead.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
 drivers/ata/libahci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tejun Heo Jan. 11, 2018, 6:11 p.m. | #1
On Thu, Jan 11, 2018 at 03:55:51PM +0300, Mika Westerberg wrote:
> Using msleep(1) may actually sleep much longer than 1 msecs (~20 msecs)
> which unnecessarily slows down system startup. Avoid that and use
> usleep_range() instead.
> 
> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>

Heh, I'm not sure.  How big of a problem is this?

Thanks.
Mika Westerberg Jan. 11, 2018, 6:22 p.m. | #2
On Thu, Jan 11, 2018 at 10:11:17AM -0800, Tejun Heo wrote:
> On Thu, Jan 11, 2018 at 03:55:51PM +0300, Mika Westerberg wrote:
> > Using msleep(1) may actually sleep much longer than 1 msecs (~20 msecs)
> > which unnecessarily slows down system startup. Avoid that and use
> > usleep_range() instead.
> > 
> > Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> 
> Heh, I'm not sure.  How big of a problem is this?

It's not a big problem so you may ignore the patch if you think it is
not needed. I just noticed the msleep(1) there and though we could do
better using usleep_range().
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index a0de7a38430c..27e7daa01ccb 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -871,7 +871,7 @@  static void ahci_start_port(struct ata_port *ap)
 				 * ports to fail the same way.
 				 */
 				if (rc == -EBUSY)
-					msleep(1);
+					usleep_range(1000, 1050);
 				else
 					break;
 			}