On Wed, 13 May 2015 15:11:15 +0800
Zhu Guihua <zhugh.f...@cn.fujitsu.com> wrote:

> Use C casts to avoid accessing ICCDevice's qdev field
> directly.
> 
> Signed-off-by: Zhu Guihua <zhugh.f...@cn.fujitsu.com>
> ---
>  hw/intc/apic.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/intc/apic.c b/hw/intc/apic.c
> index 0f97b47..e6f14b5 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)) 
> {
do here the same as below, i.e. don't use QOM cast.

>          cpu_reset_interrupt(cpu, CPU_INTERRUPT_HARD);
>      }
>  }
> @@ -549,10 +549,12 @@ 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)) {
> +    DeviceState *dev = (DeviceState *)s;
> +
> +    if (!apic_accept_pic_intr(dev) || !pic_get_output(isa_pic)) {
>          return false;
>      }
> -    apic_deliver_pic_intr(&s->busdev.qdev, 1);
> +    apic_deliver_pic_intr(dev, 1);
>      return true;
>  }
>  


Reply via email to