diff mbox

[v3,01/14] pci: Make host bridge TypeInfos const

Message ID 1341422373-13614-2-git-send-email-afaerber@suse.de
State New
Headers show

Commit Message

Andreas Färber July 4, 2012, 5:19 p.m. UTC
Also give the sPAPR host bridge type registration functions a unique
name.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/alpha_typhoon.c |    2 +-
 hw/bonito.c        |    4 ++--
 hw/dec_pci.c       |    6 +++---
 hw/grackle_pci.c   |    4 ++--
 hw/gt64xxx.c       |    4 ++--
 hw/piix_pci.c      |    8 ++++----
 hw/ppc4xx_pci.c    |    4 ++--
 hw/ppce500_pci.c   |    4 ++--
 hw/prep_pci.c      |    4 ++--
 hw/spapr_pci.c     |    7 ++++---
 hw/unin_pci.c      |   16 ++++++++--------
 11 files changed, 32 insertions(+), 31 deletions(-)

Comments

Michael S. Tsirkin July 4, 2012, 9:20 p.m. UTC | #1
On Wed, Jul 04, 2012 at 07:19:20PM +0200, Andreas Färber wrote:
> Also give the sPAPR host bridge type registration functions a unique
> name.
> 
> Signed-off-by: Andreas Färber <afaerber@suse.de>

I'd like to note that this is a bad practice.
Yoy write one thing in the 1 line summary
and then in the full commit log you
write about other unrelated stuff.

Make it a separate patch.

