[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH not-for-merge 5/5] qdev: Instrument to detect bus mismatch
From: |
Markus Armbruster |
Subject: |
[PATCH not-for-merge 5/5] qdev: Instrument to detect bus mismatch |
Date: |
Mon, 18 May 2020 07:19:45 +0200 |
Signed-off-by: Markus Armbruster <address@hidden>
---
hw/core/qdev.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 9e5538aeae..936ef3988a 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -98,6 +98,23 @@ void qdev_set_parent_bus(DeviceState *dev, BusState *bus)
{
BusState *old_parent_bus = dev->parent_bus;
+ DeviceClass *dc = DEVICE_GET_CLASS(dev);
+ if (bus) {
+ BusClass *bc;
+ for (bc = BUS_GET_CLASS(bus);
+ bc;
+ bc = (BusClass
*)object_class_dynamic_cast(object_class_get_parent(OBJECT_CLASS(bc)),
TYPE_BUS)) {
+ if (!g_strcmp0(dc->bus_type,
object_class_get_name(OBJECT_CLASS(bc)))) {
+ break;
+ }
+ }
+ if (!bc) {
+ printf("### bus mismatch %s is %s plugged into %s\n",
+ object_get_typename(OBJECT(dev)), dc->bus_type,
+ object_class_get_name(OBJECT_CLASS(BUS_GET_CLASS(bus))));
+ }
+ }
+
if (old_parent_bus) {
trace_qdev_update_parent_bus(dev, object_get_typename(OBJECT(dev)),
old_parent_bus, object_get_typename(OBJECT(old_parent_bus)),
--
2.21.1
- [PATCH not-for-merge 0/5] Instrumentation for "Fixes around device realization", Markus Armbruster, 2020/05/18
- [PATCH not-for-merge 1/5] qom: Instrument to detect missed realize, Markus Armbruster, 2020/05/18
- [PATCH not-for-merge 4/5] qdev: Instrument to detect missed QOM parenting, Markus Armbruster, 2020/05/18
- [PATCH not-for-merge 3/5] qdev: Make "info qtree" show child devices sorted by QOM path, Markus Armbruster, 2020/05/18
- [PATCH not-for-merge 2/5] qom: Make "info qom-tree" show children sorted, Markus Armbruster, 2020/05/18
- [PATCH not-for-merge 5/5] qdev: Instrument to detect bus mismatch,
Markus Armbruster <=
- Re: [PATCH not-for-merge 0/5] Instrumentation for "Fixes around device realization", no-reply, 2020/05/18
- Re: [PATCH not-for-merge 0/5] Instrumentation for "Fixes around device realization", no-reply, 2020/05/18
- Re: [PATCH not-for-merge 0/5] Instrumentation for "Fixes around device realization", no-reply, 2020/05/18
- Re: [PATCH not-for-merge 0/5] Instrumentation for "Fixes around device realization", Mark Cave-Ayland, 2020/05/18
- Re: [PATCH not-for-merge 0/5] Instrumentation for "Fixes around device realization", Philippe Mathieu-Daudé, 2020/05/20