[RFC,04/11] dev: move unrelated macros from header
Checks
Commit Message
RTE_FUNC_PTR_OR_* macros have nothing to do with the rte_device object
and associated API.
Move them to rte_common.h and include it where needed.
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
drivers/common/qat/qat_device.c | 1 +
drivers/compress/qat/qat_comp_pmd.c | 1 +
drivers/crypto/scheduler/rte_cryptodev_scheduler.c | 1 +
drivers/net/ixgbe/rte_pmd_ixgbe.c | 1 +
drivers/net/liquidio/lio_ethdev.c | 1 +
lib/compressdev/rte_compressdev.c | 1 +
lib/dmadev/rte_dmadev.c | 1 +
lib/eal/include/rte_common.h | 11 +++++++++++
lib/eal/include/rte_dev.h | 11 -----------
lib/ethdev/ethdev_driver.c | 1 +
lib/ethdev/ethdev_pci.h | 1 +
lib/mempool/rte_mempool_ops.c | 1 +
lib/regexdev/rte_regexdev.c | 1 +
lib/security/rte_security.c | 1 +
lib/vhost/vdpa.c | 1 +
15 files changed, 24 insertions(+), 11 deletions(-)
@@ -2,6 +2,7 @@
* Copyright(c) 2018-2022 Intel Corporation
*/
+#include <rte_common.h>
#include <rte_string_fns.h>
#include <rte_devargs.h>
#include <ctype.h>
@@ -2,6 +2,7 @@
* Copyright(c) 2015-2022 Intel Corporation
*/
+#include <rte_common.h>
#include <rte_malloc.h>
#include "qat_comp.h"
@@ -1,6 +1,7 @@
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2017 Intel Corporation
*/
+#include <rte_common.h>
#include <rte_string_fns.h>
#include <rte_reorder.h>
#include <rte_cryptodev.h>
@@ -2,6 +2,7 @@
* Copyright(c) 2010-2017 Intel Corporation
*/
+#include <rte_common.h>
#include <ethdev_driver.h>
#include "base/ixgbe_api.h"
@@ -2,6 +2,7 @@
* Copyright(c) 2017 Cavium, Inc
*/
+#include <rte_common.h>
#include <rte_string_fns.h>
#include <ethdev_driver.h>
#include <ethdev_pci.h>
@@ -6,6 +6,7 @@
#include <stdio.h>
#include <inttypes.h>
+#include <rte_common.h>
#include <rte_string_fns.h>
#include <rte_malloc.h>
#include <rte_eal.h>
@@ -5,6 +5,7 @@
#include <inttypes.h>
+#include <rte_common.h>
#include <rte_eal.h>
#include <rte_lcore.h>
#include <rte_log.h>
@@ -861,6 +861,17 @@ rte_log2_u64(uint64_t v)
/** Number of elements in the array. */
#define RTE_DIM(a) (sizeof (a) / sizeof ((a)[0]))
+/* Macros to check for invalid function pointers */
+#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \
+ if ((func) == NULL) \
+ return retval; \
+} while (0)
+
+#define RTE_FUNC_PTR_OR_RET(func) do { \
+ if ((func) == NULL) \
+ return; \
+} while (0)
+
/**
* Converts a numeric string to the equivalent uint64_t value.
* As well as straight number conversion, also recognises the suffixes
@@ -36,17 +36,6 @@ typedef void (*rte_dev_event_cb_fn)(const char *device_name,
enum rte_dev_event_type event,
void *cb_arg);
-/* Macros to check for invalid function pointers */
-#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \
- if ((func) == NULL) \
- return retval; \
-} while (0)
-
-#define RTE_FUNC_PTR_OR_RET(func) do { \
- if ((func) == NULL) \
- return; \
-} while (0)
-
/**
* Device policies.
*/
@@ -2,6 +2,7 @@
* Copyright(c) 2022 Intel Corporation
*/
+#include <rte_common.h>
#include <rte_kvargs.h>
#include <rte_malloc.h>
@@ -10,6 +10,7 @@
extern "C" {
#endif
+#include <rte_common.h>
#include <rte_malloc.h>
#include <rte_pci.h>
#include <rte_bus_pci.h>
@@ -6,6 +6,7 @@
#include <stdio.h>
#include <string.h>
+#include <rte_common.h>
#include <rte_string_fns.h>
#include <rte_mempool.h>
#include <rte_errno.h>
@@ -5,6 +5,7 @@
#include <string.h>
+#include <rte_common.h>
#include <rte_memzone.h>
#include <rte_string_fns.h>
@@ -4,6 +4,7 @@
* Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
*/
+#include <rte_common.h>
#include <rte_cryptodev.h>
#include <rte_dev.h>
#include <rte_telemetry.h>
@@ -10,6 +10,7 @@
#include <sys/queue.h>
+#include <rte_common.h>
#include <rte_class.h>
#include <rte_malloc.h>
#include <rte_spinlock.h>