diff options
author | Ivo van Doorn <ivdoorn@gmail.com> | 2008-08-04 10:38:47 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-08-22 16:29:58 -0400 |
commit | 8c5e7a5f59f9d11597bd47de28334da318ea0e80 (patch) | |
tree | 46dc69607e8a196fd68b3b040b312bc1e7fc0559 /drivers/net/wireless/rt2x00/rt2400pci.c | |
parent | 906c110fcc24bdd5bf0fa22d89ac75d99c747e53 (diff) |
rt2x00: Gather channel information in structure
Channel information which is read from EEPROM should
be read into an array containing per-channel information.
This removes the requirement of multiple arrays and makes
the channel handling a bit cleaner and easier to expand.
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2400pci.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2400pci.c | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c index 4c0538d6099b..0107cec18b26 100644 --- a/drivers/net/wireless/rt2x00/rt2400pci.c +++ b/drivers/net/wireless/rt2x00/rt2400pci.c | |||
@@ -1404,7 +1404,7 @@ static int rt2400pci_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1404 | * RF value list for RF2420 & RF2421 | 1404 | * RF value list for RF2420 & RF2421 |
1405 | * Supports: 2.4 GHz | 1405 | * Supports: 2.4 GHz |
1406 | */ | 1406 | */ |
1407 | static const struct rf_channel rf_vals_bg[] = { | 1407 | static const struct rf_channel rf_vals_b[] = { |
1408 | { 1, 0x00022058, 0x000c1fda, 0x00000101, 0 }, | 1408 | { 1, 0x00022058, 0x000c1fda, 0x00000101, 0 }, |
1409 | { 2, 0x00022058, 0x000c1fee, 0x00000101, 0 }, | 1409 | { 2, 0x00022058, 0x000c1fee, 0x00000101, 0 }, |
1410 | { 3, 0x00022058, 0x000c2002, 0x00000101, 0 }, | 1410 | { 3, 0x00022058, 0x000c2002, 0x00000101, 0 }, |
@@ -1421,10 +1421,11 @@ static const struct rf_channel rf_vals_bg[] = { | |||
1421 | { 14, 0x00022058, 0x000c20fa, 0x00000101, 0 }, | 1421 | { 14, 0x00022058, 0x000c20fa, 0x00000101, 0 }, |
1422 | }; | 1422 | }; |
1423 | 1423 | ||
1424 | static void rt2400pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | 1424 | static int rt2400pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) |
1425 | { | 1425 | { |
1426 | struct hw_mode_spec *spec = &rt2x00dev->spec; | 1426 | struct hw_mode_spec *spec = &rt2x00dev->spec; |
1427 | u8 *txpower; | 1427 | struct channel_info *info; |
1428 | char *tx_power; | ||
1428 | unsigned int i; | 1429 | unsigned int i; |
1429 | 1430 | ||
1430 | /* | 1431 | /* |
@@ -1440,23 +1441,28 @@ static void rt2400pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
1440 | EEPROM_MAC_ADDR_0)); | 1441 | EEPROM_MAC_ADDR_0)); |
1441 | 1442 | ||
1442 | /* | 1443 | /* |
1443 | * Convert tx_power array in eeprom. | ||
1444 | */ | ||
1445 | txpower = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START); | ||
1446 | for (i = 0; i < 14; i++) | ||
1447 | txpower[i] = TXPOWER_FROM_DEV(txpower[i]); | ||
1448 | |||
1449 | /* | ||
1450 | * Initialize hw_mode information. | 1444 | * Initialize hw_mode information. |
1451 | */ | 1445 | */ |
1452 | spec->supported_bands = SUPPORT_BAND_2GHZ; | 1446 | spec->supported_bands = SUPPORT_BAND_2GHZ; |
1453 | spec->supported_rates = SUPPORT_RATE_CCK; | 1447 | spec->supported_rates = SUPPORT_RATE_CCK; |
1454 | spec->tx_power_a = NULL; | ||
1455 | spec->tx_power_bg = txpower; | ||
1456 | spec->tx_power_default = DEFAULT_TXPOWER; | ||
1457 | 1448 | ||
1458 | spec->num_channels = ARRAY_SIZE(rf_vals_bg); | 1449 | spec->num_channels = ARRAY_SIZE(rf_vals_b); |
1459 | spec->channels = rf_vals_bg; | 1450 | spec->channels = rf_vals_b; |
1451 | |||
1452 | /* | ||
1453 | * Create channel information array | ||
1454 | */ | ||
1455 | info = kzalloc(spec->num_channels * sizeof(*info), GFP_KERNEL); | ||
1456 | if (!info) | ||
1457 | return -ENOMEM; | ||
1458 | |||
1459 | spec->channels_info = info; | ||
1460 | |||
1461 | tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START); | ||
1462 | for (i = 0; i < 14; i++) | ||
1463 | info[i].tx_power1 = TXPOWER_FROM_DEV(tx_power[i]); | ||
1464 | |||
1465 | return 0; | ||
1460 | } | 1466 | } |
1461 | 1467 | ||
1462 | static int rt2400pci_probe_hw(struct rt2x00_dev *rt2x00dev) | 1468 | static int rt2400pci_probe_hw(struct rt2x00_dev *rt2x00dev) |
@@ -1477,7 +1483,9 @@ static int rt2400pci_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
1477 | /* | 1483 | /* |
1478 | * Initialize hw specifications. | 1484 | * Initialize hw specifications. |
1479 | */ | 1485 | */ |
1480 | rt2400pci_probe_hw_mode(rt2x00dev); | 1486 | retval = rt2400pci_probe_hw_mode(rt2x00dev); |
1487 | if (retval) | ||
1488 | return retval; | ||
1481 | 1489 | ||
1482 | /* | 1490 | /* |
1483 | * This device requires the atim queue and DMA-mapped skbs. | 1491 | * This device requires the atim queue and DMA-mapped skbs. |