rt2x00: Fix hw mode registration with mac80211.

The supported_bands field of struct hw_mode_spec now represents a bitfield,
so bitfield operators need to be tested with when setting the band data.

The current code generates the following warning:

[176624.986244] WARNING: at /usr/local/src/incoming/compat-wireless-2.6/net/wireless/core.c:269 wiphy_register()
[176624.986249] Pid: 12548, comm: modprobe Tainted: P        2.6.24.2#4
[176624.986251]
[176624.986251] Call Trace:
[176624.986277]  [<ffffffff881c56bf>] :cfg80211:wiphy_register+0x17f/0x1a0
[176624.986282]  [<ffffffff881ddf80>] :rt61pci:rt61pci_eepromregister_write+0x0/0x80
[176624.986302]  [<ffffffff88b7e4bc>] :mac80211:ieee80211_register_hw+0x2c/0x2b0
[176624.986310]  [<ffffffff881cdc80>] :rt2x00lib:rt2x00lib_probe_dev+0x350/0x3f0
[176624.986318]  [<ffffffff881d74b9>] :rt2x00pci:rt2x00pci_probe+0x149/0x200
[176624.986325]  [<ffffffff8030c858>] pci_device_probe+0xf8/0x170
[176624.986331]  [<ffffffff803594fc>] driver_probe_device+0x9c/0x1c0
[176624.986335]  [<ffffffff80359700>] __driver_attach+0x0/0xb0
[176624.986337]  [<ffffffff803597a5>] __driver_attach+0xa5/0xb0
[176624.986341]  [<ffffffff8035877d>] bus_for_each_dev+0x4d/0x80
[176624.986347]  [<ffffffff80358b8c>] bus_add_driver+0xac/0x210
[176624.986351]  [<ffffffff8030cad3>] __pci_register_driver+0x73/0xc0
[176624.986357]  [<ffffffff8025689e>] sys_init_module+0x18e/0x1a20
[176624.986374]  [<ffffffff8020c42e>] system_call+0x7e/0x83

Signed-off-by: Gertjan van Wingerde <gwingerde@kpnplanet.nl>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Gertjan van Wingerde 2008-02-17 17:35:55 +01:00 committed by John W. Linville
parent 47b10cd137
commit 47ac268336

View File

@ -919,7 +919,7 @@ static int rt2x00lib_probe_hw_modes(struct rt2x00_dev *rt2x00dev,
* Rates: CCK, OFDM.
* Channels: 2.4 GHz
*/
if (spec->supported_bands > SUPPORT_BAND_2GHZ) {
if (spec->supported_bands & SUPPORT_BAND_2GHZ) {
rt2x00dev->bands[IEEE80211_BAND_2GHZ].n_channels = 14;
rt2x00dev->bands[IEEE80211_BAND_2GHZ].n_bitrates = num_rates;
rt2x00dev->bands[IEEE80211_BAND_2GHZ].channels = channels;
@ -933,7 +933,7 @@ static int rt2x00lib_probe_hw_modes(struct rt2x00_dev *rt2x00dev,
* Rates: OFDM.
* Channels: OFDM, UNII, HiperLAN2.
*/
if (spec->supported_bands > SUPPORT_BAND_5GHZ) {
if (spec->supported_bands & SUPPORT_BAND_5GHZ) {
rt2x00dev->bands[IEEE80211_BAND_5GHZ].n_channels =
spec->num_channels - 14;
rt2x00dev->bands[IEEE80211_BAND_5GHZ].n_bitrates =