qemu-ppc
[Top][All Lists]
Advanced

[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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]