Am 05.02.2014 17:38, schrieb Paolo Bonzini: > Il 05/02/2014 15:09, Andreas Färber ha scritto: >> diff --git a/hw/core/qdev.c b/hw/core/qdev.c >> index 82a9123..14c8765 100644 >> --- a/hw/core/qdev.c >> +++ b/hw/core/qdev.c >> @@ -131,21 +131,27 @@ DeviceState *qdev_create(BusState *bus, const >> char *name) >> DeviceState *qdev_try_create(BusState *bus, const char *type) >> { >> DeviceState *dev; >> + ObjectClass *oc; >> + DeviceClass *dc; >> >> - if (object_class_by_name(type) == NULL) { >> + oc = object_class_by_name(type); >> + if (oc == NULL) { >> return NULL; >> } >> + dc = DEVICE_CLASS(oc); >> dev = DEVICE(object_new(type)); >> if (!dev) { >> return NULL; >> } >> >> - if (!bus) { >> + if (!bus && dc->bus_type && strcmp(dc->bus_type, "System") == 0) { > > Should you check instead if dev is-a TYPE_SYSBUS_DEVICE?
Hmm, that would catch TYPE_SYS_BUS_DEVICE-derived types as well, which might in theory override bus_type. The ugly thing here is the cyclic dependency betwen qdev and sysbus, therefore no TYPE_SYSTEM_BUS. > Does this also leave the nand device out of info qtree, or is it still > dumped? As I pointed out several times already, devices that are not on a bus are generally *not* printed by info qtree. It depends on the old qbus concept. Therefore info qtree is not of much use anymore and should be dropped in favor of the qom-list and qom-get operations, which get us all devices and all properties. I had once attached a qom-tree for that and need to put that into a proper patch. Best before the next question pops up. :) Andreas -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg