From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56474) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ynojk-0003K3-AO for qemu-devel@nongnu.org; Thu, 30 Apr 2015 09:42:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ynojc-0008GE-JP for qemu-devel@nongnu.org; Thu, 30 Apr 2015 09:42:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45172) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ynojc-0008Fs-B5 for qemu-devel@nongnu.org; Thu, 30 Apr 2015 09:42:36 -0400 Message-ID: <5542313B.3080609@redhat.com> Date: Thu, 30 Apr 2015 15:42:19 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <5541C104.6070109@suse.de> In-Reply-To: <5541C104.6070109@suse.de> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RESEND PATCH v4 2/4] apic: convert ->busdev.qdev casts to DEVICE() casts List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?windows-1252?Q?Andreas_F=E4rber?= , Zhu Guihua , qemu-devel@nongnu.org Cc: chen.fan.fnst@cn.fujitsu.com, imammedo@redhat.com, Peter Maydell , guz.fnst@cn.fujitsu.com, izumi.taku@jp.fujitsu.com On 30/04/2015 07:43, Andreas F=E4rber wrote: > Am 30.04.2015 um 03:33 schrieb Zhu Guihua: >> > Use DEVICE() casts to avoid accessing ICCDevice's qdev field >> > directly. >> >=20 >> > Signed-off-by: Zhu Guihua >> > --- >> > hw/intc/apic.c | 6 +++--- >> > 1 file changed, 3 insertions(+), 3 deletions(-) >> >=20 >> > 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_o= utput(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, uin= t8_t dest, uint8_t dest_mode, >> > =20 >> > static bool apic_check_pic(APICCommonState *s) >> > { >> > - if (!apic_accept_pic_intr(&s->busdev.qdev) || !pic_get_output(i= sa_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 =3D DEVICE(s); variable instead of > doing the cast inline twice. >=20 > Please also check the hunk above - "irq" indicates to me we need to kee= p > QOM impact low. Yes, it's probably better to use a C cast here, so "DeviceState *dev =3D (DeviceState *)s;". Paolo > Otherwise patch looks good, thanks for splitting out. > Not sure who is going to handle this - CC'ing Paolo.