Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2676361ybb; Mon, 30 Mar 2020 10:42:18 -0700 (PDT) X-Google-Smtp-Source: ADFU+vv15er2W9SoMTkjbiW74hFmvv1j9JOkzPhTKozTk61uzgdOjWdRgRe0jmBBenJgJVYGDg8V X-Received: by 2002:a05:6830:1c7:: with SMTP id r7mr238584ota.58.1585590138154; Mon, 30 Mar 2020 10:42:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585590138; cv=none; d=google.com; s=arc-20160816; b=gR7joWZU4v2/DDMWhuUtGU7sUyjN3iqA13wENLuGlBWYm02x72eJWnOSVmvmvDAPNg dJZJHbCKp8PA+MbQAjXbJDkGx5mmLXMFYLA+zFK5FBmFuTinNe2ic2ni9V6MpOXpaI5c +gvJFTygnXAOGLuNj6E4yR4BIABSekjD6kDy26vaOcNuDy93BLiDRiDuiuoWpoZttUpQ tZLhPa0RIaEc8T0Eu/pxaBxnEowtNcpozSqIQLxU2vYdoRsnjt3aCxwHy9XXWenDDfv8 EUC/mRV+kKaFBH5CsyQNj1wd4TVgbpzl5dUZEX7jB83lJ5ECcvPaa2WpNRaJEWq4PQ6v Qs7g== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=YGHvH2P6nK7TQrcIUAsAOYU1x8zpv/Ba4jDsyhsFhTg=; b=TjuFREb4fbzaZodjfjy3qfKhRVuP1Q9In16WqKVNnzWRcEg0aEmJN5GECG2r3GJT2p w0qShWU6/6XsYettQBygKt0R3Zliwfjl78uZOuge9jkg1ScounU9BJcyjPM69EBEJh0w yFm9W+NzhcFmit3eJt+vHTxhlH+t2KdMawCmPn2N/VtcwE+o+/Wt4a+3YJu4sU+57A9c 4h1wv3CiH13x4TJFbKKglMoi+6gc50EQv8hfuwGoi2qA9rEMvFXsXo7r49FHVQFx8m1I vbvt8J/of5kp+u0jqU8tS3gKpQKgcUE5GVfzlYQCXNf0Hst8XoegcRJb/wpGQI7B1WRQ GQ4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IxRzBpM+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z11si616320oih.253.2020.03.30.10.42.05; Mon, 30 Mar 2020 10:42:18 -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=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IxRzBpM+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729891AbgC3RlR (ORCPT + 99 others); Mon, 30 Mar 2020 13:41:17 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:52556 "EHLO us-smtp-delivery-74.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729745AbgC3RlP (ORCPT ); Mon, 30 Mar 2020 13:41:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585590074; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YGHvH2P6nK7TQrcIUAsAOYU1x8zpv/Ba4jDsyhsFhTg=; b=IxRzBpM+kz+5TXsorpzFspxithz1QaEdi3t6knzmYqK3tuNdcJjT+lykcJS0kPB9uCEY/X rGRjBrJnrjSuYwcPRCYKGNO2hCqiwE4wjmGPwhagBuwIpmnzk9HmTo95v05JnIxpo/Jg2P 9jKRUSUpjwC81n7YbZbNf7PzdafPCnY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-109-vixzt7PyMZC7dnLS7w5LvQ-1; Mon, 30 Mar 2020 13:41:03 -0400 X-MC-Unique: vixzt7PyMZC7dnLS7w5LvQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2189B1B2C980; Mon, 30 Mar 2020 17:41:00 +0000 (UTC) Received: from elisabeth (unknown [10.36.110.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E96E7CDBFF; Mon, 30 Mar 2020 17:40:54 +0000 (UTC) Date: Mon, 30 Mar 2020 19:40:43 +0200 From: Stefano Brivio To: John Wyatt Cc: Julia Lawall , Soumyajit Deb , 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 Message-ID: <20200330194043.56c79bb8@elisabeth> In-Reply-To: References: <20200329092204.770405-1-jbwyatt4@gmail.com> <2fccf96c3754e6319797a10856e438e023f734a7.camel@gmail.com> Organization: Red Hat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 29 Mar 2020 12:37:18 +0200 (CEST) Julia Lawall wrote: > On Sun, 29 Mar 2020, Soumyajit Deb wrote: >=20 > > I had the same doubt the other day about the replacement of udelay() wi= th > > usleep_range(). The corresponding range for the single argument value of > > udelay() is quite confusing as I couldn't decide the range.=C2=A0But 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 o= f at > > most 10 microseconds but between 10 microseconds and 20 milliseconds, > > usleep_range() should be used.=C2=A0 > > I think the range is code specific and will depend on what range is > > acceptable and doesn't break the code. > > =C2=A0Please correct me if I am wrong. =20 >=20 > The range depends on the associated hardware. John, by the way, here you could have checked the datasheet of this LCD controller. It's a pair of those: https://www.sparkfun.com/datasheets/LCD/ks0108b.pdf reset time is 1=C2=B5s minimum, which is the only actual constraint here. The rise time should then be handled by power supply and reflected with some appropriate usage of the regulator framework. That 120ms delay, however, must be there for a reason, that is, most likely to develop this quickly without exposing a proper model of the power supplies to the driver. So... in this case, with the datasheet alone, you won't go very far, you would need the actual module (probably connected to a Raspberry Pi to catch a typical usage). Still, it's usually worth a check. In any case, most likely, as Andy suggested, this function can eventually be dropped. --=20 Stefano