Merge tag 'pull-loongarch-20241016' of https://gitlab.com/gaosong/qemu into staging
[qemu/armbru.git] / util / nvdimm-utils.c
blobaa3d199f2d117616e8bacf8103e3760e8ba45a52
1 #include "qemu/osdep.h"
2 #include "qemu/nvdimm-utils.h"
3 #include "hw/mem/nvdimm.h"
5 static int nvdimm_device_list(Object *obj, void *opaque)
7 GSList **list = opaque;
9 if (object_dynamic_cast(obj, TYPE_NVDIMM)) {
10 *list = g_slist_append(*list, DEVICE(obj));
13 object_child_foreach(obj, nvdimm_device_list, opaque);
14 return 0;
18 * inquire NVDIMM devices and link them into the list which is
19 * returned to the caller.
21 * Note: it is the caller's responsibility to free the list to avoid
22 * memory leak.
24 GSList *nvdimm_get_device_list(void)
26 GSList *list = NULL;
28 object_child_foreach(qdev_get_machine(), nvdimm_device_list, &list);
29 return list;