diff mbox series

[v2,04/22] qapi: Inline and remove QERR_DEVICE_NO_HOTPLUG definition

Message ID 20231005045041.52649-5-philmd@linaro.org
State New
Headers show
Series qapi: Kill 'qapi/qmp/qerror.h' for good | expand

Commit Message

Philippe Mathieu-Daudé Oct. 5, 2023, 4:50 a.m. UTC
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(-)

Comments

Markus Armbruster Oct. 20, 2023, 6:03 a.m. UTC | #1
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.
diff mbox series

Patch

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;
     }