From: David Hildenbrand <david@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
qemu-devel@nongnu.org,
Marcel Apfelbaum <marcel.apfelbaum@gmail.com>,
Richard Henderson <rth@twiddle.net>,
Igor Mammedov <imammedo@redhat.com>,
Eduardo Habkost <ehabkost@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v1] pc: Use hotplug_handler_(plug|unplug|unplug_request)
Date: Thu, 31 Jan 2019 10:09:18 +0100 [thread overview]
Message-ID: <b171a7a4-eccf-1fb1-b7fb-fbc3fe1017b0@redhat.com> (raw)
In-Reply-To: <20190130170943-mutt-send-email-mst@kernel.org>
On 30.01.19 23:10, Michael S. Tsirkin wrote:
> On Wed, Jan 30, 2019 at 04:07:06PM +0100, David Hildenbrand wrote:
>> On 30.01.19 14:09, Paolo Bonzini wrote:
>>> On 30/01/19 13:35, David Hildenbrand wrote:
>>>> On 14.12.18 10:58, Paolo Bonzini wrote:
>>>>> On 12/12/18 10:57, David Hildenbrand wrote:
>>>>>> Let's avoid manually looking up the hotplug handler class. Use the
>>>>>> existing wrappers instead.
>>>>>>
>>>>>> Signed-off-by: David Hildenbrand <david@redhat.com>
>>>>>> ---
>>>>>> hw/i386/pc.c | 30 ++++++++----------------------
>>>>>> 1 file changed, 8 insertions(+), 22 deletions(-)
>>>>>>
>>>>>> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
>>>>>> index 4cd2fbca4d..c8857138f9 100644
>>>>>> --- a/hw/i386/pc.c
>>>>>> +++ b/hw/i386/pc.c
>>>>>> @@ -1711,7 +1711,6 @@ static void pc_memory_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
>>>>>> static void pc_memory_plug(HotplugHandler *hotplug_dev,
>>>>>> DeviceState *dev, Error **errp)
>>>>>> {
>>>>>> - HotplugHandlerClass *hhc;
>>>>>> Error *local_err = NULL;
>>>>>> PCMachineState *pcms = PC_MACHINE(hotplug_dev);
>>>>>> bool is_nvdimm = object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM);
>>>>>> @@ -1725,8 +1724,7 @@ static void pc_memory_plug(HotplugHandler *hotplug_dev,
>>>>>> nvdimm_plug(&pcms->acpi_nvdimm_state);
>>>>>> }
>>>>>>
>>>>>> - hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev);
>>>>>> - hhc->plug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &error_abort);
>>>>>> + hotplug_handler_plug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &error_abort);
>>>>>> out:
>>>>>> error_propagate(errp, local_err);
>>>>>> }
>>>>>> @@ -1734,7 +1732,6 @@ out:
>>>>>> static void pc_memory_unplug_request(HotplugHandler *hotplug_dev,
>>>>>> DeviceState *dev, Error **errp)
>>>>>> {
>>>>>> - HotplugHandlerClass *hhc;
>>>>>> Error *local_err = NULL;
>>>>>> PCMachineState *pcms = PC_MACHINE(hotplug_dev);
>>>>>>
>>>>>> @@ -1755,9 +1752,8 @@ static void pc_memory_unplug_request(HotplugHandler *hotplug_dev,
>>>>>> goto out;
>>>>>> }
>>>>>>
>>>>>> - hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev);
>>>>>> - hhc->unplug_request(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err);
>>>>>> -
>>>>>> + hotplug_handler_unplug_request(HOTPLUG_HANDLER(pcms->acpi_dev), dev,
>>>>>> + &local_err);
>>>>>> out:
>>>>>> error_propagate(errp, local_err);
>>>>>> }
>>>>>> @@ -1766,12 +1762,9 @@ static void pc_memory_unplug(HotplugHandler *hotplug_dev,
>>>>>> DeviceState *dev, Error **errp)
>>>>>> {
>>>>>> PCMachineState *pcms = PC_MACHINE(hotplug_dev);
>>>>>> - HotplugHandlerClass *hhc;
>>>>>> Error *local_err = NULL;
>>>>>>
>>>>>> - hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev);
>>>>>> - hhc->unplug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err);
>>>>>> -
>>>>>> + hotplug_handler_unplug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err);
>>>>>> if (local_err) {
>>>>>> goto out;
>>>>>> }
>>>>>> @@ -1813,14 +1806,12 @@ static void pc_cpu_plug(HotplugHandler *hotplug_dev,
>>>>>> DeviceState *dev, Error **errp)
>>>>>> {
>>>>>> CPUArchId *found_cpu;
>>>>>> - HotplugHandlerClass *hhc;
>>>>>> Error *local_err = NULL;
>>>>>> X86CPU *cpu = X86_CPU(dev);
>>>>>> PCMachineState *pcms = PC_MACHINE(hotplug_dev);
>>>>>>
>>>>>> if (pcms->acpi_dev) {
>>>>>> - hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev);
>>>>>> - hhc->plug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err);
>>>>>> + hotplug_handler_plug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err);
>>>>>> if (local_err) {
>>>>>> goto out;
>>>>>> }
>>>>>> @@ -1844,7 +1835,6 @@ static void pc_cpu_unplug_request_cb(HotplugHandler *hotplug_dev,
>>>>>> DeviceState *dev, Error **errp)
>>>>>> {
>>>>>> int idx = -1;
>>>>>> - HotplugHandlerClass *hhc;
>>>>>> Error *local_err = NULL;
>>>>>> X86CPU *cpu = X86_CPU(dev);
>>>>>> PCMachineState *pcms = PC_MACHINE(hotplug_dev);
>>>>>> @@ -1861,9 +1851,8 @@ static void pc_cpu_unplug_request_cb(HotplugHandler *hotplug_dev,
>>>>>> goto out;
>>>>>> }
>>>>>>
>>>>>> - hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev);
>>>>>> - hhc->unplug_request(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err);
>>>>>> -
>>>>>> + hotplug_handler_unplug_request(HOTPLUG_HANDLER(pcms->acpi_dev), dev,
>>>>>> + &local_err);
>>>>>> if (local_err) {
>>>>>> goto out;
>>>>>> }
>>>>>> @@ -1877,14 +1866,11 @@ static void pc_cpu_unplug_cb(HotplugHandler *hotplug_dev,
>>>>>> DeviceState *dev, Error **errp)
>>>>>> {
>>>>>> CPUArchId *found_cpu;
>>>>>> - HotplugHandlerClass *hhc;
>>>>>> Error *local_err = NULL;
>>>>>> X86CPU *cpu = X86_CPU(dev);
>>>>>> PCMachineState *pcms = PC_MACHINE(hotplug_dev);
>>>>>>
>>>>>> - hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev);
>>>>>> - hhc->unplug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err);
>>>>>> -
>>>>>> + hotplug_handler_unplug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err);
>>>>>> if (local_err) {
>>>>>> goto out;
>>>>>> }
>>>>>>
>>>>>
>>>>> Queued, thanks.
>>>>
>>>> Paolo, just wondering, is this still on your queue or fell of the wagon?
>>>
>>> I had some issues with the previous pull request and also have to really
>>> spend some time on KVM. But it's still queued.
>>>
>>
>> No worries, I have some qdev patches based on this, but will simply send
>> this patch along with that series. Whatever hits upstream first :)
>
> Yes I was going to offer to put it on my queue but if there
> are dependencies for another queue that's fine too.
> You can also add
>
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
>
Added, thanks!
> if you like.
>
>>> Paolo
>>>
>>
>>
>> --
>>
>> Thanks,
>>
>> David / dhildenb
--
Thanks,
David / dhildenb
prev parent reply other threads:[~2019-01-31 9:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-12 9:57 [Qemu-devel] [PATCH v1] pc: Use hotplug_handler_(plug|unplug|unplug_request) David Hildenbrand
2018-12-14 9:58 ` Paolo Bonzini
2019-01-30 12:35 ` David Hildenbrand
2019-01-30 13:09 ` Paolo Bonzini
2019-01-30 15:07 ` David Hildenbrand
2019-01-30 22:10 ` Michael S. Tsirkin
2019-01-31 9:09 ` David Hildenbrand [this message]
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=b171a7a4-eccf-1fb1-b7fb-fbc3fe1017b0@redhat.com \
--to=david@redhat.com \
--cc=ehabkost@redhat.com \
--cc=imammedo@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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).