Patchwork [v1,5/5] nand: Don't inherit from Sysbus

login
register
mail settings
Submitter Peter Crosthwaite
Date June 18, 2013, 11:12 a.m.
Message ID <af1682cab1b1106aa58a782f758387e2a3f18bff.1371553360.git.peter.crosthwaite@xilinx.com>
Download mbox | patch
Permalink /patch/252235/
State New
Headers show

Comments

Peter Crosthwaite - June 18, 2013, 11:12 a.m.
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>

Nand chips are not sysbus devices - they do not have any sense of MMIO,
nor interrupts. Re-parent to TYPE_DEVICE accordingly.

Cc: afaerber@suse.de

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---

 hw/block/nand.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
Andreas Färber - June 19, 2013, 11:06 a.m.
Am 18.06.2013 13:12, schrieb peter.crosthwaite@xilinx.com:
> From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> 
> Nand chips are not sysbus devices - they do not have any sense of MMIO,
> nor interrupts. Re-parent to TYPE_DEVICE accordingly.
> 
> Cc: afaerber@suse.de
> 
> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> ---
> 
>  hw/block/nand.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)

CPUs are bus-less devices and work fine so far, so

Reviewed-by: Andreas Färber <afaerber@suse.de>

Andreas

Patch

diff --git a/hw/block/nand.c b/hw/block/nand.c
index 8dca3bc..072de7c 100644
--- a/hw/block/nand.c
+++ b/hw/block/nand.c
@@ -21,7 +21,7 @@ 
 # include "hw/hw.h"
 # include "hw/block/flash.h"
 # include "sysemu/blockdev.h"
-# include "hw/sysbus.h"
+#include "hw/qdev.h"
 #include "qemu/error-report.h"
 
 # define NAND_CMD_READ0		0x00
@@ -54,7 +54,8 @@ 
 
 typedef struct NANDFlashState NANDFlashState;
 struct NANDFlashState {
-    SysBusDevice busdev;
+    DeviceState parent_obj;
+
     uint8_t manf_id, chip_id;
     uint8_t buswidth; /* in BYTES */
     int size, pages;
@@ -440,7 +441,7 @@  static void nand_class_init(ObjectClass *klass, void *data)
 
 static const TypeInfo nand_info = {
     .name          = TYPE_NAND,
-    .parent        = TYPE_SYS_BUS_DEVICE,
+    .parent        = TYPE_DEVICE,
     .instance_size = sizeof(NANDFlashState),
     .class_init    = nand_class_init,
 };