netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Arun Vijayshankar <arunvijayshankar@gmail.com>
Cc: manishc@marvell.com, GR-Linux-NIC-Dev@marvell.com,
	netdev@vger.kernel.org, linux-staging@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: qlge: replace msleep with usleep_range
Date: Mon, 27 Jun 2022 08:12:38 +0200	[thread overview]
Message-ID: <YrlKVg7ZN9yhTOvt@kroah.com> (raw)
In-Reply-To: <Yrk3zeyzSJ0424Aa@sug>

On Sun, Jun 26, 2022 at 09:53:33PM -0700, Arun Vijayshankar wrote:
> qlge_close uses msleep for 1ms, in which case (1 - 20ms) it is preferable
> to use usleep_range in non-atomic contexts, as documented in
> Documentation/timers/timers-howto.rst. A range of 1 - 1.05ms is
> specified here, in case the device takes slightly longer than 1ms to recover from
> reset.
> 
> Signed-off-by: Arun Vijayshankar <arunvijayshankar@gmail.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 689a87d58f27..3cc4f1902c80 100644
> --- a/drivers/staging/qlge/qlge_main.c
> +++ b/drivers/staging/qlge/qlge_main.c
> @@ -3886,7 +3886,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, 1050);

Have you tested this with a device?  Doing these types of changes
without access to the hardware isn't a good idea.

Also, a loop that has the chance to never end should be fixed up, don't
you think?

thanks,

greg k-h

  reply	other threads:[~2022-06-27  6:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-27  4:53 [PATCH] staging: qlge: replace msleep with usleep_range Arun Vijayshankar
2022-06-27  6:12 ` Greg KH [this message]
     [not found]   ` <Yrnr4yYm5mo+PXKU@sug>
2022-07-01 17:01     ` Arun Vijayshankar

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=YrlKVg7ZN9yhTOvt@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=GR-Linux-NIC-Dev@marvell.com \
    --cc=arunvijayshankar@gmail.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).