From: Sebastian Andrzej Siewior <bigeasy@linutronix.de> To: netdev@vger.kernel.org Cc: linux-usb@vger.kernel.org, tglx@linutronix.de, "David S. Miller" <davem@davemloft.net>, Sebastian Andrzej Siewior <bigeasy@linutronix.de> Subject: [PATCH 1/5] net: usb: cdc-phonet: use irqsave() in USB's complete callback Date: Wed, 20 Jun 2018 21:31:17 +0200 [thread overview] Message-ID: <20180620193121.24967-2-bigeasy@linutronix.de> (raw) In-Reply-To: <20180620193121.24967-1-bigeasy@linutronix.de> The USB completion callback does not disable interrupts while acquiring the lock. We want to remove the local_irq_disable() invocation from __usb_hcd_giveback_urb() and therefore it is required for the callback handler to disable the interrupts while acquiring the lock. The callback may be invoked either in IRQ or BH context depending on the USB host controller. Use the _irqsave() variant of the locking primitives. Cc: "David S. Miller" <davem@davemloft.net> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> --- drivers/net/usb/cdc-phonet.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/usb/cdc-phonet.c b/drivers/net/usb/cdc-phonet.c index 288ecd999171..3c40312fa453 100644 --- a/drivers/net/usb/cdc-phonet.c +++ b/drivers/net/usb/cdc-phonet.c @@ -99,6 +99,7 @@ static void tx_complete(struct urb *req) struct net_device *dev = skb->dev; struct usbpn_dev *pnd = netdev_priv(dev); int status = req->status; + unsigned long flags; switch (status) { case 0: @@ -115,10 +116,10 @@ static void tx_complete(struct urb *req) } dev->stats.tx_packets++; - spin_lock(&pnd->tx_lock); + spin_lock_irqsave(&pnd->tx_lock, flags); pnd->tx_queue--; netif_wake_queue(dev); - spin_unlock(&pnd->tx_lock); + spin_unlock_irqrestore(&pnd->tx_lock, flags); dev_kfree_skb_any(skb); usb_free_urb(req); -- 2.17.1
WARNING: multiple messages have this Message-ID (diff)
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de> To: netdev@vger.kernel.org Cc: linux-usb@vger.kernel.org, tglx@linutronix.de, "David S. Miller" <davem@davemloft.net>, Sebastian Andrzej Siewior <bigeasy@linutronix.de> Subject: [1/5] net: usb: cdc-phonet: use irqsave() in USB's complete callback Date: Wed, 20 Jun 2018 21:31:17 +0200 [thread overview] Message-ID: <20180620193121.24967-2-bigeasy@linutronix.de> (raw) The USB completion callback does not disable interrupts while acquiring the lock. We want to remove the local_irq_disable() invocation from __usb_hcd_giveback_urb() and therefore it is required for the callback handler to disable the interrupts while acquiring the lock. The callback may be invoked either in IRQ or BH context depending on the USB host controller. Use the _irqsave() variant of the locking primitives. Cc: "David S. Miller" <davem@davemloft.net> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> --- drivers/net/usb/cdc-phonet.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/usb/cdc-phonet.c b/drivers/net/usb/cdc-phonet.c index 288ecd999171..3c40312fa453 100644 --- a/drivers/net/usb/cdc-phonet.c +++ b/drivers/net/usb/cdc-phonet.c @@ -99,6 +99,7 @@ static void tx_complete(struct urb *req) struct net_device *dev = skb->dev; struct usbpn_dev *pnd = netdev_priv(dev); int status = req->status; + unsigned long flags; switch (status) { case 0: @@ -115,10 +116,10 @@ static void tx_complete(struct urb *req) } dev->stats.tx_packets++; - spin_lock(&pnd->tx_lock); + spin_lock_irqsave(&pnd->tx_lock, flags); pnd->tx_queue--; netif_wake_queue(dev); - spin_unlock(&pnd->tx_lock); + spin_unlock_irqrestore(&pnd->tx_lock, flags); dev_kfree_skb_any(skb); usb_free_urb(req);
next prev parent reply other threads:[~2018-06-20 19:31 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-06-20 19:31 net/usb: Use irqsave in USB's complete callback Sebastian Andrzej Siewior 2018-06-20 19:31 ` Sebastian Andrzej Siewior [this message] 2018-06-20 19:31 ` [1/5] net: usb: cdc-phonet: use irqsave() " Sebastian Andrzej Siewior 2018-06-20 19:31 ` [PATCH 2/5] net: usb: hso: " Sebastian Andrzej Siewior 2018-06-20 19:31 ` [2/5] " Sebastian Andrzej Siewior 2018-06-20 19:31 ` [PATCH 3/5] net: usb: kaweth: " Sebastian Andrzej Siewior 2018-06-20 19:31 ` [3/5] " Sebastian Andrzej Siewior 2018-06-20 19:31 ` [PATCH 4/5] net: usb: r8152: " Sebastian Andrzej Siewior 2018-06-20 19:31 ` [4/5] " Sebastian Andrzej Siewior 2018-06-20 19:31 ` [PATCH 5/5] net: usb: rtl8150: " Sebastian Andrzej Siewior 2018-06-20 19:31 ` [5/5] " Sebastian Andrzej Siewior 2018-06-22 4:58 ` net/usb: Use irqsave " David Miller
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=20180620193121.24967-2-bigeasy@linutronix.de \ --to=bigeasy@linutronix.de \ --cc=davem@davemloft.net \ --cc=linux-usb@vger.kernel.org \ --cc=netdev@vger.kernel.org \ --cc=tglx@linutronix.de \ /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: linkBe 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.