Project : madwifi
Revision : 2000
Author : proski (Pavel Roskin)
Date : 2007-01-26 02:59:37 +0100 (Fri, 26 Jan 2007)
Log Message :
Avoid compatibility names in workqueue API
It's generally a good idea to keep the API in line with the current
kernel and provide compatibility for older kernels, not vice versa.
Thus, we should define new API for the kernels that lack it, rather
than create our own absraction layer.
Rename ATH_INIT_SCHED_TASK to ATH_INIT_WORK, since redefining INIT_WORK
for Linux 2.6.0 - 2.6.19 would be tricky. Use standard Linux 2.6.20 names
for the rest.
Affected Files:
* trunk/ath/if_ath.c updated
* trunk/ath/if_athvar.h updated
Modified: trunk/ath/if_ath.c
===================================================================
--- trunk/ath/if_ath.c 2007-01-26 01:49:05 UTC (rev 1999)
+++ trunk/ath/if_ath.c 2007-01-26 01:59:37 UTC (rev 2000)
@@ -125,7 +125,7 @@
static void ath_rxorn_tasklet(TQUEUE_ARG);
static void ath_bmiss_tasklet(TQUEUE_ARG);
static void ath_bstuck_tasklet(TQUEUE_ARG);
-static void ath_radar_task(struct ATH_WORK_THREAD *);
+static void ath_radar_task(struct work_struct *);
static void ath_dfs_test_return(unsigned long);
static int ath_stop_locked(struct net_device *);
@@ -423,7 +423,7 @@
ATH_INIT_TQUEUE(&sc->sc_bstucktq,ath_bstuck_tasklet, dev);
ATH_INIT_TQUEUE(&sc->sc_rxorntq, ath_rxorn_tasklet, dev);
ATH_INIT_TQUEUE(&sc->sc_fataltq, ath_fatal_tasklet, dev);
- ATH_INIT_SCHED_TASK(&sc->sc_radartask, ath_radar_task);
+ ATH_INIT_WORK(&sc->sc_radartask, ath_radar_task);
/*
* Attach the HAL and verify ABI compatibility by checking
@@ -943,7 +943,7 @@
ath_hal_setpower(sc->sc_ah, HAL_PM_AWAKE);
/* Flush the radar task if it's scheduled */
if (sc->sc_rtasksched == 1)
- ATH_FLUSH_TASKS();
+ flush_scheduled_work();
sc->sc_invalid = 1;
@@ -1745,7 +1745,7 @@
}
static void
-ath_radar_task(struct ATH_WORK_THREAD *thr)
+ath_radar_task(struct work_struct *thr)
{
struct ath_softc *sc = container_of(thr, struct ath_softc,
sc_radartask);
struct ath_hal *ah = sc->sc_ah;
@@ -5786,7 +5786,7 @@
ath_hal_rxmonitor(ah, &sc->sc_halstats, &sc->sc_curchan);
if (ath_hal_radar_event(ah)) {
sc->sc_rtasksched = 1;
- ATH_SCHEDULE_TASK(&sc->sc_radartask);
+ schedule_work(&sc->sc_radartask);
}
#undef PA2DESC
}
Modified: trunk/ath/if_athvar.h
===================================================================
--- trunk/ath/if_athvar.h 2007-01-26 01:49:05 UTC (rev 1999)
+++ trunk/ath/if_athvar.h 2007-01-26 01:59:37 UTC (rev 2000)
@@ -72,26 +72,23 @@
#include <linux/sched.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,41)
#include <linux/tqueue.h>
-#define ATH_WORK_THREAD tq_struct
-#define ATH_SCHEDULE_TASK(t) schedule_task((t))
-#define ATH_INIT_SCHED_TASK(t, f) do { \
+#define work_struct tq_struct
+#define schedule_work(t) schedule_task((t))
+#define flush_scheduled_work() flush_scheduled_tasks()
+#define ATH_INIT_WORK(t, f) do { \
memset((t),0,sizeof(struct tq_struct)); \
(t)->routine = (void (*)(void*)) (f); \
(t)->data=(void *) (t); \
} while (0)
-#define ATH_FLUSH_TASKS flush_scheduled_tasks
#else
#include <linux/workqueue.h>
-#define ATH_SCHEDULE_TASK(t) schedule_work((t))
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
-#define ATH_INIT_SCHED_TASK(_t, _f) INIT_WORK((_t), (void (*)(void *))(_f),
(_t));
+#define ATH_INIT_WORK(_t, _f) INIT_WORK((_t), (void (*)(void *))(_f), (_t));
#else
-#define ATH_INIT_SCHED_TASK(_t, _f) INIT_WORK((_t), (_f));
+#define ATH_INIT_WORK(_t, _f) INIT_WORK((_t), (_f));
#endif
-#define ATH_WORK_THREAD work_struct
-#define ATH_FLUSH_TASKS flush_scheduled_work
#endif /* KERNEL_VERSION < 2.5.41 */
/*
@@ -657,7 +654,7 @@
struct timer_list sc_cal_ch; /* calibration timer */
HAL_NODE_STATS sc_halstats; /* station-mode rssi stats */
- struct ATH_WORK_THREAD sc_radartask; /* Schedule task for DFS
handling */
+ struct work_struct sc_radartask; /* Schedule task for DFS
handling */
struct ctl_table_header *sc_sysctl_header;
struct ctl_table *sc_sysctls;
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
|