qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 03/30] net/pcnet-pci: QOM Upcast Sweep


From: Andreas Färber
Subject: Re: [Qemu-devel] [PATCH v2 03/30] net/pcnet-pci: QOM Upcast Sweep
Date: Mon, 22 Jul 2013 19:17:30 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7

Am 30.06.2013 09:34, schrieb Andreas Färber:
> Am 24.06.2013 08:52, schrieb address@hidden:
>> From: Peter Crosthwaite <address@hidden>
>>
>> Define and use standard QOM cast macro. Remove usages of DO_UPCAST
>> and direct -> style upcasting.
>>
>> Signed-off-by: Peter Crosthwaite <address@hidden>
>> ---
>>
>>  hw/net/pcnet-pci.c | 14 +++++++++-----
>>  1 file changed, 9 insertions(+), 5 deletions(-)
>>
>> diff --git a/hw/net/pcnet-pci.c b/hw/net/pcnet-pci.c
>> index 9df2b87..b1afbf4 100644
>> --- a/hw/net/pcnet-pci.c
>> +++ b/hw/net/pcnet-pci.c
>> @@ -43,6 +43,10 @@
>>  //#define PCNET_DEBUG_TMD
>>  //#define PCNET_DEBUG_MATCH
>>  
>> +#define TYPE_PCI_PC_NET "pcnet"
> 
> I'm wondering whether we should rename this PCNET rather than PC_NET,
> but I'm queuing it as is. Thanks,

In light of the MP_TIMER vs. MPTIMER discussion elsewhere I'm changing
both patches, i.e. TYPE_PCI_PCNET and PCI_PCNET() here, in line with
pcnet_ prefix.

Andreas

>> +
>> +#define PCI_PC_NET(obj) \
>> +     OBJECT_CHECK(PCIPCNetState, (obj), TYPE_PCI_PC_NET)
>>  
>>  typedef struct {
>>      PCIDevice pci_dev;
>> @@ -273,7 +277,7 @@ static void pci_pcnet_cleanup(NetClientState *nc)
>>  
>>  static void pci_pcnet_uninit(PCIDevice *dev)
>>  {
>> -    PCIPCNetState *d = DO_UPCAST(PCIPCNetState, pci_dev, dev);
>> +    PCIPCNetState *d = PCI_PC_NET(dev);
>>  
>>      memory_region_destroy(&d->state.mmio);
>>      memory_region_destroy(&d->io_bar);
>> @@ -293,7 +297,7 @@ static NetClientInfo net_pci_pcnet_info = {
>>  
>>  static int pci_pcnet_init(PCIDevice *pci_dev)
>>  {
>> -    PCIPCNetState *d = DO_UPCAST(PCIPCNetState, pci_dev, pci_dev);
>> +    PCIPCNetState *d = PCI_PC_NET(pci_dev);
>>      PCNetState *s = &d->state;
>>      uint8_t *pci_conf;
>>  
>> @@ -329,12 +333,12 @@ static int pci_pcnet_init(PCIDevice *pci_dev)
>>      s->phys_mem_write = pci_physical_memory_write;
>>      s->dma_opaque = pci_dev;
>>  
>> -    return pcnet_common_init(&pci_dev->qdev, s, &net_pci_pcnet_info);
>> +    return pcnet_common_init(DEVICE(pci_dev), s, &net_pci_pcnet_info);
>>  }
>>  
>>  static void pci_reset(DeviceState *dev)
>>  {
>> -    PCIPCNetState *d = DO_UPCAST(PCIPCNetState, pci_dev.qdev, dev);
>> +    PCIPCNetState *d = PCI_PC_NET(dev);
>>  
>>      pcnet_h_reset(&d->state);
>>  }
>> @@ -362,7 +366,7 @@ static void pcnet_class_init(ObjectClass *klass, void 
>> *data)
>>  }
>>  
>>  static const TypeInfo pcnet_info = {
>> -    .name          = "pcnet",
>> +    .name          = TYPE_PCI_PC_NET,
>>      .parent        = TYPE_PCI_DEVICE,
>>      .instance_size = sizeof(PCIPCNetState),
>>      .class_init    = pcnet_class_init,
>>
> 
> 


-- 
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

[Prev in Thread] Current Thread [Next in Thread]