diff options
author | Andriy Voskoboinyk <avos@FreeBSD.org> | 2016-04-29 22:43:11 +0000 |
---|---|---|
committer | Andriy Voskoboinyk <avos@FreeBSD.org> | 2016-04-29 22:43:11 +0000 |
commit | 5763d9db58d4d7671ac56057c98935c87aa695ad (patch) | |
tree | d8be6c2ce9b84861af0a16398acc20cb51b30e5f /sys | |
parent | 26f47fdd8ffecbef5f4e5892b4cb5f4553ad20ce (diff) | |
download | src-5763d9db58d4d7671ac56057c98935c87aa695ad.tar.gz src-5763d9db58d4d7671ac56057c98935c87aa695ad.zip |
wpi: convert to ieee80211_add_channel() (mostly noop).
Tested with Intel 3945BG, STA / HOSTAP modes.
Notes
Notes:
svn path=/head/; revision=298822
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/wpi/if_wpi.c | 49 |
1 files changed, 16 insertions, 33 deletions
diff --git a/sys/dev/wpi/if_wpi.c b/sys/dev/wpi/if_wpi.c index 3083316cdc82..897b986eec36 100644 --- a/sys/dev/wpi/if_wpi.c +++ b/sys/dev/wpi/if_wpi.c @@ -1412,9 +1412,18 @@ wpi_read_eeprom_band(struct wpi_softc *sc, uint8_t n, int maxchans, { struct wpi_eeprom_chan *channels = sc->eeprom_channels[n]; const struct wpi_chan_band *band = &wpi_bands[n]; - struct ieee80211_channel *c; uint32_t nflags; + uint8_t bands[IEEE80211_MODE_BYTES]; uint8_t chan, i; + int error; + + memset(bands, 0, sizeof(bands)); + + if (n == 0) { + setbit(bands, IEEE80211_MODE_11B); + setbit(bands, IEEE80211_MODE_11G); + } else + setbit(bands, IEEE80211_MODE_11A); for (i = 0; i < band->nchan; i++) { if (!(channels[i].flags & WPI_EEPROM_CHAN_VALID)) { @@ -1424,45 +1433,19 @@ wpi_read_eeprom_band(struct wpi_softc *sc, uint8_t n, int maxchans, continue; } - if (*nchans >= maxchans) - break; - chan = band->chan[i]; nflags = wpi_eeprom_channel_flags(&channels[i]); - - c = &chans[(*nchans)++]; - c->ic_ieee = chan; - c->ic_maxregpower = channels[i].maxpwr; - c->ic_maxpower = 2*c->ic_maxregpower; - - if (n == 0) { /* 2GHz band */ - c->ic_freq = ieee80211_ieee2mhz(chan, - IEEE80211_CHAN_G); - - /* G =>'s B is supported */ - c->ic_flags = IEEE80211_CHAN_B | nflags; - - if (*nchans >= maxchans) - break; - - c = &chans[(*nchans)++]; - c[0] = c[-1]; - c->ic_flags = IEEE80211_CHAN_G | nflags; - } else { /* 5GHz band */ - c->ic_freq = ieee80211_ieee2mhz(chan, - IEEE80211_CHAN_A); - - c->ic_flags = IEEE80211_CHAN_A | nflags; - } + error = ieee80211_add_channel(chans, maxchans, nchans, + chan, 0, channels[i].maxpwr, nflags, bands); + if (error != 0) + break; /* Save maximum allowed TX power for this channel. */ sc->maxpwr[chan] = channels[i].maxpwr; DPRINTF(sc, WPI_DEBUG_EEPROM, - "adding chan %d (%dMHz) flags=0x%x maxpwr=%d passive=%d," - " offset %d\n", chan, c->ic_freq, - channels[i].flags, sc->maxpwr[chan], - IEEE80211_IS_CHAN_PASSIVE(c), *nchans); + "adding chan %d flags=0x%x maxpwr=%d, offset %d\n", + chan, channels[i].flags, sc->maxpwr[chan], *nchans); } } |