r8169: simplify rtl_task
authorHeiner Kallweit <hkallweit1@gmail.com>
Sun, 22 Mar 2020 18:02:32 +0000 (19:02 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 24 Mar 2020 04:38:21 +0000 (21:38 -0700)
Currently rtl_task() is designed to handle a large number of tasks.
However we have just one, so we can remove some overhead.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/realtek/r8169_main.c

index d2eef3754b33e4c1ada745daa274061b439aed29..242b14cc713144718d8527d5cbab7ceab46f1b01 100644 (file)
@@ -4589,31 +4589,17 @@ out:
 
 static void rtl_task(struct work_struct *work)
 {
-       static const struct {
-               int bitnr;
-               void (*action)(struct rtl8169_private *);
-       } rtl_work[] = {
-               { RTL_FLAG_TASK_RESET_PENDING,  rtl_reset_work },
-       };
        struct rtl8169_private *tp =
                container_of(work, struct rtl8169_private, wk.work);
-       struct net_device *dev = tp->dev;
-       int i;
 
        rtl_lock_work(tp);
 
-       if (!netif_running(dev) ||
+       if (!netif_running(tp->dev) ||
            !test_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags))
                goto out_unlock;
 
-       for (i = 0; i < ARRAY_SIZE(rtl_work); i++) {
-               bool pending;
-
-               pending = test_and_clear_bit(rtl_work[i].bitnr, tp->wk.flags);
-               if (pending)
-                       rtl_work[i].action(tp);
-       }
-
+       if (test_and_clear_bit(RTL_FLAG_TASK_RESET_PENDING, tp->wk.flags))
+               rtl_reset_work(tp);
 out_unlock:
        rtl_unlock_work(tp);
 }