plugins: unload plugin if early init fails
[vpp.git] / src / vlib / pci / pci.h
index ec805b3..a705671 100644 (file)
@@ -159,6 +159,14 @@ static void __vlib_add_pci_device_registration_##x (void)       \
     x.next_registration = pm->pci_device_registrations;         \
     pm->pci_device_registrations = &x;                          \
 }                                                               \
+static void __vlib_rm_pci_device_registration_##x (void)        \
+    __attribute__((__destructor__)) ;                           \
+static void __vlib_rm_pci_device_registration_##x (void)        \
+{                                                               \
+    vlib_pci_main_t * pm = &pci_main;                           \
+    VLIB_REMOVE_FROM_LINKED_LIST (pm->pci_device_registrations, \
+                                  &x, next_registration);       \
+}                                                               \
 __VA_ARGS__ pci_device_registration_t x
 
 clib_error_t *vlib_pci_bind_to_uio (vlib_pci_addr_t * addr,