DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] drivers: use common container_of macro
@ 2024-02-13 15:37 David Marchand
  2024-02-13 16:57 ` Tyler Retzlaff
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: David Marchand @ 2024-02-13 15:37 UTC (permalink / raw)
  To: dev; +Cc: Rahul Lakkireddy, Yuying Zhang, Rosen Xu

rte_common.h provides container_of if none is defined.

The drivers headers touched by this commit either already include
rte_common.h or use some other common macro defined in rte_common.h.
As a consequence, it seems safe to assume that container_of is always
available for includers of those headers.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/net/cxgbe/cxgbe_compat.h      | 6 ------
 drivers/net/i40e/i40e_rxtx.h          | 5 -----
 drivers/raw/ifpga/base/ifpga_compat.h | 5 -----
 3 files changed, 16 deletions(-)

diff --git a/drivers/net/cxgbe/cxgbe_compat.h b/drivers/net/cxgbe/cxgbe_compat.h
index 0b02eb62a9..e74d476f6d 100644
--- a/drivers/net/cxgbe/cxgbe_compat.h
+++ b/drivers/net/cxgbe/cxgbe_compat.h
@@ -135,12 +135,6 @@ typedef uint64_t  dma_addr_t;
  */
 #define cxgbe_roundup(_p, _s) (((unsigned long)(_p) + (_s - 1)) & ~(_s - 1))
 
-#ifndef container_of
-#define container_of(ptr, type, member) ({ \
-		typeof(((type *)0)->member)(*__mptr) = (ptr); \
-		(type *)((char *)__mptr - offsetof(type, member)); })
-#endif
-
 #define ARRAY_SIZE(arr) RTE_DIM(arr)
 
 #define cpu_to_be16(o) rte_cpu_to_be_16(o)
diff --git a/drivers/net/i40e/i40e_rxtx.h b/drivers/net/i40e/i40e_rxtx.h
index b191f23e1f..a3a53ffce4 100644
--- a/drivers/net/i40e/i40e_rxtx.h
+++ b/drivers/net/i40e/i40e_rxtx.h
@@ -45,11 +45,6 @@
 #define I40E_RX_DESC_EXT_STATUS_FLEXBL_MASK   0x03
 #define I40E_RX_DESC_EXT_STATUS_FLEXBL_FLEX   0x01
 
-#undef container_of
-#define container_of(ptr, type, member) ({ \
-		typeof(((type *)0)->member)(*__mptr) = (ptr); \
-		(type *)((char *)__mptr - offsetof(type, member)); })
-
 #define I40E_TD_CMD (I40E_TX_DESC_CMD_ICRC |\
 		     I40E_TX_DESC_CMD_EOP)
 
diff --git a/drivers/raw/ifpga/base/ifpga_compat.h b/drivers/raw/ifpga/base/ifpga_compat.h
index cdeca70ca5..8a624d174f 100644
--- a/drivers/raw/ifpga/base/ifpga_compat.h
+++ b/drivers/raw/ifpga/base/ifpga_compat.h
@@ -7,11 +7,6 @@
 
 #include "opae_osdep.h"
 
-#undef container_of
-#define container_of(ptr, type, member) ({ \
-		typeof(((type *)0)->member)(*__mptr) = (ptr); \
-		(type *)((char *)__mptr - offsetof(type, member)); })
-
 #define IFPGA_PAGE_SHIFT       12
 #define IFPGA_PAGE_SIZE        (1 << IFPGA_PAGE_SHIFT)
 #define IFPGA_PAGE_MASK        (~(IFPGA_PAGE_SIZE - 1))
-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-02-14 12:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-13 15:37 [PATCH] drivers: use common container_of macro David Marchand
2024-02-13 16:57 ` Tyler Retzlaff
2024-02-14  2:18 ` fengchengwen
2024-02-14 12:20 ` David Marchand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).