From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>,
Yuying Zhang <Yuying.Zhang@intel.com>,
Rosen Xu <rosen.xu@intel.com>
Subject: [PATCH] drivers: use common container_of macro
Date: Tue, 13 Feb 2024 16:37:41 +0100 [thread overview]
Message-ID: <20240213153741.2133915-1-david.marchand@redhat.com> (raw)
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
next reply other threads:[~2024-02-13 15:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-13 15:37 David Marchand [this message]
2024-02-13 16:57 ` Tyler Retzlaff
2024-02-14 2:18 ` fengchengwen
2024-02-14 12:20 ` David Marchand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240213153741.2133915-1-david.marchand@redhat.com \
--to=david.marchand@redhat.com \
--cc=Yuying.Zhang@intel.com \
--cc=dev@dpdk.org \
--cc=rahul.lakkireddy@chelsio.com \
--cc=rosen.xu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).