diff mbox

[2/6] pc: add I440FX QOM cast macro

Message ID 1374996553-21828-3-git-send-email-imammedo@redhat.com
State New
Headers show

Commit Message

Igor Mammedov July 28, 2013, 7:29 a.m. UTC
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/pci-host/piix.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Andreas Färber July 28, 2013, 9:57 a.m. UTC | #1
Am 28.07.2013 09:29, schrieb Igor Mammedov:
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>  hw/pci-host/piix.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c
> index 3908860..bf879e7 100644
> --- a/hw/pci-host/piix.c
> +++ b/hw/pci-host/piix.c
> @@ -38,6 +38,10 @@
>   * http://download.intel.com/design/chipsets/datashts/29054901.pdf
>   */
>  
> +#define TYPE_I440FX_PCI_HOST "i440FX-pcihost"
> +#define I440FX_PCI_HOST(obj) \
> +    OBJECT_CHECK(I440FXState, (obj), TYPE_I440FX_PCI_HOST)

Either Anthony or mst had insisted on PCI_HOST_BRIDGE rather than
PCI_HOST. Other than that looks good, thanks!

Andreas

> +
>  typedef struct I440FXState {
>      PCIHostState parent_obj;
>  } I440FXState;
> @@ -257,7 +261,7 @@ static PCIBus *i440fx_common_init(const char *device_name,
>      PCII440FXState *f;
>      unsigned i;
>  
> -    dev = qdev_create(NULL, "i440FX-pcihost");
> +    dev = qdev_create(NULL, TYPE_I440FX_PCI_HOST);
>      s = PCI_HOST_BRIDGE(dev);
>      b = pci_bus_new(dev, NULL, pci_address_space,
>                      address_space_io, 0, TYPE_PCI_BUS);
> @@ -661,7 +665,7 @@ static void i440fx_pcihost_class_init(ObjectClass *klass, void *data)
>  }
>  
>  static const TypeInfo i440fx_pcihost_info = {
> -    .name          = "i440FX-pcihost",
> +    .name          = TYPE_I440FX_PCI_HOST,
>      .parent        = TYPE_PCI_HOST_BRIDGE,
>      .instance_size = sizeof(I440FXState),
>      .instance_init = i440fx_pcihost_initfn,
>
Igor Mammedov July 28, 2013, 5:21 p.m. UTC | #2
On Sun, 28 Jul 2013 11:57:14 +0200
Andreas Färber <afaerber@suse.de> wrote:

> Am 28.07.2013 09:29, schrieb Igor Mammedov:
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > ---
> >  hw/pci-host/piix.c | 8 ++++++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> > 
> > diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c
> > index 3908860..bf879e7 100644
> > --- a/hw/pci-host/piix.c
> > +++ b/hw/pci-host/piix.c
> > @@ -38,6 +38,10 @@
> >   * http://download.intel.com/design/chipsets/datashts/29054901.pdf
> >   */
> >  
> > +#define TYPE_I440FX_PCI_HOST "i440FX-pcihost"
> > +#define I440FX_PCI_HOST(obj) \
> > +    OBJECT_CHECK(I440FXState, (obj), TYPE_I440FX_PCI_HOST)
> 
> Either Anthony or mst had insisted on PCI_HOST_BRIDGE rather than
> PCI_HOST. Other than that looks good, thanks!

it's the type cast macro that is missing, so adding it shouldn't hurt,
and some day in future we might any way need to add it even if we don't use it
now.


> Andreas
> 
> > +
> >  typedef struct I440FXState {
> >      PCIHostState parent_obj;
> >  } I440FXState;
> > @@ -257,7 +261,7 @@ static PCIBus *i440fx_common_init(const char *device_name,
> >      PCII440FXState *f;
> >      unsigned i;
> >  
> > -    dev = qdev_create(NULL, "i440FX-pcihost");
> > +    dev = qdev_create(NULL, TYPE_I440FX_PCI_HOST);
> >      s = PCI_HOST_BRIDGE(dev);
> >      b = pci_bus_new(dev, NULL, pci_address_space,
> >                      address_space_io, 0, TYPE_PCI_BUS);
> > @@ -661,7 +665,7 @@ static void i440fx_pcihost_class_init(ObjectClass *klass, void *data)
> >  }
> >  
> >  static const TypeInfo i440fx_pcihost_info = {
> > -    .name          = "i440FX-pcihost",
> > +    .name          = TYPE_I440FX_PCI_HOST,
> >      .parent        = TYPE_PCI_HOST_BRIDGE,
> >      .instance_size = sizeof(I440FXState),
> >      .instance_init = i440fx_pcihost_initfn,
> > 
> 
> 
> -- 
> SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
> GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Andreas Färber July 28, 2013, 5:24 p.m. UTC | #3
Am 28.07.2013 19:21, schrieb Igor Mammedov:
> On Sun, 28 Jul 2013 11:57:14 +0200
> Andreas Färber <afaerber@suse.de> wrote:
> 
>> Am 28.07.2013 09:29, schrieb Igor Mammedov:
>>> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
>>> ---
>>>  hw/pci-host/piix.c | 8 ++++++--
>>>  1 file changed, 6 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c
>>> index 3908860..bf879e7 100644
>>> --- a/hw/pci-host/piix.c
>>> +++ b/hw/pci-host/piix.c
>>> @@ -38,6 +38,10 @@
>>>   * http://download.intel.com/design/chipsets/datashts/29054901.pdf
>>>   */
>>>  
>>> +#define TYPE_I440FX_PCI_HOST "i440FX-pcihost"
>>> +#define I440FX_PCI_HOST(obj) \
>>> +    OBJECT_CHECK(I440FXState, (obj), TYPE_I440FX_PCI_HOST)
>>
>> Either Anthony or mst had insisted on PCI_HOST_BRIDGE rather than
>> PCI_HOST. Other than that looks good, thanks!
> 
> it's the type cast macro that is missing, so adding it shouldn't hurt,
> and some day in future we might any way need to add it even if we don't use it
> now.

Maybe you misunderstood? Please add _BRIDGE to your macros. :)

Andreas
Igor Mammedov July 28, 2013, 6:05 p.m. UTC | #4
On Sun, 28 Jul 2013 19:24:03 +0200
Andreas Färber <afaerber@suse.de> wrote:

> Am 28.07.2013 19:21, schrieb Igor Mammedov:
> > On Sun, 28 Jul 2013 11:57:14 +0200
> > Andreas Färber <afaerber@suse.de> wrote:
> > 
> >> Am 28.07.2013 09:29, schrieb Igor Mammedov:
> >>> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> >>> ---
> >>>  hw/pci-host/piix.c | 8 ++++++--
> >>>  1 file changed, 6 insertions(+), 2 deletions(-)
> >>>
> >>> diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c
> >>> index 3908860..bf879e7 100644
> >>> --- a/hw/pci-host/piix.c
> >>> +++ b/hw/pci-host/piix.c
> >>> @@ -38,6 +38,10 @@
> >>>   * http://download.intel.com/design/chipsets/datashts/29054901.pdf
> >>>   */
> >>>  
> >>> +#define TYPE_I440FX_PCI_HOST "i440FX-pcihost"
> >>> +#define I440FX_PCI_HOST(obj) \
> >>> +    OBJECT_CHECK(I440FXState, (obj), TYPE_I440FX_PCI_HOST)
> >>
> >> Either Anthony or mst had insisted on PCI_HOST_BRIDGE rather than
> >> PCI_HOST. Other than that looks good, thanks!
> > 
> > it's the type cast macro that is missing, so adding it shouldn't hurt,
> > and some day in future we might any way need to add it even if we don't use it
> > now.
> 
> Maybe you misunderstood? Please add _BRIDGE to your macros. :)
Yep, sure I'll do it.

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

