From: Damien Hedde <damien.hedde@greensocs.com>
To: "Markus Armbruster" <armbru@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
"Eduardo Habkost" <ehabkost@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
qemu-devel@nongnu.org,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [PATCH 3/5] hw/core: Remove uses of QERR_DEVICE_NO_HOTPLUG
Date: Fri, 19 Nov 2021 12:27:30 +0100 [thread overview]
Message-ID: <062ebe36-0b8c-2b73-6a5a-db7d2c7e98b7@greensocs.com> (raw)
In-Reply-To: <87zgq0r1yq.fsf@dusky.pond.sub.org>
On 11/19/21 09:20, Markus Armbruster wrote:
> 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.
>
Since the realize check will catch more case (devices created
recursively by a command or simply by C code), we could remove the
softmmu/qdev-monitor.c check and rely on realize catching that just after.
In theory failing during realize should have the same result as "not
trying to create the device in the first place".
--
Damien
next prev parent reply other threads:[~2021-11-19 11:32 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-29 23:01 [PATCH 0/5] hw/core: Remove uses of obsolete QERR_ definitions Philippe Mathieu-Daudé
2021-10-29 23:01 ` [PATCH 1/5] hw/core: Remove use of QERR_UNSUPPORTED Philippe Mathieu-Daudé
2021-11-19 7:01 ` Markus Armbruster
2021-10-29 23:01 ` [PATCH 2/5] hw/core: Remove use of QERR_FEATURE_DISABLED Philippe Mathieu-Daudé
2021-11-19 8:18 ` Markus Armbruster
2021-10-29 23:01 ` [PATCH 3/5] hw/core: Remove uses of QERR_DEVICE_NO_HOTPLUG Philippe Mathieu-Daudé
2021-11-19 8:20 ` Markus Armbruster
2021-11-19 11:27 ` Damien Hedde [this message]
2021-10-29 23:01 ` [PATCH 4/5] hw/core: Remove uses of QERR_PROPERTY_VALUE_BAD Philippe Mathieu-Daudé
2021-11-02 9:47 ` Damien Hedde
2021-11-02 11:59 ` Philippe Mathieu-Daudé
2021-11-19 6:51 ` Markus Armbruster
2021-10-29 23:01 ` [PATCH 5/5] hw/core: Remove uses of QERR_INVALID_PARAMETER_VALUE Philippe Mathieu-Daudé
2021-11-19 8:27 ` Markus Armbruster
2021-11-02 9:51 ` [PATCH 0/5] hw/core: Remove uses of obsolete QERR_ definitions Damien Hedde
2021-11-02 11:58 ` Philippe Mathieu-Daudé
2021-11-19 8:35 ` Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=062ebe36-0b8c-2b73-6a5a-db7d2c7e98b7@greensocs.com \
--to=damien.hedde@greensocs.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=dgilbert@redhat.com \
--cc=ehabkost@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).