drivers: use common container_of macro
PATCH 1/1 drivers: use common container_of macro
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.
--- 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(-)
drivers/net/cxgbe/cxgbe_compat.h +0 -6
@@ -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)
drivers/net/i40e/i40e_rxtx.h +0 -5
@@ -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)
drivers/raw/ifpga/base/ifpga_compat.h +0 -5
@@ -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))
Signature · 1 line
2.43.0
Quoted 9 lines · David Marchand
rte_common.hprovidescontainer_ofif none is defined.The drivers headers touched by this commit either already include
rte_common.hor use some other common macro defined inrte_common.h. As a consequence, it seems safe to assume thatcontainer_ofis always available for includers of those headers.Signed-off-by David Marchand <[email protected]>---
Quoted 63 lines · David Marchand
rte_common.hprovidescontainer_ofif none is defined.The drivers headers touched by this commit either already include
rte_common.hor use some other common macro defined inrte_common.h. As a consequence, it seems safe to assume thatcontainer_ofis always available for includers of those headers.Signed-off-by David Marchand<[email protected]>--- 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(-)drivers/net/cxgbe/cxgbe_compat.h +0
-6@@ -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)drivers/net/i40e/i40e_rxtx.h +0
-5@@ -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)drivers/raw/ifpga/base/ifpga_compat.h +0
-5@@ -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))
David Marchand
AppliedQuoted 9 lines · David Marchand
rte_common.hprovidescontainer_ofif none is defined.The drivers headers touched by this commit either already include
rte_common.hor use some other common macro defined inrte_common.h. As a consequence, it seems safe to assume thatcontainer_ofis always available for includers of those headers.Signed-off-by David Marchand <[email protected]>
Applied, thanks.
Signature · 1 line
David Marchand