return dev;
}
+static void
+device_delete(struct device *dev)
+{
+ if (!dev->avl.key)
+ return;
+
+ avl_delete(&devices, &dev->avl);
+ dev->avl.key = NULL;
+}
+
void device_cleanup(struct device *dev)
{
struct device_user *dep, *tmp;
dep->cb(dep, DEV_EVENT_REMOVE);
}
- if (dev->avl.key)
- avl_delete(&devices, &dev->avl);
+ device_delete(dev);
}
void device_set_present(struct device *dev, bool state)
return odev;
case DEV_CONFIG_RECREATE:
D(DEVICE, "Device '%s': recreate device\n", odev->ifname);
+ device_delete(odev);
break;
}
}