Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp608436yba; Wed, 24 Apr 2019 06:49:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqwoTBXQv7acgKfGEkcQ1g0uSm6hdQy2MSabxKdhI+KSskKwsWsBUf4ba6nxPw6kTmaCgz4U X-Received: by 2002:a65:5089:: with SMTP id r9mr30598938pgp.14.1556113792296; Wed, 24 Apr 2019 06:49:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556113792; cv=none; d=google.com; s=arc-20160816; b=RynMAE31tLJmGziNqn1RVO0nRKWGELF1uyfLYIfNm3O74PAMkjZ1jfBo18Eqf5kmAv ti+IzMmWq1Bfu3Bd8qeL4KF2Me8ngDyceouiTlF5X+8QGz4eRp0oaSjZSCTZt5SinsMM gdCcfNx2kYiAf3lAgjxCElzna8E2FZ1MNVFxjUJ8imtOzpz63BaP1wMCG86fOgMWF8S8 lCvKlPUrQmDnTAo7106o59kIn+tcVmH06mOQrYX2L90N3la44unBu/gkUbiMKrPCZecy dCLG1v3Oiq+xZx6DMAIthwWHRexC+wkMPI3BS0fLl/NzGvBQ7HPA89yM484KmZkmpul8 21uw== 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; bh=16El/6cN6f8ikDPtkeaiQiExfvpViTNgcCMVi6kP2pk=; b=gIkYySVzoLrPx7DCiMSjsD9ShDJHUTWDZ3srB9c1rdWTwd6omEWKlwe1VoaIlPgnUn rNm3YXMYwitjEzmLnLGdlHQjkrVYuGki3mThH+/FOa2JA6YABb3G+kRpW4bGHf6ecYul k35SI7nkECezmHn7ieMNFKuue97mea1/b3m5msYeEFcLDw607dkMi1B3ozIAWaEU/Pui wOF0S6KRpAdCKap58blrUprdumvGWQSHyNoeJ0eLv5Ehi7BCK2pQ7A0I88z1YJnWpUUS fvMnRjBWqCxcZLOQBpw0wCAOhrvq62yXi/Xwd1hbwt/SxkAG+4NtZkReQMO1Z1I2N/SZ TfcA== 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 p10si18621365plq.152.2019.04.24.06.49.36; Wed, 24 Apr 2019 06:49:52 -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 S1729320AbfDXMRL (ORCPT + 99 others); Wed, 24 Apr 2019 08:17:11 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:46204 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727230AbfDXMRL (ORCPT ); Wed, 24 Apr 2019 08:17:11 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 173B18227A5D9DEDBF60; Wed, 24 Apr 2019 20:17:08 +0800 (CST) Received: from localhost (10.202.226.61) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.439.0; Wed, 24 Apr 2019 20:17:05 +0800 Date: Wed, 24 Apr 2019 13:16:55 +0100 From: Jonathan Cameron To: Matt Ranostay CC: Jonathan Cameron , Mohan Kumar , Andreas Klinger , "Hartmut Knaack" , Lars-Peter Clausen , "Peter Meerwald-Stadler" , , Subject: Re: [PATCH] drivers: iio: proximity: This patch fix the following checkpatch warning. Message-ID: <20190424131655.000013bb@huawei.com> In-Reply-To: References: <1555524925-15450-1-git-send-email-mohankumar718@gmail.com> <20190422114821.5955d4fa@archlinux> Organization: Huawei X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.226.61] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 24 Apr 2019 17:23:26 +0800 Matt Ranostay wrote: > On Mon, Apr 22, 2019 at 6:48 PM Jonathan Cameron wrote: > > > > On Thu, 18 Apr 2019 16:23:51 -0700 > > Matt Ranostay wrote: > > > > > See comments inline > > > > > > On Wed, Apr 17, 2019 at 11:15 AM Mohan Kumar wrote: > > > > > > > > As per Documentation/timers/timers-howto.txt Msleep < 20ms can sleep for > > > > up to 20ms. so use usleep_range. > > > > > > > > Signed-off-by: Mohan Kumar > > > > --- > > > > drivers/iio/proximity/mb1232.c | 2 +- > > > > drivers/iio/proximity/srf08.c | 4 ++-- > > > > 2 files changed, 3 insertions(+), 3 deletions(-) > > > > > > > > diff --git a/drivers/iio/proximity/mb1232.c b/drivers/iio/proximity/mb1232.c > > > > index 166b3e6..74f7eae 100644 > > > > --- a/drivers/iio/proximity/mb1232.c > > > > +++ b/drivers/iio/proximity/mb1232.c > > > > @@ -81,7 +81,7 @@ static s16 mb1232_read_distance(struct mb1232_data *data) > > > > } > > > > } else { > > > > /* use simple sleep if announce irq is not connected */ > > > > - msleep(15); > > > > + usleep_range(15000, 20000); > > > > > > This is actually less than ideal.. because usleep_range uses the > > > hrtimers which forces an interrupt. > > > > > > Unless you actually need to read between 15ms and 20ms it is best just > > > to leave the msleep() as it is, and let it take a bit longer > > > if required. > > Good response. Perhaps Mohan could follow up with a patch to add > > a comment to this effect to save anyone else trying to 'fix' this > > issue in future? > > Change of the warning message in the checkpatch.pl script you mean? No. That's basically telling people to 'think about it'. I meant a comment in the source for this driver to say 'We don't care here because...'. That way anyone preparing a patch for this in future will see the comment and not bother. Jonathan > > - Matt > > > > > Thanks, > > > > Jonathan > > > > > > - Matt > > > > > > > } > > > > > > > > ret = i2c_master_recv(client, (char *)&buf, sizeof(buf)); > > > > diff --git a/drivers/iio/proximity/srf08.c b/drivers/iio/proximity/srf08.c > > > > index f2bf783..605a582 100644 > > > > --- a/drivers/iio/proximity/srf08.c > > > > +++ b/drivers/iio/proximity/srf08.c > > > > @@ -150,7 +150,7 @@ static int srf08_read_ranging(struct srf08_data *data) > > > > * polling for not more than 20 ms should be enough > > > > */ > > > > waittime = 1 + data->range_mm / 172; > > > > - msleep(waittime); > > > > + usleep_range(waittime * 1000, (waittime * 1000) + 2000); > > > > for (i = 0; i < 4; i++) { > > > > ret = i2c_smbus_read_byte_data(data->client, > > > > SRF08_READ_SW_REVISION); > > > > @@ -158,7 +158,7 @@ static int srf08_read_ranging(struct srf08_data *data) > > > > /* check if a valid version number is read */ > > > > if (ret < 255 && ret > 0) > > > > break; > > > > - msleep(5); > > > > + usleep_range(5000, 15000); > > > > } > > > > > > > > if (ret >= 255 || ret <= 0) { > > > > -- > > > > 2.7.4 > > > > > >