Jelajahi Sumber

qcacld-3.0: Re-use qdf defined macros instead of redefine

Refer qdf_container_of() for GET_BASE_ADDR() and
qdf_offsetof() for GET_FIELD_OFFSET()

Change-Id: I15a9dff070e5fcbde504a7722e99d8d3b0b64b4f
CRs-Fixed: 3187194
Vishal Miskin 2 tahun lalu
induk
melakukan
a16245bd79
1 mengubah file dengan 5 tambahan dan 4 penghapusan
  1. 5 4
      core/sme/inc/csr_link_list.h

+ 5 - 4
core/sme/inc/csr_link_list.h

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2011-2012, 2014-2016, 2018-2019, 2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -29,6 +30,7 @@
 #include "qdf_mc_timer.h"
 #include "cds_api.h"
 #include "sir_types.h"
+#include "qdf_util.h"
 
 #define LL_ACCESS_LOCK          true
 #define LL_ACCESS_NOLOCK        false
@@ -55,11 +57,10 @@ typedef struct tagDblLinkList {
  * To get the address of an object of (type) base on the (address)
  * of one of its (field)
  */
-#define GET_BASE_ADDR(address, type, field) ((type *)( \
-			(uint8_t *)(address) - \
-			(uint8_t *)(&((type *)0)->field)))
+#define GET_BASE_ADDR(address, type, field) \
+	(qdf_container_of(address, type, field))
 /* To get the offset of (field) inside structure (type) */
-#define GET_FIELD_OFFSET(type, field)  ((uintptr_t)(&(((type *)0)->field)))
+#define GET_FIELD_OFFSET(type, field)  (qdf_offsetof(type, field))
 #define GET_ROUND_UP(_Field, _Boundary) \
 	(((_Field) + ((_Boundary) - 1))  & ~((_Boundary) - 1))
 #define csrIsListEmpty(pHead) ((pHead)->next == (pHead))