]> git.karo-electronics.de Git - linux-beck.git/commitdiff
net: fec: replace delayed work with standard work
authorRussell King <rmk+kernel@arm.linux.org.uk>
Tue, 8 Jul 2014 12:01:44 +0000 (13:01 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 9 Jul 2014 03:57:46 +0000 (20:57 -0700)
As of "better implementation of iMX6 ERR006358 quirk", we no longer have
a requirement for a delayed work.  Moreover, the work is now only used
for timeout purposes, so the timeout flag is also pointless - we set it
each time we queue the work, and the work clears it.

Replace the fec_enet_delayed_work struct with a standard work_struct,
resulting in simplified timeout handling code.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/fec.h
drivers/net/ethernet/freescale/fec_main.c

index 17e29497020744be09a76d99c390672f0e1dfcde..bd53caf1c1eb6b735be414aecd11a4e3ff732747 100644 (file)
@@ -256,11 +256,6 @@ struct bufdesc_ex {
 #define FLAG_RX_CSUM_ENABLED   (BD_ENET_RX_ICE | BD_ENET_RX_PCR)
 #define FLAG_RX_CSUM_ERROR     (BD_ENET_RX_ICE | BD_ENET_RX_PCR)
 
-struct fec_enet_delayed_work {
-       struct delayed_work delay_work;
-       bool timeout;
-};
-
 /* The FEC buffer descriptors track the ring buffers.  The rx_bd_base and
  * tx_bd_base always point to the base of the buffer descriptors.  The
  * cur_rx and cur_tx point to the currently available buffer.
@@ -326,6 +321,8 @@ struct fec_enet_private {
        struct  napi_struct napi;
        int     csum_flags;
 
+       struct work_struct tx_timeout_work;
+
        struct ptp_clock *ptp_clock;
        struct ptp_clock_info ptp_caps;
        unsigned long last_overflow_check;
@@ -338,7 +335,6 @@ struct fec_enet_private {
        int hwts_rx_en;
        int hwts_tx_en;
        struct timer_list time_keep;
-       struct fec_enet_delayed_work delay_work;
        struct regulator *reg_phy;
 };
 
index 8cfc3a3de7fbf25c9b6b646277c8a271fd8bbe21..b2ae7e706d5e359e232086a0c81bdb545ca753b5 100644 (file)
@@ -1020,31 +1020,25 @@ fec_timeout(struct net_device *ndev)
 
        ndev->stats.tx_errors++;
 
-       fep->delay_work.timeout = true;
-       schedule_delayed_work(&(fep->delay_work.delay_work), 0);
+       schedule_work(&fep->tx_timeout_work);
 }
 
-static void fec_enet_work(struct work_struct *work)
+static void fec_enet_timeout_work(struct work_struct *work)
 {
        struct fec_enet_private *fep =
-               container_of(work,
-                            struct fec_enet_private,
-                            delay_work.delay_work.work);
+               container_of(work, struct fec_enet_private, tx_timeout_work);
        struct net_device *ndev = fep->netdev;
 
-       if (fep->delay_work.timeout) {
-               fep->delay_work.timeout = false;
-               rtnl_lock();
-               if (netif_device_present(ndev) || netif_running(ndev)) {
-                       napi_disable(&fep->napi);
-                       netif_tx_lock_bh(ndev);
-                       fec_restart(ndev);
-                       netif_wake_queue(ndev);
-                       netif_tx_unlock_bh(ndev);
-                       napi_enable(&fep->napi);
-               }
-               rtnl_unlock();
+       rtnl_lock();
+       if (netif_device_present(ndev) || netif_running(ndev)) {
+               napi_disable(&fep->napi);
+               netif_tx_lock_bh(ndev);
+               fec_restart(ndev);
+               netif_wake_queue(ndev);
+               netif_tx_unlock_bh(ndev);
+               napi_enable(&fep->napi);
        }
+       rtnl_unlock();
 }
 
 static void
@@ -2642,7 +2636,7 @@ fec_probe(struct platform_device *pdev)
        if (fep->bufdesc_ex && fep->ptp_clock)
                netdev_info(ndev, "registered PHC device %d\n", fep->dev_id);
 
-       INIT_DELAYED_WORK(&(fep->delay_work.delay_work), fec_enet_work);
+       INIT_WORK(&fep->tx_timeout_work, fec_enet_timeout_work);
        return 0;
 
 failed_register:
@@ -2667,7 +2661,7 @@ fec_drv_remove(struct platform_device *pdev)
        struct net_device *ndev = platform_get_drvdata(pdev);
        struct fec_enet_private *fep = netdev_priv(ndev);
 
-       cancel_delayed_work_sync(&(fep->delay_work.delay_work));
+       cancel_work_sync(&fep->tx_timeout_work);
        unregister_netdev(ndev);
        fec_enet_mii_remove(fep);
        del_timer_sync(&fep->time_keep);