Skip to content

Commit 016abac

Browse files
Karthikeyan Periyasamykvalo
authored andcommitted
wifi: ath12k: add ath12k_ab_to_ah() and ath12k_ab_set_ah()
Currently, one or more ath12k_hw is part of a device (struct ath12k_base) but in future, it would be part of device group abstraction (struct ath12k_hw_group), i.e., when multiple radios (ar) across different devices can be combined together in a device group (struct ath12k_hw_group). In order to facilitate the above transition, introduce helpers ath12k_ab_to_ah() and ath12k_ab_set_ah() to get and set values of ath12k_hw respectively. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: Karthikeyan Periyasamy <[email protected]> Signed-off-by: Harshitha Prem <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent fc38e93 commit 016abac

File tree

3 files changed

+28
-14
lines changed

3 files changed

+28
-14
lines changed

drivers/net/wireless/ath/ath12k/core.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,7 @@ static void ath12k_rfkill_work(struct work_struct *work)
986986
spin_unlock_bh(&ab->base_lock);
987987

988988
for (i = 0; i < ab->num_hw; i++) {
989-
ah = ab->ah[i];
989+
ah = ath12k_ab_to_ah(ab, i);
990990
if (!ah)
991991
continue;
992992

@@ -1038,7 +1038,7 @@ static void ath12k_core_pre_reconfigure_recovery(struct ath12k_base *ab)
10381038
set_bit(ATH12K_FLAG_CRASH_FLUSH, &ab->dev_flags);
10391039

10401040
for (i = 0; i < ab->num_hw; i++) {
1041-
ah = ab->ah[i];
1041+
ah = ath12k_ab_to_ah(ab, i);
10421042
if (!ah || ah->state == ATH12K_HW_STATE_OFF)
10431043
continue;
10441044

@@ -1077,7 +1077,7 @@ static void ath12k_core_post_reconfigure_recovery(struct ath12k_base *ab)
10771077
int i, j;
10781078

10791079
for (i = 0; i < ab->num_hw; i++) {
1080-
ah = ab->ah[i];
1080+
ah = ath12k_ab_to_ah(ab, i);
10811081
if (!ah || ah->state == ATH12K_HW_STATE_OFF)
10821082
continue;
10831083

@@ -1131,7 +1131,7 @@ static void ath12k_core_restart(struct work_struct *work)
11311131

11321132
if (ab->is_reset) {
11331133
for (i = 0; i < ab->num_hw; i++) {
1134-
ah = ab->ah[i];
1134+
ah = ath12k_ab_to_ah(ab, i);
11351135
ieee80211_restart_hw(ah->hw);
11361136
}
11371137
}

drivers/net/wireless/ath/ath12k/core.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,4 +1160,15 @@ static inline struct ieee80211_hw *ath12k_ar_to_hw(struct ath12k *ar)
11601160
#define for_each_ar(ah, ar, index) \
11611161
for ((index) = 0; ((index) < (ah)->num_radio && \
11621162
((ar) = &(ah)->radio[(index)])); (index)++)
1163+
1164+
static inline struct ath12k_hw *ath12k_ab_to_ah(struct ath12k_base *ab, int idx)
1165+
{
1166+
return ab->ah[idx];
1167+
}
1168+
1169+
static inline void ath12k_ab_set_ah(struct ath12k_base *ab, int idx,
1170+
struct ath12k_hw *ah)
1171+
{
1172+
ab->ah[idx] = ah;
1173+
}
11631174
#endif /* _CORE_H_ */

drivers/net/wireless/ath/ath12k/mac.c

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10832,7 +10832,7 @@ int ath12k_mac_register(struct ath12k_base *ab)
1083210832
ab->free_vdev_map = (1LL << (ab->num_radios * TARGET_NUM_VDEVS)) - 1;
1083310833

1083410834
for (i = 0; i < ab->num_hw; i++) {
10835-
ah = ab->ah[i];
10835+
ah = ath12k_ab_to_ah(ab, i);
1083610836

1083710837
ret = ath12k_mac_hw_register(ah);
1083810838
if (ret)
@@ -10843,7 +10843,7 @@ int ath12k_mac_register(struct ath12k_base *ab)
1084310843

1084410844
err:
1084510845
for (i = i - 1; i >= 0; i--) {
10846-
ah = ab->ah[i];
10846+
ah = ath12k_ab_to_ah(ab, i);
1084710847
if (!ah)
1084810848
continue;
1084910849

@@ -10859,7 +10859,7 @@ void ath12k_mac_unregister(struct ath12k_base *ab)
1085910859
int i;
1086010860

1086110861
for (i = ab->num_hw - 1; i >= 0; i--) {
10862-
ah = ab->ah[i];
10862+
ah = ath12k_ab_to_ah(ab, i);
1086310863
if (!ah)
1086410864
continue;
1086510865

@@ -10917,6 +10917,7 @@ static struct ath12k_hw *ath12k_mac_hw_allocate(struct ath12k_base *ab,
1091710917
void ath12k_mac_destroy(struct ath12k_base *ab)
1091810918
{
1091910919
struct ath12k_pdev *pdev;
10920+
struct ath12k_hw *ah;
1092010921
int i;
1092110922

1092210923
for (i = 0; i < ab->num_radios; i++) {
@@ -10928,11 +10929,12 @@ void ath12k_mac_destroy(struct ath12k_base *ab)
1092810929
}
1092910930

1093010931
for (i = 0; i < ab->num_hw; i++) {
10931-
if (!ab->ah[i])
10932+
ah = ath12k_ab_to_ah(ab, i);
10933+
if (!ah)
1093210934
continue;
1093310935

10934-
ath12k_mac_hw_destroy(ab->ah[i]);
10935-
ab->ah[i] = NULL;
10936+
ath12k_mac_hw_destroy(ah);
10937+
ath12k_ab_set_ah(ab, i, NULL);
1093610938
}
1093710939
}
1093810940

@@ -10965,7 +10967,7 @@ int ath12k_mac_allocate(struct ath12k_base *ab)
1096510967

1096610968
ah->dev = ab->dev;
1096710969

10968-
ab->ah[i] = ah;
10970+
ath12k_ab_set_ah(ab, i, ah);
1096910971
}
1097010972

1097110973
ath12k_dp_pdev_pre_alloc(ab);
@@ -10974,11 +10976,12 @@ int ath12k_mac_allocate(struct ath12k_base *ab)
1097410976

1097510977
err:
1097610978
for (i = i - 1; i >= 0; i--) {
10977-
if (!ab->ah[i])
10979+
ah = ath12k_ab_to_ah(ab, i);
10980+
if (!ah)
1097810981
continue;
1097910982

10980-
ath12k_mac_hw_destroy(ab->ah[i]);
10981-
ab->ah[i] = NULL;
10983+
ath12k_mac_hw_destroy(ah);
10984+
ath12k_ab_set_ah(ab, i, NULL);
1098210985
}
1098310986

1098410987
return ret;

0 commit comments

Comments
 (0)