> ---
>  hw/alpha_typhoon.c |    2 +-
>  hw/bonito.c        |    4 ++--
>  hw/dec_pci.c       |    6 +++---
>  hw/grackle_pci.c   |    4 ++--
>  hw/gt64xxx.c       |    4 ++--
>  hw/piix_pci.c      |    8 ++++----
>  hw/ppc4xx_pci.c    |    4 ++--
>  hw/ppce500_pci.c   |    4 ++--
>  hw/prep_pci.c      |    4 ++--
>  hw/spapr_pci.c     |    7 ++++---
>  hw/unin_pci.c      |   16 ++++++++--------
>  11 files changed, 32 insertions(+), 31 deletions(-)
> 
> diff --git a/hw/alpha_typhoon.c b/hw/alpha_typhoon.c
> index 872e112..cc63737 100644
> --- a/hw/alpha_typhoon.c
> +++ b/hw/alpha_typhoon.c
> @@ -817,7 +817,7 @@ static void typhoon_pcihost_class_init(ObjectClass *klass, void *data)
>      dc->no_user = 1;
>  }
>  
> -static TypeInfo typhoon_pcihost_info = {
> +static const TypeInfo typhoon_pcihost_info = {
>      .name          = "typhoon-pcihost",
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(TyphoonState),
> diff --git a/hw/bonito.c b/hw/bonito.c
> index 77786f8..b990875 100644
> --- a/hw/bonito.c
> +++ b/hw/bonito.c
> @@ -781,7 +781,7 @@ static void bonito_class_init(ObjectClass *klass, void *data)
>      dc->vmsd = &vmstate_bonito;
>  }
>  
> -static TypeInfo bonito_info = {
> +static const TypeInfo bonito_info = {
>      .name          = "Bonito",
>      .parent        = TYPE_PCI_DEVICE,
>      .instance_size = sizeof(PCIBonitoState),
> @@ -797,7 +797,7 @@ static void bonito_pcihost_class_init(ObjectClass *klass, void *data)
>      dc->no_user = 1;
>  }
>  
> -static TypeInfo bonito_pcihost_info = {
> +static const TypeInfo bonito_pcihost_info = {
>      .name          = "Bonito-pcihost",
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(BonitoState),
> diff --git a/hw/dec_pci.c b/hw/dec_pci.c
> index 37337bf..5194a9f 100644
> --- a/hw/dec_pci.c
> +++ b/hw/dec_pci.c
> @@ -66,7 +66,7 @@ static void dec_21154_pci_bridge_class_init(ObjectClass *klass, void *data)
>      dc->vmsd = &vmstate_pci_device;
>  }
>  
> -static TypeInfo dec_21154_pci_bridge_info = {
> +static const TypeInfo dec_21154_pci_bridge_info = {
>      .name          = "dec-21154-p2p-bridge",
>      .parent        = TYPE_PCI_DEVICE,
>      .instance_size = sizeof(PCIBridge),
> @@ -119,7 +119,7 @@ static void dec_21154_pci_host_class_init(ObjectClass *klass, void *data)
>      k->is_bridge = 1;
>  }
>  
> -static TypeInfo dec_21154_pci_host_info = {
> +static const TypeInfo dec_21154_pci_host_info = {
>      .name          = "dec-21154",
>      .parent        = TYPE_PCI_DEVICE,
>      .instance_size = sizeof(PCIDevice),
> @@ -133,7 +133,7 @@ static void pci_dec_21154_device_class_init(ObjectClass *klass, void *data)
>      sdc->init = pci_dec_21154_device_init;
>  }
>  
> -static TypeInfo pci_dec_21154_device_info = {
> +static const TypeInfo pci_dec_21154_device_info = {
>      .name          = "dec-21154-sysbus",
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(DECState),
> diff --git a/hw/grackle_pci.c b/hw/grackle_pci.c
> index 81ff3a3..35667ad 100644
> --- a/hw/grackle_pci.c
> +++ b/hw/grackle_pci.c
> @@ -134,7 +134,7 @@ static void grackle_pci_class_init(ObjectClass *klass, void *data)
>      dc->no_user = 1;
>  }
>  
> -static TypeInfo grackle_pci_info = {
> +static const TypeInfo grackle_pci_info = {
>      .name          = "grackle",
>      .parent        = TYPE_PCI_DEVICE,
>      .instance_size = sizeof(PCIDevice),
> @@ -150,7 +150,7 @@ static void pci_grackle_class_init(ObjectClass *klass, void *data)
>      dc->no_user = 1;
>  }
>  
> -static TypeInfo grackle_pci_host_info = {
> +static const TypeInfo grackle_pci_host_info = {
>      .name          = "grackle-pcihost",
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(GrackleState),
> diff --git a/hw/gt64xxx.c b/hw/gt64xxx.c
> index a2d0e5a..04831bb 100644
> --- a/hw/gt64xxx.c
> +++ b/hw/gt64xxx.c
> @@ -1147,7 +1147,7 @@ static void gt64120_pci_class_init(ObjectClass *klass, void *data)
>      k->class_id = PCI_CLASS_BRIDGE_HOST;
>  }
>  
> -static TypeInfo gt64120_pci_info = {
> +static const TypeInfo gt64120_pci_info = {
>      .name          = "gt64120_pci",
>      .parent        = TYPE_PCI_DEVICE,
>      .instance_size = sizeof(PCIDevice),
> @@ -1161,7 +1161,7 @@ static void gt64120_class_init(ObjectClass *klass, void *data)
>      sdc->init = gt64120_init;
>  }
>  
> -static TypeInfo gt64120_info = {
> +static const TypeInfo gt64120_info = {
>      .name          = "gt64120",
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(GT64120State),
> diff --git a/hw/piix_pci.c b/hw/piix_pci.c
> index 09e84f5..5db4026 100644
> --- a/hw/piix_pci.c
> +++ b/hw/piix_pci.c
> @@ -517,7 +517,7 @@ static void piix3_class_init(ObjectClass *klass, void *data)
>      k->class_id     = PCI_CLASS_BRIDGE_ISA;
>  }
>  
> -static TypeInfo piix3_info = {
> +static const TypeInfo piix3_info = {
>      .name          = "PIIX3",
>      .parent        = TYPE_PCI_DEVICE,
>      .instance_size = sizeof(PIIX3State),
> @@ -540,7 +540,7 @@ static void piix3_xen_class_init(ObjectClass *klass, void *data)
>      k->class_id     = PCI_CLASS_BRIDGE_ISA;
>  };
>  
> -static TypeInfo piix3_xen_info = {
> +static const TypeInfo piix3_xen_info = {
>      .name          = "PIIX3-xen",
>      .parent        = TYPE_PCI_DEVICE,
>      .instance_size = sizeof(PIIX3State),
> @@ -564,7 +564,7 @@ static void i440fx_class_init(ObjectClass *klass, void *data)
>      dc->vmsd = &vmstate_i440fx;
>  }
>  
> -static TypeInfo i440fx_info = {
> +static const TypeInfo i440fx_info = {
>      .name          = "i440FX",
>      .parent        = TYPE_PCI_DEVICE,
>      .instance_size = sizeof(PCII440FXState),
> @@ -581,7 +581,7 @@ static void i440fx_pcihost_class_init(ObjectClass *klass, void *data)
>      dc->no_user = 1;
>  }
>  
> -static TypeInfo i440fx_pcihost_info = {
> +static const TypeInfo i440fx_pcihost_info = {
>      .name          = "i440FX-pcihost",
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(I440FXState),
> diff --git a/hw/ppc4xx_pci.c b/hw/ppc4xx_pci.c
> index 203c3cd..104ed98 100644
> --- a/hw/ppc4xx_pci.c
> +++ b/hw/ppc4xx_pci.c
> @@ -377,7 +377,7 @@ static void ppc4xx_host_bridge_class_init(ObjectClass *klass, void *data)
>      k->class_id     = PCI_CLASS_BRIDGE_OTHER;
>  }
>  
> -static TypeInfo ppc4xx_host_bridge_info = {
> +static const TypeInfo ppc4xx_host_bridge_info = {
>      .name          = "ppc4xx-host-bridge",
>      .parent        = TYPE_PCI_DEVICE,
>      .instance_size = sizeof(PCIDevice),
> @@ -393,7 +393,7 @@ static void ppc4xx_pcihost_class_init(ObjectClass *klass, void *data)
>      dc->vmsd = &vmstate_ppc4xx_pci;
>  }
>  
> -static TypeInfo ppc4xx_pcihost_info = {
> +static const TypeInfo ppc4xx_pcihost_info = {
>      .name          = "ppc4xx-pcihost",
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(PPC4xxPCIState),
> diff --git a/hw/ppce500_pci.c b/hw/ppce500_pci.c
> index 0f60b24..99748b3 100644
> --- a/hw/ppce500_pci.c
> +++ b/hw/ppce500_pci.c
> @@ -350,7 +350,7 @@ static void e500_host_bridge_class_init(ObjectClass *klass, void *data)
>      dc->desc = "Host bridge";
>  }
>  
> -static TypeInfo e500_host_bridge_info = {
> +static const TypeInfo e500_host_bridge_info = {
>      .name          = "e500-host-bridge",
>      .parent        = TYPE_PCI_DEVICE,
>      .instance_size = sizeof(PCIDevice),
> @@ -366,7 +366,7 @@ static void e500_pcihost_class_init(ObjectClass *klass, void *data)
>      dc->vmsd = &vmstate_ppce500_pci;
>  }
>  
> -static TypeInfo e500_pcihost_info = {
> +static const TypeInfo e500_pcihost_info = {
>      .name          = "e500-pcihost",
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(PPCE500PCIState),
> diff --git a/hw/prep_pci.c b/hw/prep_pci.c
> index 38dbff4..a8cdc21 100644
> --- a/hw/prep_pci.c
> +++ b/hw/prep_pci.c
> @@ -166,7 +166,7 @@ static void raven_class_init(ObjectClass *klass, void *data)
>      dc->no_user = 1;
>  }
>  
> -static TypeInfo raven_info = {
> +static const TypeInfo raven_info = {
>      .name = "raven",
>      .parent = TYPE_PCI_DEVICE,
>      .instance_size = sizeof(RavenPCIState),
> @@ -183,7 +183,7 @@ static void raven_pcihost_class_init(ObjectClass *klass, void *data)
>      dc->no_user = 1;
>  }
>  
> -static TypeInfo raven_pcihost_info = {
> +static const TypeInfo raven_pcihost_info = {
>      .name = "raven-pcihost",
>      .parent = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(PREPPCIState),
> diff --git a/hw/spapr_pci.c b/hw/spapr_pci.c
> index 47ba5ff..0e0830f 100644
> --- a/hw/spapr_pci.c
> +++ b/hw/spapr_pci.c
> @@ -368,7 +368,7 @@ static void spapr_phb_class_init(ObjectClass *klass, void *data)
>      spapr_rtas_register("ibm,write-pci-config", rtas_ibm_write_pci_config);
>  }
>  
> -static TypeInfo spapr_phb_info = {
> +static const TypeInfo spapr_phb_info = {
>      .name          = "spapr-pci-host-bridge",
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(sPAPRPHBState),
> @@ -490,8 +490,9 @@ int spapr_populate_pci_devices(sPAPRPHBState *phb,
>      return 0;
>  }
>  
> -static void register_types(void)
> +static void spapr_pci_register_types(void)
>  {
>      type_register_static(&spapr_phb_info);
>  }
> -type_init(register_types)
> +
> +type_init(spapr_pci_register_types)
> diff --git a/hw/unin_pci.c b/hw/unin_pci.c
> index 409bcd4..2b309df 100644
> --- a/hw/unin_pci.c
> +++ b/hw/unin_pci.c
> @@ -350,7 +350,7 @@ static void unin_main_pci_host_class_init(ObjectClass *klass, void *data)
>      k->class_id  = PCI_CLASS_BRIDGE_HOST;
>  }
>  
> -static TypeInfo unin_main_pci_host_info = {
> +static const TypeInfo unin_main_pci_host_info = {
>      .name = "uni-north-pci",
>      .parent = TYPE_PCI_DEVICE,
>      .instance_size = sizeof(PCIDevice),
> @@ -368,7 +368,7 @@ static void u3_agp_pci_host_class_init(ObjectClass *klass, void *data)
>      k->class_id  = PCI_CLASS_BRIDGE_HOST;
>  }
>  
> -static TypeInfo u3_agp_pci_host_info = {
> +static const TypeInfo u3_agp_pci_host_info = {
>      .name = "u3-agp",
>      .parent = TYPE_PCI_DEVICE,
>      .instance_size = sizeof(PCIDevice),
> @@ -386,7 +386,7 @@ static void unin_agp_pci_host_class_init(ObjectClass *klass, void *data)
>      k->class_id  = PCI_CLASS_BRIDGE_HOST;
>  }
>  
> -static TypeInfo unin_agp_pci_host_info = {
> +static const TypeInfo unin_agp_pci_host_info = {
>      .name = "uni-north-agp",
>      .parent = TYPE_PCI_DEVICE,
>      .instance_size = sizeof(PCIDevice),
> @@ -404,7 +404,7 @@ static void unin_internal_pci_host_class_init(ObjectClass *klass, void *data)
>      k->class_id  = PCI_CLASS_BRIDGE_HOST;
>  }
>  
> -static TypeInfo unin_internal_pci_host_info = {
> +static const TypeInfo unin_internal_pci_host_info = {
>      .name = "uni-north-internal-pci",
>      .parent = TYPE_PCI_DEVICE,
>      .instance_size = sizeof(PCIDevice),
> @@ -418,7 +418,7 @@ static void pci_unin_main_class_init(ObjectClass *klass, void *data)
>      sbc->init = pci_unin_main_init_device;
>  }
>  
> -static TypeInfo pci_unin_main_info = {
> +static const TypeInfo pci_unin_main_info = {
>      .name          = "uni-north-pci-pcihost",
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(UNINState),
> @@ -432,7 +432,7 @@ static void pci_u3_agp_class_init(ObjectClass *klass, void *data)
>      sbc->init = pci_u3_agp_init_device;
>  }
>  
> -static TypeInfo pci_u3_agp_info = {
> +static const TypeInfo pci_u3_agp_info = {
>      .name          = "u3-agp-pcihost",
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(UNINState),
> @@ -446,7 +446,7 @@ static void pci_unin_agp_class_init(ObjectClass *klass, void *data)
>      sbc->init = pci_unin_agp_init_device;
>  }
>  
> -static TypeInfo pci_unin_agp_info = {
> +static const TypeInfo pci_unin_agp_info = {
>      .name          = "uni-north-agp-pcihost",
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(UNINState),
> @@ -460,7 +460,7 @@ static void pci_unin_internal_class_init(ObjectClass *klass, void *data)
>      sbc->init = pci_unin_internal_init_device;
>  }
>  
> -static TypeInfo pci_unin_internal_info = {
> +static const TypeInfo pci_unin_internal_info = {
>      .name          = "uni-north-internal-pci-pcihost",
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(UNINState),
> -- 
> 1.7.7
Andreas Färber July 4, 2012, 10:51 p.m. UTC | #2
Am 04.07.2012 23:20, schrieb Michael S. Tsirkin:
> On Wed, Jul 04, 2012 at 07:19:20PM +0200, Andreas Färber wrote:
>> Also give the sPAPR host bridge type registration functions a unique
>> name.
>>
>> Signed-off-by: Andreas Färber <afaerber@suse.de>
> 
> I'd like to note that this is a bad practice.
> Yoy write one thing in the 1 line summary
> and then in the full commit log you
> write about other unrelated stuff.

(It seemed related by the proximity to the TypeInfo fwiw.)

> Make it a separate patch.

Do you request that for Coding Style fixes, too? See QOM'ify prep_pci
for an example that removed the only remaining violations in the file
while touching code above and below.

Background of why v2 already did multiple things at once (without anyone
complaining) was that Anthony complained that my CPU refactorings were
too long and not doing enough in one patch.

I'm already up from 2 to 14 here and don't mind splitting things up
further again but I don't think there's sufficient reason that warrants
having a patch that just renames the function for aesthetics. Would you
be okay with moving it into the corresponding QOM'ify sPAPR patch or the
final "Tidy up" patch instead?

Andreas
Michael S. Tsirkin July 5, 2012, 3:25 p.m. UTC | #3
On Thu, Jul 05, 2012 at 12:51:12AM +0200, Andreas Färber wrote:
> Am 04.07.2012 23:20, schrieb Michael S. Tsirkin:
> > On Wed, Jul 04, 2012 at 07:19:20PM +0200, Andreas Färber wrote:
> >> Also give the sPAPR host bridge type registration functions a unique
> >> name.
> >>
> >> Signed-off-by: Andreas Färber <afaerber@suse.de>
> > 
> > I'd like to note that this is a bad practice.
> > Yoy write one thing in the 1 line summary
> > and then in the full commit log you
> > write about other unrelated stuff.
> 
> (It seemed related by the proximity to the TypeInfo fwiw.)
> 
> > Make it a separate patch.
> 
> Do you request that for Coding Style fixes, too? See QOM'ify prep_pci
> for an example that removed the only remaining violations in the file
> while touching code above and below.
> 
> Background of why v2 already did multiple things at once (without anyone
> complaining) was that Anthony complained that my CPU refactorings were
> too long and not doing enough in one patch.
> 
> I'm already up from 2 to 14 here and don't mind splitting things up
> further again but I don't think there's sufficient reason that warrants
> having a patch that just renames the function for aesthetics. Would you
> be okay with moving it into the corresponding QOM'ify sPAPR patch or the
> final "Tidy up" patch instead?
> 
> Andreas

You can even leave it as is, but subject should then say
'misc cleanups in XXXX.c' ot something to that effect.

> -- 
> 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/alpha_typhoon.c b/hw/alpha_typhoon.c
index 872e112..cc63737 100644
--- a/hw/alpha_typhoon.c
+++ b/hw/alpha_typhoon.c
@@ -817,7 +817,7 @@  static void typhoon_pcihost_class_init(ObjectClass *klass, void *data)
     dc->no_user = 1;
 }
 
-static TypeInfo typhoon_pcihost_info = {
+static const TypeInfo typhoon_pcihost_info = {
     .name          = "typhoon-pcihost",
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(TyphoonState),
diff --git a/hw/bonito.c b/hw/bonito.c
index 77786f8..b990875 100644
--- a/hw/bonito.c
+++ b/hw/bonito.c
@@ -781,7 +781,7 @@  static void bonito_class_init(ObjectClass *klass, void *data)
     dc->vmsd = &vmstate_bonito;
 }
 
-static TypeInfo bonito_info = {
+static const TypeInfo bonito_info = {
     .name          = "Bonito",
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCIBonitoState),
@@ -797,7 +797,7 @@  static void bonito_pcihost_class_init(ObjectClass *klass, void *data)
     dc->no_user = 1;
 }
 
-static TypeInfo bonito_pcihost_info = {
+static const TypeInfo bonito_pcihost_info = {
     .name          = "Bonito-pcihost",
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(BonitoState),
diff --git a/hw/dec_pci.c b/hw/dec_pci.c
index 37337bf..5194a9f 100644
--- a/hw/dec_pci.c
+++ b/hw/dec_pci.c
@@ -66,7 +66,7 @@  static void dec_21154_pci_bridge_class_init(ObjectClass *klass, void *data)
     dc->vmsd = &vmstate_pci_device;
 }
 
-static TypeInfo dec_21154_pci_bridge_info = {
+static const TypeInfo dec_21154_pci_bridge_info = {
     .name          = "dec-21154-p2p-bridge",
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCIBridge),
@@ -119,7 +119,7 @@  static void dec_21154_pci_host_class_init(ObjectClass *klass, void *data)
     k->is_bridge = 1;
 }
 
-static TypeInfo dec_21154_pci_host_info = {
+static const TypeInfo dec_21154_pci_host_info = {
     .name          = "dec-21154",
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCIDevice),
@@ -133,7 +133,7 @@  static void pci_dec_21154_device_class_init(ObjectClass *klass, void *data)
     sdc->init = pci_dec_21154_device_init;
 }
 
-static TypeInfo pci_dec_21154_device_info = {
+static const TypeInfo pci_dec_21154_device_info = {
     .name          = "dec-21154-sysbus",
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(DECState),
diff --git a/hw/grackle_pci.c b/hw/grackle_pci.c
index 81ff3a3..35667ad 100644
--- a/hw/grackle_pci.c
+++ b/hw/grackle_pci.c
@@ -134,7 +134,7 @@  static void grackle_pci_class_init(ObjectClass *klass, void *data)
     dc->no_user = 1;
 }
 
-static TypeInfo grackle_pci_info = {
+static const TypeInfo grackle_pci_info = {
     .name          = "grackle",
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCIDevice),
@@ -150,7 +150,7 @@  static void pci_grackle_class_init(ObjectClass *klass, void *data)
     dc->no_user = 1;
 }
 
-static TypeInfo grackle_pci_host_info = {
+static const TypeInfo grackle_pci_host_info = {
     .name          = "grackle-pcihost",
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(GrackleState),
diff --git a/hw/gt64xxx.c b/hw/gt64xxx.c
index a2d0e5a..04831bb 100644
--- a/hw/gt64xxx.c
+++ b/hw/gt64xxx.c
@@ -1147,7 +1147,7 @@  static void gt64120_pci_class_init(ObjectClass *klass, void *data)
     k->class_id = PCI_CLASS_BRIDGE_HOST;
 }
 
-static TypeInfo gt64120_pci_info = {
+static const TypeInfo gt64120_pci_info = {
     .name          = "gt64120_pci",
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCIDevice),
@@ -1161,7 +1161,7 @@  static void gt64120_class_init(ObjectClass *klass, void *data)
     sdc->init = gt64120_init;
 }
 
-static TypeInfo gt64120_info = {
+static const TypeInfo gt64120_info = {
     .name          = "gt64120",
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(GT64120State),
diff --git a/hw/piix_pci.c b/hw/piix_pci.c
index 09e84f5..5db4026 100644
--- a/hw/piix_pci.c
+++ b/hw/piix_pci.c
@@ -517,7 +517,7 @@  static void piix3_class_init(ObjectClass *klass, void *data)
     k->class_id     = PCI_CLASS_BRIDGE_ISA;
 }
 
-static TypeInfo piix3_info = {
+static const TypeInfo piix3_info = {
     .name          = "PIIX3",
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PIIX3State),
@@ -540,7 +540,7 @@  static void piix3_xen_class_init(ObjectClass *klass, void *data)
     k->class_id     = PCI_CLASS_BRIDGE_ISA;
 };
 
-static TypeInfo piix3_xen_info = {
+static const TypeInfo piix3_xen_info = {
     .name          = "PIIX3-xen",
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PIIX3State),
@@ -564,7 +564,7 @@  static void i440fx_class_init(ObjectClass *klass, void *data)
     dc->vmsd = &vmstate_i440fx;
 }
 
-static TypeInfo i440fx_info = {
+static const TypeInfo i440fx_info = {
     .name          = "i440FX",
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCII440FXState),
@@ -581,7 +581,7 @@  static void i440fx_pcihost_class_init(ObjectClass *klass, void *data)
     dc->no_user = 1;
 }
 
-static TypeInfo i440fx_pcihost_info = {
+static const TypeInfo i440fx_pcihost_info = {
     .name          = "i440FX-pcihost",
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(I440FXState),
diff --git a/hw/ppc4xx_pci.c b/hw/ppc4xx_pci.c
index 203c3cd..104ed98 100644
--- a/hw/ppc4xx_pci.c
+++ b/hw/ppc4xx_pci.c
@@ -377,7 +377,7 @@  static void ppc4xx_host_bridge_class_init(ObjectClass *klass, void *data)
     k->class_id     = PCI_CLASS_BRIDGE_OTHER;
 }
 
-static TypeInfo ppc4xx_host_bridge_info = {
+static const TypeInfo ppc4xx_host_bridge_info = {
     .name          = "ppc4xx-host-bridge",
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCIDevice),
@@ -393,7 +393,7 @@  static void ppc4xx_pcihost_class_init(ObjectClass *klass, void *data)
     dc->vmsd = &vmstate_ppc4xx_pci;
 }
 
-static TypeInfo ppc4xx_pcihost_info = {
+static const TypeInfo ppc4xx_pcihost_info = {
     .name          = "ppc4xx-pcihost",
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(PPC4xxPCIState),
diff --git a/hw/ppce500_pci.c b/hw/ppce500_pci.c
index 0f60b24..99748b3 100644
--- a/hw/ppce500_pci.c
+++ b/hw/ppce500_pci.c
@@ -350,7 +350,7 @@  static void e500_host_bridge_class_init(ObjectClass *klass, void *data)
     dc->desc = "Host bridge";
 }
 
-static TypeInfo e500_host_bridge_info = {
+static const TypeInfo e500_host_bridge_info = {
     .name          = "e500-host-bridge",
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCIDevice),
@@ -366,7 +366,7 @@  static void e500_pcihost_class_init(ObjectClass *klass, void *data)
     dc->vmsd = &vmstate_ppce500_pci;
 }
 
-static TypeInfo e500_pcihost_info = {
+static const TypeInfo e500_pcihost_info = {
     .name          = "e500-pcihost",
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(PPCE500PCIState),
diff --git a/hw/prep_pci.c b/hw/prep_pci.c
index 38dbff4..a8cdc21 100644
--- a/hw/prep_pci.c
+++ b/hw/prep_pci.c
@@ -166,7 +166,7 @@  static void raven_class_init(ObjectClass *klass, void *data)
     dc->no_user = 1;
 }
 
-static TypeInfo raven_info = {
+static const TypeInfo raven_info = {
     .name = "raven",
     .parent = TYPE_PCI_DEVICE,
     .instance_size = sizeof(RavenPCIState),
@@ -183,7 +183,7 @@  static void raven_pcihost_class_init(ObjectClass *klass, void *data)
     dc->no_user = 1;
 }
 
-static TypeInfo raven_pcihost_info = {
+static const TypeInfo raven_pcihost_info = {
     .name = "raven-pcihost",
     .parent = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(PREPPCIState),
diff --git a/hw/spapr_pci.c b/hw/spapr_pci.c
index 47ba5ff..0e0830f 100644
--- a/hw/spapr_pci.c
+++ b/hw/spapr_pci.c
@@ -368,7 +368,7 @@  static void spapr_phb_class_init(ObjectClass *klass, void *data)
     spapr_rtas_register("ibm,write-pci-config", rtas_ibm_write_pci_config);
 }
 
-static TypeInfo spapr_phb_info = {
+static const TypeInfo spapr_phb_info = {
     .name          = "spapr-pci-host-bridge",
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(sPAPRPHBState),
@@ -490,8 +490,9 @@  int spapr_populate_pci_devices(sPAPRPHBState *phb,
     return 0;
 }
 
-static void register_types(void)
+static void spapr_pci_register_types(void)
 {
     type_register_static(&spapr_phb_info);
 }
-type_init(register_types)
+
+type_init(spapr_pci_register_types)
diff --git a/hw/unin_pci.c b/hw/unin_pci.c
index 409bcd4..2b309df 100644
--- a/hw/unin_pci.c
+++ b/hw/unin_pci.c
@@ -350,7 +350,7 @@  static void unin_main_pci_host_class_init(ObjectClass *klass, void *data)
     k->class_id  = PCI_CLASS_BRIDGE_HOST;
 }
 
-static TypeInfo unin_main_pci_host_info = {
+static const TypeInfo unin_main_pci_host_info = {
     .name = "uni-north-pci",
     .parent = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCIDevice),
@@ -368,7 +368,7 @@  static void u3_agp_pci_host_class_init(ObjectClass *klass, void *data)
     k->class_id  = PCI_CLASS_BRIDGE_HOST;
 }
 
-static TypeInfo u3_agp_pci_host_info = {
+static const TypeInfo u3_agp_pci_host_info = {
     .name = "u3-agp",
     .parent = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCIDevice),
@@ -386,7 +386,7 @@  static void unin_agp_pci_host_class_init(ObjectClass *klass, void *data)
     k->class_id  = PCI_CLASS_BRIDGE_HOST;
 }
 
-static TypeInfo unin_agp_pci_host_info = {
+static const TypeInfo unin_agp_pci_host_info = {
     .name = "uni-north-agp",
     .parent = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCIDevice),
@@ -404,7 +404,7 @@  static void unin_internal_pci_host_class_init(ObjectClass *klass, void *data)
     k->class_id  = PCI_CLASS_BRIDGE_HOST;
 }
 
-static TypeInfo unin_internal_pci_host_info = {
+static const TypeInfo unin_internal_pci_host_info = {
     .name = "uni-north-internal-pci",
     .parent = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCIDevice),
@@ -418,7 +418,7 @@  static void pci_unin_main_class_init(ObjectClass *klass, void *data)
     sbc->init = pci_unin_main_init_device;
 }
 
-static TypeInfo pci_unin_main_info = {
+static const TypeInfo pci_unin_main_info = {
     .name          = "uni-north-pci-pcihost",
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(UNINState),
@@ -432,7 +432,7 @@  static void pci_u3_agp_class_init(ObjectClass *klass, void *data)
     sbc->init = pci_u3_agp_init_device;
 }
 
-static TypeInfo pci_u3_agp_info = {
+static const TypeInfo pci_u3_agp_info = {
     .name          = "u3-agp-pcihost",
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(UNINState),
@@ -446,7 +446,7 @@  static void pci_unin_agp_class_init(ObjectClass *klass, void *data)
     sbc->init = pci_unin_agp_init_device;
 }
 
-static TypeInfo pci_unin_agp_info = {
+static const TypeInfo pci_unin_agp_info = {
     .name          = "uni-north-agp-pcihost",
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(UNINState),
@@ -460,7 +460,7 @@  static void pci_unin_internal_class_init(ObjectClass *klass, void *data)
     sbc->init = pci_unin_internal_init_device;
 }
 
-static TypeInfo pci_unin_internal_info = {
+static const TypeInfo pci_unin_internal_info = {
     .name          = "uni-north-internal-pci-pcihost",
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(UNINState),