Commit 4a32c36d authored by Gabor Juhos's avatar Gabor Juhos Committed by John W. Linville

rt2x00: rt2800lib: use switch statement for RF specific setup

It is much more readable than multiple if-else-if
statements.
Signed-off-by: default avatarGabor Juhos <juhosg@openwrt.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent aa10350d
...@@ -7504,38 +7504,46 @@ static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) ...@@ -7504,38 +7504,46 @@ static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
spec->supported_bands = SUPPORT_BAND_2GHZ; spec->supported_bands = SUPPORT_BAND_2GHZ;
spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM; spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;
if (rt2x00_rf(rt2x00dev, RF2820) || switch (rt2x00dev->chip.rf) {
rt2x00_rf(rt2x00dev, RF2720)) { case RF2720:
case RF2820:
spec->num_channels = 14; spec->num_channels = 14;
spec->channels = rf_vals; spec->channels = rf_vals;
} else if (rt2x00_rf(rt2x00dev, RF2850) || break;
rt2x00_rf(rt2x00dev, RF2750)) {
case RF2750:
case RF2850:
spec->supported_bands |= SUPPORT_BAND_5GHZ; spec->supported_bands |= SUPPORT_BAND_5GHZ;
spec->num_channels = ARRAY_SIZE(rf_vals); spec->num_channels = ARRAY_SIZE(rf_vals);
spec->channels = rf_vals; spec->channels = rf_vals;
} else if (rt2x00_rf(rt2x00dev, RF3020) || break;
rt2x00_rf(rt2x00dev, RF2020) ||
rt2x00_rf(rt2x00dev, RF3021) || case RF2020:
rt2x00_rf(rt2x00dev, RF3022) || case RF3020:
rt2x00_rf(rt2x00dev, RF3070) || case RF3021:
rt2x00_rf(rt2x00dev, RF3290) || case RF3022:
rt2x00_rf(rt2x00dev, RF3320) || case RF3070:
rt2x00_rf(rt2x00dev, RF3322) || case RF3290:
rt2x00_rf(rt2x00dev, RF5360) || case RF3320:
rt2x00_rf(rt2x00dev, RF5370) || case RF3322:
rt2x00_rf(rt2x00dev, RF5372) || case RF5360:
rt2x00_rf(rt2x00dev, RF5390) || case RF5370:
rt2x00_rf(rt2x00dev, RF5392)) { case RF5372:
case RF5390:
case RF5392:
spec->num_channels = 14; spec->num_channels = 14;
spec->channels = rf_vals_3x; spec->channels = rf_vals_3x;
} else if (rt2x00_rf(rt2x00dev, RF3052) || break;
rt2x00_rf(rt2x00dev, RF3053)) {
case RF3052:
case RF3053:
spec->supported_bands |= SUPPORT_BAND_5GHZ; spec->supported_bands |= SUPPORT_BAND_5GHZ;
spec->num_channels = ARRAY_SIZE(rf_vals_3x); spec->num_channels = ARRAY_SIZE(rf_vals_3x);
spec->channels = rf_vals_3x; spec->channels = rf_vals_3x;
} else if (rt2x00_rf(rt2x00dev, RF5592)) { break;
spec->supported_bands |= SUPPORT_BAND_5GHZ;
case RF5592:
spec->supported_bands |= SUPPORT_BAND_5GHZ;
rt2800_register_read(rt2x00dev, MAC_DEBUG_INDEX, &reg); rt2800_register_read(rt2x00dev, MAC_DEBUG_INDEX, &reg);
if (rt2x00_get_field32(reg, MAC_DEBUG_INDEX_XTAL)) { if (rt2x00_get_field32(reg, MAC_DEBUG_INDEX_XTAL)) {
spec->num_channels = ARRAY_SIZE(rf_vals_5592_xtal40); spec->num_channels = ARRAY_SIZE(rf_vals_5592_xtal40);
...@@ -7544,6 +7552,7 @@ static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) ...@@ -7544,6 +7552,7 @@ static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
spec->num_channels = ARRAY_SIZE(rf_vals_5592_xtal20); spec->num_channels = ARRAY_SIZE(rf_vals_5592_xtal20);
spec->channels = rf_vals_5592_xtal20; spec->channels = rf_vals_5592_xtal20;
} }
break;
} }
if (WARN_ON_ONCE(!spec->channels)) if (WARN_ON_ONCE(!spec->channels))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment