Received: from eggs.gnu.org ([2001:4830:134:3::10]:36937) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YtHh5-0007p1-QN for qemu-devel@nongnu.org; Fri, 15 May 2015 11:38:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YtHh1-0003Ix-Mv for qemu-devel@nongnu.org; Fri, 15 May 2015 11:38:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52299) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YtHh1-0003IU-Dj for qemu-devel@nongnu.org; Fri, 15 May 2015 11:38:31 -0400 Date: Fri, 15 May 2015 17:38:15 +0200 From: Igor Mammedov Message-ID: <20150515173815.6fce8f87@nial.brq.redhat.com> In-Reply-To: <0051827ad57821b4ca512d60958f820ee8b471d6.1431500428.git.zhugh.fnst@cn.fujitsu.com> References: <0051827ad57821b4ca512d60958f820ee8b471d6.1431500428.git.zhugh.fnst@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v5 2/4] apic: convert ->busdev.qdev casts to C casts List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Zhu Guihua Cc: ehabkost@redhat.com, qemu-devel@nongnu.org, guz.fnst@cn.fujitsu.com, izumi.taku@jp.fujitsu.com, chen.fan.fnst@cn.fujitsu.com, pbonzini@redhat.com, afaerber@suse.de On Wed, 13 May 2015 15:11:15 +0800 Zhu Guihua wrote: > Use C casts to avoid accessing ICCDevice's qdev field > directly. > > Signed-off-by: Zhu Guihua > --- > 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; > } >