software/drivers/sd8887/src/wlan/mlinux/moal_cfgvendor.c
/**
 * @brief process one channel in bucket
 *
 * @param priv       A pointer to moal_private struct
 *
 * @param channel     a pointer to channel
 *
 * @return      0: success  other: fail
 */
@brief process one channel in bucket
@param priv       A pointer to moal_private struct

@param channel     a pointer to channel

@return      0: success  other: fail
@brief process one channel in bucket @param priv A pointer to moal_private struct @param channel a pointer to channel @return 0 : success other : fail
static mlan_status
woal_band_to_valid_channels(moal_private *priv, wifi_band w_band, int channel[],
			    t_u32 *nchannel)
{
	int band = 0;
	struct ieee80211_supported_band *sband;
	struct ieee80211_channel *ch;
	int i = 0;
	t_u8 cnt = 0;
	int *ch_ptr = channel;
	for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
		if (!priv->wdev->wiphy->bands[band])
			continue;
		if ((band == IEEE80211_BAND_2GHZ) && !(w_band & WIFI_BAND_BG))
			continue;
		if ((band == IEEE80211_BAND_5GHZ) &&
		    !((w_band & WIFI_BAND_A) || (w_band & WIFI_BAND_A_DFS)))
			continue;
		sband = priv->wdev->wiphy->bands[band];
		for (i = 0; (i < sband->n_channels); i++) {
			ch = &sband->channels[i];
			if (ch->flags & IEEE80211_CHAN_DISABLED) {
				PRINTM(MERROR, "Skip DISABLED channel %d\n",
				       ch->center_freq);
				continue;
			}
			if ((band == IEEE80211_BAND_5GHZ)) {
				if (((ch->flags & IEEE80211_CHAN_RADAR) &&
				     !(w_band & WIFI_BAND_A_DFS)) ||
				    (!(ch->flags & IEEE80211_CHAN_RADAR) &&
				     !(w_band & WIFI_BAND_A)))
					continue;
			}
			if (cnt >= *nchannel) {
				PRINTM(MERROR,
				       "cnt=%d is exceed %d, cur ch=%d %dMHz\n",
				       cnt, *nchannel, ch->hw_value,
				       ch->center_freq);
				break;
			}
			*ch_ptr = ch->center_freq;
			ch_ptr++;
			cnt++;
		}
	}
	PRINTM(MCMND, "w_band=%d cnt=%d\n", w_band, cnt);
	*nchannel = cnt;
	return MLAN_STATUS_SUCCESS;
}
static mlan_status woal_band_to_valid_channels ( moal_private * priv , wifi_band w_band , int channel [ ] , t_u32 * nchannel ) { int band = 0 ; struct ieee80211_supported_band * sband ; struct ieee80211_channel * ch ; int i = 0 ; t_u8 cnt = 0 ; int * ch_ptr = channel ; for ( band = 0 ; band < IEEE80211_NUM_BANDS ; band ++ ) { if ( ! priv -> wdev -> wiphy -> bands [ band ] ) continue ; if ( ( band == IEEE80211_BAND_2GHZ ) && ! ( w_band & WIFI_BAND_BG ) ) continue ; if ( ( band == IEEE80211_BAND_5GHZ ) && ! ( ( w_band & WIFI_BAND_A ) || ( w_band & WIFI_BAND_A_DFS ) ) ) continue ; sband = priv -> wdev -> wiphy -> bands [ band ] ; for ( i = 0 ; ( i < sband -> n_channels ) ; i ++ ) { ch = & sband -> channels [ i ] ; if ( ch -> flags & IEEE80211_CHAN_DISABLED ) { PRINTM ( MERROR , " \n " , ch -> center_freq ) ; continue ; } if ( ( band == IEEE80211_BAND_5GHZ ) ) { if ( ( ( ch -> flags & IEEE80211_CHAN_RADAR ) && ! ( w_band & WIFI_BAND_A_DFS ) ) || ( ! ( ch -> flags & IEEE80211_CHAN_RADAR ) && ! ( w_band & WIFI_BAND_A ) ) ) continue ; } if ( cnt >= * nchannel ) { PRINTM ( MERROR , " \n " , cnt , * nchannel , ch -> hw_value , ch -> center_freq ) ; break ; } * ch_ptr = ch -> center_freq ; ch_ptr ++ ; cnt ++ ; } } PRINTM ( MCMND , " \n " , w_band , cnt ) ; * nchannel = cnt ; return MLAN_STATUS_SUCCESS ; }
@brief process one channel in bucket
 @param priv       A pointer to moal_private struct
@brief process one channel in bucket @param priv A pointer to moal_private struct