[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 1/3] qdev: Introduce a function to get qbus's par
From: |
arei.gonglei |
Subject: |
[Qemu-devel] [PATCH v3 1/3] qdev: Introduce a function to get qbus's parent |
Date: |
Mon, 1 Sep 2014 21:29:17 +0800 |
From: Gonglei <address@hidden>
We may use it check type of qbus's parent.
Signed-off-by: Gonglei <address@hidden>
---
hw/core/qdev.c | 9 +++++++++
include/hw/qdev-core.h | 1 +
2 files changed, 10 insertions(+)
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index da1ba48..e42d313 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -616,6 +616,15 @@ BusState *qbus_create(const char *typename, DeviceState
*parent, const char *nam
return bus;
}
+DeviceState *qbus_get_parent(BusState *bus)
+{
+ if (bus) {
+ return bus->parent;
+ }
+
+ return NULL;
+}
+
static char *bus_get_fw_dev_path(BusState *bus, DeviceState *dev)
{
BusClass *bc = BUS_GET_CLASS(bus);
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index 0799ff2..760e726 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -301,6 +301,7 @@ typedef int (qdev_walkerfn)(DeviceState *dev, void *opaque);
void qbus_create_inplace(void *bus, size_t size, const char *typename,
DeviceState *parent, const char *name);
BusState *qbus_create(const char *typename, DeviceState *parent, const char
*name);
+DeviceState *qbus_get_parent(BusState *bus);
/* Returns > 0 if either devfn or busfn skip walk somewhere in cursion,
* < 0 if either devfn or busfn terminate walk somewhere in cursion,
* 0 otherwise. */
--
1.7.12.4
- [Qemu-devel] [PATCH v3 0/3] add check for PCIe root ports and downstream ports, arei.gonglei, 2014/09/01
- [Qemu-devel] [PATCH v3 3/3] pcie: remove confused comments, arei.gonglei, 2014/09/01
- [Qemu-devel] [PATCH v3 2/3] pcie: add check for ari capability of pcie devices, arei.gonglei, 2014/09/01
- [Qemu-devel] [PATCH v3 1/3] qdev: Introduce a function to get qbus's parent,
arei.gonglei <=
- Re: [Qemu-devel] [PATCH v3 0/3] add check for PCIe root ports and downstream ports, Gonglei (Arei), 2014/09/04
- Re: [Qemu-devel] [PATCH v3 0/3] add check for PCIe root ports and downstream ports, Gonglei (Arei), 2014/09/29
- Re: [Qemu-devel] [PATCH v3 0/3] add check for PCIe root ports and downstream ports, Michael S. Tsirkin, 2014/09/29