diff options
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/eeprom.c')
| -rw-r--r-- | drivers/net/wireless/ath/ath9k/eeprom.c | 29 | 
1 files changed, 27 insertions, 2 deletions
| diff --git a/drivers/net/wireless/ath/ath9k/eeprom.c b/drivers/net/wireless/ath/ath9k/eeprom.c index 0512397a293c..971d770722cf 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom.c +++ b/drivers/net/wireless/ath/ath9k/eeprom.c @@ -113,9 +113,34 @@ void ath9k_hw_usb_gen_fill_eeprom(struct ath_hw *ah, u16 *eep_data,  	}  } -bool ath9k_hw_nvram_read(struct ath_common *common, u32 off, u16 *data) +static bool ath9k_hw_nvram_read_blob(struct ath_hw *ah, u32 off, +				     u16 *data)  { -	return common->bus_ops->eeprom_read(common, off, data); +	u16 *blob_data; + +	if (off * sizeof(u16) > ah->eeprom_blob->size) +		return false; + +	blob_data = (u16 *)ah->eeprom_blob->data; +	*data =  blob_data[off]; +	return true; +} + +bool ath9k_hw_nvram_read(struct ath_hw *ah, u32 off, u16 *data) +{ +	struct ath_common *common = ath9k_hw_common(ah); +	bool ret; + +	if (ah->eeprom_blob) +		ret = ath9k_hw_nvram_read_blob(ah, off, data); +	else +		ret = common->bus_ops->eeprom_read(common, off, data); + +	if (!ret) +		ath_dbg(common, EEPROM, +			"unable to read eeprom region at offset %u\n", off); + +	return ret;  }  void ath9k_hw_fill_vpd_table(u8 pwrMin, u8 pwrMax, u8 *pPwrList, |