openwrtv3/package/mac80211/patches/605-rt2x00-pci-eeprom.patch
Gabor Juhos 7695c8b049 mac80211: rt2x00: fix PCI eeprom patch
Fixes the following warnings:

  CC [M] <...>/drivers/net/wireless/rt2x00/rt2800pci.o
<...>/drivers/net/wireless/rt2x00/rt2800pci.c: In function 'rt2800pci_read_eeprom_file':
<...>/drivers/net/wireless/rt2x00/rt2800pci.c:95:2: warning: 'return' with a value, in function returning void [enabled by default]
<...>/drivers/net/wireless/rt2x00/rt2800pci.c: In function 'rt2800pci_read_eeprom':
<...>/drivers/net/wireless/rt2x00/rt2800pci.c:994:2: warning: 'retval' may be used uninitialized in this function [-Wuninitialized]

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 35143
2013-01-13 20:44:14 +00:00

46 lines
1.6 KiB
Diff

--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -89,7 +89,7 @@ static void rt2800pci_mcu_status(struct
rt2x00pci_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0);
}
-static int rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev)
+static int rt2800pci_read_eeprom_file(struct rt2x00_dev *rt2x00dev)
{
memcpy(rt2x00dev->eeprom, rt2x00dev->eeprom_file->data, EEPROM_SIZE);
return 0;
@@ -983,8 +983,9 @@ static int rt2800pci_read_eeprom(struct
{
int retval;
- if (rt2x00_is_soc(rt2x00dev))
- retval = rt2800pci_read_eeprom_soc(rt2x00dev);
+ if (rt2x00_is_soc(rt2x00dev) ||
+ test_bit(REQUIRE_EEPROM_FILE, &rt2x00dev->cap_flags))
+ retval = rt2800pci_read_eeprom_file(rt2x00dev);
else if (rt2800pci_efuse_detect(rt2x00dev))
retval = rt2800pci_read_eeprom_efuse(rt2x00dev);
else
--- a/drivers/net/wireless/rt2x00/rt2x00pci.c
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
@@ -255,6 +255,7 @@ exit:
int rt2x00pci_probe(struct pci_dev *pci_dev, const struct rt2x00_ops *ops)
{
struct ieee80211_hw *hw;
+ struct rt2x00_platform_data *pdata;
struct rt2x00_dev *rt2x00dev;
int retval;
u16 chip;
@@ -300,6 +301,12 @@ int rt2x00pci_probe(struct pci_dev *pci_
rt2x00dev->irq = pci_dev->irq;
rt2x00dev->name = pci_name(pci_dev);
+ /* if we get passed the name of a eeprom_file_name, then use this in
+ favour of the eeprom */
+ pdata = rt2x00dev->dev->platform_data;
+ if (pdata && pdata->eeprom_file_name)
+ set_bit(REQUIRE_EEPROM_FILE, &rt2x00dev->cap_flags);
+
if (pci_is_pcie(pci_dev))
rt2x00_set_chip_intf(rt2x00dev, RT2X00_CHIP_INTF_PCIE);
else