[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RESEND PATCH v4 2/4] apic: convert ->busdev.qdev casts
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [RESEND PATCH v4 2/4] apic: convert ->busdev.qdev casts to DEVICE() casts |
Date: |
Thu, 30 Apr 2015 15:42:19 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 |
On 30/04/2015 07:43, Andreas Färber wrote:
> Am 30.04.2015 um 03:33 schrieb Zhu Guihua:
>> > Use DEVICE() casts to avoid accessing ICCDevice's qdev field
>> > directly.
>> >
>> > Signed-off-by: Zhu Guihua <address@hidden>
>> > ---
>> > hw/intc/apic.c | 6 +++---
>> > 1 file changed, 3 insertions(+), 3 deletions(-)
>> >
>> > diff --git a/hw/intc/apic.c b/hw/intc/apic.c
>> > index 0f97b47..00ae0ec 100644
>> > --- a/hw/intc/apic.c
>> > +++ b/hw/intc/apic.c
>> > @@ -376,7 +376,7 @@ static void apic_update_irq(APICCommonState *s)
>> > cpu_interrupt(cpu, CPU_INTERRUPT_POLL);
>> > } else if (apic_irq_pending(s) > 0) {
>> > cpu_interrupt(cpu, CPU_INTERRUPT_HARD);
>> > - } else if (!apic_accept_pic_intr(&s->busdev.qdev) ||
>> > !pic_get_output(isa_pic)) {
>> > + } else if (!apic_accept_pic_intr(DEVICE(s)) ||
>> > !pic_get_output(isa_pic)) {
>> > cpu_reset_interrupt(cpu, CPU_INTERRUPT_HARD);
>> > }
>> > }
>> > @@ -549,10 +549,10 @@ static void apic_deliver(DeviceState *dev, uint8_t
>> > dest, uint8_t dest_mode,
>> >
>> > static bool apic_check_pic(APICCommonState *s)
>> > {
>> > - if (!apic_accept_pic_intr(&s->busdev.qdev) ||
>> > !pic_get_output(isa_pic)) {
>> > + if (!apic_accept_pic_intr(DEVICE(s)) || !pic_get_output(isa_pic)) {
>> > return false;
>> > }
>> > - apic_deliver_pic_intr(&s->busdev.qdev, 1);
>> > + apic_deliver_pic_intr(DEVICE(s), 1);
> Please use a local DeviceState *dev = DEVICE(s); variable instead of
> doing the cast inline twice.
>
> Please also check the hunk above - "irq" indicates to me we need to keep
> QOM impact low.
Yes, it's probably better to use a C cast here, so "DeviceState *dev =
(DeviceState *)s;".
Paolo
> Otherwise patch looks good, thanks for splitting out.
> Not sure who is going to handle this - CC'ing Paolo.