env/pci: use TAILQ_FOREACH_SAFE in pci_foreach_device()
It'll make it possible to remove a PCI device from within the callback. Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com> Change-Id: I4cea2207a29bb145aee968715e873076a8c0993c Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13956 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Tom Nabarro <tom.nabarro@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Dong Yi <dongx.yi@intel.com>
This commit is contained in:
parent
4c482a623b
commit
9a9aed4e7b
@ -776,10 +776,10 @@ spdk_pci_enumerate(struct spdk_pci_driver *driver,
|
||||
void
|
||||
spdk_pci_for_each_device(void *ctx, void (*fn)(void *ctx, struct spdk_pci_device *dev))
|
||||
{
|
||||
struct spdk_pci_device *dev;
|
||||
struct spdk_pci_device *dev, *tmp;
|
||||
|
||||
pthread_mutex_lock(&g_pci_mutex);
|
||||
TAILQ_FOREACH(dev, &g_pci_devices, internal.tailq) {
|
||||
TAILQ_FOREACH_SAFE(dev, &g_pci_devices, internal.tailq, tmp) {
|
||||
fn(ctx, dev);
|
||||
}
|
||||
pthread_mutex_unlock(&g_pci_mutex);
|
||||
|
Loading…
Reference in New Issue
Block a user