1 --- a/drivers/net/wireless/ath/ath9k/pci.c
2 +++ b/drivers/net/wireless/ath/ath9k/pci.c
5 #include <linux/nl80211.h>
7 +#include <linux/ath9k_platform.h>
10 static struct pci_device_id ath_pci_id_table[] __devinitdata = {
11 @@ -61,21 +62,36 @@ static void ath_pci_cleanup(struct ath_c
13 static bool ath_pci_eeprom_read(struct ath_common *common, u32 off, u16 *data)
15 - struct ath_hw *ah = (struct ath_hw *) common->ah;
16 + struct ath_softc *sc = (struct ath_softc *) common->priv;
17 + struct ath9k_platform_data *pdata = sc->dev->platform_data;
19 - common->ops->read(ah, AR5416_EEPROM_OFFSET + (off << AR5416_EEPROM_S));
21 + if (off >= (ARRAY_SIZE(pdata->eeprom_data))) {
22 + ath_print(common, ATH_DBG_FATAL,
23 + "%s: eeprom read failed, offset %08x "
24 + "is out of range\n",
28 + *data = pdata->eeprom_data[off];
30 + struct ath_hw *ah = (struct ath_hw *) common->ah;
32 + common->ops->read(ah, AR5416_EEPROM_OFFSET +
33 + (off << AR5416_EEPROM_S));
35 + if (!ath9k_hw_wait(ah,
36 + AR_EEPROM_STATUS_DATA,
37 + AR_EEPROM_STATUS_DATA_BUSY |
38 + AR_EEPROM_STATUS_DATA_PROT_ACCESS, 0,
43 - if (!ath9k_hw_wait(ah,
44 - AR_EEPROM_STATUS_DATA,
45 - AR_EEPROM_STATUS_DATA_BUSY |
46 - AR_EEPROM_STATUS_DATA_PROT_ACCESS, 0,
49 + *data = MS(common->ops->read(ah, AR_EEPROM_STATUS_DATA),
50 + AR_EEPROM_STATUS_DATA_VAL);
53 - *data = MS(common->ops->read(ah, AR_EEPROM_STATUS_DATA),
54 - AR_EEPROM_STATUS_DATA_VAL);