linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: drake@draketalley.com
Cc: Manish Chopra <manishc@marvell.com>,
	GR-Linux-NIC-Dev@marvell.com, Coiby Xu <coiby.xu@gmail.com>,
	netdev@vger.kernel.org, linux-staging@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] staging: qlge: replace msleep with usleep_range
Date: Mon, 31 Oct 2022 17:50:46 +0100	[thread overview]
Message-ID: <Y1/85jGvMRAJ8bYh@kroah.com> (raw)
In-Reply-To: <20221031142516.266704-3-drake@draketalley.com>

On Mon, Oct 31, 2022 at 10:25:15AM -0400, drake@draketalley.com wrote:
> From: Drake Talley <drake@draketalley.com>
> 
> Since msleep may delay for up to 20ms, usleep_range is recommended for
> short durations in the docs linked in the below warning.  I set the
> range to 1000-2000 based on looking at other usages of usleep_range.
> 
> Reported by checkpatch:
> 
> WARNING: msleep < 20ms can sleep for up to 20ms; see Documentation/timers/timers-howto.rst
> 
> Signed-off-by: Drake Talley <drake@draketalley.com>
> ---
>  drivers/staging/qlge/qlge_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c
> index 8c1fdd8ebba0..c8403dbb5bad 100644
> --- a/drivers/staging/qlge/qlge_main.c
> +++ b/drivers/staging/qlge/qlge_main.c
> @@ -3890,7 +3890,7 @@ static int qlge_close(struct net_device *ndev)
>  	 * (Rarely happens, but possible.)
>  	 */
>  	while (!test_bit(QL_ADAPTER_UP, &qdev->flags))
> -		msleep(1);
> +		usleep_range(1000, 2000);

Please see the mailing list archives for why making this type of change
without the hardware to test it is not a good idea.

sorry,

greg k-h

  reply	other threads:[~2022-10-31 16:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-31 14:25 [PATCH 0/3] cleanup style for staging qlge driver drake
2022-10-31 14:25 ` [PATCH 1/3] staging: qlge: Separate multiple assignments drake
2022-10-31 16:53   ` Greg Kroah-Hartman
2022-10-31 14:25 ` [PATCH 2/3] staging: qlge: replace msleep with usleep_range drake
2022-10-31 16:50   ` Greg Kroah-Hartman [this message]
2022-10-31 14:25 ` [PATCH 3/3] staging: qlge: add comment explaining memory barrier drake
2022-10-31 16:53   ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y1/85jGvMRAJ8bYh@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=GR-Linux-NIC-Dev@marvell.com \
    --cc=coiby.xu@gmail.com \
    --cc=drake@draketalley.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=manishc@marvell.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).