Skip to content

Commit

Permalink
hw: cannot_instantiate_with_device_add_yet due to pointer props
Browse files Browse the repository at this point in the history
Pointer properties can be set only by code, not by device_add.  A
device with a pointer property can work with device_add only when the
property may remain null.

This is the case for property "interrupt_vector" of device
"etraxfs,pic".  Add a comment there.

Set cannot_instantiate_with_device_add_yet for the other devices with
pointer properties, with a comment explaining why.

Juha Riihimäki and Peter Maydell deserve my thanks for making "pointer
property must not remain null" blatantly obvious in the OMAP devices.

Only device "smbus-eeprom" is actually changed.  The others are all
sysbus devices, which get cannot_instantiate_with_device_add_yet set
in their abstract base's class init function.  Setting it again in
their class init function is technically redundant, but serves as
insurance for when sysbus devices become available with device_add,
and as documentation.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> (for ETRAX)
Signed-off-by: Andreas Färber <afaerber@suse.de>
  • Loading branch information
Markus Armbruster authored and afaerber committed Dec 24, 2013
1 parent 061e84f commit 1b111dc
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions hw/audio/marvell_88w8618.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@ static void mv88w8618_audio_class_init(ObjectClass *klass, void *data)
dc->reset = mv88w8618_audio_reset;
dc->vmsd = &mv88w8618_audio_vmsd;
dc->props = mv88w8618_audio_properties;
/* Reason: pointer property "wm8750" */
dc->cannot_instantiate_with_device_add_yet = true;
}

static const TypeInfo mv88w8618_audio_info = {
Expand Down
2 changes: 2 additions & 0 deletions hw/dma/sparc32_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,8 @@ static void sparc32_dma_class_init(ObjectClass *klass, void *data)
dc->reset = dma_reset;
dc->vmsd = &vmstate_dma;
dc->props = sparc32_dma_properties;
/* Reason: pointer property "iommu_opaque" */
dc->cannot_instantiate_with_device_add_yet = true;
}

static const TypeInfo sparc32_dma_info = {
Expand Down
4 changes: 4 additions & 0 deletions hw/gpio/omap_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,8 @@ static void omap_gpio_class_init(ObjectClass *klass, void *data)
k->init = omap_gpio_init;
dc->reset = omap_gpif_reset;
dc->props = omap_gpio_properties;
/* Reason: pointer property "clk" */
dc->cannot_instantiate_with_device_add_yet = true;
}

static const TypeInfo omap_gpio_info = {
Expand Down Expand Up @@ -788,6 +790,8 @@ static void omap2_gpio_class_init(ObjectClass *klass, void *data)
k->init = omap2_gpio_init;
dc->reset = omap2_gpif_reset;
dc->props = omap2_gpio_properties;
/* Reason: pointer properties "iclk", "fclk0", ..., "fclk5" */
dc->cannot_instantiate_with_device_add_yet = true;
}

static const TypeInfo omap2_gpio_info = {
Expand Down
2 changes: 2 additions & 0 deletions hw/i2c/omap_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,8 @@ static void omap_i2c_class_init(ObjectClass *klass, void *data)
k->init = omap_i2c_init;
dc->props = omap_i2c_properties;
dc->reset = omap_i2c_reset;
/* Reason: pointer properties "iclk", "fclk" */
dc->cannot_instantiate_with_device_add_yet = true;
}

static const TypeInfo omap_i2c_info = {
Expand Down
2 changes: 2 additions & 0 deletions hw/i2c/smbus_eeprom.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ static void smbus_eeprom_class_initfn(ObjectClass *klass, void *data)
sc->write_data = eeprom_write_data;
sc->read_data = eeprom_read_data;
dc->props = smbus_eeprom_properties;
/* Reason: pointer property "data" */
dc->cannot_instantiate_with_device_add_yet = true;
}

static const TypeInfo smbus_eeprom_info = {
Expand Down
4 changes: 4 additions & 0 deletions hw/intc/etraxfs_pic.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ static void etraxfs_pic_class_init(ObjectClass *klass, void *data)

k->init = etraxfs_pic_init;
dc->props = etraxfs_pic_properties;
/*
* Note: pointer property "interrupt_vector" may remain null, thus
* no need for dc->cannot_instantiate_with_device_add_yet = true;
*/
}

static const TypeInfo etraxfs_pic_info = {
Expand Down
2 changes: 2 additions & 0 deletions hw/intc/grlib_irqmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,8 @@ static void grlib_irqmp_class_init(ObjectClass *klass, void *data)
k->init = grlib_irqmp_init;
dc->reset = grlib_irqmp_reset;
dc->props = grlib_irqmp_properties;
/* Reason: pointer properties "set_pil_in", "set_pil_in_opaque" */
dc->cannot_instantiate_with_device_add_yet = true;
}

static const TypeInfo grlib_irqmp_info = {
Expand Down
4 changes: 4 additions & 0 deletions hw/intc/omap_intc.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,8 @@ static void omap_intc_class_init(ObjectClass *klass, void *data)
k->init = omap_intc_init;
dc->reset = omap_inth_reset;
dc->props = omap_intc_properties;
/* Reason: pointer property "clk" */
dc->cannot_instantiate_with_device_add_yet = true;
}

static const TypeInfo omap_intc_info = {
Expand Down Expand Up @@ -637,6 +639,8 @@ static void omap2_intc_class_init(ObjectClass *klass, void *data)
k->init = omap2_intc_init;
dc->reset = omap_inth_reset;
dc->props = omap2_intc_properties;
/* Reason: pointer property "iclk", "fclk" */
dc->cannot_instantiate_with_device_add_yet = true;
}

static const TypeInfo omap2_intc_info = {
Expand Down
2 changes: 2 additions & 0 deletions hw/net/etraxfs_eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,8 @@ static void etraxfs_eth_class_init(ObjectClass *klass, void *data)

k->init = fs_eth_init;
dc->props = etraxfs_eth_properties;
/* Reason: pointer properties "dma_out", "dma_in" */
dc->cannot_instantiate_with_device_add_yet = true;
}

static const TypeInfo etraxfs_eth_info = {
Expand Down
2 changes: 2 additions & 0 deletions hw/net/lance.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ static void lance_class_init(ObjectClass *klass, void *data)
dc->reset = lance_reset;
dc->vmsd = &vmstate_lance;
dc->props = lance_properties;
/* Reason: pointer property "dma" */
dc->cannot_instantiate_with_device_add_yet = true;
}

static const TypeInfo lance_info = {
Expand Down

0 comments on commit 1b111dc

Please sign in to comment.