aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2500pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2500pci.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2500pci.c39
1 files changed, 26 insertions, 13 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
index 181a146b4768..e0ff76ff490d 100644
--- a/drivers/net/wireless/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/rt2x00/rt2500pci.c
@@ -1721,10 +1721,11 @@ static const struct rf_channel rf_vals_5222[] = {
1721 { 161, 0x00022020, 0x000090be, 0x00000101, 0x00000a07 }, 1721 { 161, 0x00022020, 0x000090be, 0x00000101, 0x00000a07 },
1722}; 1722};
1723 1723
1724static void rt2500pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) 1724static int rt2500pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
1725{ 1725{
1726 struct hw_mode_spec *spec = &rt2x00dev->spec; 1726 struct hw_mode_spec *spec = &rt2x00dev->spec;
1727 u8 *txpower; 1727 struct channel_info *info;
1728 char *tx_power;
1728 unsigned int i; 1729 unsigned int i;
1729 1730
1730 /* 1731 /*
@@ -1741,20 +1742,10 @@ static void rt2500pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
1741 EEPROM_MAC_ADDR_0)); 1742 EEPROM_MAC_ADDR_0));
1742 1743
1743 /* 1744 /*
1744 * Convert tx_power array in eeprom.
1745 */
1746 txpower = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START);
1747 for (i = 0; i < 14; i++)
1748 txpower[i] = TXPOWER_FROM_DEV(txpower[i]);
1749
1750 /*
1751 * Initialize hw_mode information. 1745 * Initialize hw_mode information.
1752 */ 1746 */
1753 spec->supported_bands = SUPPORT_BAND_2GHZ; 1747 spec->supported_bands = SUPPORT_BAND_2GHZ;
1754 spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM; 1748 spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM;
1755 spec->tx_power_a = NULL;
1756 spec->tx_power_bg = txpower;
1757 spec->tx_power_default = DEFAULT_TXPOWER;
1758 1749
1759 if (rt2x00_rf(&rt2x00dev->chip, RF2522)) { 1750 if (rt2x00_rf(&rt2x00dev->chip, RF2522)) {
1760 spec->num_channels = ARRAY_SIZE(rf_vals_bg_2522); 1751 spec->num_channels = ARRAY_SIZE(rf_vals_bg_2522);
@@ -1776,6 +1767,26 @@ static void rt2500pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
1776 spec->num_channels = ARRAY_SIZE(rf_vals_5222); 1767 spec->num_channels = ARRAY_SIZE(rf_vals_5222);
1777 spec->channels = rf_vals_5222; 1768 spec->channels = rf_vals_5222;
1778 } 1769 }
1770
1771 /*
1772 * Create channel information array
1773 */
1774 info = kzalloc(spec->num_channels * sizeof(*info), GFP_KERNEL);
1775 if (!info)
1776 return -ENOMEM;
1777
1778 spec->channels_info = info;
1779
1780 tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START);
1781 for (i = 0; i < 14; i++)
1782 info[i].tx_power1 = TXPOWER_FROM_DEV(tx_power[i]);
1783
1784 if (spec->num_channels > 14) {
1785 for (i = 14; i < spec->num_channels; i++)
1786 info[i].tx_power1 = DEFAULT_TXPOWER;
1787 }
1788
1789 return 0;
1779} 1790}
1780 1791
1781static int rt2500pci_probe_hw(struct rt2x00_dev *rt2x00dev) 1792static int rt2500pci_probe_hw(struct rt2x00_dev *rt2x00dev)
@@ -1796,7 +1807,9 @@ static int rt2500pci_probe_hw(struct rt2x00_dev *rt2x00dev)
1796 /* 1807 /*
1797 * Initialize hw specifications. 1808 * Initialize hw specifications.
1798 */ 1809 */
1799 rt2500pci_probe_hw_mode(rt2x00dev); 1810 retval = rt2500pci_probe_hw_mode(rt2x00dev);
1811 if (retval)
1812 return retval;
1800 1813
1801 /* 1814 /*
1802 * This device requires the atim queue and DMA-mapped skbs. 1815 * This device requires the atim queue and DMA-mapped skbs.