[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 04/22] qapi: Inline and remove QERR_DEVICE_NO_HOTPLUG defi
From: |
Markus Armbruster |
Subject: |
Re: [PATCH v2 04/22] qapi: Inline and remove QERR_DEVICE_NO_HOTPLUG definition |
Date: |
Fri, 20 Oct 2023 08:03:08 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) |
Philippe Mathieu-Daudé <philmd@linaro.org> writes:
> Address the comment added in commit 4629ed1e98
> ("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, manually
> removing the definition in include/qapi/qmp/qerror.h.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> 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 daa889809b..e93211085a 100644
> --- a/include/qapi/qmp/qerror.h
> +++ b/include/qapi/qmp/qerror.h
> @@ -17,9 +17,6 @@
> * add new ones!
> */
>
> -#define QERR_DEVICE_NO_HOTPLUG \
> - "Device '%s' does not support hotplugging"
> -
> #define QERR_INVALID_PARAMETER \
> "Invalid parameter '%s'"
>
> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
> index 43d863b0c5..9b62e0573d 100644
> --- a/hw/core/qdev.c
> +++ b/hw/core/qdev.c
> @@ -479,7 +479,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 3a9740dcbd..a964bd80df 100644
> --- a/softmmu/qdev-monitor.c
> +++ b/softmmu/qdev-monitor.c
> @@ -911,7 +911,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;
> }
Could factor out
if (!dc->hotpluggable)) {
error_setg(errp, "Device '%s' does not support hotplugging",
object_get_typename(OBJECT(dev)));
}
return true;
Idea, not a demand.
- [PATCH v2 00/22] qapi: Kill 'qapi/qmp/qerror.h' for good, Philippe Mathieu-Daudé, 2023/10/05
- [PATCH v2 01/22] qapi: Inline and remove QERR_BUS_NO_HOTPLUG definition, Philippe Mathieu-Daudé, 2023/10/05
- [PATCH v2 03/22] qapi: Inline and remove QERR_DEVICE_IN_USE definition, Philippe Mathieu-Daudé, 2023/10/05
- [PATCH v2 02/22] qapi: Inline and remove QERR_DEVICE_HAS_NO_MEDIUM definition, Philippe Mathieu-Daudé, 2023/10/05
- [PATCH v2 04/22] qapi: Inline and remove QERR_DEVICE_NO_HOTPLUG definition, Philippe Mathieu-Daudé, 2023/10/05
- Re: [PATCH v2 04/22] qapi: Inline and remove QERR_DEVICE_NO_HOTPLUG definition,
Markus Armbruster <=
- [PATCH v2 05/22] qapi: Inline QERR_INVALID_PARAMETER definition (constant parameter), Philippe Mathieu-Daudé, 2023/10/05
- [PATCH v2 07/22] qapi: Inline QERR_INVALID_PARAMETER_TYPE definition (constant param), Philippe Mathieu-Daudé, 2023/10/05
- [PATCH v2 06/22] qapi: Inline and remove QERR_INVALID_PARAMETER definition, Philippe Mathieu-Daudé, 2023/10/05
- [PATCH v2 08/22] qapi: Inline QERR_INVALID_PARAMETER_TYPE definition (constant value), Philippe Mathieu-Daudé, 2023/10/05
- [PATCH v2 09/22] qapi: Inline and remove QERR_INVALID_PARAMETER_TYPE definition, Philippe Mathieu-Daudé, 2023/10/05
- [PATCH v2 10/22] qapi: Correct error message for 'vcpu_dirty_limit' parameter, Philippe Mathieu-Daudé, 2023/10/05