[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/5] hw/core: Remove uses of QERR_DEVICE_NO_HOTPLUG
From: |
Markus Armbruster |
Subject: |
Re: [PATCH 3/5] hw/core: Remove uses of QERR_DEVICE_NO_HOTPLUG |
Date: |
Fri, 19 Nov 2021 09:20:29 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) |
Philippe Mathieu-Daudé <philmd@redhat.com> writes:
> QERR_DEVICE_NO_HOTPLUG definition is obsolete since 2015 (commit
> 4629ed1e989, "qerror: Finally unused, clean up"). Replace the two
> uses and drop the definition.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> include/qapi/qmp/qerror.h | 3 ---
> hw/core/qdev.c | 3 ++-
> softmmu/qdev-monitor.c | 2 +-
> 3 files changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/include/qapi/qmp/qerror.h b/include/qapi/qmp/qerror.h
> index 596fce0c54e..f49ae01cdb0 100644
> --- a/include/qapi/qmp/qerror.h
> +++ b/include/qapi/qmp/qerror.h
> @@ -26,9 +26,6 @@
> #define QERR_DEVICE_IN_USE \
> "Device '%s' is in use"
>
> -#define QERR_DEVICE_NO_HOTPLUG \
> - "Device '%s' does not support hotplugging"
> -
> #define QERR_FEATURE_DISABLED \
> "The feature '%s' is not enabled"
>
> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
> index 7f06403752d..14375861c36 100644
> --- a/hw/core/qdev.c
> +++ b/hw/core/qdev.c
> @@ -734,7 +734,8 @@ static void device_set_realized(Object *obj, bool value,
> Error **errp)
> static int unattached_count;
>
> if (dev->hotplugged && !dc->hotpluggable) {
> - error_setg(errp, QERR_DEVICE_NO_HOTPLUG, object_get_typename(obj));
> + error_setg(errp, "Device '%s' does not support hotplugging",
> + object_get_typename(obj));
> return;
> }
>
> diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c
> index 4851de51a5c..35a885a6623 100644
> --- a/softmmu/qdev-monitor.c
> +++ b/softmmu/qdev-monitor.c
> @@ -896,7 +896,7 @@ void qdev_unplug(DeviceState *dev, Error **errp)
> }
>
> if (!dc->hotpluggable) {
> - error_setg(errp, QERR_DEVICE_NO_HOTPLUG,
> + error_setg(errp, "Device '%s' does not support hotplugging",
> object_get_typename(OBJECT(dev)));
> return;
> }
When the same error is detected in multiple places, I like to ask myself
whether the code calls for a refactoring. But I can't see a useful one
here.
Reviewed-by: Markus Armbruster <armbru@redhat.com>
- Re: [PATCH 3/5] hw/core: Remove uses of QERR_DEVICE_NO_HOTPLUG,
Markus Armbruster <=