From: Luis R. Rodriguez Date: Fri, 11 Dec 2009 23:36:16 +0000 (-0800) Subject: Add a backport for flush_delayed_work() X-Git-Tag: next-20100113~37 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=5d3ff43a5c8b251a9dabb06a03783b1d53f516f6;p=~emulex%2Ffor-vlad%2Fcompat.git Add a backport for flush_delayed_work() We can't really *flush* per se, see the code for more details but we can at least delete and synch the timer. Signed-off-by: Luis R. Rodriguez --- diff --git a/include/linux/compat-2.6.32.h b/include/linux/compat-2.6.32.h index 54f7cb0..727ac71 100644 --- a/include/linux/compat-2.6.32.h +++ b/include/linux/compat-2.6.32.h @@ -9,6 +9,7 @@ #include #include #include +#include #define SDIO_VENDOR_ID_INTEL 0x0089 #define SDIO_DEVICE_ID_INTEL_IWMC3200WIMAX 0x1402 @@ -17,6 +18,24 @@ #define SDIO_DEVICE_ID_INTEL_IWMC3200GPS 0x1405 #define SDIO_DEVICE_ID_INTEL_IWMC3200BT 0x1406 +static inline void flush_delayed_work(struct delayed_work *dwork) +{ + if (del_timer_sync(&dwork->timer)) { + /* + * This is what would happen on 2.6.32 but since we don't have + * access to the singlethread_cpu we can't really backport this, + * so avoid really *flush*ing the work... Oh well. Any better ideas? + + struct cpu_workqueue_struct *cwq; + cwq = wq_per_cpu(keventd_wq, get_cpu()); + __queue_work(cwq, &dwork->work); + put_cpu(); + + */ + } + flush_work(&dwork->work); +} + /* * struct genl_multicast_group was made netns aware through * patch "genetlink: make netns aware" by johannes, we just