[prev in list] [next in list] [prev in thread] [next in thread]
List: linux-wlan-devel
Subject: [lwlan-devel] [PATCH] Re: 0.2.7 fails to compile against kernel
From: Pavel Roskin <proski () gnu ! org>
Date: 2007-01-25 21:45:47
Message-ID: 1169761547.2072.36.camel () dv
[Download RAW message or body]
Hello!
On Thu, 2007-01-25 at 18:52 +0000, Tom K wrote:
> The error is:
>
> In file included from
> /home/tomk/src/linux-wlan-ng-0.2.7/src/prism2/driver/prism2_usb.c:2:
> /home/tomk/src/linux-wlan-ng-0.2.7/src/prism2/driver/hfa384x_usb.c:714:56:
> error: macro "INIT_WORK" passed 3 arguments, but takes just 2
Sorry, I didn't realize that linux-wlan-ng is still not converted to the
new INIT_WORK! Here's the patch:
Add support for 2-argument INIT_WORK in Linux 2.6.20
INIT_WORK got dumbed down in 2.6.20. The argument of the worker
function is now the first argument to INIT_WORK, so pass it as the third
argument for older kernels. Get the original argument to the worker
function using container_of. Provide container_of replacement for Linux
2.4.x. Remove PREPARE_WORK, it's unused.
Signed-off-by: Pavel Roskin <proski@gnu.org>
Index: src/include/wlan/wlan_compat.h
===================================================================
--- src/include/wlan/wlan_compat.h (revision 1815)
+++ src/include/wlan/wlan_compat.h (working copy)
@@ -490,6 +490,12 @@
} while (0)
#endif
+#ifndef container_of
+#define container_of(ptr, type, member) ({ \
+ const typeof( ((type *)0)->member ) *__mptr = (ptr); \
+ (type *)( (char *)__mptr - offsetof(type,member) );})
+#endif
+
#ifndef INIT_WORK
#define work_struct tq_struct
@@ -500,11 +506,19 @@
#endif
#define flush_scheduled_work flush_scheduled_tasks
-#define INIT_WORK(_wq, _routine, _data) INIT_TQUEUE(_wq, _routine, _data)
-#define PREPARE_WORK(_wq, _routine, _data) PREPARE_TQUEUE(_wq, _routine, _data)
+#define INIT_WORK2(_wq, _routine) INIT_TQUEUE(_wq, (void (*)(void *))_routine, _wq)
#endif
-#endif // < 2.5 kernel
+#else // >= 2.5 kernel
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+#define INIT_WORK2(_wq, _routine) INIT_WORK(_wq, (void (*)(void *))_routine, _wq)
+#else
+#define INIT_WORK2(_wq, _routine) INIT_WORK(_wq, _routine)
+#endif
+
+#endif // >= 2.5 kernel
+
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,38))
typedef struct device netdevice_t;
#elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,4))
Index: src/prism2/include/prism2/prism2mgmt.h
===================================================================
--- src/prism2/include/prism2/prism2mgmt.h (revision 1815)
+++ src/prism2/include/prism2/prism2mgmt.h (working copy)
@@ -168,9 +168,9 @@
UINT8 *prism2buf, p80211pstrd_t *pstr, hfa384x_t *priv );
int prism2mgmt_get_grpaddr_index( UINT32 did );
-void prism2sta_processing_defer(void *data);
+void prism2sta_processing_defer(struct work_struct *data);
-void prism2sta_commsqual_defer(void *data);
+void prism2sta_commsqual_defer(struct work_struct *data);
void prism2sta_commsqual_timer(unsigned long data);
/*=============================================================*/
Index: src/prism2/driver/hfa384x_usb.c
===================================================================
--- src/prism2/driver/hfa384x_usb.c (revision 1815)
+++ src/prism2/driver/hfa384x_usb.c (working copy)
@@ -711,8 +711,8 @@
tasklet_init(&hw->completion_bh,
hfa384x_usbctlx_completion_task,
(unsigned long)hw);
- INIT_WORK(&hw->link_bh, prism2sta_processing_defer, hw);
- INIT_WORK(&hw->usb_work, hfa384x_usb_defer, hw);
+ INIT_WORK2(&hw->link_bh, prism2sta_processing_defer);
+ INIT_WORK2(&hw->usb_work, hfa384x_usb_defer);
init_timer(&hw->throttle);
hw->throttle.function = hfa384x_usb_throttlefn;
@@ -733,7 +733,7 @@
hw->link_status = HFA384x_LINK_NOTCONNECTED;
hw->state = HFA384x_STATE_INIT;
- INIT_WORK(&hw->commsqual_bh, prism2sta_commsqual_defer, hw);
+ INIT_WORK2(&hw->commsqual_bh, prism2sta_commsqual_defer);
init_timer(&hw->commsqual_timer);
hw->commsqual_timer.data = (unsigned long) hw;
hw->commsqual_timer.function = prism2sta_commsqual_timer;
Index: src/prism2/driver/prism2sta.c
===================================================================
--- src/prism2/driver/prism2sta.c (revision 1815)
+++ src/prism2/driver/prism2sta.c (working copy)
@@ -1438,9 +1438,9 @@
return;
}
-void prism2sta_processing_defer(void *data)
+void prism2sta_processing_defer(struct work_struct *data)
{
- hfa384x_t *hw = (hfa384x_t *) data;
+ hfa384x_t *hw = container_of(data, struct hfa384x, link_bh);
wlandevice_t *wlandev = hw->wlandev;
hfa384x_bytestr32_t ssid;
int result;
@@ -1540,7 +1540,7 @@
WLAN_MACMODE_IBSS_STA : WLAN_MACMODE_ESS_STA;
/* Get the ball rolling on the comms quality stuff */
- prism2sta_commsqual_defer(hw);
+ prism2sta_commsqual_defer(&hw->commsqual_bh);
}
break;
@@ -2413,7 +2413,7 @@
}
#endif
-void prism2sta_commsqual_defer(void *data)
+void prism2sta_commsqual_defer(struct work_struct *data)
{
hfa384x_t *hw = (hfa384x_t *) data;
wlandevice_t *wlandev = hw->wlandev;
Index: src/prism2/driver/hfa384x.c
===================================================================
--- src/prism2/driver/hfa384x.c (revision 1815)
+++ src/prism2/driver/hfa384x.c (working copy)
@@ -352,9 +352,9 @@
/* Init the auth queue head */
skb_queue_head_init(&hw->authq);
- INIT_WORK(&hw->link_bh, prism2sta_processing_defer, hw);
+ INIT_WORK2(&hw->link_bh, prism2sta_processing_defer);
- INIT_WORK(&hw->commsqual_bh, prism2sta_commsqual_defer, hw);
+ INIT_WORK2(&hw->commsqual_bh, prism2sta_commsqual_defer);
init_timer(&hw->commsqual_timer);
hw->commsqual_timer.data = (unsigned long) hw;
--
Regards,
Pavel Roskin
_______________________________________________
Linux-wlan-devel mailing list
Linux-wlan-devel@lists.linux-wlan.com
http://lists.linux-wlan.com/mailman/listinfo/linux-wlan-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic