Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

brcm80211: moved function brcmu_chspec_malformed

Moved brcmu_chspec_malformed into the only file using it. The
function name was adjusted accordingly.

Reported-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by

Alwin Beukers and committed by
John W. Linville
3de67818 f8e4b412

+27 -36
+27 -1
drivers/net/wireless/brcm80211/brcmsmac/channel.c
··· 1485 1485 } 1486 1486 1487 1487 /* 1488 + * Verify the chanspec is using a legal set of parameters, i.e. that the 1489 + * chanspec specified a band, bw, ctl_sb and channel and that the 1490 + * combination could be legal given any set of circumstances. 1491 + * RETURNS: true is the chanspec is malformed, false if it looks good. 1492 + */ 1493 + static bool brcms_c_chspec_malformed(u16 chanspec) 1494 + { 1495 + /* must be 2G or 5G band */ 1496 + if (!CHSPEC_IS5G(chanspec) && !CHSPEC_IS2G(chanspec)) 1497 + return true; 1498 + /* must be 20 or 40 bandwidth */ 1499 + if (!CHSPEC_IS40(chanspec) && !CHSPEC_IS20(chanspec)) 1500 + return true; 1501 + 1502 + /* 20MHZ b/w must have no ctl sb, 40 must have a ctl sb */ 1503 + if (CHSPEC_IS20(chanspec)) { 1504 + if (!CHSPEC_SB_NONE(chanspec)) 1505 + return true; 1506 + } else if (!CHSPEC_SB_UPPER(chanspec) && !CHSPEC_SB_LOWER(chanspec)) { 1507 + return true; 1508 + } 1509 + 1510 + return false; 1511 + } 1512 + 1513 + /* 1488 1514 * Validate the chanspec for this locale, for 40MHZ we need to also 1489 1515 * check that the sidebands are valid 20MZH channels in this locale 1490 1516 * and they are also a legal HT combination ··· 1523 1497 u8 channel = CHSPEC_CHANNEL(chspec); 1524 1498 1525 1499 /* check the chanspec */ 1526 - if (brcmu_chspec_malformed(chspec)) { 1500 + if (brcms_c_chspec_malformed(chspec)) { 1527 1501 wiphy_err(wlc->wiphy, "wl%d: malformed chanspec 0x%x\n", 1528 1502 wlc->pub->unit, chspec); 1529 1503 return false;
-27
drivers/net/wireless/brcm80211/brcmutil/wifi.c
··· 14 14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 15 */ 16 16 #include <brcmu_wifi.h> 17 - 18 - /* 19 - * Verify the chanspec is using a legal set of parameters, i.e. that the 20 - * chanspec specified a band, bw, ctl_sb and channel and that the 21 - * combination could be legal given any set of circumstances. 22 - * RETURNS: true is the chanspec is malformed, false if it looks good. 23 - */ 24 - bool brcmu_chspec_malformed(u16 chanspec) 25 - { 26 - /* must be 2G or 5G band */ 27 - if (!CHSPEC_IS5G(chanspec) && !CHSPEC_IS2G(chanspec)) 28 - return true; 29 - /* must be 20 or 40 bandwidth */ 30 - if (!CHSPEC_IS40(chanspec) && !CHSPEC_IS20(chanspec)) 31 - return true; 32 - 33 - /* 20MHZ b/w must have no ctl sb, 40 must have a ctl sb */ 34 - if (CHSPEC_IS20(chanspec)) { 35 - if (!CHSPEC_SB_NONE(chanspec)) 36 - return true; 37 - } else if (!CHSPEC_SB_UPPER(chanspec) && !CHSPEC_SB_LOWER(chanspec)) { 38 - return true; 39 - } 40 - 41 - return false; 42 - } 43 - EXPORT_SYMBOL(brcmu_chspec_malformed);
-8
drivers/net/wireless/brcm80211/include/brcmu_wifi.h
··· 168 168 return (bitmap & (1 << (prec))) != 0; 169 169 } 170 170 171 - /* 172 - * Verify the chanspec is using a legal set of parameters, i.e. that the 173 - * chanspec specified a band, bw, ctl_sb and channel and that the 174 - * combination could be legal given any set of circumstances. 175 - * RETURNS: true is the chanspec is malformed, false if it looks good. 176 - */ 177 - extern bool brcmu_chspec_malformed(u16 chanspec); 178 - 179 171 /* Enumerate crypto algorithms */ 180 172 #define CRYPTO_ALGO_OFF 0 181 173 #define CRYPTO_ALGO_WEP1 1