All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shuah Khan <skhan@linuxfoundation.org>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Shuah Khan <shuah@kernel.org>,
	linux-usb@vger.kernel.org, kernel-janitors@vger.kernel.org,
	Valentina Manea <valentina.manea.m@gmail.com>,
	Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH] USB: usbip: clean up mixed use of _irq() and _irqsave()
Date: Wed, 25 May 2022 09:12:49 -0600	[thread overview]
Message-ID: <5a66600c-f8b6-de5d-44ad-4f6f0eb3934d@linuxfoundation.org> (raw)
In-Reply-To: <Yo4gqLPtHO6XKMLn@kili>

On 5/25/22 6:27 AM, Dan Carpenter wrote:
> It generally doesn't make sense to use _irq() and _irqsave() in the same
> function because either some of the callers have disabled IRQs or they
> haven't.  In this case, the v_recv_cmd_submit() appears to always be
> called with IRQs enabled so the code works fine.  That means I could
> convert it to either _irq() or _irqsave() but I chose to use _irqsave()
> because it's more conservative and easier to review.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>   drivers/usb/usbip/vudc_rx.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/usbip/vudc_rx.c b/drivers/usb/usbip/vudc_rx.c
> index 1e8a23d92cb4..d4a2f30a7580 100644
> --- a/drivers/usb/usbip/vudc_rx.c
> +++ b/drivers/usb/usbip/vudc_rx.c
> @@ -104,18 +104,18 @@ static int v_recv_cmd_submit(struct vudc *udc,
>   	if (pdu->base.direction == USBIP_DIR_IN)
>   		address |= USB_DIR_IN;
>   
> -	spin_lock_irq(&udc->lock);
> +	spin_lock_irqsave(&udc->lock, flags);
>   	urb_p->ep = vudc_find_endpoint(udc, address);
>   	if (!urb_p->ep) {
>   		/* we don't know the type, there may be isoc data! */
>   		dev_err(&udc->pdev->dev, "request to nonexistent endpoint");
> -		spin_unlock_irq(&udc->lock);
> +		spin_unlock_irqrestore(&udc->lock, flags);
>   		usbip_event_add(&udc->ud, VUDC_EVENT_ERROR_TCP);
>   		ret = -EPIPE;
>   		goto free_urbp;
>   	}
>   	urb_p->type = urb_p->ep->type;
> -	spin_unlock_irq(&udc->lock);
> +	spin_unlock_irqrestore(&udc->lock, flags);
>   
>   	urb_p->new = 1;
>   	urb_p->seqnum = pdu->base.seqnum;
> 

Thank you for the patch.

Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>

Greg, please pick this up.

thanks,
-- Shuah

      reply	other threads:[~2022-05-25 15:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-25 12:27 [PATCH] USB: usbip: clean up mixed use of _irq() and _irqsave() Dan Carpenter
2022-05-25 15:12 ` Shuah Khan [this message]

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=5a66600c-f8b6-de5d-44ad-4f6f0eb3934d@linuxfoundation.org \
    --to=skhan@linuxfoundation.org \
    --cc=dan.carpenter@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=valentina.manea.m@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.