Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ath9k: use 'struct ath_hw *' as the first argument for 'ath9k_hw_nvram_read'

The 'ath9k_hw_nvram_read' function takes a
'struct ath_common *' as its first argument.
Almost each of its caller has a 'struct ath_hw *'
parameter in their argument list, and that is
dereferenced in order to get the 'struct ath_common'
pointer.

Change the first argument of 'ath9k_hw_nvram_read'
to be a 'struct ath_hw *', and remove the dereference
calls from the callers.

Also change the type of the first argument of the
ar9300_eeprom_read_{byte,word} functions.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by

Gabor Juhos and committed by
John W. Linville
0e4b9f2f 7177d8f9

+17 -22
+8 -9
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
··· 3001 3001 } 3002 3002 } 3003 3003 3004 - static bool ar9300_eeprom_read_byte(struct ath_common *common, int address, 3004 + static bool ar9300_eeprom_read_byte(struct ath_hw *ah, int address, 3005 3005 u8 *buffer) 3006 3006 { 3007 3007 u16 val; 3008 3008 3009 - if (unlikely(!ath9k_hw_nvram_read(common, address / 2, &val))) 3009 + if (unlikely(!ath9k_hw_nvram_read(ah, address / 2, &val))) 3010 3010 return false; 3011 3011 3012 3012 *buffer = (val >> (8 * (address % 2))) & 0xff; 3013 3013 return true; 3014 3014 } 3015 3015 3016 - static bool ar9300_eeprom_read_word(struct ath_common *common, int address, 3016 + static bool ar9300_eeprom_read_word(struct ath_hw *ah, int address, 3017 3017 u8 *buffer) 3018 3018 { 3019 3019 u16 val; 3020 3020 3021 - if (unlikely(!ath9k_hw_nvram_read(common, address / 2, &val))) 3021 + if (unlikely(!ath9k_hw_nvram_read(ah, address / 2, &val))) 3022 3022 return false; 3023 3023 3024 3024 buffer[0] = val >> 8; ··· 3044 3044 * the 16-bit word at that address 3045 3045 */ 3046 3046 if (address % 2 == 0) { 3047 - if (!ar9300_eeprom_read_byte(common, address--, buffer++)) 3047 + if (!ar9300_eeprom_read_byte(ah, address--, buffer++)) 3048 3048 goto error; 3049 3049 3050 3050 count--; 3051 3051 } 3052 3052 3053 3053 for (i = 0; i < count / 2; i++) { 3054 - if (!ar9300_eeprom_read_word(common, address, buffer)) 3054 + if (!ar9300_eeprom_read_word(ah, address, buffer)) 3055 3055 goto error; 3056 3056 3057 3057 address -= 2; ··· 3059 3059 } 3060 3060 3061 3061 if (count % 2) 3062 - if (!ar9300_eeprom_read_byte(common, address, buffer)) 3062 + if (!ar9300_eeprom_read_byte(ah, address, buffer)) 3063 3063 goto error; 3064 3064 3065 3065 return true; ··· 3236 3236 static int ar9300_eeprom_restore_flash(struct ath_hw *ah, u8 *mptr, 3237 3237 int mdata_size) 3238 3238 { 3239 - struct ath_common *common = ath9k_hw_common(ah); 3240 3239 u16 *data = (u16 *) mptr; 3241 3240 int i; 3242 3241 3243 3242 for (i = 0; i < mdata_size / 2; i++, data++) 3244 - ath9k_hw_nvram_read(common, i, data); 3243 + ath9k_hw_nvram_read(ah, i, data); 3245 3244 3246 3245 return 0; 3247 3246 }
+2 -1
drivers/net/wireless/ath/ath9k/eeprom.c
··· 113 113 } 114 114 } 115 115 116 - bool ath9k_hw_nvram_read(struct ath_common *common, u32 off, u16 *data) 116 + bool ath9k_hw_nvram_read(struct ath_hw *ah, u32 off, u16 *data) 117 117 { 118 + struct ath_common *common = ath9k_hw_common(ah); 118 119 bool ret; 119 120 120 121 ret = common->bus_ops->eeprom_read(common, off, data);
+1 -1
drivers/net/wireless/ath/ath9k/eeprom.h
··· 663 663 int16_t targetRight); 664 664 bool ath9k_hw_get_lower_upper_index(u8 target, u8 *pList, u16 listSize, 665 665 u16 *indexL, u16 *indexR); 666 - bool ath9k_hw_nvram_read(struct ath_common *common, u32 off, u16 *data); 666 + bool ath9k_hw_nvram_read(struct ath_hw *ah, u32 off, u16 *data); 667 667 void ath9k_hw_usb_gen_fill_eeprom(struct ath_hw *ah, u16 *eep_data, 668 668 int eep_start_loc, int size); 669 669 void ath9k_hw_fill_vpd_table(u8 pwrMin, u8 pwrMax, u8 *pPwrList,
+2 -4
drivers/net/wireless/ath/ath9k/eeprom_4k.c
··· 32 32 33 33 static bool __ath9k_hw_4k_fill_eeprom(struct ath_hw *ah) 34 34 { 35 - struct ath_common *common = ath9k_hw_common(ah); 36 35 u16 *eep_data = (u16 *)&ah->eeprom.map4k; 37 36 int addr, eep_start_loc = 64; 38 37 39 38 for (addr = 0; addr < SIZE_EEPROM_4K; addr++) { 40 - if (!ath9k_hw_nvram_read(common, addr + eep_start_loc, 41 - eep_data)) 39 + if (!ath9k_hw_nvram_read(ah, addr + eep_start_loc, eep_data)) 42 40 return false; 43 41 eep_data++; 44 42 } ··· 192 194 193 195 194 196 if (!ath9k_hw_use_flash(ah)) { 195 - if (!ath9k_hw_nvram_read(common, AR5416_EEPROM_MAGIC_OFFSET, 197 + if (!ath9k_hw_nvram_read(ah, AR5416_EEPROM_MAGIC_OFFSET, 196 198 &magic)) { 197 199 ath_err(common, "Reading Magic # failed\n"); 198 200 return false;
+2 -4
drivers/net/wireless/ath/ath9k/eeprom_9287.c
··· 33 33 static bool __ath9k_hw_ar9287_fill_eeprom(struct ath_hw *ah) 34 34 { 35 35 struct ar9287_eeprom *eep = &ah->eeprom.map9287; 36 - struct ath_common *common = ath9k_hw_common(ah); 37 36 u16 *eep_data; 38 37 int addr, eep_start_loc = AR9287_EEP_START_LOC; 39 38 eep_data = (u16 *)eep; 40 39 41 40 for (addr = 0; addr < SIZE_EEPROM_AR9287; addr++) { 42 - if (!ath9k_hw_nvram_read(common, addr + eep_start_loc, 43 - eep_data)) 41 + if (!ath9k_hw_nvram_read(ah, addr + eep_start_loc, eep_data)) 44 42 return false; 45 43 eep_data++; 46 44 } ··· 185 187 struct ath_common *common = ath9k_hw_common(ah); 186 188 187 189 if (!ath9k_hw_use_flash(ah)) { 188 - if (!ath9k_hw_nvram_read(common, AR5416_EEPROM_MAGIC_OFFSET, 190 + if (!ath9k_hw_nvram_read(ah, AR5416_EEPROM_MAGIC_OFFSET, 189 191 &magic)) { 190 192 ath_err(common, "Reading Magic # failed\n"); 191 193 return false;
+2 -3
drivers/net/wireless/ath/ath9k/eeprom_def.c
··· 91 91 92 92 static bool __ath9k_hw_def_fill_eeprom(struct ath_hw *ah) 93 93 { 94 - struct ath_common *common = ath9k_hw_common(ah); 95 94 u16 *eep_data = (u16 *)&ah->eeprom.def; 96 95 int addr, ar5416_eep_start_loc = 0x100; 97 96 98 97 for (addr = 0; addr < SIZE_EEPROM_DEF; addr++) { 99 - if (!ath9k_hw_nvram_read(common, addr + ar5416_eep_start_loc, 98 + if (!ath9k_hw_nvram_read(ah, addr + ar5416_eep_start_loc, 100 99 eep_data)) 101 100 return false; 102 101 eep_data++; ··· 267 268 bool need_swap = false; 268 269 int i, addr, size; 269 270 270 - if (!ath9k_hw_nvram_read(common, AR5416_EEPROM_MAGIC_OFFSET, &magic)) { 271 + if (!ath9k_hw_nvram_read(ah, AR5416_EEPROM_MAGIC_OFFSET, &magic)) { 271 272 ath_err(common, "Reading Magic # failed\n"); 272 273 return false; 273 274 }