/* Delete all mtd devices from a supplied devices list, free memory allocated for each device and delete all device partitions. */
static int device_delall(struct list_head *head)
/* Delete all mtd devices from a supplied devices list, free memory allocated for each device and delete all device partitions. */
static int device_delall(struct list_head *head)
{
	struct list_head *entry, *n;
	struct mtd_device *dev_tmp;
	list_for_each_safe(entry, n, head) {
		dev_tmp = list_entry(entry, struct mtd_device, link);
		list_del(entry);
		part_delall(&dev_tmp->parts);
		free(dev_tmp);
	}
	INIT_LIST_HEAD(&devices);
	return 0;
}