Skip to content

Commit

Permalink
qapi: Inline and remove QERR_BUS_NO_HOTPLUG definition
Browse files Browse the repository at this point in the history
Address the comment added in commit 4629ed1
("qerror: Finally unused, clean up"), from 2015:

  /*
   * These macros will go away, please don't use
   * in new code, and do not add new ones!
   */

Mechanical transformation using sed, and manual cleanup.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240312141343.3168265-3-armbru@redhat.com>
  • Loading branch information
philmd authored and Markus Armbruster committed Apr 24, 2024
1 parent 4a18751 commit 7f65e78
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
5 changes: 2 additions & 3 deletions hw/ppc/spapr_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#include "trace.h"
#include "qemu/error-report.h"
#include "qemu/module.h"
#include "qapi/qmp/qerror.h"
#include "hw/ppc/fdt.h"
#include "hw/pci/pci_bridge.h"
#include "hw/pci/pci_bus.h"
Expand Down Expand Up @@ -1554,7 +1553,7 @@ static void spapr_pci_pre_plug(HotplugHandler *plug_handler,
* we need to let them know it's not enabled
*/
if (plugged_dev->hotplugged) {
error_setg(errp, QERR_BUS_NO_HOTPLUG,
error_setg(errp, "Bus '%s' does not support hotplugging",
phb->parent_obj.bus->qbus.name);
return;
}
Expand Down Expand Up @@ -1675,7 +1674,7 @@ static void spapr_pci_unplug_request(HotplugHandler *plug_handler,
SpaprDrc *drc = drc_from_dev(phb, pdev);

if (!phb->dr_enabled) {
error_setg(errp, QERR_BUS_NO_HOTPLUG,
error_setg(errp, "Bus '%s' does not support hotplugging",
phb->parent_obj.bus->qbus.name);
return;
}
Expand Down
3 changes: 0 additions & 3 deletions include/qapi/qmp/qerror.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
* add new ones!
*/

#define QERR_BUS_NO_HOTPLUG \
"Bus '%s' does not support hotplugging"

#define QERR_DEVICE_HAS_NO_MEDIUM \
"Device '%s' has no medium"

Expand Down
8 changes: 5 additions & 3 deletions system/qdev-monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -660,15 +660,16 @@ DeviceState *qdev_device_add_from_qdict(const QDict *opts,

if (qdev_should_hide_device(opts, from_json, errp)) {
if (bus && !qbus_is_hotpluggable(bus)) {
error_setg(errp, QERR_BUS_NO_HOTPLUG, bus->name);
error_setg(errp, "Bus '%s' does not support hotplugging",
bus->name);
}
return NULL;
} else if (*errp) {
return NULL;
}

if (phase_check(PHASE_MACHINE_READY) && bus && !qbus_is_hotpluggable(bus)) {
error_setg(errp, QERR_BUS_NO_HOTPLUG, bus->name);
error_setg(errp, "Bus '%s' does not support hotplugging", bus->name);
return NULL;
}

Expand Down Expand Up @@ -910,7 +911,8 @@ void qdev_unplug(DeviceState *dev, Error **errp)
}

if (dev->parent_bus && !qbus_is_hotpluggable(dev->parent_bus)) {
error_setg(errp, QERR_BUS_NO_HOTPLUG, dev->parent_bus->name);
error_setg(errp, "Bus '%s' does not support hotplugging",
dev->parent_bus->name);
return;
}

Expand Down

0 comments on commit 7f65e78

Please sign in to comment.