From 03e8a3a945b60fac8e7b750625d2927519a0a21b Mon Sep 17 00:00:00 2001 From: ryd Date: Thu, 24 Jan 2008 03:03:04 +0000 Subject: Updating libertas wireless driver to latest version. git-svn-id: svn://svn.openwrt.org/openwrt/trunk@10235 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/libertas/src/11d.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'package/libertas/src/11d.c') diff --git a/package/libertas/src/11d.c b/package/libertas/src/11d.c index 5e10ce0d3..40f1daadb 100644 --- a/package/libertas/src/11d.c +++ b/package/libertas/src/11d.c @@ -46,11 +46,13 @@ static struct chan_freq_power channel_freq_power_UN_BG[] = { static u8 lbs_region_2_code(u8 *region) { u8 i; + u8 size = sizeof(region_code_mapping)/ + sizeof(struct region_code_mapping); for (i = 0; region[i] && i < COUNTRY_CODE_LEN; i++) region[i] = toupper(region[i]); - for (i = 0; i < ARRAY_SIZE(region_code_mapping); i++) { + for (i = 0; i < size; i++) { if (!memcmp(region, region_code_mapping[i].region, COUNTRY_CODE_LEN)) return (region_code_mapping[i].code); @@ -63,8 +65,9 @@ static u8 lbs_region_2_code(u8 *region) static u8 *lbs_code_2_region(u8 code) { u8 i; - - for (i = 0; i < ARRAY_SIZE(region_code_mapping); i++) { + u8 size = sizeof(region_code_mapping) + / sizeof(struct region_code_mapping); + for (i = 0; i < size; i++) { if (region_code_mapping[i].code == code) return (region_code_mapping[i].region); } @@ -87,7 +90,8 @@ static u8 lbs_get_chan_11d(u8 band, u8 firstchan, u8 nrchan, u8 *chan) u8 cfp_no; cfp = channel_freq_power_UN_BG; - cfp_no = ARRAY_SIZE(channel_freq_power_UN_BG); + cfp_no = sizeof(channel_freq_power_UN_BG) / + sizeof(struct chan_freq_power); for (i = 0; i < cfp_no; i++) { if ((cfp + i)->channel == firstchan) { @@ -137,12 +141,16 @@ static u8 lbs_channel_known_11d(u8 chan, u32 lbs_chan_2_freq(u8 chan, u8 band) { struct chan_freq_power *cf; + u16 cnt; u16 i; u32 freq = 0; cf = channel_freq_power_UN_BG; + cnt = + sizeof(channel_freq_power_UN_BG) / + sizeof(struct chan_freq_power); - for (i = 0; i < ARRAY_SIZE(channel_freq_power_UN_BG); i++) { + for (i = 0; i < cnt; i++) { if (chan == cf[i].channel) freq = cf[i].freq; } -- cgit v1.2.3