avl_init(&devices, avl_strcmp, false, NULL);
}
-static void free_device(struct device *dev)
+static void free_simple_device(struct device *dev)
{
cleanup_device(dev);
free(dev);
static const struct device_type simple_type = {
.name = "Device",
.check_state = system_if_check,
- .free = free_device,
+ .free = free_simple_device,
};
struct device *dev;
if (list_empty(&dev->users)) {
/* all references have gone away, remove this device */
- dev->type->free(dev);
+ free_device(dev);
}
dep->dev = NULL;
int (*del)(struct device *main, struct device *member);
};
+static inline void
+free_device(struct device *dev)
+{
+ dev->type->free(dev);
+}
+
void init_virtual_device(struct device *dev, const struct device_type *type, const char *name);
int init_device(struct device *iface, const struct device_type *type, const char *ifname);
void cleanup_device(struct device *iface);