Skip to contentSkip to conversation

nand: Don't use qdev_create() in nand_init()

PATCH In review Andreas Färber 2 participants 3 messages Feb 5, 2014 – Feb 8, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nand: Don't use qdev_create() in nand_init()

Commit 7426aa72c36c908a7d0eae3e38568bb0a70de479 (nand: Don't inherit from Sysbus) changed the parent type of TYPE_NAND but continued to use qdev_create(), which handled a NULL BusState as SysBus.

Use object_new() instead, and reuse the TYPE_NAND define while at it.

---
 hw/block/nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/block/nand.c +1 -1
index a871ce0..6d7c804 100644
@@ -632,7 +632,7 @@ DeviceState *nand_init(BlockDriverState *bdrv, int manf_id, int chip_id)
     if (nand_flash_ids[chip_id].size == 0) {
         hw_error("%s: Unsupported NAND chip ID.\n", __FUNCTION__);
     }
-    dev = qdev_create(NULL, "nand");
+    dev = DEVICE(object_new(TYPE_NAND));
     qdev_prop_set_uint8(dev, "manufacturer_id", manf_id);
     qdev_prop_set_uint8(dev, "chip_id", chip_id);
     if (bdrv) {
Signature · 1 line
1.8.4.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 30 lines · On Wed, 5 Feb 2014 15:30:53 +0100 Andreas Färber <[email protected]> wrote:

Commit 7426aa72c36c908a7d0eae3e38568bb0a70de479 (nand: Don't inherit from Sysbus) changed the parent type of TYPE_NAND but continued to use qdev_create(), which handled a NULL BusState as SysBus.

Use object_new() instead, and reuse the TYPE_NAND define while at it.

---
 hw/block/nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/block/nand.c +1 -1
index a871ce0..6d7c804 100644
@@ -632,7 +632,7 @@ DeviceState *nand_init(BlockDriverState *bdrv, int manf_id, int chip_id)
     if (nand_flash_ids[chip_id].size == 0) {
         hw_error("%s: Unsupported NAND chip ID.\n", __FUNCTION__);
     }
-    dev = qdev_create(NULL, "nand");
+    dev = DEVICE(object_new(TYPE_NAND));
     qdev_prop_set_uint8(dev, "manufacturer_id", manf_id);
     qdev_prop_set_uint8(dev, "chip_id", chip_id);
     if (bdrv) {
Signature · 1 line
1.8.4.5
Signature · 2 lines
Regards,
  Igor
author Applied
#2 lore raw

Am 05.02.2014 15:56, schrieb Igor Mammedov:

Quoted 27 lines
Quoted 24 lines · On Wed, 5 Feb 2014 15:30:53 +0100 Andreas Färber <[email protected]> wrote:

Commit 7426aa72c36c908a7d0eae3e38568bb0a70de479 (nand: Don't inherit from Sysbus) changed the parent type of TYPE_NAND but continued to use qdev_create(), which handled a NULL BusState as SysBus.

Use object_new() instead, and reuse the TYPE_NAND define while at it.

---
 hw/block/nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/block/nand.c +1 -1
index a871ce0..6d7c804 100644
@@ -632,7 +632,7 @@ DeviceState *nand_init(BlockDriverState *bdrv, int manf_id, int chip_id)
     if (nand_flash_ids[chip_id].size == 0) {
         hw_error("%s: Unsupported NAND chip ID.\n", __FUNCTION__);
     }
-    dev = qdev_create(NULL, "nand");
+    dev = DEVICE(object_new(TYPE_NAND));
     qdev_prop_set_uint8(dev, "manufacturer_id", manf_id);
Quoted 8 lines
Quoted 6 lines
hw/block/nand.c +0 -0
     qdev_prop_set_uint8(dev, "chip_id", chip_id);
     if (bdrv) {
Signature · 1 line
1.8.4.5

Thanks, applied to qom-next:
https://github.com/afaerber/qemu-cpu/commits/qom-next

Paolo, if you want your "all three patches can be applied" to be recorded, please reply with a proper tag!

Andreas

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