Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: et131x: Update tx trans_start on device close to prevent tx_timeout

Updating the tx trans_start before closing the device prevents a possible tx_timeout occuring during the closing process.
Tested on an ET1310 device.

Signed-off-by: Mark Einon <mark.einon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Mark Einon and committed by
Greg Kroah-Hartman
ac657d58 c8b7de7f

+11 -4
+11 -4
drivers/staging/et131x/et131x_netdev.c
··· 153 153 result = request_irq(netdev->irq, et131x_isr, IRQF_SHARED, 154 154 netdev->name, netdev); 155 155 if (result) { 156 - dev_err(&adapter->pdev->dev, "c ould not register IRQ %d\n", 156 + dev_err(&adapter->pdev->dev, "could not register IRQ %d\n", 157 157 netdev->irq); 158 158 return result; 159 159 } ··· 181 181 int et131x_close(struct net_device *netdev) 182 182 { 183 183 struct et131x_adapter *adapter = netdev_priv(netdev); 184 + 185 + /* Save the timestamp for the TX watchdog, prevent a timeout */ 186 + netdev->trans_start = jiffies; 184 187 185 188 /* First thing is to stop the queue */ 186 189 netif_stop_queue(netdev); ··· 452 449 struct tcb *tcb; 453 450 unsigned long flags; 454 451 452 + /* If the device is closed, ignore the timeout */ 453 + if (~(adapter->flags & fMP_ADAPTER_INTERRUPT_IN_USE)); 454 + return; 455 + 455 456 /* Any nonrecoverable hardware error? 456 457 * Checks adapter->flags for any failure in phy reading 457 458 */ ··· 692 685 return NULL; 693 686 } 694 687 695 - /* Setup the function registration table (and other data) for a 688 + /* 689 + * Setup the function registration table (and other data) for a 696 690 * net_device 697 691 */ 698 - 699 692 netdev->watchdog_timeo = ET131X_TX_TIMEOUT; 700 - netdev->netdev_ops = &et131x_netdev_ops; 693 + netdev->netdev_ops = &et131x_netdev_ops; 701 694 702 695 /* netdev->ethtool_ops = &et131x_ethtool_ops; */ 703 696