Skip to content

Commit 17dd22a

Browse files
Karthikeyan Periyasamykvalo
authored andcommitted
wifi: ath12k: add ath12k_get_num_hw()
Currently, one or more struct ath12k_hw is part of device (struct ath12k_base) but in future, ath12k_hw would be part of device group (struct ath12k_hw_group). Hence, num_hw under device would be moved to device group. To facilitate above transition, add helper ath12k_get_num_hw() to get the number of radios per device. In future, this helper will return the number of radios in a device group. 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 016abac commit 17dd22a

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

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

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

988-
for (i = 0; i < ab->num_hw; i++) {
988+
for (i = 0; i < ath12k_get_num_hw(ab); i++) {
989989
ah = ath12k_ab_to_ah(ab, i);
990990
if (!ah)
991991
continue;
@@ -1037,7 +1037,7 @@ static void ath12k_core_pre_reconfigure_recovery(struct ath12k_base *ab)
10371037
if (ab->is_reset)
10381038
set_bit(ATH12K_FLAG_CRASH_FLUSH, &ab->dev_flags);
10391039

1040-
for (i = 0; i < ab->num_hw; i++) {
1040+
for (i = 0; i < ath12k_get_num_hw(ab); i++) {
10411041
ah = ath12k_ab_to_ah(ab, i);
10421042
if (!ah || ah->state == ATH12K_HW_STATE_OFF)
10431043
continue;
@@ -1076,7 +1076,7 @@ static void ath12k_core_post_reconfigure_recovery(struct ath12k_base *ab)
10761076
struct ath12k *ar;
10771077
int i, j;
10781078

1079-
for (i = 0; i < ab->num_hw; i++) {
1079+
for (i = 0; i < ath12k_get_num_hw(ab); i++) {
10801080
ah = ath12k_ab_to_ah(ab, i);
10811081
if (!ah || ah->state == ATH12K_HW_STATE_OFF)
10821082
continue;
@@ -1130,7 +1130,7 @@ static void ath12k_core_restart(struct work_struct *work)
11301130
}
11311131

11321132
if (ab->is_reset) {
1133-
for (i = 0; i < ab->num_hw; i++) {
1133+
for (i = 0; i < ath12k_get_num_hw(ab); i++) {
11341134
ah = ath12k_ab_to_ah(ab, i);
11351135
ieee80211_restart_hw(ah->hw);
11361136
}

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,4 +1171,9 @@ static inline void ath12k_ab_set_ah(struct ath12k_base *ab, int idx,
11711171
{
11721172
ab->ah[idx] = ah;
11731173
}
1174+
1175+
static inline int ath12k_get_num_hw(struct ath12k_base *ab)
1176+
{
1177+
return ab->num_hw;
1178+
}
11741179
#endif /* _CORE_H_ */

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

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

10834-
for (i = 0; i < ab->num_hw; i++) {
10834+
for (i = 0; i < ath12k_get_num_hw(ab); i++) {
1083510835
ah = ath12k_ab_to_ah(ab, i);
1083610836

1083710837
ret = ath12k_mac_hw_register(ah);
@@ -10858,7 +10858,7 @@ void ath12k_mac_unregister(struct ath12k_base *ab)
1085810858
struct ath12k_hw *ah;
1085910859
int i;
1086010860

10861-
for (i = ab->num_hw - 1; i >= 0; i--) {
10861+
for (i = ath12k_get_num_hw(ab) - 1; i >= 0; i--) {
1086210862
ah = ath12k_ab_to_ah(ab, i);
1086310863
if (!ah)
1086410864
continue;
@@ -10928,7 +10928,7 @@ void ath12k_mac_destroy(struct ath12k_base *ab)
1092810928
pdev->ar = NULL;
1092910929
}
1093010930

10931-
for (i = 0; i < ab->num_hw; i++) {
10931+
for (i = 0; i < ath12k_get_num_hw(ab); i++) {
1093210932
ah = ath12k_ab_to_ah(ab, i);
1093310933
if (!ah)
1093410934
continue;
@@ -10951,7 +10951,7 @@ int ath12k_mac_allocate(struct ath12k_base *ab)
1095110951
ab->num_hw = ab->num_radios;
1095210952
radio_per_hw = 1;
1095310953

10954-
for (i = 0; i < ab->num_hw; i++) {
10954+
for (i = 0; i < ath12k_get_num_hw(ab); i++) {
1095510955
for (j = 0; j < radio_per_hw; j++) {
1095610956
pdev_map[j].ab = ab;
1095710957
pdev_map[j].pdev_idx = (i * radio_per_hw) + j;

0 commit comments

Comments
 (0)