ath10k: ce cleanup
cover ath10k: ce cleanup
Trivial cleanup.
Michal Kazior (2):
ath10k: use ALIGN() kernel macros
ath10k: use void pointer instead of char pointer
drivers/net/wireless/ath/ath10k/ce.c | 50 +++++++++++----------------------- drivers/net/wireless/ath/ath10k/ce.h | 2 +- 2 files changed, 17 insertions(+), 35 deletions(-)
Signature · 1 line
1.7.9.5
PATCH 1/2 ath10k: use ALIGN() kernel macros
Signed-off-by Michal Kazior <[email protected]>
--- drivers/net/wireless/ath/ath10k/ce.c | 50 +++++++++++----------------------- 1 file changed, 16 insertions(+), 34 deletions(-)
drivers/net/wireless/ath/ath10k/ce.c +16 -34
@@ -946,24 +946,14 @@ static int ath10k_ce_init_src_ring(struct ath10k *ar,pci_alloc_consistent (ar_pci->pdev, (nentries *sizeof (struct ce_desc ) +CE_DESC_RING_ALIGN ), &base_addr); - src_ring->base_addr_ce_space_unaligned = base_addr; -if (src_ring->base_addr_ce_space_unaligned & - (CE_DESC_RING_ALIGN -1 )) { - src_ring->base_addr_ce_space = - (src_ring->base_addr_ce_space_unaligned + -CE_DESC_RING_ALIGN -1 ) & ~(CE_DESC_RING_ALIGN -1 ); - - src_ring->base_addr_owner_space = - (void *)(((size_t ) src_ring->base_addr_owner_space_unaligned + -CE_DESC_RING_ALIGN -1 ) & ~(CE_DESC_RING_ALIGN -1 )); - }else { - src_ring->base_addr_ce_space = - src_ring->base_addr_ce_space_unaligned; - src_ring->base_addr_owner_space = - src_ring->base_addr_owner_space_unaligned; - } + src_ring->base_addr_owner_space =PTR_ALIGN ( + src_ring->base_addr_owner_space_unaligned, +CE_DESC_RING_ALIGN ); + src_ring->base_addr_ce_space =ALIGN ( + src_ring->base_addr_ce_space_unaligned, +CE_DESC_RING_ALIGN );/* * Also allocate a shadow src ring in regular
@@ -972,9 +962,10 @@ static int ath10k_ce_init_src_ring(struct ath10k *ar, src_ring->shadow_base_unaligned =kmalloc ((nentries *sizeof (struct ce_desc ) +CE_DESC_RING_ALIGN ),GFP_KERNEL ); - src_ring->shadow_base = (struct ce_desc *) - (((size_t ) src_ring->shadow_base_unaligned + -CE_DESC_RING_ALIGN -1 ) & ~(CE_DESC_RING_ALIGN -1 )); + + src_ring->shadow_base =PTR_ALIGN ( + src_ring->shadow_base_unaligned, +CE_DESC_RING_ALIGN );ath10k_pci_wake (ar);ath10k_ce_src_ring_base_addr_set (ar, ctrl_addr, src_ring->base_addr_ce_space);
@@ -1042,21 +1033,12 @@ static int ath10k_ce_init_dest_ring(struct ath10k *ar,memset (dest_ring->base_addr_owner_space_unaligned,0 , nentries *sizeof (struct ce_desc ) +CE_DESC_RING_ALIGN ); -if (dest_ring->base_addr_ce_space_unaligned & - (CE_DESC_RING_ALIGN -1 )) { - dest_ring->base_addr_ce_space = - (dest_ring->base_addr_ce_space_unaligned + -CE_DESC_RING_ALIGN -1 ) & ~(CE_DESC_RING_ALIGN -1 ); - - dest_ring->base_addr_owner_space = - (void *)(((size_t ) dest_ring->base_addr_owner_space_unaligned + -CE_DESC_RING_ALIGN -1 ) & ~(CE_DESC_RING_ALIGN -1 )); - }else { - dest_ring->base_addr_ce_space = - dest_ring->base_addr_ce_space_unaligned; - dest_ring->base_addr_owner_space = - dest_ring->base_addr_owner_space_unaligned; - } + dest_ring->base_addr_owner_space =PTR_ALIGN ( + dest_ring->base_addr_owner_space_unaligned, +CE_DESC_RING_ALIGN ); + dest_ring->base_addr_ce_space =ALIGN ( + dest_ring->base_addr_ce_space_unaligned, +CE_DESC_RING_ALIGN );ath10k_pci_wake (ar); ath10k_ce_dest_ring_base_addr_set(ar, ctrl_addr,
Signature · 1 line
1.7.9.5
PATCH 2/2 ath10k: use void pointer instead of char pointer
In reply to Michal KaziorSigned-off-by Michal Kazior <[email protected]>
--- drivers/net/wireless/ath/ath10k/ce.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/ce.h +1 -1
@@ -111,7 +111,7 @@ struct ce_ring_state {* Start of shadow copy of descriptors, within regular memory. * Aligned to descriptor-size boundary. */ -char *shadow_base_unaligned; +void *shadow_base_unaligned;struct ce_desc *shadow_base;void **per_transfer_context;
Signature · 1 line
1.7.9.5
cover ath10k: ce cleanup
In reply to Michal KaziorQuoted 5 lines · Michal Kazior
Trivial cleanup.
Michal Kazior (2):
ath10k: useALIGN()kernel macros
ath10k: use void pointer instead of char pointer
Thanks, both applied.
Signature · 1 line
Kalle Valo