X-GM-THRID: 7019965111499489280 X-Received: by 2002:adf:fe45:: with SMTP id m5mr27928100wrs.197.1634464330090; Sun, 17 Oct 2021 02:52:10 -0700 (PDT) X-BeenThere: outreachy-kernel@googlegroups.com Received: by 2002:a5d:508a:: with SMTP id a10ls2870320wrt.1.gmail; Sun, 17 Oct 2021 02:52:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLJKwIYdL+kPBm0cAQH2eLd5jY5HzyPi5GoWf8Z2W2MZNn5QnA04xPyXNYzZfSNfTXqsBS X-Received: by 2002:adf:b31d:: with SMTP id j29mr27605234wrd.429.1634464328637; Sun, 17 Oct 2021 02:52:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634464328; cv=none; d=google.com; s=arc-20160816; b=hKSvh/nmFabpx1P8bKlDBJcppll5hgXhVsiVym4BdWwoZHMUHLnuCSxinaxKeg4K4K DELOu3pmts2hYzWelwbuDUotGI3aBp9w+EAp/Enpx6RxVQGAQCszn9a8PUy6RQSHehs4 rProotjUDJO+0VoySlgklFYnY3bAtVWEwJrBwCoOtxH/stZBLZ5K9VQO9y7MnGIqsU2b 4BuXVAtAS3Qxt4CFIsAFN+9O8b77T/NYVRmzGeIIFtyj/9Wbj1Lz/0K1OzbOlXYeGoru dJ3Sy9/Gbf2v8L86g//FCwgv9mWk8u0+zoFsvcjRGR7HtWBZs7udnluX+AbFJPBUDWuu iAWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:references:message-id:in-reply-to:subject :cc:to:from:date:ironport-hdrordr; bh=DfBng9kCfzQ6rV/1UDfAIKvQaRvbfn+H0gLhfvIJOb4=; b=oP/ckX3KCyfCA6geloK2fWnOi0jBA5yBgBXp/cuqBdoBe1DKsjh8I5/gH4rb9q0c3p R/1I8DnUx3IAWpR8QaFZIYa9E/+fnz9I0uNeYn4ltkWiGGRY9uEo8JtObl+fZHgN2Axw NNPZ7SDa99/H+al1hj//drovfhet66SpeQbWeADW3cbRkvs6eXjyyW7A6fcWkYrqUBAh mQlJSsguVaKRi+9PnBOsFd6JQxH5H0AZwlZguk/P8LZ0qmYl9ibwyJhIhwluB030WeHE mktuDcktv2MTpkrYVAmmofkfqwiFdnPBKGOKKGL0ujrrHCOj6xVCDlVMEfHaJoh0VCcU v9aA== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of julia.lawall@inria.fr designates 192.134.164.104 as permitted sender) smtp.mailfrom=julia.lawall@inria.fr Return-Path: Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr. [192.134.164.104]) by gmr-mx.google.com with ESMTPS id z4si351121wre.0.2021.10.17.02.52.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 Oct 2021 02:52:08 -0700 (PDT) Received-SPF: pass (google.com: domain of julia.lawall@inria.fr designates 192.134.164.104 as permitted sender) client-ip=192.134.164.104; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of julia.lawall@inria.fr designates 192.134.164.104 as permitted sender) smtp.mailfrom=julia.lawall@inria.fr 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 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. >