diff options
author | ryd <ryd@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2008-01-24 03:03:04 +0000 |
---|---|---|
committer | ryd <ryd@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2008-01-24 03:03:04 +0000 |
commit | 03e8a3a945b60fac8e7b750625d2927519a0a21b (patch) | |
tree | 7c357506d88222dd5b47d4d3c83b076321ef92eb /package/libertas/src/11d.c | |
parent | d32a09bb67c33233abf7c3a2da27cebaa0966aa3 (diff) |
Updating libertas wireless driver to latest version.
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@10235 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/libertas/src/11d.c')
-rw-r--r-- | package/libertas/src/11d.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/package/libertas/src/11d.c b/package/libertas/src/11d.c index 5e10ce0d35..40f1daadb5 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; } |