Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1400628ybb; Sun, 29 Mar 2020 03:49:33 -0700 (PDT) X-Google-Smtp-Source: ADFU+vv6u9EMDaMOlZckK34iFjE5QntFMANUGmqy7zyZNEF/OB0vOEPYiboLyeijWDZyAno+Fx5s X-Received: by 2002:a05:6830:1d91:: with SMTP id y17mr5448995oti.184.1585478972847; Sun, 29 Mar 2020 03:49:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585478972; cv=none; d=google.com; s=arc-20160816; b=ek1Q3R8NOsXruANK69e4a8FSpvejWUMU7ACMaUBghsZZkYGtD9YIkJnBLBZHIo05Qv Ff5kJ0RDFiQARpvUmgNW+X6qOI3KoQZCb/psjp+jdbWQLaw5JbhVm1gbFkfeFP049qPn B6+M8Q1rBF1+I57ohOYyfvHvLTdB4dcukU4sbkEb4CHOZrxvSVZqzaLc4kHcSOMpiQKk iimqHR+NcRqTXpwc3hU2zxhLj8uLmhorT3+t4Acvv1g8LTIznGJgl+8+CKkp0rkjqA0+ ZP7CMaIS0q7XrkHuUVuBDtkUpgxnYMrCVH8WJPDfS+aUQ11WWoSfhR4M0tzbUxX0SSkr s4jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=vlnHpS6gLU8CELXWgdZARrG91hdBpzOyqL89F3+i3gQ=; b=iZoMltuTsLYS6zj3W7V8gt6VvnlO3kNe97g2lvJr3C+Ob4unGeb0ZKgEVcSdhiBK7m EZM/HY5Wh8DHU9OCWu/HOB3EwtOMqzUb9Jc8T9RglracQ8OuvrmDKINAETRN3CRre6XI q8Ba4KwlBceEGGy50JkIwPilVezOTQTHDwVpT7j92UDmnzzpzx4NW0+qq/K3qJDYvl4A WTYoU2MEJJ1VpY4iCcsRbcDo00zkpFt3wxXLRIUfuYdBlhAbNpAMfD615A0N5C0IPdhs KC3sPhTWplvEmjI8bye7Bpz6xIRIe8/Dh8ROyqcjOLvCH+PMAS2x30ZEyGlhtpv7/wUg kERQ== 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 g2si4972318otr.13.2020.03.29.03.49.18; Sun, 29 Mar 2020 03:49: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; 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 S1728014AbgC2KhV (ORCPT + 99 others); Sun, 29 Mar 2020 06:37:21 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:27248 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727791AbgC2KhV (ORCPT ); Sun, 29 Mar 2020 06:37:21 -0400 X-IronPort-AV: E=Sophos;i="5.72,319,1580770800"; d="scan'208";a="442809216" Received: from abo-173-121-68.mrs.modulonet.fr (HELO hadrien) ([85.68.121.173]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Mar 2020 12:37:18 +0200 Date: Sun, 29 Mar 2020 12:37:18 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: Soumyajit Deb cc: John Wyatt , outreachy-kernel@googlegroups.com, Greg Kroah-Hartman , Payal Kshirsagar , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [Outreachy kernel] [PATCH] staging: fbtft: Replace udelay with preferred usleep_range In-Reply-To: Message-ID: References: <20200329092204.770405-1-jbwyatt4@gmail.com> <2fccf96c3754e6319797a10856e438e023f734a7.camel@gmail.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-1337720750-1585478238=:2990" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1337720750-1585478238=:2990 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT On Sun, 29 Mar 2020, Soumyajit Deb wrote: > I had the same doubt the other day about the replacement of udelay() with > usleep_range(). The corresponding range for the single argument value of > udelay() is quite confusing as I couldn't decide the range. But as much as I > noticed checkpatch.pl gives warning for replacing udelay() with > usleep_range() by checking the argument value of udelay(). In the > documentation, it is written udelay() should be used for a sleep time of at > most 10 microseconds but between 10 microseconds and 20 milliseconds, > usleep_range() should be used.  > I think the range is code specific and will depend on what range is > acceptable and doesn't break the code. >  Please correct me if I am wrong. The range depends on the associated hardware. Just because checkpatch suggests something doesn't mean that it is easy to address the problem. julia > > More clarification on this issue will be helpful. > > On Sun, 29 Mar 2020, 15:17 Julia Lawall, wrote: > > > On Sun, 29 Mar 2020, John Wyatt wrote: > > > On Sun, 2020-03-29 at 11:28 +0200, Julia Lawall wrote: > > > > > > On Sun, 29 Mar 2020, John B. Wyatt IV wrote: > > > > > > > Fix style issue with usleep_range being reported as > preferred over > > > > udelay. > > > > > > > > Issue reported by checkpatch. > > > > > > > > Please review. > > > > > > > > As written in Documentation/timers/timers-howto.rst udelay > is the > > > > generally preferred API. hrtimers, as noted in the docs, > may be too > > > > expensive for this short timer. > > > > > > > > Are the docs out of date, or, is this a checkpatch issue? > > > > > > > > Signed-off-by: John B. Wyatt IV > > > > --- > > > >  drivers/staging/fbtft/fb_agm1264k-fl.c | 2 +- > > > >  1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > diff --git a/drivers/staging/fbtft/fb_agm1264k-fl.c > > > > b/drivers/staging/fbtft/fb_agm1264k-fl.c > > > > index eeeeec97ad27..019c8cce6bab 100644 > > > > --- a/drivers/staging/fbtft/fb_agm1264k-fl.c > > > > +++ b/drivers/staging/fbtft/fb_agm1264k-fl.c > > > > @@ -85,7 +85,7 @@ static void reset(struct fbtft_par *par) > > > >   dev_dbg(par->info->device, "%s()\n", __func__); > > > > > > > >   gpiod_set_value(par->gpio.reset, 0); > > > > - udelay(20); > > > > + usleep_range(20, 20); > > > > > > usleep_range should have a range, eg usleep_range(50, > 100);.  But it > > > is > > > hard to know a priori what the range should be.  So it is > probably > > > better > > > to leave the code alone. > > > > Understood. > > > > With the question I wrote in the commit message: > > > > "As written in Documentation/timers/timers-howto.rst udelay is > the > > generally preferred API. hrtimers, as noted in the docs, may > be too > > expensive for this short timer. > > > > Are the docs out of date, or, is this a checkpatch issue?" > > > > Is usleep_range too expensive for this operation? > > > > Why does checkpatch favor usleep_range while the docs favor > udelay? > > I don't know the answer in detail, but it is quite possible that > checkpatch doesn't pay any attention to the delay argument.  > Checkpatch is > a perl script that highlights things that may be of concern.  It > is not a > precise static analsis tool. > > As a matter of form, all of your Please review comments should > have been > put below the ---.  Currently, if someone had wanted to apply > the patch, > you would make them do extra work to remove this information. > > julia > > > > > > > > > julia > > > > > > >   gpiod_set_value(par->gpio.reset, 1); > > > >   mdelay(120); > > > >  } > > > > -- > > > > 2.25.1 > > > > > > > > -- > > > > You received this message because you are subscribed to > the Google > > > > Groups "outreachy-kernel" group. > > > > To unsubscribe from this group and stop receiving emails > from it, > > > > send an email to > outreachy-kernel+unsubscribe@googlegroups.com. > > > > To view this discussion on the web visit > > > >https://groups.google.com/d/msgid/outreachy-kernel/20200329092204.770405-1- > jbwyatt4%40gmail.com > > > > . > > > > > > > > > > -- > You received this message because you are subscribed to the > Google Groups "outreachy-kernel" group. > To unsubscribe from this group and stop receiving emails from > it, send an email to > outreachy-kernel+unsubscribe@googlegroups.com. > To view this discussion on the web visithttps://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.21.20032911 > 44460.2990%40hadrien. > > > --8323329-1337720750-1585478238=:2990--