diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2012-12-10 09:30:27 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-12-10 15:49:56 -0500 |
commit | 0e4b9f2f12e94686855605eda64ea534a95d77f2 (patch) | |
tree | 752ee51ab1bd44c4db76dc782a0625637fcd711b | |
parent | 7177d8f998c452701ad5352cca12408e26f80b07 (diff) |
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>
-rw-r--r-- | drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 17 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/eeprom.c | 3 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/eeprom.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/eeprom_4k.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/eeprom_9287.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/eeprom_def.c | 5 |
6 files changed, 17 insertions, 22 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c index 11082b417d24..562186ca9b52 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | |||
@@ -3001,24 +3001,24 @@ static u32 ath9k_hw_ar9300_get_eeprom(struct ath_hw *ah, | |||
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 | u8 *buffer) | 3005 | u8 *buffer) |
3006 | { | 3006 | { |
3007 | u16 val; | 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 | return false; | 3010 | return false; |
3011 | 3011 | ||
3012 | *buffer = (val >> (8 * (address % 2))) & 0xff; | 3012 | *buffer = (val >> (8 * (address % 2))) & 0xff; |
3013 | return true; | 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 | u8 *buffer) | 3017 | u8 *buffer) |
3018 | { | 3018 | { |
3019 | u16 val; | 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 | return false; | 3022 | return false; |
3023 | 3023 | ||
3024 | buffer[0] = val >> 8; | 3024 | buffer[0] = val >> 8; |
@@ -3044,14 +3044,14 @@ static bool ar9300_read_eeprom(struct ath_hw *ah, int address, u8 *buffer, | |||
3044 | * the 16-bit word at that address | 3044 | * the 16-bit word at that address |
3045 | */ | 3045 | */ |
3046 | if (address % 2 == 0) { | 3046 | if (address % 2 == 0) { |
3047 | if (!ar9300_eeprom_read_byte(common, address--, buffer++)) | 3047 | if (!ar9300_eeprom_read_byte(ah, address--, buffer++)) |
3048 | goto error; | 3048 | goto error; |
3049 | 3049 | ||
3050 | count--; | 3050 | count--; |
3051 | } | 3051 | } |
3052 | 3052 | ||
3053 | for (i = 0; i < count / 2; i++) { | 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 | goto error; | 3055 | goto error; |
3056 | 3056 | ||
3057 | address -= 2; | 3057 | address -= 2; |
@@ -3059,7 +3059,7 @@ static bool ar9300_read_eeprom(struct ath_hw *ah, int address, u8 *buffer, | |||
3059 | } | 3059 | } |
3060 | 3060 | ||
3061 | if (count % 2) | 3061 | if (count % 2) |
3062 | if (!ar9300_eeprom_read_byte(common, address, buffer)) | 3062 | if (!ar9300_eeprom_read_byte(ah, address, buffer)) |
3063 | goto error; | 3063 | goto error; |
3064 | 3064 | ||
3065 | return true; | 3065 | return true; |
@@ -3236,12 +3236,11 @@ static bool ar9300_check_eeprom_header(struct ath_hw *ah, eeprom_read_op read, | |||
3236 | static int ar9300_eeprom_restore_flash(struct ath_hw *ah, u8 *mptr, | 3236 | static int ar9300_eeprom_restore_flash(struct ath_hw *ah, u8 *mptr, |
3237 | int mdata_size) | 3237 | int mdata_size) |
3238 | { | 3238 | { |
3239 | struct ath_common *common = ath9k_hw_common(ah); | ||
3240 | u16 *data = (u16 *) mptr; | 3239 | u16 *data = (u16 *) mptr; |
3241 | int i; | 3240 | int i; |
3242 | 3241 | ||
3243 | for (i = 0; i < mdata_size / 2; i++, data++) | 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 | return 0; | 3245 | return 0; |
3247 | } | 3246 | } |
diff --git a/drivers/net/wireless/ath/ath9k/eeprom.c b/drivers/net/wireless/ath/ath9k/eeprom.c index bf52ae1fdfff..eb9ac5ea6180 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom.c +++ b/drivers/net/wireless/ath/ath9k/eeprom.c | |||
@@ -113,8 +113,9 @@ void ath9k_hw_usb_gen_fill_eeprom(struct ath_hw *ah, u16 *eep_data, | |||
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 | bool ret; | 119 | bool ret; |
119 | 120 | ||
120 | ret = common->bus_ops->eeprom_read(common, off, data); | 121 | ret = common->bus_ops->eeprom_read(common, off, data); |
diff --git a/drivers/net/wireless/ath/ath9k/eeprom.h b/drivers/net/wireless/ath/ath9k/eeprom.h index 319c651fa6c5..40d4f62d0f16 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom.h +++ b/drivers/net/wireless/ath/ath9k/eeprom.h | |||
@@ -663,7 +663,7 @@ int16_t ath9k_hw_interpolate(u16 target, u16 srcLeft, u16 srcRight, | |||
663 | int16_t targetRight); | 663 | int16_t targetRight); |
664 | bool ath9k_hw_get_lower_upper_index(u8 target, u8 *pList, u16 listSize, | 664 | bool ath9k_hw_get_lower_upper_index(u8 target, u8 *pList, u16 listSize, |
665 | u16 *indexL, u16 *indexR); | 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 | void ath9k_hw_usb_gen_fill_eeprom(struct ath_hw *ah, u16 *eep_data, | 667 | void ath9k_hw_usb_gen_fill_eeprom(struct ath_hw *ah, u16 *eep_data, |
668 | int eep_start_loc, int size); | 668 | int eep_start_loc, int size); |
669 | void ath9k_hw_fill_vpd_table(u8 pwrMin, u8 pwrMax, u8 *pPwrList, | 669 | void ath9k_hw_fill_vpd_table(u8 pwrMin, u8 pwrMax, u8 *pPwrList, |
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_4k.c b/drivers/net/wireless/ath/ath9k/eeprom_4k.c index 17c843d37210..c2bfd748eed8 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c +++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c | |||
@@ -32,13 +32,11 @@ static int ath9k_hw_4k_get_eeprom_rev(struct ath_hw *ah) | |||
32 | 32 | ||
33 | static bool __ath9k_hw_4k_fill_eeprom(struct ath_hw *ah) | 33 | static bool __ath9k_hw_4k_fill_eeprom(struct ath_hw *ah) |
34 | { | 34 | { |
35 | struct ath_common *common = ath9k_hw_common(ah); | ||
36 | u16 *eep_data = (u16 *)&ah->eeprom.map4k; | 35 | u16 *eep_data = (u16 *)&ah->eeprom.map4k; |
37 | int addr, eep_start_loc = 64; | 36 | int addr, eep_start_loc = 64; |
38 | 37 | ||
39 | for (addr = 0; addr < SIZE_EEPROM_4K; addr++) { | 38 | for (addr = 0; addr < SIZE_EEPROM_4K; addr++) { |
40 | if (!ath9k_hw_nvram_read(common, addr + eep_start_loc, | 39 | if (!ath9k_hw_nvram_read(ah, addr + eep_start_loc, eep_data)) |
41 | eep_data)) | ||
42 | return false; | 40 | return false; |
43 | eep_data++; | 41 | eep_data++; |
44 | } | 42 | } |
@@ -194,7 +192,7 @@ static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah) | |||
194 | 192 | ||
195 | 193 | ||
196 | if (!ath9k_hw_use_flash(ah)) { | 194 | if (!ath9k_hw_use_flash(ah)) { |
197 | if (!ath9k_hw_nvram_read(common, AR5416_EEPROM_MAGIC_OFFSET, | 195 | if (!ath9k_hw_nvram_read(ah, AR5416_EEPROM_MAGIC_OFFSET, |
198 | &magic)) { | 196 | &magic)) { |
199 | ath_err(common, "Reading Magic # failed\n"); | 197 | ath_err(common, "Reading Magic # failed\n"); |
200 | return false; | 198 | return false; |
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_9287.c b/drivers/net/wireless/ath/ath9k/eeprom_9287.c index f2c32bc36f1c..3ae1f3df0637 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c +++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c | |||
@@ -33,14 +33,12 @@ static int ath9k_hw_ar9287_get_eeprom_rev(struct ath_hw *ah) | |||
33 | static bool __ath9k_hw_ar9287_fill_eeprom(struct ath_hw *ah) | 33 | static bool __ath9k_hw_ar9287_fill_eeprom(struct ath_hw *ah) |
34 | { | 34 | { |
35 | struct ar9287_eeprom *eep = &ah->eeprom.map9287; | 35 | struct ar9287_eeprom *eep = &ah->eeprom.map9287; |
36 | struct ath_common *common = ath9k_hw_common(ah); | ||
37 | u16 *eep_data; | 36 | u16 *eep_data; |
38 | int addr, eep_start_loc = AR9287_EEP_START_LOC; | 37 | int addr, eep_start_loc = AR9287_EEP_START_LOC; |
39 | eep_data = (u16 *)eep; | 38 | eep_data = (u16 *)eep; |
40 | 39 | ||
41 | for (addr = 0; addr < SIZE_EEPROM_AR9287; addr++) { | 40 | for (addr = 0; addr < SIZE_EEPROM_AR9287; addr++) { |
42 | if (!ath9k_hw_nvram_read(common, addr + eep_start_loc, | 41 | if (!ath9k_hw_nvram_read(ah, addr + eep_start_loc, eep_data)) |
43 | eep_data)) | ||
44 | return false; | 42 | return false; |
45 | eep_data++; | 43 | eep_data++; |
46 | } | 44 | } |
@@ -187,7 +185,7 @@ static int ath9k_hw_ar9287_check_eeprom(struct ath_hw *ah) | |||
187 | struct ath_common *common = ath9k_hw_common(ah); | 185 | struct ath_common *common = ath9k_hw_common(ah); |
188 | 186 | ||
189 | if (!ath9k_hw_use_flash(ah)) { | 187 | if (!ath9k_hw_use_flash(ah)) { |
190 | if (!ath9k_hw_nvram_read(common, AR5416_EEPROM_MAGIC_OFFSET, | 188 | if (!ath9k_hw_nvram_read(ah, AR5416_EEPROM_MAGIC_OFFSET, |
191 | &magic)) { | 189 | &magic)) { |
192 | ath_err(common, "Reading Magic # failed\n"); | 190 | ath_err(common, "Reading Magic # failed\n"); |
193 | return false; | 191 | return false; |
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_def.c b/drivers/net/wireless/ath/ath9k/eeprom_def.c index 2654f741b8bf..1c25368b3836 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom_def.c +++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c | |||
@@ -91,12 +91,11 @@ static int ath9k_hw_def_get_eeprom_rev(struct ath_hw *ah) | |||
91 | 91 | ||
92 | static bool __ath9k_hw_def_fill_eeprom(struct ath_hw *ah) | 92 | static bool __ath9k_hw_def_fill_eeprom(struct ath_hw *ah) |
93 | { | 93 | { |
94 | struct ath_common *common = ath9k_hw_common(ah); | ||
95 | u16 *eep_data = (u16 *)&ah->eeprom.def; | 94 | u16 *eep_data = (u16 *)&ah->eeprom.def; |
96 | int addr, ar5416_eep_start_loc = 0x100; | 95 | int addr, ar5416_eep_start_loc = 0x100; |
97 | 96 | ||
98 | for (addr = 0; addr < SIZE_EEPROM_DEF; addr++) { | 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 | eep_data)) | 99 | eep_data)) |
101 | return false; | 100 | return false; |
102 | eep_data++; | 101 | eep_data++; |
@@ -268,7 +267,7 @@ static int ath9k_hw_def_check_eeprom(struct ath_hw *ah) | |||
268 | bool need_swap = false; | 267 | bool need_swap = false; |
269 | int i, addr, size; | 268 | int i, addr, size; |
270 | 269 | ||
271 | if (!ath9k_hw_nvram_read(common, AR5416_EEPROM_MAGIC_OFFSET, &magic)) { | 270 | if (!ath9k_hw_nvram_read(ah, AR5416_EEPROM_MAGIC_OFFSET, &magic)) { |
272 | ath_err(common, "Reading Magic # failed\n"); | 271 | ath_err(common, "Reading Magic # failed\n"); |
273 | return false; | 272 | return false; |
274 | } | 273 | } |