Fix libertas compile on 2.6.27.

SVN-Revision: 13452
This commit is contained in:
Lars-Peter Clausen 2008-11-30 19:24:20 +00:00
parent dd6e0afc45
commit 93a53872e7

View file

@ -1,22 +1,46 @@
Index: kmod-libertas/scan.c diff --git a/scan.c b/scan.c
=================================================================== index 387d487..d9cde10 100644
--- kmod-libertas.orig/scan.c 2008-11-30 17:44:39.000000000 +0100 --- a/scan.c
+++ kmod-libertas/scan.c 2008-11-30 17:46:08.000000000 +0100 +++ b/scan.c
@@ -13,6 +13,13 @@ @@ -4,6 +4,7 @@
* IOCTL handlers as well as command preperation and response routines
* for sending scan commands to the firmware.
*/
+#include <linux/version.h>
#include <linux/etherdevice.h>
#include <asm/unaligned.h>
@@ -13,6 +14,14 @@
#include "scan.h" #include "scan.h"
#include "cmd.h" #include "cmd.h"
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
+#define IWE(func, ...) func(&iweinfo, __VA_ARGS__) +#define IWE(func, ...) func(info, __VA_ARGS__)
+static struct iw_request_info iweinfo = { 0, 0 }; +#define LCP_LEN iwe_stream_lcp_len(info)
+#else +#else
+#define IWE(func, ...) func(__VA_ARGS__) +#define IWE(func, ...) func(__VA_ARGS__)
+#define LCP_LEN IW_EV_LCP_LEN
+#endif +#endif
+ +
//! Approximate amount of data needed to pass a scan result back to iwlist //! Approximate amount of data needed to pass a scan result back to iwlist
#define MAX_SCAN_CELL_SIZE (IW_EV_ADDR_LEN \ #define MAX_SCAN_CELL_SIZE (IW_EV_ADDR_LEN \
+ IW_ESSID_MAX_SIZE \ + IW_ESSID_MAX_SIZE \
@@ -807,7 +814,7 @@ @@ -776,6 +785,7 @@ out:
#define MAX_CUSTOM_LEN 64
static inline char *lbs_translate_scan(struct lbs_private *priv,
+ struct iw_request_info *info,
char *start, char *stop,
struct bss_descriptor *bss)
{
@@ -801,24 +811,24 @@ static inline char *lbs_translate_scan(struct lbs_private *priv,
iwe.cmd = SIOCGIWAP;
iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
memcpy(iwe.u.ap_addr.sa_data, &bss->bssid, ETH_ALEN);
- start = iwe_stream_add_event(start, stop, &iwe, IW_EV_ADDR_LEN);
+ start = IWE(iwe_stream_add_event, start, stop, &iwe, IW_EV_ADDR_LEN);
/* SSID */
iwe.cmd = SIOCGIWESSID; iwe.cmd = SIOCGIWESSID;
iwe.u.data.flags = 1; iwe.u.data.flags = 1;
iwe.u.data.length = min((uint32_t) bss->ssid_len, (uint32_t) IW_ESSID_MAX_SIZE); iwe.u.data.length = min((uint32_t) bss->ssid_len, (uint32_t) IW_ESSID_MAX_SIZE);
@ -25,16 +49,41 @@ Index: kmod-libertas/scan.c
/* Mode */ /* Mode */
iwe.cmd = SIOCGIWMODE; iwe.cmd = SIOCGIWMODE;
@@ -862,7 +869,7 @@ iwe.u.mode = bss->mode;
- start = iwe_stream_add_event(start, stop, &iwe, IW_EV_UINT_LEN);
+ start = IWE(iwe_stream_add_event, start, stop, &iwe, IW_EV_UINT_LEN);
/* Frequency */
iwe.cmd = SIOCGIWFREQ;
iwe.u.freq.m = (long)cfp->freq * 100000;
iwe.u.freq.e = 1;
- start = iwe_stream_add_event(start, stop, &iwe, IW_EV_FREQ_LEN);
+ start = IWE(iwe_stream_add_event, start, stop, &iwe, IW_EV_FREQ_LEN);
/* Add quality statistics */
iwe.cmd = IWEVQUAL;
@@ -852,7 +862,7 @@ static inline char *lbs_translate_scan(struct lbs_private *priv,
nf = priv->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE;
iwe.u.qual.level = CAL_RSSI(snr, nf);
}
- start = iwe_stream_add_event(start, stop, &iwe, IW_EV_QUAL_LEN);
+ start = IWE(iwe_stream_add_event, start, stop, &iwe, IW_EV_QUAL_LEN);
/* Add encryption capability */
iwe.cmd = SIOCGIWENCODE;
@@ -862,9 +872,9 @@ static inline char *lbs_translate_scan(struct lbs_private *priv,
iwe.u.data.flags = IW_ENCODE_DISABLED; iwe.u.data.flags = IW_ENCODE_DISABLED;
} }
iwe.u.data.length = 0; iwe.u.data.length = 0;
- start = iwe_stream_add_point(start, stop, &iwe, bss->ssid); - start = iwe_stream_add_point(start, stop, &iwe, bss->ssid);
+ start = IWE(iwe_stream_add_point, start, stop, &iwe, bss->ssid); + start = IWE(iwe_stream_add_point, start, stop, &iwe, bss->ssid);
current_val = start + IW_EV_LCP_LEN; - current_val = start + IW_EV_LCP_LEN;
+ current_val = start + LCP_LEN;
@@ -874,7 +881,7 @@ iwe.cmd = SIOCGIWRATE;
iwe.u.bitrate.fixed = 0;
@@ -874,19 +884,19 @@ static inline char *lbs_translate_scan(struct lbs_private *priv,
for (j = 0; bss->rates[j] && (j < sizeof(bss->rates)); j++) { for (j = 0; bss->rates[j] && (j < sizeof(bss->rates)); j++) {
/* Bit rate given in 500 kb/s units */ /* Bit rate given in 500 kb/s units */
iwe.u.bitrate.value = bss->rates[j] * 500000; iwe.u.bitrate.value = bss->rates[j] * 500000;
@ -43,7 +92,7 @@ Index: kmod-libertas/scan.c
stop, &iwe, IW_EV_PARAM_LEN); stop, &iwe, IW_EV_PARAM_LEN);
} }
if ((bss->mode == IW_MODE_ADHOC) && priv->adhoccreate if ((bss->mode == IW_MODE_ADHOC) && priv->adhoccreate
@@ -882,7 +889,7 @@ && !lbs_ssid_cmp(priv->curbssparams.ssid,
priv->curbssparams.ssid_len, priv->curbssparams.ssid_len,
bss->ssid, bss->ssid_len)) { bss->ssid, bss->ssid_len)) {
iwe.u.bitrate.value = 22 * 500000; iwe.u.bitrate.value = 22 * 500000;
@ -52,7 +101,12 @@ Index: kmod-libertas/scan.c
stop, &iwe, IW_EV_PARAM_LEN); stop, &iwe, IW_EV_PARAM_LEN);
} }
/* Check if we added any event */ /* Check if we added any event */
@@ -895,7 +902,7 @@ - if((current_val - start) > IW_EV_LCP_LEN)
+ if((current_val - start) > LCP_LEN)
start = current_val;
memset(&iwe, 0, sizeof(iwe));
@@ -895,7 +905,7 @@ static inline char *lbs_translate_scan(struct lbs_private *priv,
memcpy(buf, bss->wpa_ie, bss->wpa_ie_len); memcpy(buf, bss->wpa_ie, bss->wpa_ie_len);
iwe.cmd = IWEVGENIE; iwe.cmd = IWEVGENIE;
iwe.u.data.length = bss->wpa_ie_len; iwe.u.data.length = bss->wpa_ie_len;
@ -61,7 +115,7 @@ Index: kmod-libertas/scan.c
} }
memset(&iwe, 0, sizeof(iwe)); memset(&iwe, 0, sizeof(iwe));
@@ -904,7 +911,7 @@ @@ -904,7 +914,7 @@ static inline char *lbs_translate_scan(struct lbs_private *priv,
memcpy(buf, bss->rsn_ie, bss->rsn_ie_len); memcpy(buf, bss->rsn_ie, bss->rsn_ie_len);
iwe.cmd = IWEVGENIE; iwe.cmd = IWEVGENIE;
iwe.u.data.length = bss->rsn_ie_len; iwe.u.data.length = bss->rsn_ie_len;
@ -70,7 +124,7 @@ Index: kmod-libertas/scan.c
} }
if (bss->mesh) { if (bss->mesh) {
@@ -915,7 +922,7 @@ @@ -915,7 +925,7 @@ static inline char *lbs_translate_scan(struct lbs_private *priv,
p += snprintf(p, MAX_CUSTOM_LEN, "mesh-type: olpc"); p += snprintf(p, MAX_CUSTOM_LEN, "mesh-type: olpc");
iwe.u.data.length = p - custom; iwe.u.data.length = p - custom;
if (iwe.u.data.length) if (iwe.u.data.length)
@ -79,3 +133,12 @@ Index: kmod-libertas/scan.c
} }
out: out:
@@ -1036,7 +1046,7 @@ int lbs_get_scan(struct net_device *dev, struct iw_request_info *info,
}
/* Translate to WE format this entry */
- next_ev = lbs_translate_scan(priv, ev, stop, iter_bss);
+ next_ev = lbs_translate_scan(priv, info, ev, stop, iter_bss);
if (next_ev == NULL)
continue;
ev = next_ev;