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 <zhugh.f...@cn.fujitsu.com>
>> > ---
>> >  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.

Reply via email to