Received: by 10.192.165.148 with SMTP id m20csp2445957imm; Thu, 26 Apr 2018 11:06:36 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqqt+SC0c+0wPV00364BRpoAxLmrvD4DH8a3uoMTBQposENxPUkb9OZsELrPq7gJ6cjRqYY X-Received: by 10.98.171.16 with SMTP id p16mr12862307pff.211.1524765996086; Thu, 26 Apr 2018 11:06:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524765996; cv=none; d=google.com; s=arc-20160816; b=hc4C1fYoPl2X18w7HCuxm2TX3rzshoacITfJTfbSYsL0tC7778hCGveGEqAee+KpcX a0wxmpqdcHHnULjbRbb2FgF4VzkE7hEs6D6gH/CJRhP6Xgsz0PWnZ41qnVuveJaYpR/h aLl+u4sCG5A21uwZapO5k2QarTBJwR4Kl9W76rKS4DbC8G/fVvL5RaPDQWMzSkhApa9k Yrt6q56ma5GC4KPT8L0TEbE+NvIgPk183jyUJ4QA56+SQGhiposkekNhFvzsuCmch5as DlsrbnsAOid0zZU2BdophzcFIOm4yXlL8PFr8eoANfSGfu5wzK4/Kxc8msvyciFuT0jm tEWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=rei1sg6M/9wr198oDIxW+FqHW1bMm34MjI+6JCK9vP8=; b=D4KyOyR7DEWycK+Bpa/4DFwBeqIBXUPdeCD65ktLp9x+oTVyyu6OxkGU104wYulHvs VPgrG4gtvKYmAhnWoz1ncyvJJEFUMQXhT23bninoIx5wlyIU+tTgtaaFfWu8sD+l3g7Q 1mmUF/IqLsQVn0jwnjmdAE6KlTKxTPufqNsN3sbzv+PFBw4SJsos+IIegbDr1r+xYRUj obZOYCNv8VlGCb4qN2/hm0XzVdgA5+Zohj8MlZpfVj1LwPpVW3iyzXi+LYWEzKHNQGQ7 mqALR6xHoWHV2Y8OGipO6tjB/VUJ9NDlc3NrmMEzjkQ3ASNq2PciRdlKx9gE+twNIw0C YnLw== ARC-Authentication-Results: i=1; mx.google.com; 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 u17-v6si6612975plj.182.2018.04.26.11.06.21; Thu, 26 Apr 2018 11:06:36 -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; 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 S1756891AbeDZSEC (ORCPT + 99 others); Thu, 26 Apr 2018 14:04:02 -0400 Received: from mail.bootlin.com ([62.4.15.54]:33051 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756433AbeDZSEA (ORCPT ); Thu, 26 Apr 2018 14:04:00 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 272C62072F; Thu, 26 Apr 2018 20:03:59 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.0 Received: from bbrezillon (unknown [195.53.49.241]) by mail.bootlin.com (Postfix) with ESMTPSA id 9D417203B7; Thu, 26 Apr 2018 20:03:48 +0200 (CEST) Date: Thu, 26 Apr 2018 20:03:48 +0200 From: Boris Brezillon To: Luca Ellero Cc: Marek Vasut , Andrey Smirnov , Richard Weinberger , linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, Miquel Raynal , Brian Norris , David Woodhouse Subject: Re: [PATCH] mtd: dataflash: replace msleep with usleep_range Message-ID: <20180426200348.7c4eef72@bbrezillon> In-Reply-To: <1524043588-25816-1-git-send-email-luca.ellero@brickedbrain.com> References: <1524043588-25816-1-git-send-email-luca.ellero@brickedbrain.com> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 18 Apr 2018 11:26:26 +0200 Luca Ellero 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 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); > } > } >