staging: et131x: Simplify unlocking tcb_send_qlock in et131x_tx_timeout()
authorMark Einon <mark.einon@gmail.com>
Sun, 14 Sep 2014 15:58:59 +0000 (16:58 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 19 Sep 2014 23:04:52 +0000 (16:04 -0700)
The tcb_send_qlock spinlock is unlocked in all three paths at the end of
et131x_tx_timeout(). We can call it once before entering any of the paths,
saving ourselves a few lines of code.

This change puts tcb->count++ outside of the lock, but et131x_tx_timeout()
itself is protected by the tx_global_lock, so this shouldn't matter.

Signed-off-by: Mark Einon <mark.einon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/et131x/et131x.c

index daa4e24ef9ed5e3eb04f9fede4918894e98bf175..c8f54264865f6d65da6d0d329959601894fd14c7 100644 (file)
@@ -4170,16 +4170,13 @@ static void et131x_tx_timeout(struct net_device *netdev)
 
        /* Is send stuck? */
        spin_lock_irqsave(&adapter->tcb_send_qlock, flags);
-
        tcb = tx_ring->send_head;
+       spin_unlock_irqrestore(&adapter->tcb_send_qlock, flags);
 
-       if (tcb != NULL) {
+       if (tcb) {
                tcb->count++;
 
                if (tcb->count > NIC_SEND_HANG_THRESHOLD) {
-                       spin_unlock_irqrestore(&adapter->tcb_send_qlock,
-                                              flags);
-
                        dev_warn(&adapter->pdev->dev,
                                 "Send stuck - reset. tcb->WrIndex %x\n",
                                 tcb->index);
@@ -4189,11 +4186,8 @@ static void et131x_tx_timeout(struct net_device *netdev)
                        /* perform reset of tx/rx */
                        et131x_disable_txrx(netdev);
                        et131x_enable_txrx(netdev);
-                       return;
                }
        }
-
-       spin_unlock_irqrestore(&adapter->tcb_send_qlock, flags);
 }
 
 /* et131x_change_mtu - The handler called to change the MTU for the device */
This page took 0.040925 seconds and 5 git commands to generate.