Patch

diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c
index 3908860..bf879e7 100644
--- a/hw/pci-host/piix.c
+++ b/hw/pci-host/piix.c
@@ -38,6 +38,10 @@ 
  * http://download.intel.com/design/chipsets/datashts/29054901.pdf
  */
 
+#define TYPE_I440FX_PCI_HOST "i440FX-pcihost"
+#define I440FX_PCI_HOST(obj) \
+    OBJECT_CHECK(I440FXState, (obj), TYPE_I440FX_PCI_HOST)
+
 typedef struct I440FXState {
     PCIHostState parent_obj;
 } I440FXState;
@@ -257,7 +261,7 @@  static PCIBus *i440fx_common_init(const char *device_name,
     PCII440FXState *f;
     unsigned i;
 
-    dev = qdev_create(NULL, "i440FX-pcihost");
+    dev = qdev_create(NULL, TYPE_I440FX_PCI_HOST);
     s = PCI_HOST_BRIDGE(dev);
     b = pci_bus_new(dev, NULL, pci_address_space,
                     address_space_io, 0, TYPE_PCI_BUS);
@@ -661,7 +665,7 @@  static void i440fx_pcihost_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo i440fx_pcihost_info = {
-    .name          = "i440FX-pcihost",
+    .name          = TYPE_I440FX_PCI_HOST,
     .parent        = TYPE_PCI_HOST_BRIDGE,
     .instance_size = sizeof(I440FXState),
     .instance_init = i440fx_pcihost_initfn,