Przeglądaj źródła

r8152: check tx agg list before spin lock

Check tx agg list before spin lock to avoid doing spin lock every
times.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
hayeswang 11 lat temu
rodzic
commit
21949ab7df
1 zmienionych plików z 3 dodań i 0 usunięć
  1. 3 0
      drivers/net/usb/r8152.c

+ 3 - 0
drivers/net/usb/r8152.c

@@ -1266,6 +1266,9 @@ static struct tx_agg *r8152_get_tx_agg(struct r8152 *tp)
 	struct tx_agg *agg = NULL;
 	struct tx_agg *agg = NULL;
 	unsigned long flags;
 	unsigned long flags;
 
 
+	if (list_empty(&tp->tx_free))
+		return NULL;
+
 	spin_lock_irqsave(&tp->tx_lock, flags);
 	spin_lock_irqsave(&tp->tx_lock, flags);
 	if (!list_empty(&tp->tx_free)) {
 	if (!list_empty(&tp->tx_free)) {
 		struct list_head *cursor;
 		struct list_head *cursor;