From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C0BDC433EF for ; Sun, 17 Oct 2021 09:53:38 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E0B5261027 for ; Sun, 17 Oct 2021 09:53:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E0B5261027 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=inria.fr Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:Message-ID: In-Reply-To:Subject:cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bnXQ4SzwofJil9cyqtdR/y7F6m65RAFBFQ8RKj1vYqg=; b=mwxQPfeWTsAPA1 Ou2d2wXCIkZH5LcKJT7/LwAGZr2ryraNFAm4QwGn3LAQLbtm7mGptheNcrBXGDbkSfg5WmSpUbQWm fIqNR5IQ8+I9BmrMPxKvPjqIFvGgPoWXeE3/67BCsB1ZsHeBW6iVjAkGpo+EYbHg84efL2tcQlJTm U6XwKjoiQNqGqYxKh4pqnomw+unp+4A+xnQSbHpH0BXKwyBAgeSjWh5DDrvijYv9baAW4FhixUbtH 9PCFal9hR2C8KuFBB+LchlVw4DgBi9pBbg6yzm/WRBryrO7PXLk89OjSrH8PZTCJPMzCBjW9ref35 EZww17mqrPtl7ge/0ZQg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mc2q0-00C2OC-UP; Sun, 17 Oct 2021 09:52:17 +0000 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mc2pw-00C2Nn-3e for linux-arm-kernel@lists.infradead.org; Sun, 17 Oct 2021 09:52:14 +0000 IronPort-HdrOrdr: =?us-ascii?q?A9a23=3Ads00EKr/4iry/VVJ+OseFNkaV5oseYIsimQD?= =?us-ascii?q?101hICG9E/bo8/xG885x6faZslwssTQb+OxoW5PwJE80l6QU3WB5B97LYOClgh?= =?us-ascii?q?rKEGgI1+XfKlPbdxEWutQtt5tIQuxOTOf9ClV3lq/BjTWQGdxI+ra6zJw=3D?= X-IronPort-AV: E=Sophos;i="5.84,326,1620684000"; d="scan'208";a="396157498" Received: from 173.121.68.85.rev.sfr.net (HELO hadrien) ([85.68.121.173]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Oct 2021 11:52:07 +0200 Date: Sun, 17 Oct 2021 11:52:07 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: Kushal-kothari cc: linux-arm-kernel@lists.infradead.org, mike.rapoport@gmail.com, kushalkothari2850@gmail.com, outreachy-kernel@googlegroups.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev, nsaenz@kernel.org, bcm-kernel-feedback-list@broadcom.com Subject: Re: [Outreachy kernel] [PATCH v2] staging: vc04_services: replace msleep() by usleep_range() In-Reply-To: <20211017092900.134752-1-kushalkothari285@gmail.com> Message-ID: References: <20211017092900.134752-1-kushalkothari285@gmail.com> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211017_025212_493616_375C6B91 X-CRM114-Status: GOOD ( 27.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sun, 17 Oct 2021, Kushal-kothari wrote: > Fixed the warning:-msleep < 20ms can sleep for up to 20ms by replacing > msleep(unsigned long msecs) by usleep_range(unsigned long min, unsigned long max) > in usecs as msleep(1ms~20ms) can sleep for upto 20 ms. In addition to Greg's comments, the log message is still not really ideal. There is still the word Fix that doesn't really contribute anything. The prototypes of msleep and usleep are also not useful - the reader either knows them or can easily find them. A better messge could be something like: "Checkpatch warns that an msleep of less than 20ms can sleep for up to 20ms. Replace msleep(1) by a call to usleep_range that makes the possible range (1ms - 20ms) explicit." But the argument to msleep is in milliseconds. If the appropriate first argument to usleep_range is 1000, then it would seem that the second argument should be 20000? One thing that you can do to try to understand such a problem better is to see what others have done before to resolve it. You could try a command like git log -S msleep -p to see commits that have changed the number of calls to msleep. I reiterate Greg's comments that making these timing changes without being able to test the result is risky. These are just suggestions of some methodologies that you could follow for a change where it is more clear that the change is correct. julia > > Signed-off-by: Kushal-kothari > --- > > Changes from v1: Reword both the subject and the log message. > > drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c > index 6fbafdfe340f..80a7898c5331 100644 > --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c > +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c > @@ -857,7 +857,7 @@ vchiq_bulk_transmit(unsigned int handle, const void *data, unsigned int size, > if (status != VCHIQ_RETRY) > break; > > - msleep(1); > + usleep_range(1000, 2000); > } > > return status; > @@ -894,7 +894,7 @@ enum vchiq_status vchiq_bulk_receive(unsigned int handle, void *data, > if (status != VCHIQ_RETRY) > break; > > - msleep(1); > + usleep_range(1000, 2000); > } > > return status; > -- > 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/20211017092900.134752-1-kushalkothari285%40gmail.com. > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel