aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath10k/ce.c
diff options
context:
space:
mode:
authorMichal Kazior <michal.kazior@tieto.com>2013-08-27 07:07:58 -0400
committerKalle Valo <kvalo@qca.qualcomm.com>2013-09-01 02:21:45 -0400
commit39e4086a7365b933265839090b3468c9ecc52a42 (patch)
tree77f0791971402e88770852dbb1f98c489aea7af9 /drivers/net/wireless/ath/ath10k/ce.c
parente2951f7ff8d6f94f1f3c2cab1f360de444b32ed8 (diff)
ath10k: use inline ce_state structure
Simplifies memory managament of ce_state. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath10k/ce.c')
-rw-r--r--drivers/net/wireless/ath/ath10k/ce.c37
1 files changed, 13 insertions, 24 deletions
diff --git a/drivers/net/wireless/ath/ath10k/ce.c b/drivers/net/wireless/ath/ath10k/ce.c
index 1a702e1fa581..c8b7d210b4dc 100644
--- a/drivers/net/wireless/ath/ath10k/ce.c
+++ b/drivers/net/wireless/ath/ath10k/ce.c
@@ -727,7 +727,7 @@ int ath10k_ce_completed_send_next(struct ce_state *ce_state,
727void ath10k_ce_per_engine_service(struct ath10k *ar, unsigned int ce_id) 727void ath10k_ce_per_engine_service(struct ath10k *ar, unsigned int ce_id)
728{ 728{
729 struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); 729 struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
730 struct ce_state *ce_state = ar_pci->ce_id_to_state[ce_id]; 730 struct ce_state *ce_state = &ar_pci->ce_states[ce_id];
731 u32 ctrl_addr = ce_state->ctrl_addr; 731 u32 ctrl_addr = ce_state->ctrl_addr;
732 void *transfer_context; 732 void *transfer_context;
733 u32 buf; 733 u32 buf;
@@ -846,7 +846,7 @@ void ath10k_ce_disable_interrupts(struct ath10k *ar)
846 846
847 ath10k_pci_wake(ar); 847 ath10k_pci_wake(ar);
848 for (ce_id = 0; ce_id < ar_pci->ce_count; ce_id++) { 848 for (ce_id = 0; ce_id < ar_pci->ce_count; ce_id++) {
849 struct ce_state *ce_state = ar_pci->ce_id_to_state[ce_id]; 849 struct ce_state *ce_state = &ar_pci->ce_states[ce_id];
850 u32 ctrl_addr = ce_state->ctrl_addr; 850 u32 ctrl_addr = ce_state->ctrl_addr;
851 851
852 ath10k_ce_copy_complete_intr_disable(ar, ctrl_addr); 852 ath10k_ce_copy_complete_intr_disable(ar, ctrl_addr);
@@ -1081,27 +1081,17 @@ static struct ce_state *ath10k_ce_init_state(struct ath10k *ar,
1081 const struct ce_attr *attr) 1081 const struct ce_attr *attr)
1082{ 1082{
1083 struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); 1083 struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
1084 struct ce_state *ce_state = NULL; 1084 struct ce_state *ce_state = &ar_pci->ce_states[ce_id];
1085 u32 ctrl_addr = ath10k_ce_base_address(ce_id); 1085 u32 ctrl_addr = ath10k_ce_base_address(ce_id);
1086 1086
1087 spin_lock_bh(&ar_pci->ce_lock); 1087 spin_lock_bh(&ar_pci->ce_lock);
1088 1088
1089 if (!ar_pci->ce_id_to_state[ce_id]) { 1089 ce_state->ar = ar;
1090 ce_state = kzalloc(sizeof(*ce_state), GFP_ATOMIC); 1090 ce_state->id = ce_id;
1091 if (ce_state == NULL) { 1091 ce_state->ctrl_addr = ctrl_addr;
1092 spin_unlock_bh(&ar_pci->ce_lock); 1092 ce_state->state = CE_RUNNING;
1093 return NULL; 1093 ce_state->attr_flags = attr->flags;
1094 } 1094 ce_state->src_sz_max = attr->src_sz_max;
1095
1096 ar_pci->ce_id_to_state[ce_id] = ce_state;
1097 ce_state->ar = ar;
1098 ce_state->id = ce_id;
1099 ce_state->ctrl_addr = ctrl_addr;
1100 ce_state->state = CE_RUNNING;
1101 /* Save attribute flags */
1102 ce_state->attr_flags = attr->flags;
1103 ce_state->src_sz_max = attr->src_sz_max;
1104 }
1105 1095
1106 spin_unlock_bh(&ar_pci->ce_lock); 1096 spin_unlock_bh(&ar_pci->ce_lock);
1107 1097
@@ -1159,13 +1149,9 @@ struct ce_state *ath10k_ce_init(struct ath10k *ar,
1159 1149
1160void ath10k_ce_deinit(struct ce_state *ce_state) 1150void ath10k_ce_deinit(struct ce_state *ce_state)
1161{ 1151{
1162 unsigned int ce_id = ce_state->id;
1163 struct ath10k *ar = ce_state->ar; 1152 struct ath10k *ar = ce_state->ar;
1164 struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); 1153 struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
1165 1154
1166 ce_state->state = CE_UNUSED;
1167 ar_pci->ce_id_to_state[ce_id] = NULL;
1168
1169 if (ce_state->src_ring) { 1155 if (ce_state->src_ring) {
1170 kfree(ce_state->src_ring->shadow_base_unaligned); 1156 kfree(ce_state->src_ring->shadow_base_unaligned);
1171 pci_free_consistent(ar_pci->pdev, 1157 pci_free_consistent(ar_pci->pdev,
@@ -1186,5 +1172,8 @@ void ath10k_ce_deinit(struct ce_state *ce_state)
1186 ce_state->dest_ring->base_addr_ce_space); 1172 ce_state->dest_ring->base_addr_ce_space);
1187 kfree(ce_state->dest_ring); 1173 kfree(ce_state->dest_ring);
1188 } 1174 }
1189 kfree(ce_state); 1175
1176 ce_state->state = CE_UNUSED;
1177 ce_state->src_ring = NULL;
1178 ce_state->dest_ring = NULL;
1190} 1179}