atl1c: Do not call cancel_work_sync from the work itself

Submitted by on Aug. 3, 2009, 5:32 a.m.


Message ID
State Changes Requested
Delegated to: David Miller
Headers show

Commit Message Aug. 3, 2009, 5:32 a.m.
Signed-off-by: jie yang <jie.yang>

To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to
More majordomo info at


David Miller Aug. 3, 2009, 8:20 p.m.
From: <>
Date: Mon, 3 Aug 2009 13:32:19 +0800

> Signed-off-by: jie yang <jie.yang>

Your entire email address should be surrounded by '<' and '>'
characters, not just your username, in the signoff.

Also, please provide a more detailed commit message.  Explain what
goes wrong in the current code (when happens when a work is cancelled
within itself, I was under the impression that this works just fine
and is just a NOP), and the basic description of your solution.
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to
More majordomo info at

Patch hide | download patch | download mbox

diff --git a/drivers/net/atl1c/atl1c.h b/drivers/net/atl1c/atl1c.h
index 2a1120a..53242dc 100644
--- a/drivers/net/atl1c/atl1c.h
+++ b/drivers/net/atl1c/atl1c.h
@@ -427,6 +427,7 @@  struct atl1c_hw {
 #define ATL1C_ASPM_CTRL_MON        0x0200
 #define ATL1C_HIB_DISABLE      0x0400
 #define ATL1C_LINK_CAP_1000M       0x0800
+#define ATL1C_RESET_IN_WORK        0x1000
 #define ATL1C_FPGA_VERSION     0x8000
    u16 cmb_tpd;
    u16 cmb_rrd;
diff --git a/drivers/net/atl1c/atl1c_main.c b/drivers/net/atl1c/atl1c_main.c
index 1d601ce..dec88fa 100644
--- a/drivers/net/atl1c/atl1c_main.c
+++ b/drivers/net/atl1c/atl1c_main.c
@@ -321,7 +321,10 @@  static void atl1c_del_timer(struct atl1c_adapter *adapter)
 static void atl1c_cancel_work(struct atl1c_adapter *adapter)
-   cancel_work_sync(&adapter->reset_task);
+   if (adapter->hw.ctrl_flags & ATL1C_RESET_IN_WORK)
+       adapter->hw.ctrl_flags &= ~ATL1C_RESET_IN_WORK;/* clear the flag */
+   else
+       cancel_work_sync(&adapter->reset_task);
@@ -1544,6 +1547,7 @@  static irqreturn_t atl1c_intr(int irq, void *data)
            /* reset MAC */
            hw->intr_mask &= ~ISR_ERROR;
            AT_WRITE_REG(hw, REG_IMR, hw->intr_mask);
+           adapter->hw.ctrl_flags |= ATL1C_RESET_IN_WORK;