Received: by 10.192.165.156 with SMTP id m28csp1020961imm; Wed, 18 Apr 2018 02:35:33 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+HDGhupV5tHuNKX71BeZq4rrxoRg8fP2jbphlWQGYZ0L89RwQFCowGGKiIJM1Dbzxf8rht X-Received: by 10.99.177.68 with SMTP id g4mr1154510pgp.253.1524044132946; Wed, 18 Apr 2018 02:35:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524044132; cv=none; d=google.com; s=arc-20160816; b=FQ5aqVlVVXA0CCJRjg00oHYZ8BzrxLSgrzepHqmMSbRlZgWu1tksju3pcwnhaaZQtw 8Gj/QuqYAXJ5QOSEhiVWa7qGP+t5j4NwglAx+9/UsFvfq3YMDm9RnrkK59zcLpoyzcsN v3datTQ+jA8BHGiK/IljEoNG8sohDJQpWJ+5yjwdDdB4YH/4xqc4YcIkBqvZ4/6BqQsR ftUxh5IWa31ZLxCYTOPRIBp+fGixmSe/XNARQE3DBuLsTwGscclZGgT0L+sqkRClrdiw nap6B948adk/mZmsQsFg+9QW0uywZYZRLylV9BBBL7pzDj817EbGKbRhBO34p9KKvXpE HItg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:dkim-signature:message-id:date:subject :cc:from:arc-authentication-results; bh=C7Sy4fqr9hN1VM9emx6F7urURyT669Ac6Gx7pC7mZYE=; b=PWNivlxbzI3QZVlWzPW9UAZcPScyTBVIwBh9rfHqqU94Vxagc+tLOdcZAJQzOKdULv p0TpxEAxdKV7jW1i94JepvhTqABlTx37Mjk8ZDjpgMM/R6232QI2cpHX5SR+/jpotVTe qkCmsDSc3QmHLSPVV+EIdhP8O5Ebn0KfVK0CUTU2rGZw+0k+pOjPfL07lSLrMurFxF8P bJkVB9q4J1uiriTmD4exllvIPPbZir01fsi7krWp/bH86+qKNlaIqY5MXRYlk/4WUgtm uZokhaXl8OtSheFULmKB2vd94rRmWFhdWahT5U58COCYtNY5IQCXG65OUmI90EWAD0jC 5Pkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@aruba.it header.s=a1 header.b=gYIWixL9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z1-v6si860630plo.263.2018.04.18.02.35.18; Wed, 18 Apr 2018 02:35:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@aruba.it header.s=a1 header.b=gYIWixL9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752166AbeDRJeG (ORCPT + 99 others); Wed, 18 Apr 2018 05:34:06 -0400 Received: from smtpcmd0756.aruba.it ([62.149.156.56]:32814 "EHLO smtpcmd0756.aruba.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751187AbeDRJeE (ORCPT ); Wed, 18 Apr 2018 05:34:04 -0400 X-Greylist: delayed 426 seconds by postgrey-1.27 at vger.kernel.org; Wed, 18 Apr 2018 05:34:04 EDT Received: from asem-TANK.asem.intra ([151.1.184.193]) by smtpcmd07.ad.aruba.it with bizsmtp id blSt1x0154AmavK01lSuCj; Wed, 18 Apr 2018 11:26:56 +0200 From: Luca Ellero Cc: Luca Ellero , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Andrey Smirnov , Miquel Raynal , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] mtd: dataflash: replace msleep with usleep_range Date: Wed, 18 Apr 2018 11:26:26 +0200 Message-Id: <1524043588-25816-1-git-send-email-luca.ellero@brickedbrain.com> X-Mailer: git-send-email 2.7.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aruba.it; s=a1; t=1524043616; bh=C7Sy4fqr9hN1VM9emx6F7urURyT669Ac6Gx7pC7mZYE=; h=From:To:Subject:Date; b=gYIWixL98gRpLbtXw87KNMQK5MOvZR04I2pk0SVPNk4jkzJoxngKc6Sr4FzPPrNah U+78NzYyaSYmuI6KgIarMfE+YGfgxYqpWQozMGqH05FXqOF3O3YEPbaOdT6Ei3sV3i GN9qgGRZmPZYhBM1K0BFSI5tDGpwNRwerisJXvO/NwUF8OiLMu/+mwY8N4QBUZpO52 gLjM4zaX20IPHOaW3WfrO6WG0Z1655k6VDj2td0748JX4i1vDay3Gsap46QuH0hdlj FBGbjetzRXiuyxEfv01ecWKqQW7YQcnf8/fagwDgkvQRRyXKnpS5LR8V4uS6p7mSEI NYtszXQ3bppMA== To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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