From a12157095a8a59eeaeb7c9efe70495288140159c Mon Sep 17 00:00:00 2001
From: Hari Chandrakanthan <quic_haric@quicinc.com>
Date: Mon, 10 Jan 2022 12:38:10 +0530
Subject: [PATCH] ath11k: provide access of the dma buffer back to dma device

In ath11k_dbring_bufs_replenish, after accessing paddr which is a member of
ath11k_dbring_element, provide the access of the buffer back to
dma device by using dma_sync_single_for_device.

Also the gfp flag to used inside ath11k_dbring_fill_bufs is changed
from GFP_KERNEL to GFP_ATOMIC as the buffers are allocated inside spin lock.

Signed-off-by: Hari Chandrakanthan <quic_haric@quicinc.com>
---
 drivers/net/wireless/ath/ath11k/dbring.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/net/wireless/ath/ath11k/dbring.c
+++ b/drivers/net/wireless/ath/ath11k/dbring.c
@@ -81,6 +81,8 @@ static int ath11k_dbring_bufs_replenish(
 
 	buff->paddr = paddr;
 
+	dma_sync_single_for_device(ab->dev, paddr, ring->buf_sz, DMA_FROM_DEVICE);
+
 	cookie = FIELD_PREP(DP_RXDMA_BUF_COOKIE_PDEV_ID, ar->pdev_idx) |
 		 FIELD_PREP(DP_RXDMA_BUF_COOKIE_BUF_ID, buf_id);
 
