Patch for madwifi

Denis Leroy <[email protected]>
Newsgroups gmane.linux.freshrpms.user
Message-ID <[email protected]>
Salut Matthias,

Please find patch attached for 2.6.20 support. Just add it to your 
madwifi.spec file :-)


-denis
madwifi-0.9.2.1-twosixtwenty.patch (text/x-patch, 5.2 KB)
diff -u -r madwifi-0.9.2.1.orig/ath/if_ath.c madwifi-0.9.2.1/ath/if_ath.c
--- madwifi-0.9.2.1.orig/ath/if_ath.c	2007-03-17 15:23:01.000000000 +0100
+++ madwifi-0.9.2.1/ath/if_ath.c	2007-03-17 15:13:43.000000000 +0100
@@ -115,7 +115,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(TQUEUE_ARG);
+static void ath_radar_task(struct work_struct *);
 static void ath_dfs_test_return(unsigned long);
 
 static int ath_stop_locked(struct net_device *);
@@ -411,7 +411,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,	dev);
+	ATH_INIT_WORK(&sc->sc_radartask, ath_radar_task);
 
 	/*
 	 * Attach the hal and verify ABI compatibility by checking
@@ -931,7 +931,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;
 
@@ -1580,7 +1580,11 @@
  * Interrupt handler.  Most of the actual processing is deferred.
  */
 irqreturn_t
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
+ath_intr(int irq, void *dev_id)
+#else
 ath_intr(int irq, void *dev_id, struct pt_regs *regs)
+#endif
 {
 	struct net_device *dev = dev_id;
 	struct ath_softc *sc = dev->priv;
@@ -1700,7 +1704,7 @@
 }
 
 static void
-ath_radar_task(TQUEUE_ARG data)
+ath_radar_task(struct work_struct* data)
 {
 	struct net_device *dev = (struct net_device *)data;
 	struct ath_softc *sc = dev->priv;
@@ -5627,7 +5631,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
 }
diff -u -r madwifi-0.9.2.1.orig/ath/if_athvar.h madwifi-0.9.2.1/ath/if_athvar.h
--- madwifi-0.9.2.1.orig/ath/if_athvar.h	2006-06-28 08:45:43.000000000 +0200
+++ madwifi-0.9.2.1/ath/if_athvar.h	2007-03-17 15:14:29.000000000 +0100
@@ -71,22 +71,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, d) do { 	\
-	memset((t),0,sizeof(struct tq_struct)); 	\
+#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 *) (d); 		\
+	(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))
 
-#define ATH_INIT_SCHED_TASK(_t, _f, _d)	INIT_WORK((_t), (void (*)(void *))(_f), (void *)(_d));
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+#define ATH_INIT_WORK(_t, _f)	INIT_WORK((_t), (void (*)(void *))(_f), (_t));
+#else
+#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 */
 
 /*
@@ -613,7 +614,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 */
 
 #ifdef CONFIG_SYSCTL
 	struct ctl_table_header *sc_sysctl_header;
@@ -686,7 +687,11 @@
 void ath_resume(struct net_device *);
 void ath_suspend(struct net_device *);
 void ath_shutdown(struct net_device *);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
+irqreturn_t ath_intr(int, void *);
+#else
 irqreturn_t ath_intr(int, void *, struct pt_regs *);
+#endif
 int ath_ioctl_ethtool(struct ath_softc *, int, void __user *);
 void bus_read_cachesize(struct ath_softc *, u_int8_t *);
 #ifdef CONFIG_SYSCTL
diff -u -r madwifi-0.9.2.1.orig/net80211/ieee80211_crypto_ccmp.c madwifi-0.9.2.1/net80211/ieee80211_crypto_ccmp.c
--- madwifi-0.9.2.1.orig/net80211/ieee80211_crypto_ccmp.c	2007-03-17 15:23:01.000000000 +0100
+++ madwifi-0.9.2.1/net80211/ieee80211_crypto_ccmp.c	2007-03-17 15:20:07.000000000 +0100
@@ -296,6 +296,9 @@
 static void
 rijndael_encrypt(struct crypto_tfm *tfm, const void *src, void *dst)
 {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
+	crypto_cipher_encrypt_one(tfm, dst, src);
+#else
 	struct scatterlist sg_src;
 	struct scatterlist sg_dst;
 
@@ -307,6 +310,7 @@
 	sg_dst.offset = offset_in_page(dst);
 	sg_dst.length = AES_BLOCK_LEN;
 	crypto_cipher_encrypt(tfm, &sg_dst, &sg_src, AES_BLOCK_LEN);
+#endif
 }
 
 /*
diff -u -r madwifi-0.9.2.1.orig/net80211/ieee80211_linux.h madwifi-0.9.2.1/net80211/ieee80211_linux.h
--- madwifi-0.9.2.1.orig/net80211/ieee80211_linux.h	2006-07-04 12:22:11.000000000 +0200
+++ madwifi-0.9.2.1/net80211/ieee80211_linux.h	2007-03-17 15:03:45.000000000 +0100
@@ -32,6 +32,7 @@
 #ifdef CONFIG_NET_WIRELESS
 #include <linux/wireless.h>
 #endif
+#include <linux/mm.h>
 
 /*
  * Task deferral
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.