[PATCH v2 38/43] raw/ifpga: replace with TAILQ_FOREACH_SAFE
Stephen Hemminger
stephen at networkplumber.org
Mon Aug 25 05:38:51 CEST 2025
There is now a standard macro to safely walk tailq.
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
drivers/raw/ifpga/base/ifpga_enumerate.c | 6 +++---
drivers/raw/ifpga/base/opae_hw_api.h | 1 -
drivers/raw/ifpga/base/opae_intel_max10.c | 8 +-------
drivers/raw/ifpga/base/osdep_rte/osdep_generic.h | 1 +
4 files changed, 5 insertions(+), 11 deletions(-)
diff --git a/drivers/raw/ifpga/base/ifpga_enumerate.c b/drivers/raw/ifpga/base/ifpga_enumerate.c
index 61eb6601ea..f8507fdf46 100644
--- a/drivers/raw/ifpga/base/ifpga_enumerate.c
+++ b/drivers/raw/ifpga/base/ifpga_enumerate.c
@@ -6,6 +6,8 @@
#include <inttypes.h>
#include <unistd.h>
+#include <rte_bsd_queue.h>
+
#include "opae_hw_api.h"
#include "ifpga_api.h"
@@ -725,9 +727,7 @@ static void dfl_fpga_enum_info_free(struct dfl_fpga_enum_info *info)
return;
/* remove all device feature lists in the list. */
- for (dfl = TAILQ_FIRST(&info->dfls);
- dfl && (tmp = TAILQ_NEXT(dfl, node), 1);
- dfl = tmp) {
+ TAILQ_FOREACH_SAFE(dfl, &info->dfls, node, tmp) {
TAILQ_REMOVE(&info->dfls, dfl, node);
opae_free(dfl);
}
diff --git a/drivers/raw/ifpga/base/opae_hw_api.h b/drivers/raw/ifpga/base/opae_hw_api.h
index 57750022dd..f95bdf35b6 100644
--- a/drivers/raw/ifpga/base/opae_hw_api.h
+++ b/drivers/raw/ifpga/base/opae_hw_api.h
@@ -8,7 +8,6 @@
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
-#include <sys/queue.h>
#include "opae_osdep.h"
#include "opae_intel_max10.h"
diff --git a/drivers/raw/ifpga/base/opae_intel_max10.c b/drivers/raw/ifpga/base/opae_intel_max10.c
index 58c884a8d8..84e0767b3a 100644
--- a/drivers/raw/ifpga/base/opae_intel_max10.c
+++ b/drivers/raw/ifpga/base/opae_intel_max10.c
@@ -4,14 +4,8 @@
#include "opae_intel_max10.h"
#include <libfdt.h>
-#include "opae_osdep.h"
-#ifndef TAILQ_FOREACH_SAFE
-#define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
- for ((var) = TAILQ_FIRST((head)); \
- (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
- (var) = (tvar))
-#endif
+#include "opae_osdep.h"
int max10_sys_read(struct intel_max10_device *dev,
unsigned int offset, unsigned int *val)
diff --git a/drivers/raw/ifpga/base/osdep_rte/osdep_generic.h b/drivers/raw/ifpga/base/osdep_rte/osdep_generic.h
index d4e634c9d2..0ff2700384 100644
--- a/drivers/raw/ifpga/base/osdep_rte/osdep_generic.h
+++ b/drivers/raw/ifpga/base/osdep_rte/osdep_generic.h
@@ -8,6 +8,7 @@
#include <stdlib.h>
#include <rte_common.h>
+#include <rte_bsd_queue.h>
#include <rte_cycles.h>
#include <rte_spinlock.h>
#include <rte_log.h>
--
2.47.2
More information about the dev
mailing list