From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:53334) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SvsbE-0006Qy-GQ for qemu-devel@nongnu.org; Mon, 30 Jul 2012 12:13:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SvsbA-0004xf-7X for qemu-devel@nongnu.org; Mon, 30 Jul 2012 12:13:40 -0400 Message-ID: <5016B2AC.4060302@suse.de> Date: Mon, 30 Jul 2012 18:13:32 +0200 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= MIME-Version: 1.0 References: <1343305716-5178-1-git-send-email-afaerber@suse.de> <1343305716-5178-15-git-send-email-afaerber@suse.de> <87fw89xmeh.fsf@codemonkey.ws> In-Reply-To: <87fw89xmeh.fsf@codemonkey.ws> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v4 14/18] pci: Tidy up PCI host bridges List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: mst@redhat.com, Alexander Graf , qemu-devel@nongnu.org, qemu-ppc@nongnu.org, Scott Wood , liwanp@linux.vnet.ibm.com, David Gibson Am 30.07.2012 18:07, schrieb Anthony Liguori: > Andreas F=C3=A4rber writes: >=20 >> Uglify the parent field to enforce QOM-style access via casts. >> Don't just typedef PCIHostState, either use it directly or embed it. >> >> Signed-off-by: Andreas F=C3=A4rber >> --- >> hw/alpha_typhoon.c | 4 ++-- >> hw/dec_pci.c | 2 +- >> hw/grackle_pci.c | 2 +- >> hw/gt64xxx.c | 26 ++++++++++++++++---------- >> hw/piix_pci.c | 6 ++++-- >> hw/ppc4xx_pci.c | 8 +++++--- >> hw/ppce500_pci.c | 2 +- >> hw/prep_pci.c | 8 +++++--- >> hw/spapr_pci.c | 12 +++++++----- >> hw/spapr_pci.h | 2 +- >> hw/unin_pci.c | 14 +++++++------- >> 11 files changed, 50 insertions(+), 36 deletions(-) >> >> diff --git a/hw/alpha_typhoon.c b/hw/alpha_typhoon.c >> index 58025a3..955d628 100644 >> --- a/hw/alpha_typhoon.c >> +++ b/hw/alpha_typhoon.c >> @@ -46,7 +46,7 @@ typedef struct TyphoonPchip { >> OBJECT_CHECK(TyphoonState, (obj), TYPE_TYPHOON_PCI_HOST_BRIDGE) >> =20 >> typedef struct TyphoonState { >> - PCIHostState host; >> + PCIHostState parent_obj; >> =20 >> TyphoonCchip cchip; >> TyphoonPchip pchip; >> @@ -770,7 +770,7 @@ PCIBus *typhoon_init(ram_addr_t ram_size, ISABus *= *isa_bus, >> b =3D pci_register_bus(dev, "pci", >> typhoon_set_irq, sys_map_irq, s, >> &s->pchip.reg_mem, addr_space_io, 0, 64); >> - s->host.bus =3D b; >> + PCI_HOST_BRIDGE(s)->bus =3D b; >=20 > Using cast macros is a good thing but doing it like this is bad. You > should use a temporary variable. Sorry, seems I overlooked that in the big to-cast-or-not-to-cast thread. That was how I wanted to change it, yes. Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=C3=B6rffer; HRB 16746 AG N=C3=BC= rnberg