Re: [PATCH 3/7] ath9k: Add support for reading the EEPROM data using the nvmem API

From: RafaÅ MiÅecki
Date: Mon Mar 13 2017 - 18:17:28 EST


On 03/13/2017 10:05 PM, Alban wrote:
@@ -654,6 +656,25 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc,
if (ret)
return ret;

+ /* If the EEPROM hasn't been retrieved via firmware request
+ * use the nvmem API insted.
+ */
+ if (!ah->eeprom_blob) {
+ struct nvmem_cell *eeprom_cell;
+
+ eeprom_cell = nvmem_cell_get(ah->dev, "eeprom");
+ if (!IS_ERR(eeprom_cell)) {
+ ah->eeprom_data = nvmem_cell_read(
+ eeprom_cell, &ah->eeprom_size);
+ nvmem_cell_put(eeprom_cell);
+
+ if (IS_ERR(ah->eeprom_data)) {
+ dev_err(ah->dev, "failed to read eeprom");

One trivial thing: missing line break.


+ return PTR_ERR(ah->eeprom_data);
+ }
+ }
+ }
+
if (ath9k_led_active_high != -1)
ah->config.led_active_high = ath9k_led_active_high == 1;