Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2618759pxb; Sun, 17 Oct 2021 20:41:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/7ljQIQi06E/7fYwrr1YK3KLQEnEMPBc435dUY40xRK+zsXa2/pEedg80qo3wk5umVR3F X-Received: by 2002:a17:902:f551:b0:13e:fb56:f519 with SMTP id h17-20020a170902f55100b0013efb56f519mr24997021plf.0.1634528469439; Sun, 17 Oct 2021 20:41:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634528469; cv=none; d=google.com; s=arc-20160816; b=0E8i/xRSrV42RvHwlDBqJEquljUJPNU8J7ntKPQYuS0hqqPDhtAsoinHVZVyzTnJsX pf4xnO5WoxJ8/6UlIsdiu4nu1RdpPgyc9CwBDjBMUdcizvn24VB6Tqc0q2dVggAJKiMo tG8fZJxlDolCEFFDpK6rV82xP62vfZgOgKJgDvHOlHdwz/u7c+hKmMfo+3lOkYQKYGTI mLgxnapqZ9g1PiugRcdyBYPPDKzLAGGHguxnEq2LHqNisvVXBv9KemA62DDgCCOk3kEk FVUNfXfYjwry+f2CnGpdJ5kU0qSKxCdq1nKMWwNJ9K5a0aWA6qe1yldbLjLnZZcHl46E EXLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date:ironport-hdrordr; bh=DfBng9kCfzQ6rV/1UDfAIKvQaRvbfn+H0gLhfvIJOb4=; b=GHErIJE4AbJ7EbzZGSpJe0hGjL67AhW0qH4KgYvrvJJcQ5R6txNVT3OGLy1wQqj9W3 GVVsKRxW1zfoCdLwUMvZtkgXTYiLX6HFrIcdyi9bCjgk4D9nXVy2qVjweZg07kRlvVj0 UK5wUJhEYA2X5E4dVBpGd3ceg6Jknaehj2xQVoc8S8rHO5XRI7rlnhNYn2cT1WF8mymP yMoEPMXKLC6/v9caw0KfSIgDrlg6IOMiLQLDQKTCP3bptrfzoV7Kb0vGYm7c3fRH1Qou F3pc2QdxkdrtTvRSrHQhdk5gJqjdwlToLd92hQ6U5TFcUgPn6cmPvTnRbVQH8gGmAWZT obcA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b10si22660892plh.361.2021.10.17.20.40.55; Sun, 17 Oct 2021 20:41:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245199AbhJQJyT (ORCPT + 98 others); Sun, 17 Oct 2021 05:54:19 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:37986 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232657AbhJQJyS (ORCPT ); Sun, 17 Oct 2021 05:54:18 -0400 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 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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. >