Am 30.07.2012 18:07, schrieb Anthony Liguori:
> Andreas Färber <afaer...@suse.de> writes:
> 
>> 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ärber <afaer...@suse.de>
>> ---
>>  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)
>>  
>>  typedef struct TyphoonState {
>> -    PCIHostState host;
>> +    PCIHostState parent_obj;
>>  
>>      TyphoonCchip cchip;
>>      TyphoonPchip pchip;
>> @@ -770,7 +770,7 @@ PCIBus *typhoon_init(ram_addr_t ram_size, ISABus 
>> **isa_bus,
>>      b = pci_register_bus(dev, "pci",
>>                           typhoon_set_irq, sys_map_irq, s,
>>                           &s->pchip.reg_mem, addr_space_io, 0, 64);
>> -    s->host.bus = b;
>> +    PCI_HOST_BRIDGE(s)->bus = b;
> 
> 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

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

Reply via email to