diff options
-rw-r--r-- | softmmu/qdev-monitor.c | 32 |
1 files changed, 6 insertions, 26 deletions
diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c index 12b7540f17..0e10f0466f 100644 --- a/softmmu/qdev-monitor.c +++ b/softmmu/qdev-monitor.c @@ -572,28 +572,6 @@ void qdev_set_id(DeviceState *dev, const char *id) } } -static int is_failover_device(void *opaque, const char *name, const char *value, - Error **errp) -{ - if (strcmp(name, "failover_pair_id") == 0) { - QemuOpts *opts = opaque; - - if (qdev_should_hide_device(opts)) { - return 1; - } - } - - return 0; -} - -static bool should_hide_device(QemuOpts *opts) -{ - if (qemu_opt_foreach(opts, is_failover_device, opts, NULL) == 0) { - return false; - } - return true; -} - DeviceState *qdev_device_add(QemuOpts *opts, Error **errp) { DeviceClass *dc; @@ -634,11 +612,13 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **errp) } } - if (should_hide_device(opts)) { - if (bus && !qbus_is_hotpluggable(bus)) { - error_setg(errp, QERR_BUS_NO_HOTPLUG, bus->name); + if (qemu_opt_get(opts, "failover_pair_id")) { + if (qdev_should_hide_device(opts)) { + if (bus && !qbus_is_hotpluggable(bus)) { + error_setg(errp, QERR_BUS_NO_HOTPLUG, bus->name); + } + return NULL; } - return NULL; } if (qdev_hotplug && bus && !qbus_is_hotpluggable(bus)) { |