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);
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);
}
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) {
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;
}