Loading drivers/net/wireless/bcm43xx/bcm43xx_main.c +27 −18 Original line number Original line Diff line number Diff line Loading @@ -939,9 +939,9 @@ static int bcm43xx_sprom_extract(struct bcm43xx_private *bcm) return 0; return 0; } } static void bcm43xx_geo_init(struct bcm43xx_private *bcm) static int bcm43xx_geo_init(struct bcm43xx_private *bcm) { { struct ieee80211_geo geo; struct ieee80211_geo *geo; struct ieee80211_channel *chan; struct ieee80211_channel *chan; int have_a = 0, have_bg = 0; int have_a = 0, have_bg = 0; int i; int i; Loading @@ -949,7 +949,10 @@ static void bcm43xx_geo_init(struct bcm43xx_private *bcm) struct bcm43xx_phyinfo *phy; struct bcm43xx_phyinfo *phy; const char *iso_country; const char *iso_country; memset(&geo, 0, sizeof(geo)); geo = kzalloc(sizeof(*geo), GFP_KERNEL); if (!geo) return -ENOMEM; for (i = 0; i < bcm->nr_80211_available; i++) { for (i = 0; i < bcm->nr_80211_available; i++) { phy = &(bcm->core_80211_ext[i].phy); phy = &(bcm->core_80211_ext[i].phy); switch (phy->type) { switch (phy->type) { Loading @@ -967,31 +970,36 @@ static void bcm43xx_geo_init(struct bcm43xx_private *bcm) iso_country = bcm43xx_locale_iso(bcm->sprom.locale); iso_country = bcm43xx_locale_iso(bcm->sprom.locale); if (have_a) { if (have_a) { for (i = 0, channel = 0; channel < 201; channel++) { for (i = 0, channel = IEEE80211_52GHZ_MIN_CHANNEL; chan = &geo.a[i++]; channel <= IEEE80211_52GHZ_MAX_CHANNEL; channel++) { chan = &geo->a[i++]; chan->freq = bcm43xx_channel_to_freq_a(channel); chan->freq = bcm43xx_channel_to_freq_a(channel); chan->channel = channel; chan->channel = channel; } } geo.a_channels = i; geo->a_channels = i; } } if (have_bg) { if (have_bg) { for (i = 0, channel = 1; channel < 15; channel++) { for (i = 0, channel = IEEE80211_24GHZ_MIN_CHANNEL; chan = &geo.bg[i++]; channel <= IEEE80211_24GHZ_MAX_CHANNEL; channel++) { chan = &geo->bg[i++]; chan->freq = bcm43xx_channel_to_freq_bg(channel); chan->freq = bcm43xx_channel_to_freq_bg(channel); chan->channel = channel; chan->channel = channel; } } geo.bg_channels = i; geo->bg_channels = i; } } memcpy(geo.name, iso_country, 2); memcpy(geo->name, iso_country, 2); if (0 /*TODO: Outdoor use only */) if (0 /*TODO: Outdoor use only */) geo.name[2] = 'O'; geo->name[2] = 'O'; else if (0 /*TODO: Indoor use only */) else if (0 /*TODO: Indoor use only */) geo.name[2] = 'I'; geo->name[2] = 'I'; else else geo.name[2] = ' '; geo->name[2] = ' '; geo.name[3] = '\0'; geo->name[3] = '\0'; ieee80211_set_geo(bcm->ieee, &geo); ieee80211_set_geo(bcm->ieee, geo); kfree(geo); return 0; } } /* DummyTransmission function, as documented on /* DummyTransmission function, as documented on Loading Loading @@ -3464,16 +3472,17 @@ static int bcm43xx_attach_board(struct bcm43xx_private *bcm) goto err_80211_unwind; goto err_80211_unwind; bcm43xx_wireless_core_disable(bcm); bcm43xx_wireless_core_disable(bcm); } } err = bcm43xx_geo_init(bcm); if (err) goto err_80211_unwind; bcm43xx_pctl_set_crystal(bcm, 0); bcm43xx_pctl_set_crystal(bcm, 0); /* Set the MAC address in the networking subsystem */ /* Set the MAC address in the networking subsystem */ if (bcm43xx_current_phy(bcm)->type == BCM43xx_PHYTYPE_A) if (is_valid_ether_addr(bcm->sprom.et1macaddr)) memcpy(bcm->net_dev->dev_addr, bcm->sprom.et1macaddr, 6); memcpy(bcm->net_dev->dev_addr, bcm->sprom.et1macaddr, 6); else else memcpy(bcm->net_dev->dev_addr, bcm->sprom.il0macaddr, 6); memcpy(bcm->net_dev->dev_addr, bcm->sprom.il0macaddr, 6); bcm43xx_geo_init(bcm); snprintf(bcm->nick, IW_ESSID_MAX_SIZE, snprintf(bcm->nick, IW_ESSID_MAX_SIZE, "Broadcom %04X", bcm->chip_id); "Broadcom %04X", bcm->chip_id); Loading drivers/net/wireless/bcm43xx/bcm43xx_main.h +4 −2 Original line number Original line Diff line number Diff line Loading @@ -118,12 +118,14 @@ int bcm43xx_channel_to_freq(struct bcm43xx_private *bcm, static inline static inline int bcm43xx_is_valid_channel_a(u8 channel) int bcm43xx_is_valid_channel_a(u8 channel) { { return (channel <= 200); return (channel >= IEEE80211_52GHZ_MIN_CHANNEL && channel <= IEEE80211_52GHZ_MAX_CHANNEL); } } static inline static inline int bcm43xx_is_valid_channel_bg(u8 channel) int bcm43xx_is_valid_channel_bg(u8 channel) { { return (channel >= 1 && channel <= 14); return (channel >= IEEE80211_24GHZ_MIN_CHANNEL && channel <= IEEE80211_24GHZ_MAX_CHANNEL); } } static inline static inline int bcm43xx_is_valid_channel(struct bcm43xx_private *bcm, int bcm43xx_is_valid_channel(struct bcm43xx_private *bcm, Loading drivers/net/wireless/bcm43xx/bcm43xx_phy.c +1 −1 Original line number Original line Diff line number Diff line Loading @@ -1287,7 +1287,7 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm) if (radio->revision == 8) if (radio->revision == 8) bcm43xx_phy_write(bcm, 0x0805, 0x3230); bcm43xx_phy_write(bcm, 0x0805, 0x3230); bcm43xx_phy_init_pctl(bcm); bcm43xx_phy_init_pctl(bcm); if (bcm->chip_id == 0x4306 && bcm->chip_package != 2) { if (bcm->chip_id == 0x4306 && bcm->chip_package == 2) { bcm43xx_phy_write(bcm, 0x0429, bcm43xx_phy_write(bcm, 0x0429, bcm43xx_phy_read(bcm, 0x0429) & 0xBFFF); bcm43xx_phy_read(bcm, 0x0429) & 0xBFFF); bcm43xx_phy_write(bcm, 0x04C3, bcm43xx_phy_write(bcm, 0x04C3, Loading drivers/net/wireless/bcm43xx/bcm43xx_wx.c +5 −2 Original line number Original line Diff line number Diff line Loading @@ -182,8 +182,11 @@ static int bcm43xx_wx_set_mode(struct net_device *net_dev, mode = BCM43xx_INITIAL_IWMODE; mode = BCM43xx_INITIAL_IWMODE; bcm43xx_lock_mmio(bcm, flags); bcm43xx_lock_mmio(bcm, flags); if (bcm->initialized) { if (bcm->ieee->iw_mode != mode) if (bcm->ieee->iw_mode != mode) bcm43xx_set_iwmode(bcm, mode); bcm43xx_set_iwmode(bcm, mode); } else bcm->ieee->iw_mode = mode; bcm43xx_unlock_mmio(bcm, flags); bcm43xx_unlock_mmio(bcm, flags); return 0; return 0; Loading include/net/ieee80211.h +4 −2 Original line number Original line Diff line number Diff line Loading @@ -958,11 +958,13 @@ enum ieee80211_state { #define IEEE80211_24GHZ_MIN_CHANNEL 1 #define IEEE80211_24GHZ_MIN_CHANNEL 1 #define IEEE80211_24GHZ_MAX_CHANNEL 14 #define IEEE80211_24GHZ_MAX_CHANNEL 14 #define IEEE80211_24GHZ_CHANNELS 14 #define IEEE80211_24GHZ_CHANNELS (IEEE80211_24GHZ_MAX_CHANNEL - \ IEEE80211_24GHZ_MIN_CHANNEL + 1) #define IEEE80211_52GHZ_MIN_CHANNEL 34 #define IEEE80211_52GHZ_MIN_CHANNEL 34 #define IEEE80211_52GHZ_MAX_CHANNEL 165 #define IEEE80211_52GHZ_MAX_CHANNEL 165 #define IEEE80211_52GHZ_CHANNELS 131 #define IEEE80211_52GHZ_CHANNELS (IEEE80211_52GHZ_MAX_CHANNEL - \ IEEE80211_52GHZ_MIN_CHANNEL + 1) enum { enum { IEEE80211_CH_PASSIVE_ONLY = (1 << 0), IEEE80211_CH_PASSIVE_ONLY = (1 << 0), Loading Loading
drivers/net/wireless/bcm43xx/bcm43xx_main.c +27 −18 Original line number Original line Diff line number Diff line Loading @@ -939,9 +939,9 @@ static int bcm43xx_sprom_extract(struct bcm43xx_private *bcm) return 0; return 0; } } static void bcm43xx_geo_init(struct bcm43xx_private *bcm) static int bcm43xx_geo_init(struct bcm43xx_private *bcm) { { struct ieee80211_geo geo; struct ieee80211_geo *geo; struct ieee80211_channel *chan; struct ieee80211_channel *chan; int have_a = 0, have_bg = 0; int have_a = 0, have_bg = 0; int i; int i; Loading @@ -949,7 +949,10 @@ static void bcm43xx_geo_init(struct bcm43xx_private *bcm) struct bcm43xx_phyinfo *phy; struct bcm43xx_phyinfo *phy; const char *iso_country; const char *iso_country; memset(&geo, 0, sizeof(geo)); geo = kzalloc(sizeof(*geo), GFP_KERNEL); if (!geo) return -ENOMEM; for (i = 0; i < bcm->nr_80211_available; i++) { for (i = 0; i < bcm->nr_80211_available; i++) { phy = &(bcm->core_80211_ext[i].phy); phy = &(bcm->core_80211_ext[i].phy); switch (phy->type) { switch (phy->type) { Loading @@ -967,31 +970,36 @@ static void bcm43xx_geo_init(struct bcm43xx_private *bcm) iso_country = bcm43xx_locale_iso(bcm->sprom.locale); iso_country = bcm43xx_locale_iso(bcm->sprom.locale); if (have_a) { if (have_a) { for (i = 0, channel = 0; channel < 201; channel++) { for (i = 0, channel = IEEE80211_52GHZ_MIN_CHANNEL; chan = &geo.a[i++]; channel <= IEEE80211_52GHZ_MAX_CHANNEL; channel++) { chan = &geo->a[i++]; chan->freq = bcm43xx_channel_to_freq_a(channel); chan->freq = bcm43xx_channel_to_freq_a(channel); chan->channel = channel; chan->channel = channel; } } geo.a_channels = i; geo->a_channels = i; } } if (have_bg) { if (have_bg) { for (i = 0, channel = 1; channel < 15; channel++) { for (i = 0, channel = IEEE80211_24GHZ_MIN_CHANNEL; chan = &geo.bg[i++]; channel <= IEEE80211_24GHZ_MAX_CHANNEL; channel++) { chan = &geo->bg[i++]; chan->freq = bcm43xx_channel_to_freq_bg(channel); chan->freq = bcm43xx_channel_to_freq_bg(channel); chan->channel = channel; chan->channel = channel; } } geo.bg_channels = i; geo->bg_channels = i; } } memcpy(geo.name, iso_country, 2); memcpy(geo->name, iso_country, 2); if (0 /*TODO: Outdoor use only */) if (0 /*TODO: Outdoor use only */) geo.name[2] = 'O'; geo->name[2] = 'O'; else if (0 /*TODO: Indoor use only */) else if (0 /*TODO: Indoor use only */) geo.name[2] = 'I'; geo->name[2] = 'I'; else else geo.name[2] = ' '; geo->name[2] = ' '; geo.name[3] = '\0'; geo->name[3] = '\0'; ieee80211_set_geo(bcm->ieee, &geo); ieee80211_set_geo(bcm->ieee, geo); kfree(geo); return 0; } } /* DummyTransmission function, as documented on /* DummyTransmission function, as documented on Loading Loading @@ -3464,16 +3472,17 @@ static int bcm43xx_attach_board(struct bcm43xx_private *bcm) goto err_80211_unwind; goto err_80211_unwind; bcm43xx_wireless_core_disable(bcm); bcm43xx_wireless_core_disable(bcm); } } err = bcm43xx_geo_init(bcm); if (err) goto err_80211_unwind; bcm43xx_pctl_set_crystal(bcm, 0); bcm43xx_pctl_set_crystal(bcm, 0); /* Set the MAC address in the networking subsystem */ /* Set the MAC address in the networking subsystem */ if (bcm43xx_current_phy(bcm)->type == BCM43xx_PHYTYPE_A) if (is_valid_ether_addr(bcm->sprom.et1macaddr)) memcpy(bcm->net_dev->dev_addr, bcm->sprom.et1macaddr, 6); memcpy(bcm->net_dev->dev_addr, bcm->sprom.et1macaddr, 6); else else memcpy(bcm->net_dev->dev_addr, bcm->sprom.il0macaddr, 6); memcpy(bcm->net_dev->dev_addr, bcm->sprom.il0macaddr, 6); bcm43xx_geo_init(bcm); snprintf(bcm->nick, IW_ESSID_MAX_SIZE, snprintf(bcm->nick, IW_ESSID_MAX_SIZE, "Broadcom %04X", bcm->chip_id); "Broadcom %04X", bcm->chip_id); Loading
drivers/net/wireless/bcm43xx/bcm43xx_main.h +4 −2 Original line number Original line Diff line number Diff line Loading @@ -118,12 +118,14 @@ int bcm43xx_channel_to_freq(struct bcm43xx_private *bcm, static inline static inline int bcm43xx_is_valid_channel_a(u8 channel) int bcm43xx_is_valid_channel_a(u8 channel) { { return (channel <= 200); return (channel >= IEEE80211_52GHZ_MIN_CHANNEL && channel <= IEEE80211_52GHZ_MAX_CHANNEL); } } static inline static inline int bcm43xx_is_valid_channel_bg(u8 channel) int bcm43xx_is_valid_channel_bg(u8 channel) { { return (channel >= 1 && channel <= 14); return (channel >= IEEE80211_24GHZ_MIN_CHANNEL && channel <= IEEE80211_24GHZ_MAX_CHANNEL); } } static inline static inline int bcm43xx_is_valid_channel(struct bcm43xx_private *bcm, int bcm43xx_is_valid_channel(struct bcm43xx_private *bcm, Loading
drivers/net/wireless/bcm43xx/bcm43xx_phy.c +1 −1 Original line number Original line Diff line number Diff line Loading @@ -1287,7 +1287,7 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm) if (radio->revision == 8) if (radio->revision == 8) bcm43xx_phy_write(bcm, 0x0805, 0x3230); bcm43xx_phy_write(bcm, 0x0805, 0x3230); bcm43xx_phy_init_pctl(bcm); bcm43xx_phy_init_pctl(bcm); if (bcm->chip_id == 0x4306 && bcm->chip_package != 2) { if (bcm->chip_id == 0x4306 && bcm->chip_package == 2) { bcm43xx_phy_write(bcm, 0x0429, bcm43xx_phy_write(bcm, 0x0429, bcm43xx_phy_read(bcm, 0x0429) & 0xBFFF); bcm43xx_phy_read(bcm, 0x0429) & 0xBFFF); bcm43xx_phy_write(bcm, 0x04C3, bcm43xx_phy_write(bcm, 0x04C3, Loading
drivers/net/wireless/bcm43xx/bcm43xx_wx.c +5 −2 Original line number Original line Diff line number Diff line Loading @@ -182,8 +182,11 @@ static int bcm43xx_wx_set_mode(struct net_device *net_dev, mode = BCM43xx_INITIAL_IWMODE; mode = BCM43xx_INITIAL_IWMODE; bcm43xx_lock_mmio(bcm, flags); bcm43xx_lock_mmio(bcm, flags); if (bcm->initialized) { if (bcm->ieee->iw_mode != mode) if (bcm->ieee->iw_mode != mode) bcm43xx_set_iwmode(bcm, mode); bcm43xx_set_iwmode(bcm, mode); } else bcm->ieee->iw_mode = mode; bcm43xx_unlock_mmio(bcm, flags); bcm43xx_unlock_mmio(bcm, flags); return 0; return 0; Loading
include/net/ieee80211.h +4 −2 Original line number Original line Diff line number Diff line Loading @@ -958,11 +958,13 @@ enum ieee80211_state { #define IEEE80211_24GHZ_MIN_CHANNEL 1 #define IEEE80211_24GHZ_MIN_CHANNEL 1 #define IEEE80211_24GHZ_MAX_CHANNEL 14 #define IEEE80211_24GHZ_MAX_CHANNEL 14 #define IEEE80211_24GHZ_CHANNELS 14 #define IEEE80211_24GHZ_CHANNELS (IEEE80211_24GHZ_MAX_CHANNEL - \ IEEE80211_24GHZ_MIN_CHANNEL + 1) #define IEEE80211_52GHZ_MIN_CHANNEL 34 #define IEEE80211_52GHZ_MIN_CHANNEL 34 #define IEEE80211_52GHZ_MAX_CHANNEL 165 #define IEEE80211_52GHZ_MAX_CHANNEL 165 #define IEEE80211_52GHZ_CHANNELS 131 #define IEEE80211_52GHZ_CHANNELS (IEEE80211_52GHZ_MAX_CHANNEL - \ IEEE80211_52GHZ_MIN_CHANNEL + 1) enum { enum { IEEE80211_CH_PASSIVE_ONLY = (1 << 0), IEEE80211_CH_PASSIVE_ONLY = (1 << 0), Loading