diff mbox

[v6,2/4] apic: convert ->busdev.qdev casts to C casts

Message ID 5813534d8a2afa9ae2ff8f42c17b53dad2b3386e.1431936953.git.zhugh.fnst@cn.fujitsu.com
State New
Headers show

Commit Message

Zhu Guihua May 20, 2015, 2:40 a.m. UTC
Use C casts to avoid accessing ICCDevice's qdev field
directly.

Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com>
---
 hw/intc/apic.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

Igor Mammedov May 20, 2015, 11:48 a.m. UTC | #1
On Wed, 20 May 2015 10:40:47 +0800
Zhu Guihua <zhugh.fnst@cn.fujitsu.com> wrote:

> Use C casts to avoid accessing ICCDevice's qdev field
> directly.
> 
> Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>

> ---
>  hw/intc/apic.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/intc/apic.c b/hw/intc/apic.c
> index 0f97b47..77b639c 100644
> --- a/hw/intc/apic.c
> +++ b/hw/intc/apic.c
> @@ -370,13 +370,14 @@ static int apic_irq_pending(APICCommonState *s)
>  static void apic_update_irq(APICCommonState *s)
>  {
>      CPUState *cpu;
> +    DeviceState *dev = (DeviceState *)s;
>  
>      cpu = CPU(s->cpu);
>      if (!qemu_cpu_is_self(cpu)) {
>          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(dev) || !pic_get_output(isa_pic)) {
>          cpu_reset_interrupt(cpu, CPU_INTERRUPT_HARD);
>      }
>  }
> @@ -549,10 +550,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;
>  }
>
Andreas Färber May 20, 2015, 12:41 p.m. UTC | #2
Am 20.05.2015 um 04:40 schrieb Zhu Guihua:
> Use C casts to avoid accessing ICCDevice's qdev field
> directly.
> 
> Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com>
> ---
>  hw/intc/apic.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)

Reviewed-by: Andreas Färber <afaerber@suse.de>

Andreas
Eduardo Habkost May 22, 2015, 7:22 p.m. UTC | #3
On Wed, May 20, 2015 at 10:40:47AM +0800, Zhu Guihua wrote:
> Use C casts to avoid accessing ICCDevice's qdev field
> directly.
> 
> Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com>

Applied to the x86 tree. Thanks.
diff mbox

Patch

diff --git a/hw/intc/apic.c b/hw/intc/apic.c
index 0f97b47..77b639c 100644
--- a/hw/intc/apic.c
+++ b/hw/intc/apic.c
@@ -370,13 +370,14 @@  static int apic_irq_pending(APICCommonState *s)
 static void apic_update_irq(APICCommonState *s)
 {
     CPUState *cpu;
+    DeviceState *dev = (DeviceState *)s;
 
     cpu = CPU(s->cpu);
     if (!qemu_cpu_is_self(cpu)) {
         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(dev) || !pic_get_output(isa_pic)) {
         cpu_reset_interrupt(cpu, CPU_INTERRUPT_HARD);
     }
 }
@@ -549,10 +550,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;
 }