summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorhayeswang <hayeswang@realtek.com>2014-03-07 11:04:34 +0800
committerSeema Khowala <seemaj@nvidia.com>2014-04-23 14:07:35 -0700
commit26c6d7f060f47c3ec95475f00f0e9d7d46a5f70c (patch)
tree1256c2df1cb227c40b06480ba23d03aa4fbcf83f /drivers/net
parent8e1f381d6e9f77d46f85859d778a0ddbed82d95b (diff)
r8152: replace spin_lock_irqsave and spin_unlock_irqrestore
Use spin_lock and spin_unlock in interrupt context. The ndo_start_xmit would not be called in interrupt context, so replace the relative spin_lock_irqsave and spin_unlock_irqrestore with spin_lock_bh and spin_unlock_bh. Change-Id: I1a1764c0e3785efb6a72c14702763d9e516f794a Signed-off-by: Hayes Wang <hayeswang@realtek.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Aly Hirani <ahirani@nvidia.com> Reviewed-on: http://git-master/r/390292 (cherry picked from commit f6ef437cdfb0f7ea777242158d4bde29ac5ab8f0) Reviewed-on: http://git-master/r/396894 Reviewed-by: Preetham Chandru <pchandru@nvidia.com> Tested-by: Preetham Chandru <pchandru@nvidia.com> Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/usb/r8152.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index fda18fb9ddf3..13dbb7056740 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -961,7 +961,6 @@ static int rtl8152_set_mac_address(struct net_device *netdev, void *p)
static void read_bulk_callback(struct urb *urb)
{
struct net_device *netdev;
- unsigned long flags;
int status = urb->status;
struct rx_agg *agg;
struct r8152 *tp;
@@ -995,9 +994,9 @@ static void read_bulk_callback(struct urb *urb)
if (urb->actual_length < ETH_ZLEN)
break;
- spin_lock_irqsave(&tp->rx_lock, flags);
+ spin_lock(&tp->rx_lock);
list_add_tail(&agg->list, &tp->rx_done);
- spin_unlock_irqrestore(&tp->rx_lock, flags);
+ spin_unlock(&tp->rx_lock);
tasklet_schedule(&tp->tl);
return;
case -ESHUTDOWN:
@@ -1020,9 +1019,9 @@ static void read_bulk_callback(struct urb *urb)
if (result == -ENODEV) {
netif_device_detach(tp->netdev);
} else if (result) {
- spin_lock_irqsave(&tp->rx_lock, flags);
+ spin_lock(&tp->rx_lock);
list_add_tail(&agg->list, &tp->rx_done);
- spin_unlock_irqrestore(&tp->rx_lock, flags);
+ spin_unlock(&tp->rx_lock);
tasklet_schedule(&tp->tl);
}
}
@@ -1031,7 +1030,6 @@ static void write_bulk_callback(struct urb *urb)
{
struct net_device_stats *stats;
struct net_device *netdev;
- unsigned long flags;
struct tx_agg *agg;
struct r8152 *tp;
int status = urb->status;
@@ -1055,9 +1053,9 @@ static void write_bulk_callback(struct urb *urb)
stats->tx_bytes += agg->skb_len;
}
- spin_lock_irqsave(&tp->tx_lock, flags);
+ spin_lock(&tp->tx_lock);
list_add_tail(&agg->list, &tp->tx_free);
- spin_unlock_irqrestore(&tp->tx_lock, flags);
+ spin_unlock(&tp->tx_lock);
usb_autopm_put_interface_async(tp->intf);
@@ -1328,14 +1326,13 @@ r8152_tx_csum(struct r8152 *tp, struct tx_desc *desc, struct sk_buff *skb)
static int r8152_tx_agg_fill(struct r8152 *tp, struct tx_agg *agg)
{
struct sk_buff_head skb_head, *tx_queue = &tp->tx_queue;
- unsigned long flags;
int remain, ret;
u8 *tx_data;
__skb_queue_head_init(&skb_head);
- spin_lock_irqsave(&tx_queue->lock, flags);
+ spin_lock_bh(&tx_queue->lock);
skb_queue_splice_init(tx_queue, &skb_head);
- spin_unlock_irqrestore(&tx_queue->lock, flags);
+ spin_unlock_bh(&tx_queue->lock);
tx_data = agg->head;
agg->skb_num = agg->skb_len = 0;
@@ -1372,9 +1369,9 @@ static int r8152_tx_agg_fill(struct r8152 *tp, struct tx_agg *agg)
}
if (!skb_queue_empty(&skb_head)) {
- spin_lock_irqsave(&tx_queue->lock, flags);
+ spin_lock_bh(&tx_queue->lock);
skb_queue_splice(&skb_head, tx_queue);
- spin_unlock_irqrestore(&tx_queue->lock, flags);
+ spin_unlock_bh(&tx_queue->lock);
}
netif_tx_lock_bh(tp->netdev);
@@ -1549,16 +1546,15 @@ static void rtl_drop_queued_tx(struct r8152 *tp)
{
struct net_device_stats *stats = &tp->netdev->stats;
struct sk_buff_head skb_head, *tx_queue = &tp->tx_queue;
- unsigned long flags;
struct sk_buff *skb;
if (skb_queue_empty(tx_queue))
return;
__skb_queue_head_init(&skb_head);
- spin_lock_irqsave(&tx_queue->lock, flags);
+ spin_lock_bh(&tx_queue->lock);
skb_queue_splice_init(tx_queue, &skb_head);
- spin_unlock_irqrestore(&tx_queue->lock, flags);
+ spin_unlock_bh(&tx_queue->lock);
while ((skb = __skb_dequeue(&skb_head))) {
dev_kfree_skb(skb);