qcacld-3.0: Add QDF atomic API's

Replace CDF atomic API's with QDF atomic API's.

Change-Id: I18b4ab3487357d150bdfb96f9a078e1b5abb3156
CRs-Fixed: 981188
diff --git a/core/cdf/inc/cdf_atomic.h b/core/cdf/inc/cdf_atomic.h
deleted file mode 100644
index 4ae5dc5..0000000
--- a/core/cdf/inc/cdf_atomic.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
- *
- * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
- *
- *
- * Permission to use, copy, modify, and/or distribute this software for
- * any purpose with or without fee is hereby granted, provided that the
- * above copyright notice and this permission notice appear in all
- * copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
- * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
- * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * This file was originally distributed by Qualcomm Atheros, Inc.
- * under proprietary terms before Copyright ownership was assigned
- * to the Linux Foundation.
- */
-
-/**
- * DOC: cdf_atomic.h
- * This file abstracts an atomic counter.
- */
-
-#ifndef _CDF_ATOMIC_H
-#define _CDF_ATOMIC_H
-
-#include <i_cdf_atomic.h>
-
-/**
- * cdf_atomic_t - atomic type of variable
- *
- * Use this when you want a simple resource counter etc. which is atomic
- * across multiple CPU's. These maybe slower than usual counters on some
- * platforms/OS'es, so use them with caution.
- */
-
-typedef __cdf_atomic_t cdf_atomic_t;
-
-/**
- * cdf_atomic_init() - initialize an atomic type variable
- * @v:	A pointer to an opaque atomic variable
- *
- * Return: None
- */
-static inline void cdf_atomic_init(cdf_atomic_t *v)
-{
-	__cdf_atomic_init(v);
-}
-
-/**
- * cdf_atomic_read() - read the value of an atomic variable
- * @v:	A pointer to an opaque atomic variable
- *
- * Return: The current value of the variable
- */
-static inline int32_t cdf_atomic_read(cdf_atomic_t *v)
-{
-	return __cdf_atomic_read(v);
-}
-
-/**
- * cdf_atomic_inc() - increment the value of an atomic variable
- * @v:	A pointer to an opaque atomic variable
- *
- * Return: None
- */
-static inline void cdf_atomic_inc(cdf_atomic_t *v)
-{
-	__cdf_atomic_inc(v);
-}
-
-/**
- * cdf_atomic_dec() - decrement the value of an atomic variable
- * @v:	A pointer to an opaque atomic variable
- *
- * Return: None
- */
-static inline void cdf_atomic_dec(cdf_atomic_t *v)
-{
-	__cdf_atomic_dec(v);
-}
-
-/**
- * cdf_atomic_add() - add a value to the value of an atomic variable
- * @v:	A pointer to an opaque atomic variable
- * @i:	The amount by which to increase the atomic counter
- *
- * Return: None
- */
-static inline void cdf_atomic_add(int i, cdf_atomic_t *v)
-{
-	__cdf_atomic_add(i, v);
-}
-
-/**
- * cdf_atomic_sub() - Subtract a value from an atomic variable.
- * @i: the amount by which to decrease the atomic counter
- * @v: a pointer to an opaque atomic variable
- *
- * Return: none
- */
-static inline void cdf_atomic_sub(int i, cdf_atomic_t *v)
-{
-	__cdf_atomic_sub(i, v);
-}
-
-/**
- * cdf_atomic_dec_and_test() - decrement an atomic variable and check if the
- *				new value is zero
- * @v: A pointer to an opaque atomic variable
- *
- * Return:
- *    true (non-zero) if the new value is zero,
- *    or false (0) if the new value is non-zero
- */
-static inline int32_t cdf_atomic_dec_and_test(cdf_atomic_t *v)
-{
-	return __cdf_atomic_dec_and_test(v);
-}
-
-/**
- * cdf_atomic_set() - set a value to the value of an atomic variable
- * @v: A pointer to an opaque atomic variable
- *
- * Return: None
- */
-static inline void cdf_atomic_set(cdf_atomic_t *v, int i)
-{
-	__cdf_atomic_set(v, i);
-}
-
-/**
- * cdf_atomic_inc_return() - return the incremented value of an atomic variable
- * @v: A pointer to an opaque atomic variable
- *
- * Return: The current value of the variable
- */
-static inline int32_t cdf_atomic_inc_return(cdf_atomic_t *v)
-{
-	return __cdf_atomic_inc_return(v);
-}
-
-#endif
diff --git a/core/cdf/src/i_cdf_atomic.h b/core/cdf/src/i_cdf_atomic.h
deleted file mode 100644
index e3c1a91..0000000
--- a/core/cdf/src/i_cdf_atomic.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
- *
- * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
- *
- *
- * Permission to use, copy, modify, and/or distribute this software for
- * any purpose with or without fee is hereby granted, provided that the
- * above copyright notice and this permission notice appear in all
- * copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
- * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
- * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * This file was originally distributed by Qualcomm Atheros, Inc.
- * under proprietary terms before Copyright ownership was assigned
- * to the Linux Foundation.
- */
-#ifndef I_CDF_ATOMIC_H
-#define I_CDF_ATOMIC_H
-
-#include <qdf_status.h>         /* QDF_STATUS */
-
-#include <linux/atomic.h>
-
-typedef atomic_t __cdf_atomic_t;
-
-static inline QDF_STATUS __cdf_atomic_init(__cdf_atomic_t *v)
-{
-	atomic_set(v, 0);
-
-	return QDF_STATUS_SUCCESS;
-}
-
-static inline int32_t __cdf_atomic_read(__cdf_atomic_t *v)
-{
-	return atomic_read(v);
-}
-
-static inline void __cdf_atomic_inc(__cdf_atomic_t *v)
-{
-	atomic_inc(v);
-}
-
-static inline void __cdf_atomic_dec(__cdf_atomic_t *v)
-{
-	atomic_dec(v);
-}
-
-static inline void __cdf_atomic_add(int i, __cdf_atomic_t *v)
-{
-	atomic_add(i, v);
-}
-
-/**
- * cdf_atomic_sub() - Subtract a value from an atomic variable
- * @i: the amount by which to decrease the atomic counter
- * @v: a pointer to an opaque atomic variable
- *
- * Return: none
- */
-static inline void __cdf_atomic_sub(int i, __cdf_atomic_t *v)
-{
-	atomic_sub(i, v);
-}
-
-static inline int32_t __cdf_atomic_dec_and_test(__cdf_atomic_t *v)
-{
-	return atomic_dec_and_test(v);
-}
-
-static inline void __cdf_atomic_set(__cdf_atomic_t *v, int i)
-{
-	atomic_set(v, i);
-}
-
-static inline int32_t __cdf_atomic_inc_return(__cdf_atomic_t *v)
-{
-	return atomic_inc_return(v);
-}
-
-#endif
diff --git a/core/dp/htt/htt_rx.c b/core/dp/htt/htt_rx.c
index 768736f..191a567 100644
--- a/core/dp/htt/htt_rx.c
+++ b/core/dp/htt/htt_rx.c
@@ -1849,7 +1849,7 @@
 
 void htt_rx_msdu_buff_replenish(htt_pdev_handle pdev)
 {
-	if (cdf_atomic_dec_and_test(&pdev->rx_ring.refill_ref_cnt)) {
+	if (qdf_atomic_dec_and_test(&pdev->rx_ring.refill_ref_cnt)) {
 		int num_to_fill;
 		num_to_fill = pdev->rx_ring.fill_level -
 			pdev->rx_ring.fill_cnt;
@@ -1857,7 +1857,7 @@
 		htt_rx_ring_fill_n(pdev,
 				   num_to_fill /* okay if <= 0 */);
 	}
-	cdf_atomic_inc(&pdev->rx_ring.refill_ref_cnt);
+	qdf_atomic_inc(&pdev->rx_ring.refill_ref_cnt);
 }
 
 #define AR600P_ASSEMBLE_HW_RATECODE(_rate, _nss, _pream)     \
@@ -2204,8 +2204,8 @@
 	* Initialize the Rx refill reference counter to be one so that
 	* only one thread is allowed to refill the Rx ring.
 	*/
-	cdf_atomic_init(&pdev->rx_ring.refill_ref_cnt);
-	cdf_atomic_inc(&pdev->rx_ring.refill_ref_cnt);
+	qdf_atomic_init(&pdev->rx_ring.refill_ref_cnt);
+	qdf_atomic_inc(&pdev->rx_ring.refill_ref_cnt);
 
 	/* Initialize the Rx refill retry timer */
 	cdf_softirq_timer_init(pdev->osdev,
diff --git a/core/dp/htt/htt_types.h b/core/dp/htt/htt_types.h
index 0121a09..e322980 100644
--- a/core/dp/htt/htt_types.h
+++ b/core/dp/htt/htt_types.h
@@ -32,7 +32,7 @@
 #include <cdf_types.h>          /* cdf_device_t */
 #include <cdf_lock.h>           /* cdf_spinlock_t */
 #include <cdf_softirq_timer.h>  /* cdf_softirq_timer_t */
-#include <cdf_atomic.h>         /* cdf_atomic_inc */
+#include <qdf_atomic.h>         /* qdf_atomic_inc */
 #include <cdf_nbuf.h>           /* cdf_nbuf_t */
 #include <htc_api.h>            /* HTC_PACKET */
 
@@ -331,7 +331,7 @@
 		 * variable is used to guarantee that only one thread tries
 		 * to replenish Rx ring.
 		 */
-		cdf_atomic_t refill_ref_cnt;
+		qdf_atomic_t refill_ref_cnt;
 #ifdef DEBUG_DMA_DONE
 		uint32_t dbg_initial_msdu_payld;
 		uint32_t dbg_mpdu_range;
diff --git a/core/dp/txrx/ol_rx.c b/core/dp/txrx/ol_rx.c
index 19db139..310d13d 100644
--- a/core/dp/txrx/ol_rx.c
+++ b/core/dp/txrx/ol_rx.c
@@ -1201,7 +1201,7 @@
 	peer->security[txrx_sec_ucast].sec_type =
 		peer->security[txrx_sec_mcast].sec_type = htt_sec_type_none;
 	peer->keyinstalled = 0;
-	cdf_atomic_init(&peer->fw_pn_check);
+	qdf_atomic_init(&peer->fw_pn_check);
 }
 
 void
diff --git a/core/dp/txrx/ol_rx_pn.c b/core/dp/txrx/ol_rx_pn.c
index f61ccd1..a37125a 100644
--- a/core/dp/txrx/ol_rx_pn.c
+++ b/core/dp/txrx/ol_rx_pn.c
@@ -96,7 +96,7 @@
 	int last_pn_valid;
 
 	/* Make sure host pn check is not redundant */
-	if ((cdf_atomic_read(&peer->fw_pn_check)) ||
+	if ((qdf_atomic_read(&peer->fw_pn_check)) ||
 		(vdev->opmode == wlan_op_mode_ibss)) {
 		return msdu_list;
 	}
diff --git a/core/dp/txrx/ol_rx_reorder.c b/core/dp/txrx/ol_rx_reorder.c
index 79e42e7..e6f3c16 100644
--- a/core/dp/txrx/ol_rx_reorder.c
+++ b/core/dp/txrx/ol_rx_reorder.c
@@ -617,7 +617,7 @@
 	else
 		return;
 
-	cdf_atomic_set(&peer->fw_pn_check, 1);
+	qdf_atomic_set(&peer->fw_pn_check, 1);
 	/*TODO: Fragmentation case */
 	win_sz_mask = peer->tids_rx_reorder[tid].win_sz_mask;
 	seq_num_start &= win_sz_mask;
diff --git a/core/dp/txrx/ol_tx.c b/core/dp/txrx/ol_tx.c
index e0ff756..3ab7827 100644
--- a/core/dp/txrx/ol_tx.c
+++ b/core/dp/txrx/ol_tx.c
@@ -27,7 +27,7 @@
 
 /* OS abstraction libraries */
 #include <cdf_nbuf.h>           /* cdf_nbuf_t, etc. */
-#include <cdf_atomic.h>         /* cdf_atomic_read, etc. */
+#include <qdf_atomic.h>         /* qdf_atomic_read, etc. */
 #include <cdf_util.h>           /* cdf_unlikely */
 
 /* APIs for other modules */
@@ -1106,7 +1106,7 @@
 #define OL_TX_ENCAP_WRAPPER(pdev, vdev, tx_desc, msdu, tx_msdu_info) \
 	do { \
 		if (OL_TX_ENCAP(vdev, tx_desc, msdu, &tx_msdu_info) != A_OK) { \
-			cdf_atomic_inc(&pdev->tx_queue.rsrc_cnt); \
+			qdf_atomic_inc(&pdev->tx_queue.rsrc_cnt); \
 			ol_tx_desc_frame_free_nonstd(pdev, tx_desc, 1);	\
 			if (tx_msdu_info.peer) { \
 				/* remove the peer reference added above */ \
diff --git a/core/dp/txrx/ol_tx_desc.c b/core/dp/txrx/ol_tx_desc.c
index 4a70fdb..a6aba47 100644
--- a/core/dp/txrx/ol_tx_desc.c
+++ b/core/dp/txrx/ol_tx_desc.c
@@ -443,7 +443,7 @@
 	TAILQ_FOREACH_SAFE(tx_desc, tx_descs, tx_desc_list_elem, tmp) {
 		cdf_nbuf_t msdu = tx_desc->netbuf;
 
-		cdf_atomic_init(&tx_desc->ref_cnt);   /* clear the ref cnt */
+		qdf_atomic_init(&tx_desc->ref_cnt);   /* clear the ref cnt */
 #ifdef QCA_SUPPORT_SW_TXRX_ENCAP
 		/* restore original hdr offset */
 		OL_TX_RESTORE_HDR(tx_desc, msdu);
@@ -466,7 +466,7 @@
 	ol_txrx_mgmt_tx_cb ota_ack_cb;
 	char *trace_str;
 
-	cdf_atomic_init(&tx_desc->ref_cnt);     /* clear the ref cnt */
+	qdf_atomic_init(&tx_desc->ref_cnt);     /* clear the ref cnt */
 #ifdef QCA_SUPPORT_SW_TXRX_ENCAP
 	/* restore original hdr offset */
 	OL_TX_RESTORE_HDR(tx_desc, (tx_desc->netbuf));
diff --git a/core/dp/txrx/ol_tx_queue.c b/core/dp/txrx/ol_tx_queue.c
index a894b1c..9ff8fcd 100644
--- a/core/dp/txrx/ol_tx_queue.c
+++ b/core/dp/txrx/ol_tx_queue.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -26,7 +26,7 @@
  */
 
 #include <cdf_nbuf.h>           /* cdf_nbuf_t, etc. */
-#include <cdf_atomic.h>         /* cdf_atomic_read, etc. */
+#include <qdf_atomic.h>         /* qdf_atomic_read, etc. */
 #include <ol_cfg.h>             /* ol_cfg_addba_retry */
 #include <htt.h>                /* HTT_TX_EXT_TID_MGMT */
 #include <ol_htt_tx_api.h>      /* htt_tx_desc_tid */
diff --git a/core/dp/txrx/ol_tx_send.c b/core/dp/txrx/ol_tx_send.c
index e729f02..6ab22ac 100644
--- a/core/dp/txrx/ol_tx_send.c
+++ b/core/dp/txrx/ol_tx_send.c
@@ -25,7 +25,7 @@
  * to the Linux Foundation.
  */
 
-#include <cdf_atomic.h>         /* cdf_atomic_inc, etc. */
+#include <qdf_atomic.h>         /* qdf_atomic_inc, etc. */
 #include <cdf_lock.h>           /* cdf_os_spinlock */
 #include <qdf_time.h>           /* qdf_system_ticks, etc. */
 #include <cdf_nbuf.h>           /* cdf_nbuf_t */
@@ -60,7 +60,7 @@
 
 #define OL_TX_CREDIT_RECLAIM(pdev)					\
 	do {								\
-		if (cdf_atomic_read(&pdev->target_tx_credit)  <		\
+		if (qdf_atomic_read(&pdev->target_tx_credit)  <		\
 		    ol_cfg_tx_credit_lwm(pdev->ctrl_pdev)) {		\
 			ol_osif_ath_tasklet(pdev->osdev);		\
 		}							\
@@ -83,16 +83,16 @@
  * messages.
  */
 #define OL_TX_TARGET_CREDIT_ADJUST(factor, pdev, msdu) \
-	cdf_atomic_add(	\
+	qdf_atomic_add(	\
 		factor * htt_tx_msdu_credit(msdu), &pdev->target_tx_credit)
 #define OL_TX_TARGET_CREDIT_DECR(pdev, msdu) \
 	OL_TX_TARGET_CREDIT_ADJUST(-1, pdev, msdu)
 #define OL_TX_TARGET_CREDIT_INCR(pdev, msdu) \
 	OL_TX_TARGET_CREDIT_ADJUST(1, pdev, msdu)
 #define OL_TX_TARGET_CREDIT_DECR_INT(pdev, delta) \
-	cdf_atomic_add(-1 * delta, &pdev->target_tx_credit)
+	qdf_atomic_add(-1 * delta, &pdev->target_tx_credit)
 #define OL_TX_TARGET_CREDIT_INCR_INT(pdev, delta) \
-	cdf_atomic_add(delta, &pdev->target_tx_credit)
+	qdf_atomic_add(delta, &pdev->target_tx_credit)
 #else
 /*
  * LL does not need to keep track of target credit.
@@ -112,12 +112,12 @@
 	do {								\
 		struct ol_txrx_vdev_t *vdev;				\
 		TAILQ_FOREACH(vdev, &pdev->vdev_list, vdev_list_elem) {	\
-			if (cdf_atomic_read(&vdev->os_q_paused) &&	\
+			if (qdf_atomic_read(&vdev->os_q_paused) &&	\
 			    (vdev->tx_fl_hwm != 0)) {			\
 				cdf_spin_lock(&pdev->tx_mutex);		\
 				if (pdev->tx_desc.num_free >		\
 				    vdev->tx_fl_hwm) {			\
-					cdf_atomic_set(&vdev->os_q_paused, 0); \
+					qdf_atomic_set(&vdev->os_q_paused, 0); \
 					cdf_spin_unlock(&pdev->tx_mutex); \
 					ol_txrx_flow_control_cb(vdev, true);\
 				}					\
@@ -139,8 +139,8 @@
 
 	TX_CREDIT_DEBUG_PRINT("TX %d bytes\n", cdf_nbuf_len(msdu));
 	TX_CREDIT_DEBUG_PRINT(" <HTT> Decrease credit %d - 1 = %d, len:%d.\n",
-			      cdf_atomic_read(&pdev->target_tx_credit),
-			      cdf_atomic_read(&pdev->target_tx_credit) - 1,
+			      qdf_atomic_read(&pdev->target_tx_credit),
+			      qdf_atomic_read(&pdev->target_tx_credit) - 1,
 			      cdf_nbuf_len(msdu));
 
 	msdu_credit_consumed = htt_tx_msdu_credit(msdu);
@@ -312,24 +312,24 @@
 
 	if ((tx_desc->pkt_type != ol_tx_frm_no_free) &&
 	    (tx_desc->pkt_type < OL_TXRX_MGMT_TYPE_BASE)) {
-		cdf_atomic_add(1, &pdev->tx_queue.rsrc_cnt);
+		qdf_atomic_add(1, &pdev->tx_queue.rsrc_cnt);
 		ol_tx_desc_frame_free_nonstd(pdev, tx_desc, status != A_OK);
 	}
 }
 
 void ol_tx_target_credit_init(struct ol_txrx_pdev_t *pdev, int credit_delta)
 {
-	cdf_atomic_add(credit_delta, &pdev->orig_target_tx_credit);
+	qdf_atomic_add(credit_delta, &pdev->orig_target_tx_credit);
 }
 
 void ol_tx_target_credit_update(struct ol_txrx_pdev_t *pdev, int credit_delta)
 {
 	TX_CREDIT_DEBUG_PRINT(" <HTT> Increase credit %d + %d = %d\n",
-			      cdf_atomic_read(&pdev->target_tx_credit),
+			      qdf_atomic_read(&pdev->target_tx_credit),
 			      credit_delta,
-			      cdf_atomic_read(&pdev->target_tx_credit) +
+			      qdf_atomic_read(&pdev->target_tx_credit) +
 			      credit_delta);
-	cdf_atomic_add(credit_delta, &pdev->target_tx_credit);
+	qdf_atomic_add(credit_delta, &pdev->target_tx_credit);
 }
 
 #ifdef QCA_COMPUTE_TX_DELAY
@@ -360,7 +360,7 @@
 #define ol_tx_msdu_complete_single(_pdev, _tx_desc, _netbuf,\
 				   _lcl_freelist, _tx_desc_last)	\
 	do {								\
-		cdf_atomic_init(&(_tx_desc)->ref_cnt);			\
+		qdf_atomic_init(&(_tx_desc)->ref_cnt);			\
 		/* restore orginal hdr offset */			\
 		OL_TX_RESTORE_HDR((_tx_desc), (_netbuf));		\
 		cdf_nbuf_unmap((_pdev)->osdev, (_netbuf), CDF_DMA_TO_DEVICE); \
@@ -453,7 +453,7 @@
 		 * been given to the target to transmit, for which the
 		 * target has never provided a response.
 		 */
-		if (cdf_atomic_read(&tx_desc->ref_cnt)) {
+		if (qdf_atomic_read(&tx_desc->ref_cnt)) {
 			TXRX_PRINT(TXRX_PRINT_LEVEL_WARN,
 				   "Warning: freeing tx frame "
 				   "(no tx completion from the target)\n");
@@ -577,11 +577,11 @@
 	}
 
 	TX_CREDIT_DEBUG_PRINT(" <HTT> Increase credit %d + %d = %d\n",
-			      cdf_atomic_read(&pdev->target_tx_credit),
-			      1, cdf_atomic_read(&pdev->target_tx_credit) + 1);
+			      qdf_atomic_read(&pdev->target_tx_credit),
+			      1, qdf_atomic_read(&pdev->target_tx_credit) + 1);
 
 
-	cdf_atomic_add(1, &pdev->target_tx_credit);
+	qdf_atomic_add(1, &pdev->target_tx_credit);
 }
 
 /* WARNING: ol_tx_inspect_handler()'s bahavior is similar to that of
@@ -620,7 +620,7 @@
 
 #ifndef ATH_11AC_TXCOMPACT
 		/* save this multicast packet to local free list */
-		if (cdf_atomic_dec_and_test(&tx_desc->ref_cnt))
+		if (qdf_atomic_dec_and_test(&tx_desc->ref_cnt))
 #endif
 		{
 			/* for this function only, force htt status to be
@@ -643,9 +643,9 @@
 					   htt_tx_status_discard);
 	}
 	TX_CREDIT_DEBUG_PRINT(" <HTT> Increase HTT credit %d + %d = %d..\n",
-			      cdf_atomic_read(&pdev->target_tx_credit),
+			      qdf_atomic_read(&pdev->target_tx_credit),
 			      num_msdus,
-			      cdf_atomic_read(&pdev->target_tx_credit) +
+			      qdf_atomic_read(&pdev->target_tx_credit) +
 			      num_msdus);
 
 	OL_TX_TARGET_CREDIT_ADJUST(num_msdus, pdev, NULL);
diff --git a/core/dp/txrx/ol_txrx.c b/core/dp/txrx/ol_txrx.c
index f8629ba..282e26c 100644
--- a/core/dp/txrx/ol_txrx.c
+++ b/core/dp/txrx/ol_txrx.c
@@ -31,7 +31,7 @@
 #include <cdf_memory.h>         /* cdf_mem_malloc,free */
 #include <cdf_types.h>          /* cdf_device_t, cdf_print */
 #include <cdf_lock.h>           /* cdf_spinlock */
-#include <cdf_atomic.h>         /* cdf_atomic_read */
+#include <qdf_atomic.h>         /* qdf_atomic_read */
 
 /* Required for WLAN_FEATURE_FASTPATH */
 #include <ce_api.h>
@@ -126,7 +126,7 @@
 	if (!peer)
 		return NULL;
 	*peer_id = peer->local_id;
-	cdf_atomic_dec(&peer->ref_cnt);
+	qdf_atomic_dec(&peer->ref_cnt);
 	return peer;
 }
 
@@ -180,7 +180,7 @@
 	if (!peer)
 		return NULL;
 	*peer_id = peer->local_id;
-	cdf_atomic_dec(&peer->ref_cnt);
+	qdf_atomic_dec(&peer->ref_cnt);
 	return peer;
 }
 
@@ -523,14 +523,14 @@
 	 */
 
 	/* initialize the counter of the target's tx buffer availability */
-	cdf_atomic_init(&pdev->target_tx_credit);
-	cdf_atomic_init(&pdev->orig_target_tx_credit);
+	qdf_atomic_init(&pdev->target_tx_credit);
+	qdf_atomic_init(&pdev->orig_target_tx_credit);
 	/*
 	 * LL - initialize the target credit outselves.
 	 * HL - wait for a HTT target credit initialization during htt_attach.
 	 */
 
-	cdf_atomic_add(ol_cfg_target_tx_credit(pdev->ctrl_pdev),
+	qdf_atomic_add(ol_cfg_target_tx_credit(pdev->ctrl_pdev),
 		   &pdev->target_tx_credit);
 
 	desc_pool_size = ol_tx_get_desc_global_pool_size(pdev);
@@ -638,7 +638,7 @@
 #endif
 #endif
 		c_element->tx_desc.id = i;
-		cdf_atomic_init(&c_element->tx_desc.ref_cnt);
+		qdf_atomic_init(&c_element->tx_desc.ref_cnt);
 		c_element = c_element->next;
 		fail_idx = i;
 	}
@@ -1022,7 +1022,7 @@
 		 * been given to the target to transmit, for which the
 		 * target has never provided a response.
 		 */
-		if (cdf_atomic_read(&tx_desc->ref_cnt)) {
+		if (qdf_atomic_read(&tx_desc->ref_cnt)) {
 			TXRX_PRINT(TXRX_PRINT_LEVEL_WARN,
 				   "Warning: freeing tx frame (no compltn)\n");
 			ol_tx_desc_frame_free_nonstd(pdev,
@@ -1112,8 +1112,8 @@
 			       &vdev->ll_pause.timer,
 			       ol_tx_vdev_ll_pause_queue_send, vdev,
 			       CDF_TIMER_TYPE_SW);
-	cdf_atomic_init(&vdev->os_q_paused);
-	cdf_atomic_set(&vdev->os_q_paused, 0);
+	qdf_atomic_init(&vdev->os_q_paused);
+	qdf_atomic_set(&vdev->os_q_paused, 0);
 	vdev->tx_fl_lwm = 0;
 	vdev->tx_fl_hwm = 0;
 	vdev->wait_on_peer_id = OL_TXRX_INVALID_LOCAL_PEER_ID;
@@ -1267,8 +1267,8 @@
 	ol_rx_callback_fp data_rx = NULL;
 	void *cds_ctx = cds_get_global_context();
 
-	if (cdf_atomic_inc_return(&peer->flush_in_progress) > 1) {
-		cdf_atomic_dec(&peer->flush_in_progress);
+	if (qdf_atomic_inc_return(&peer->flush_in_progress) > 1) {
+		qdf_atomic_dec(&peer->flush_in_progress);
 		return;
 	}
 
@@ -1300,7 +1300,7 @@
 				typeof(*cache_buf), list);
 	}
 	cdf_spin_unlock_bh(&peer->bufq_lock);
-	cdf_atomic_dec(&peer->flush_in_progress);
+	qdf_atomic_dec(&peer->flush_in_progress);
 }
 
 ol_txrx_peer_handle
@@ -1330,7 +1330,7 @@
 				peer_mac_addr[0], peer_mac_addr[1],
 				peer_mac_addr[2], peer_mac_addr[3],
 				peer_mac_addr[4], peer_mac_addr[5]);
-			if (cdf_atomic_read(&temp_peer->delete_in_progress)) {
+			if (qdf_atomic_read(&temp_peer->delete_in_progress)) {
 				vdev->wait_on_peer_id = temp_peer->local_id;
 				qdf_event_create(&vdev->wait_delete_comp);
 				wait_on_deletion = true;
@@ -1387,16 +1387,16 @@
 	cdf_spinlock_init(&peer->peer_info_lock);
 	cdf_spinlock_init(&peer->bufq_lock);
 
-	cdf_atomic_init(&peer->delete_in_progress);
-	cdf_atomic_init(&peer->flush_in_progress);
+	qdf_atomic_init(&peer->delete_in_progress);
+	qdf_atomic_init(&peer->flush_in_progress);
 
-	cdf_atomic_init(&peer->ref_cnt);
+	qdf_atomic_init(&peer->ref_cnt);
 
 	/* keep one reference for attach */
-	cdf_atomic_inc(&peer->ref_cnt);
+	qdf_atomic_inc(&peer->ref_cnt);
 
 	/* keep one reference for ol_rx_peer_map_handler */
-	cdf_atomic_inc(&peer->ref_cnt);
+	qdf_atomic_inc(&peer->ref_cnt);
 
 	peer->valid = 1;
 
@@ -1495,7 +1495,7 @@
 			   "%s: no state change, returns directly\n",
 			   __func__);
 #endif
-		cdf_atomic_dec(&peer->ref_cnt);
+		qdf_atomic_dec(&peer->ref_cnt);
 		return QDF_STATUS_SUCCESS;
 	}
 
@@ -1525,7 +1525,7 @@
 				ol_txrx_peer_tid_unpause(peer, tid);
 		}
 	}
-	cdf_atomic_dec(&peer->ref_cnt);
+	qdf_atomic_dec(&peer->ref_cnt);
 
 	/* Set the state after the Pause to avoid the race condiction
 	   with ADDBA check in tx path */
@@ -1628,7 +1628,7 @@
 		break;
 	}
 	}
-	cdf_atomic_dec(&peer->ref_cnt);
+	qdf_atomic_dec(&peer->ref_cnt);
 }
 
 uint8_t
@@ -1683,7 +1683,7 @@
 	 * (A double-free should never happen, so assert if it does.)
 	 */
 
-	if (0 == cdf_atomic_read(&(peer->ref_cnt))) {
+	if (0 == qdf_atomic_read(&(peer->ref_cnt))) {
 		TXRX_PRINT(TXRX_PRINT_LEVEL_ERR,
 			   "The Peer is not present anymore\n");
 		cdf_assert(0);
@@ -1701,7 +1701,7 @@
 	 * concurrently with the empty check.
 	 */
 	cdf_spin_lock_bh(&pdev->peer_ref_mutex);
-	if (cdf_atomic_dec_and_test(&peer->ref_cnt)) {
+	if (qdf_atomic_dec_and_test(&peer->ref_cnt)) {
 		u_int16_t peer_id;
 
 		TXRX_PRINT(TXRX_PRINT_LEVEL_ERR,
@@ -1722,7 +1722,7 @@
 		ol_rx_peer_cleanup(vdev, peer);
 
 		/* peer is removed from peer_list */
-		cdf_atomic_set(&peer->delete_in_progress, 0);
+		qdf_atomic_set(&peer->delete_in_progress, 0);
 
 		/*
 		 * Set wait_delete_comp event if the current peer id matches
@@ -1834,7 +1834,7 @@
 	cdf_spinlock_destroy(&peer->bufq_lock);
 	/* set delete_in_progress to identify that wma
 	 * is waiting for unmap massage for this peer */
-	cdf_atomic_set(&peer->delete_in_progress, 1);
+	qdf_atomic_set(&peer->delete_in_progress, 1);
 	/*
 	 * Remove the reference added during peer_attach.
 	 * The peer will still be left allocated until the
@@ -1956,8 +1956,8 @@
 void ol_txrx_discard_tx_pending(ol_txrx_pdev_handle pdev_handle)
 {
 	ol_tx_desc_list tx_descs;
-	/* First let hif do the cdf_atomic_dec_and_test(&tx_desc->ref_cnt)
-	 * then let htt do the cdf_atomic_dec_and_test(&tx_desc->ref_cnt)
+	/* First let hif do the qdf_atomic_dec_and_test(&tx_desc->ref_cnt)
+	 * then let htt do the qdf_atomic_dec_and_test(&tx_desc->ref_cnt)
 	 * which is tha same with normal data send complete path*/
 	htt_tx_pending_discard(pdev_handle->htt_pdev);
 
@@ -2672,7 +2672,7 @@
 		vdev->tx_fl_hwm =
 			(uint16_t) (low_watermark + high_watermark_offset);
 		/* Not enough free resource, stop TX OS Q */
-		cdf_atomic_set(&vdev->os_q_paused, 1);
+		qdf_atomic_set(&vdev->os_q_paused, 1);
 		cdf_spin_unlock_bh(&vdev->pdev->tx_mutex);
 		return false;
 	}
diff --git a/core/dp/txrx/ol_txrx_flow_control.c b/core/dp/txrx/ol_txrx_flow_control.c
index 77fd41e..cd352e1 100644
--- a/core/dp/txrx/ol_txrx_flow_control.c
+++ b/core/dp/txrx/ol_txrx_flow_control.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2015-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -27,7 +27,7 @@
 
 /* OS abstraction libraries */
 #include <cdf_nbuf.h>           /* cdf_nbuf_t, etc. */
-#include <cdf_atomic.h>         /* cdf_atomic_read, etc. */
+#include <cdf_atomic.h>         /* qdf_atomic_read, etc. */
 #include <cdf_util.h>           /* cdf_unlikely */
 
 /* APIs for other modules */
diff --git a/core/dp/txrx/ol_txrx_internal.h b/core/dp/txrx/ol_txrx_internal.h
index 30315e6..85da268 100644
--- a/core/dp/txrx/ol_txrx_internal.h
+++ b/core/dp/txrx/ol_txrx_internal.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -48,9 +48,9 @@
 #define OL_TX_DESC_REF_INC(tx_desc)     /* no-op */
 #else
 #define OL_TX_DESC_NO_REFS(tx_desc) \
-	cdf_atomic_dec_and_test(&tx_desc->ref_cnt)
-#define OL_TX_DESC_REF_INIT(tx_desc) cdf_atomic_init(&tx_desc->ref_cnt)
-#define OL_TX_DESC_REF_INC(tx_desc) cdf_atomic_inc(&tx_desc->ref_cnt)
+	qdf_atomic_dec_and_test(&tx_desc->ref_cnt)
+#define OL_TX_DESC_REF_INIT(tx_desc) qdf_atomic_init(&tx_desc->ref_cnt)
+#define OL_TX_DESC_REF_INC(tx_desc) qdf_atomic_inc(&tx_desc->ref_cnt)
 #endif
 
 #ifndef TXRX_ASSERT_LEVEL
diff --git a/core/dp/txrx/ol_txrx_peer_find.c b/core/dp/txrx/ol_txrx_peer_find.c
index 6422ed4..495afa0 100644
--- a/core/dp/txrx/ol_txrx_peer_find.c
+++ b/core/dp/txrx/ol_txrx_peer_find.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -194,7 +194,7 @@
 		    && peer->vdev == vdev) {
 			/* found it - increment the ref count before releasing
 			   the lock */
-			cdf_atomic_inc(&peer->ref_cnt);
+			qdf_atomic_inc(&peer->ref_cnt);
 			cdf_spin_unlock_bh(&pdev->peer_ref_mutex);
 			return peer;
 		}
@@ -226,7 +226,7 @@
 		    0 && (check_valid == 0 || peer->valid)) {
 			/* found it - increment the ref count before
 			   releasing the lock */
-			cdf_atomic_inc(&peer->ref_cnt);
+			qdf_atomic_inc(&peer->ref_cnt);
 			cdf_spin_unlock_bh(&pdev->peer_ref_mutex);
 			return peer;
 		}
@@ -290,8 +290,8 @@
 				 * 1, so it will get deleted by
 				 * ol_txrx_peer_unref_delete.
 				 */
-				cdf_atomic_init(&peer->ref_cnt); /* set to 0 */
-				cdf_atomic_inc(&peer->ref_cnt); /* incr to 1 */
+				qdf_atomic_init(&peer->ref_cnt); /* set to 0 */
+				qdf_atomic_inc(&peer->ref_cnt); /* incr to 1 */
 				TXRX_PRINT(TXRX_PRINT_LEVEL_ERR,
 					   "%s: Delete Peer %p\n", __func__,
 					   peer);
@@ -441,7 +441,7 @@
 	 */
 	if (vdev->last_real_peer
 	    && vdev->last_real_peer->peer_ids[0] != HTT_INVALID_PEER_ID) {
-		cdf_atomic_inc(&vdev->last_real_peer->ref_cnt);
+		qdf_atomic_inc(&vdev->last_real_peer->ref_cnt);
 		peer = vdev->last_real_peer;
 	} else {
 		peer = NULL;
diff --git a/core/dp/txrx/ol_txrx_types.h b/core/dp/txrx/ol_txrx_types.h
index da06c7d..7c0bc80 100644
--- a/core/dp/txrx/ol_txrx_types.h
+++ b/core/dp/txrx/ol_txrx_types.h
@@ -37,7 +37,7 @@
 #include <cds_queue.h>          /* TAILQ */
 #include <a_types.h>            /* A_UINT8 */
 #include <htt.h>                /* htt_sec_type, htt_pkt_type, etc. */
-#include <cdf_atomic.h>         /* cdf_atomic_t */
+#include <qdf_atomic.h>         /* qdf_atomic_t */
 #include <wdi_event_api.h>      /* wdi_event_subscribe */
 #include <cdf_softirq_timer.h>  /* cdf_softirq_timer_t */
 #include <cdf_lock.h>           /* cdf_spinlock */
@@ -133,7 +133,7 @@
 	cdf_dma_addr_t htt_tx_desc_paddr;
 	void *htt_frag_desc; /* struct msdu_ext_desc_t * */
 	cdf_dma_addr_t htt_frag_desc_paddr;
-	cdf_atomic_t ref_cnt;
+	qdf_atomic_t ref_cnt;
 	enum htt_tx_status status;
 
 #ifdef QCA_COMPUTE_TX_DELAY
@@ -497,8 +497,8 @@
 	 * track of roughly how much space is available in the target for
 	 * tx frames
 	 */
-	cdf_atomic_t target_tx_credit;
-	cdf_atomic_t orig_target_tx_credit;
+	qdf_atomic_t target_tx_credit;
+	qdf_atomic_t orig_target_tx_credit;
 
 	/* Peer mac address to staid mapping */
 	struct ol_mac_addr mac_to_staid[WLAN_MAX_STA_COUNT + 3];
@@ -677,7 +677,7 @@
 	 * conditional compilation.
 	 */
 	struct {
-		cdf_atomic_t rsrc_cnt;
+		qdf_atomic_t rsrc_cnt;
 		/* threshold_lo - when to start tx desc margin replenishment */
 		uint16_t rsrc_threshold_lo;
 		/* threshold_hi - where to stop during tx desc margin
@@ -842,7 +842,7 @@
 		uint32_t q_overflow_cnt;
 	} ll_pause;
 	bool disable_intrabss_fwd;
-	cdf_atomic_t os_q_paused;
+	qdf_atomic_t os_q_paused;
 	uint16_t tx_fl_lwm;
 	uint16_t tx_fl_hwm;
 	cdf_spinlock_t flow_control_lock;
@@ -910,9 +910,9 @@
 struct ol_txrx_peer_t {
 	struct ol_txrx_vdev_t *vdev;
 
-	cdf_atomic_t ref_cnt;
-	cdf_atomic_t delete_in_progress;
-	cdf_atomic_t flush_in_progress;
+	qdf_atomic_t ref_cnt;
+	qdf_atomic_t delete_in_progress;
+	qdf_atomic_t flush_in_progress;
 
 	/* The peer state tracking is used for HL systems
 	 * that don't support tx and rx filtering within the target.
@@ -985,7 +985,7 @@
 	uint8_t keyinstalled;
 
 	/* Bit to indicate if PN check is done in fw */
-	cdf_atomic_t fw_pn_check;
+	qdf_atomic_t fw_pn_check;
 
 #ifdef WLAN_FEATURE_11W
 	/* PN counter for Robust Management Frames */
diff --git a/core/utils/epping/inc/epping_internal.h b/core/utils/epping/inc/epping_internal.h
index 0ea5d52..2e03fd5 100644
--- a/core/utils/epping/inc/epping_internal.h
+++ b/core/utils/epping/inc/epping_internal.h
@@ -50,7 +50,7 @@
 #include "htc_api.h"
 #include "htc_packet.h"
 #include "epping_test.h"
-#include <cdf_atomic.h>
+#include <qdf_atomic.h>
 #include <sir_mac_prot_def.h>
 #include <sir_debug.h>
 
@@ -68,7 +68,7 @@
    -------------------------------------------------------------------------*/
 #define EPPING_MAX_ADAPTERS             1
 
-#define EPPING_LOG(level, args ...) CDF_TRACE( CDF_MODULE_ID_HDD, level, ## args)
+#define EPPING_LOG(level, args ...) CDF_TRACE(CDF_MODULE_ID_HDD, level, ## args)
 
 struct epping_cookie {
 	HTC_PACKET HtcPkt;      /* HTC packet wrapper */
@@ -100,7 +100,7 @@
 	HTC_ENDPOINT_ID eid;
 	struct semaphore sem;
 	bool inited;
-	cdf_atomic_t atm;
+	qdf_atomic_t atm;
 } epping_poll_t;
 #endif
 
diff --git a/core/wma/inc/wma.h b/core/wma/inc/wma.h
index eb38ae5..fd1548b 100644
--- a/core/wma/inc/wma.h
+++ b/core/wma/inc/wma.h
@@ -765,7 +765,7 @@
 	A_UINT32 requestor_id;
 	A_UINT32 disable_hw_ack;
 	wmi_channel chan;
-	cdf_atomic_t hidden_ssid_restart_in_progress;
+	qdf_atomic_t hidden_ssid_restart_in_progress;
 	uint8_t ssidHidden;
 } vdev_restart_params_t;
 
@@ -870,7 +870,7 @@
 	tAniGetPEStatsRsp *stats_rsp;
 	uint8_t fw_stats_set;
 	void *del_staself_req;
-	cdf_atomic_t bss_status;
+	qdf_atomic_t bss_status;
 	uint8_t rate_flags;
 	uint8_t nss;
 	bool is_channel_switch;
@@ -1273,7 +1273,7 @@
 #endif
 	cdf_wake_lock_t wow_wake_lock;
 	int wow_nack;
-	cdf_atomic_t is_wow_bus_suspended;
+	qdf_atomic_t is_wow_bus_suspended;
 	cdf_mc_timer_t wma_scan_comp_timer;
 	uint8_t dfs_phyerr_filter_offload;
 	bool suitable_ap_hb_failure;
@@ -1301,7 +1301,7 @@
 	struct dbs_hw_mode_info hw_mode;
 	uint32_t old_hw_mode_index;
 	uint32_t new_hw_mode_index;
-	cdf_atomic_t scan_id_counter;
+	qdf_atomic_t scan_id_counter;
 	wma_peer_authorized_fp peer_authorized_cb;
 	uint32_t num_of_diag_events_logs;
 	uint32_t *events_logs_list;
diff --git a/core/wma/inc/wma_internal.h b/core/wma/inc/wma_internal.h
index 0a7a646..66015f6 100644
--- a/core/wma/inc/wma_internal.h
+++ b/core/wma/inc/wma_internal.h
@@ -985,7 +985,7 @@
 static inline int wma_get_wow_bus_suspend(tp_wma_handle wma)
 {
 
-	return cdf_atomic_read(&wma->is_wow_bus_suspended);
+	return qdf_atomic_read(&wma->is_wow_bus_suspended);
 }
 
 QDF_STATUS wma_resume_req(tp_wma_handle wma, enum cdf_suspend_type type);
diff --git a/core/wma/src/wma_dev_if.c b/core/wma/src/wma_dev_if.c
index 0c92e0c..2372a7a 100644
--- a/core/wma/src/wma_dev_if.c
+++ b/core/wma/src/wma_dev_if.c
@@ -688,7 +688,7 @@
 	uint8_t vdev_id = pdel_sta_self_req_param->session_id;
 	struct wma_txrx_node *iface = &wma_handle->interfaces[vdev_id];
 
-	if (cdf_atomic_read(&iface->bss_status) == WMA_BSS_STATUS_STARTED) {
+	if (qdf_atomic_read(&iface->bss_status) == WMA_BSS_STATUS_STARTED) {
 		WMA_LOGA("BSS is not yet stopped. Defering vdev(vdev id %x) deletion",
 			vdev_id);
 		iface->del_staself_req = pdel_sta_self_req_param;
@@ -812,7 +812,7 @@
 		}
 		bcn->seq_no = MIN_SW_SEQ;
 		cdf_spinlock_init(&bcn->lock);
-		cdf_atomic_set(&wma->interfaces[resp_event->vdev_id].bss_status,
+		qdf_atomic_set(&wma->interfaces[resp_event->vdev_id].bss_status,
 			       WMA_BSS_STATUS_STARTED);
 		WMA_LOGD("%s: AP mode (type %d subtype %d) BSS is started",
 			 __func__, wma->interfaces[resp_event->vdev_id].type,
@@ -951,7 +951,7 @@
 	}
 
 	if ((resp_event->vdev_id <= wma->max_bssid) &&
-	    (cdf_atomic_read
+	    (qdf_atomic_read
 		(&wma->interfaces[resp_event->vdev_id].vdev_restart_params.hidden_ssid_restart_in_progress))
 	    && (wma_is_vdev_in_ap_mode(wma, resp_event->vdev_id) == true)) {
 		WMA_LOGE("%s: vdev restart event recevied for hidden ssid set using IOCTL",
@@ -963,7 +963,7 @@
 			WMA_LOGE("%s : failed to send vdev up", __func__);
 			return -EEXIST;
 		}
-		cdf_atomic_set(&wma->interfaces[resp_event->vdev_id].
+		qdf_atomic_set(&wma->interfaces[resp_event->vdev_id].
 			       vdev_restart_params.
 			       hidden_ssid_restart_in_progress, 0);
 		wma->interfaces[resp_event->vdev_id].vdev_up = true;
@@ -1409,7 +1409,7 @@
 	TAILQ_FOREACH_REVERSE(peer, &vdev->peer_list, peer_list_t, peer_list_elem) {
 		if (temp) {
 			cdf_spin_unlock_bh(&vdev->pdev->peer_ref_mutex);
-			if (cdf_atomic_read(&temp->delete_in_progress) == 0) {
+			if (qdf_atomic_read(&temp->delete_in_progress) == 0) {
 				wma_remove_peer(wma, temp->mac_addr.raw,
 					vdev_id, temp, false);
 			}
@@ -1480,7 +1480,7 @@
 			      peer_list_elem) {
 		if (temp) {
 			cdf_spin_unlock_bh(&vdev->pdev->peer_ref_mutex);
-			if (cdf_atomic_read(&temp->delete_in_progress) == 0) {
+			if (qdf_atomic_read(&temp->delete_in_progress) == 0) {
 				wma_remove_peer(wma, temp->mac_addr.raw,
 						vdev_id, temp, false);
 			}
@@ -1598,7 +1598,7 @@
 	buf = wmi_buf_alloc(wma_handle->wmi_handle, len);
 	if (!buf) {
 		WMA_LOGE("%s : wmi_buf_alloc failed", __func__);
-		cdf_atomic_set(&intr[sessionId].vdev_restart_params.
+		qdf_atomic_set(&intr[sessionId].vdev_restart_params.
 			       hidden_ssid_restart_in_progress, 0);
 		return;
 	}
@@ -1649,7 +1649,7 @@
 				   WMI_VDEV_RESTART_REQUEST_CMDID);
 	if (ret < 0) {
 		WMA_LOGE("%s: Failed to send vdev restart command", __func__);
-		cdf_atomic_set(&intr[sessionId].vdev_restart_params.
+		qdf_atomic_set(&intr[sessionId].vdev_restart_params.
 			       hidden_ssid_restart_in_progress, 0);
 		cdf_nbuf_free(buf);
 	}
@@ -1692,7 +1692,7 @@
 	resp_event = param_buf->fixed_param;
 
 	if ((resp_event->vdev_id <= wma->max_bssid) &&
-	    (cdf_atomic_read
+	    (qdf_atomic_read
 		     (&wma->interfaces[resp_event->vdev_id].vdev_restart_params.
 		     hidden_ssid_restart_in_progress))
 	    && ((wma->interfaces[resp_event->vdev_id].type == WMI_VDEV_TYPE_AP)
@@ -1770,7 +1770,7 @@
 		ol_txrx_vdev_unpause(iface->handle,
 				     OL_TXQ_PAUSE_REASON_VDEV_STOP);
 		iface->pause_bitmap &= ~(1 << PAUSE_TYPE_HOST);
-		cdf_atomic_set(&iface->bss_status, WMA_BSS_STATUS_STOPPED);
+		qdf_atomic_set(&iface->bss_status, WMA_BSS_STATUS_STOPPED);
 		WMA_LOGD("%s: (type %d subtype %d) BSS is stopped",
 			 __func__, iface->type, iface->sub_type);
 		bcn = wma->interfaces[resp_event->vdev_id].beacon;
@@ -1942,7 +1942,7 @@
 		self_sta_req->type;
 	wma_handle->interfaces[self_sta_req->session_id].sub_type =
 		self_sta_req->sub_type;
-	cdf_atomic_init(&wma_handle->interfaces
+	qdf_atomic_init(&wma_handle->interfaces
 			[self_sta_req->session_id].bss_status);
 
 	if (((self_sta_req->type == WMI_VDEV_TYPE_AP) &&
@@ -2777,7 +2777,7 @@
 		ol_txrx_vdev_unpause(iface->handle,
 				     OL_TXQ_PAUSE_REASON_VDEV_STOP);
 		iface->pause_bitmap &= ~(1 << PAUSE_TYPE_HOST);
-		cdf_atomic_set(&iface->bss_status, WMA_BSS_STATUS_STOPPED);
+		qdf_atomic_set(&iface->bss_status, WMA_BSS_STATUS_STOPPED);
 		WMA_LOGD("%s: (type %d subtype %d) BSS is stopped",
 			 __func__, iface->type, iface->sub_type);
 
@@ -4149,7 +4149,7 @@
 	if (params->nonRoamReassoc) {
 		ol_txrx_peer_state_update(pdev, params->bssId,
 					  ol_txrx_peer_state_auth);
-		cdf_atomic_set(&iface->bss_status, WMA_BSS_STATUS_STARTED);
+		qdf_atomic_set(&iface->bss_status, WMA_BSS_STATUS_STARTED);
 		iface->aid = params->assocId;
 		goto out;
 	}
@@ -4188,7 +4188,7 @@
 			 * following which are useful for LFR3.0.*/
 			ol_txrx_peer_state_update(pdev, params->bssId,
 						  ol_txrx_peer_state_auth);
-			cdf_atomic_set(&iface->bss_status,
+			qdf_atomic_set(&iface->bss_status,
 				       WMA_BSS_STATUS_STARTED);
 			iface->aid = params->assocId;
 			WMA_LOGE("LFR3:statype %d vdev %d aid %d bssid %pM",
@@ -4294,7 +4294,7 @@
 		wma->interfaces[params->smesessionId].vdev_up = true;
 	}
 
-	cdf_atomic_set(&iface->bss_status, WMA_BSS_STATUS_STARTED);
+	qdf_atomic_set(&iface->bss_status, WMA_BSS_STATUS_STARTED);
 	WMA_LOGD("%s: STA mode (type %d subtype %d) BSS is started",
 		 __func__, iface->type, iface->sub_type);
 	/* Sta is now associated, configure various params */
diff --git a/core/wma/src/wma_features.c b/core/wma/src/wma_features.c
index dee39dd..5773643 100644
--- a/core/wma/src/wma_features.c
+++ b/core/wma/src/wma_features.c
@@ -3102,7 +3102,7 @@
 static inline void wma_set_wow_bus_suspend(tp_wma_handle wma, int val)
 {
 
-	cdf_atomic_set(&wma->is_wow_bus_suspended, val);
+	qdf_atomic_set(&wma->is_wow_bus_suspended, val);
 }
 
 
diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c
index 28b98cd..76ae27d 100644
--- a/core/wma/src/wma_main.c
+++ b/core/wma/src/wma_main.c
@@ -1840,8 +1840,8 @@
 	qdf_list_create(&wma_handle->wma_hold_req_queue,
 		      MAX_ENTRY_HOLD_REQ_QUEUE);
 	cdf_spinlock_init(&wma_handle->wma_hold_req_q_lock);
-	cdf_atomic_init(&wma_handle->is_wow_bus_suspended);
-	cdf_atomic_init(&wma_handle->scan_id_counter);
+	qdf_atomic_init(&wma_handle->is_wow_bus_suspended);
+	qdf_atomic_init(&wma_handle->scan_id_counter);
 
 	/* Register vdev start response event handler */
 	wmi_unified_register_event_handler(wma_handle->wmi_handle,
diff --git a/core/wma/src/wma_mgmt.c b/core/wma/src/wma_mgmt.c
index e38234e..02cbc2e 100644
--- a/core/wma/src/wma_mgmt.c
+++ b/core/wma/src/wma_mgmt.c
@@ -2873,7 +2873,7 @@
 	}
 
 	intr[pReq->sessionId].vdev_restart_params.ssidHidden = pReq->ssidHidden;
-	cdf_atomic_set(&intr[pReq->sessionId].vdev_restart_params.
+	qdf_atomic_set(&intr[pReq->sessionId].vdev_restart_params.
 		       hidden_ssid_restart_in_progress, 1);
 
 	/* vdev stop -> vdev restart -> vdev up */
@@ -2885,7 +2885,7 @@
 							(1 << PAUSE_TYPE_HOST);
 	if (wmi_unified_vdev_stop_send(wma_handle->wmi_handle, pReq->sessionId)) {
 		WMA_LOGE("%s: %d Failed to send vdev stop", __func__, __LINE__);
-		cdf_atomic_set(&intr[pReq->sessionId].vdev_restart_params.
+		qdf_atomic_set(&intr[pReq->sessionId].vdev_restart_params.
 			       hidden_ssid_restart_in_progress, 0);
 		return;
 	}
diff --git a/core/wma/src/wma_scan_roam.c b/core/wma/src/wma_scan_roam.c
index 66920c8..6dff2ec 100644
--- a/core/wma/src/wma_scan_roam.c
+++ b/core/wma/src/wma_scan_roam.c
@@ -6820,7 +6820,7 @@
 	}
 
 	/* host need to cycle through the lower 12 bits to generate ids */
-	*scan_id = cdf_atomic_inc_return(&wma->scan_id_counter) &
+	*scan_id = qdf_atomic_inc_return(&wma->scan_id_counter) &
 			WMA_SCAN_ID_MASK;
 	/*
 	 * Firmware expects the host scan request id appended
diff --git a/core/wmi/wmi_unified.c b/core/wmi/wmi_unified.c
index 4daab40..8bf451c 100644
--- a/core/wmi/wmi_unified.c
+++ b/core/wmi/wmi_unified.c
@@ -802,7 +802,7 @@
 	if (wmi_get_runtime_pm_inprogress(wmi_handle)) {
 		if (wmi_is_runtime_pm_cmd(cmd_id))
 			htc_tag = HTC_TX_PACKET_TAG_AUTO_PM;
-	} else if (cdf_atomic_read(&wmi_handle->is_target_suspended) &&
+	} else if (qdf_atomic_read(&wmi_handle->is_target_suspended) &&
 	    ((WMI_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID != cmd_id) &&
 	     (WMI_PDEV_RESUME_CMDID != cmd_id))) {
 		pr_err("%s: Target is suspended  could not send WMI command\n",
@@ -832,13 +832,13 @@
 
 	WMI_SET_FIELD(cdf_nbuf_data(buf), WMI_CMD_HDR, COMMANDID, cmd_id);
 
-	cdf_atomic_inc(&wmi_handle->pending_cmds);
-	if (cdf_atomic_read(&wmi_handle->pending_cmds) >= WMI_MAX_CMDS) {
+	qdf_atomic_inc(&wmi_handle->pending_cmds);
+	if (qdf_atomic_read(&wmi_handle->pending_cmds) >= WMI_MAX_CMDS) {
 		scn = cds_get_context(CDF_MODULE_ID_HIF);
 		pr_err("\n%s: hostcredits = %d\n", __func__,
 		       wmi_get_host_credits(wmi_handle));
 		htc_dump_counter_info(wmi_handle->htc_handle);
-		cdf_atomic_dec(&wmi_handle->pending_cmds);
+		qdf_atomic_dec(&wmi_handle->pending_cmds);
 		pr_err("%s: MAX 1024 WMI Pending cmds reached.\n", __func__);
 		CDF_BUG(0);
 		return -EBUSY;
@@ -846,7 +846,7 @@
 
 	pkt = cdf_mem_malloc(sizeof(*pkt));
 	if (!pkt) {
-		cdf_atomic_dec(&wmi_handle->pending_cmds);
+		qdf_atomic_dec(&wmi_handle->pending_cmds);
 		pr_err("%s, Failed to alloc htc packet %x, no memory\n",
 		       __func__, cmd_id);
 		return -ENOMEM;
@@ -879,7 +879,7 @@
 	status = htc_send_pkt(wmi_handle->htc_handle, pkt);
 
 	if (A_OK != status) {
-		cdf_atomic_dec(&wmi_handle->pending_cmds);
+		qdf_atomic_dec(&wmi_handle->pending_cmds);
 		pr_err("%s %d, htc_send_pkt failed\n", __func__, __LINE__);
 	}
 
@@ -1193,7 +1193,7 @@
  */
 void wmi_runtime_pm_init(struct wmi_unified *wmi_handle)
 {
-	cdf_atomic_init(&wmi_handle->runtime_pm_inprogress);
+	qdf_atomic_init(&wmi_handle->runtime_pm_inprogress);
 }
 #else
 void wmi_runtime_pm_init(struct wmi_unified *wmi_handle)
@@ -1215,8 +1215,8 @@
 	}
 	OS_MEMZERO(wmi_handle, sizeof(struct wmi_unified));
 	wmi_handle->scn_handle = scn_handle;
-	cdf_atomic_init(&wmi_handle->pending_cmds);
-	cdf_atomic_init(&wmi_handle->is_target_suspended);
+	qdf_atomic_init(&wmi_handle->pending_cmds);
+	qdf_atomic_init(&wmi_handle->is_target_suspended);
 	wmi_runtime_pm_init(wmi_handle);
 	cdf_spinlock_init(&wmi_handle->eventq_lock);
 	cdf_nbuf_queue_init(&wmi_handle->event_queue);
@@ -1313,7 +1313,7 @@
 #endif
 	cdf_nbuf_free(wmi_cmd_buf);
 	cdf_mem_free(htc_pkt);
-	cdf_atomic_dec(&wmi_handle->pending_cmds);
+	qdf_atomic_dec(&wmi_handle->pending_cmds);
 }
 
 int
@@ -1369,22 +1369,22 @@
 
 int wmi_get_pending_cmds(wmi_unified_t wmi_handle)
 {
-	return cdf_atomic_read(&wmi_handle->pending_cmds);
+	return qdf_atomic_read(&wmi_handle->pending_cmds);
 }
 
 void wmi_set_target_suspend(wmi_unified_t wmi_handle, A_BOOL val)
 {
-	cdf_atomic_set(&wmi_handle->is_target_suspended, val);
+	qdf_atomic_set(&wmi_handle->is_target_suspended, val);
 }
 
 #ifdef FEATURE_RUNTIME_PM
 void wmi_set_runtime_pm_inprogress(wmi_unified_t wmi_handle, A_BOOL val)
 {
-	cdf_atomic_set(&wmi_handle->runtime_pm_inprogress, val);
+	qdf_atomic_set(&wmi_handle->runtime_pm_inprogress, val);
 }
 
 inline bool wmi_get_runtime_pm_inprogress(wmi_unified_t wmi_handle)
 {
-	return cdf_atomic_read(&wmi_handle->runtime_pm_inprogress);
+	return qdf_atomic_read(&wmi_handle->runtime_pm_inprogress);
 }
 #endif
diff --git a/core/wmi/wmi_unified_priv.h b/core/wmi/wmi_unified_priv.h
index 293480d..3787a94 100644
--- a/core/wmi/wmi_unified_priv.h
+++ b/core/wmi/wmi_unified_priv.h
@@ -34,7 +34,7 @@
 #include "a_types.h"
 #include "wmi.h"
 #include "wmi_unified.h"
-#include "cdf_atomic.h"
+#include "qdf_atomic.h"
 
 #define WMI_UNIFIED_MAX_EVENT 0x100
 #define WMI_MAX_CMDS  1024
@@ -69,7 +69,7 @@
 
 struct wmi_unified {
 	ol_scn_t scn_handle;    /* handle to device */
-	cdf_atomic_t pending_cmds;
+	qdf_atomic_t pending_cmds;
 	HTC_ENDPOINT_ID wmi_endpoint_id;
 	uint16_t max_msg_len;
 	WMI_EVT_ID event_id[WMI_UNIFIED_MAX_EVENT];
@@ -88,10 +88,10 @@
 	cdf_spinlock_t wmi_record_lock;
 #endif /*WMI_INTERFACE_EVENT_LOGGING */
 
-	cdf_atomic_t is_target_suspended;
+	qdf_atomic_t is_target_suspended;
 
 #ifdef FEATURE_RUNTIME_PM
-	cdf_atomic_t runtime_pm_inprogress;
+	qdf_atomic_t runtime_pm_inprogress;
 #endif
 
 	int (*wma_process_fw_event_handler_cbk)(struct wmi_unified *wmi_handle,