-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mem: move nvdimm_device_list to utilities
nvdimm_device_list is required for parsing the list for devices in subsequent patches. Move it to common utility area. Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Message-Id: <158131055857.2897.15658377276504711773.stgit@lep8c.aus.stglabs.ibm.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
- Loading branch information
1 parent
a784926
commit 3f350f6
Showing
4 changed files
with
38 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#ifndef NVDIMM_UTILS_H | ||
#define NVDIMM_UTILS_H | ||
|
||
#include "qemu/osdep.h" | ||
|
||
GSList *nvdimm_get_device_list(void); | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include "qemu/nvdimm-utils.h" | ||
#include "hw/mem/nvdimm.h" | ||
|
||
static int nvdimm_device_list(Object *obj, void *opaque) | ||
{ | ||
GSList **list = opaque; | ||
|
||
if (object_dynamic_cast(obj, TYPE_NVDIMM)) { | ||
*list = g_slist_append(*list, DEVICE(obj)); | ||
} | ||
|
||
object_child_foreach(obj, nvdimm_device_list, opaque); | ||
return 0; | ||
} | ||
|
||
/* | ||
* inquire NVDIMM devices and link them into the list which is | ||
* returned to the caller. | ||
* | ||
* Note: it is the caller's responsibility to free the list to avoid | ||
* memory leak. | ||
*/ | ||
GSList *nvdimm_get_device_list(void) | ||
{ | ||
GSList *list = NULL; | ||
|
||
object_child_foreach(qdev_get_machine(), nvdimm_device_list, &list); | ||
return list; | ||
} |