X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=discover%2Fdevice-handler.c;h=7f7081df5f6fc27abd033788d2202c5cca1988c2;hp=c21eb286d2bd8b47d361fad1c537c883e50fdbbc;hb=0adfe11dc0738321cdd529f30773899cc8f79855;hpb=20889c61bc0e6712c1cac5a0a6e9e8e9dff7cf84;ds=sidebyside diff --git a/discover/device-handler.c b/discover/device-handler.c index c21eb28..7f7081d 100644 --- a/discover/device-handler.c +++ b/discover/device-handler.c @@ -344,6 +344,11 @@ void device_handler_remove(struct device_handler *handler, talloc_free(opt); } + /* if this is a network device, we have to unregister it from the + * network code */ + if (device->device->type == DEVICE_TYPE_NETWORK) + network_unregister_device(handler->network, device); + handler->n_devices--; memmove(&handler->devices[i], &handler->devices[i + 1], (handler->n_devices - i) * sizeof(handler->devices[0])); @@ -646,6 +651,8 @@ void device_handler_add_device(struct device_handler *handler, struct discover_device *, handler->n_devices); handler->devices[handler->n_devices - 1] = device; + if (device->device->type == DEVICE_TYPE_NETWORK) + network_register_device(handler->network, device); } /* Start discovery on a hotplugged device. The device will be in our devices