mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-14 00:24:41 -04:00
qcacmn: Fix channel conversion utility functions
Update wlan_chan_to_freq and wlan_freq_to_chan utility functions to handle invalid channel number and freq value of 0 respectively. Change-Id: I92e2d5026bb93439b77b749d447654ceb9413fde CRs-fixed: 2546771
This commit is contained in:
parent
8ce125ec51
commit
ae310478dd
1 changed files with 6 additions and 1 deletions
|
|
@ -28,7 +28,9 @@
|
|||
|
||||
uint32_t wlan_chan_to_freq(uint8_t chan)
|
||||
{
|
||||
/* ch 0 - ch 13 */
|
||||
if (chan == 0 )
|
||||
return 0;
|
||||
|
||||
if (chan < WLAN_24_GHZ_CHANNEL_14)
|
||||
return WLAN_24_GHZ_BASE_FREQ + chan * WLAN_CHAN_SPACING_5MHZ;
|
||||
else if (chan == WLAN_24_GHZ_CHANNEL_14)
|
||||
|
|
@ -47,6 +49,9 @@ uint8_t wlan_freq_to_chan(uint32_t freq)
|
|||
{
|
||||
uint8_t chan;
|
||||
|
||||
if (freq == 0)
|
||||
return 0;
|
||||
|
||||
if (freq > WLAN_24_GHZ_BASE_FREQ && freq < WLAN_CHAN_14_FREQ)
|
||||
chan = ((freq - WLAN_24_GHZ_BASE_FREQ) /
|
||||
WLAN_CHAN_SPACING_5MHZ);
|
||||
|
|
|
|||
Loading…
Reference in a new issue