aboutsummaryrefslogtreecommitdiff
path: root/hw/arm/spitz.c
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2013-07-24 08:54:33 +0200
committerAndreas Färber <afaerber@suse.de>2013-07-29 21:06:26 +0200
commit7eb8104a9cd274a14b9a8a6caf38d0720e56cd21 (patch)
tree13f7e509cfb4d872ba516f78cb05d3376cbc1660 /hw/arm/spitz.c
parent6050ed5fb98822220f71d69c46870bdf1f3bc076 (diff)
spitz: QOM cast cleanup for SLNANDState
Introduce a type constant, use QOM casts and rename the parent field. Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw/arm/spitz.c')
-rw-r--r--hw/arm/spitz.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c
index 593b75e55b..0bf5c5c0da 100644
--- a/hw/arm/spitz.c
+++ b/hw/arm/spitz.c
@@ -50,8 +50,12 @@
#define FLASHCTL_RYBY (1 << 5)
#define FLASHCTL_NCE (FLASHCTL_CE0 | FLASHCTL_CE1)
+#define TYPE_SL_NAND "sl-nand"
+#define SL_NAND(obj) OBJECT_CHECK(SLNANDState, (obj), TYPE_SL_NAND)
+
typedef struct {
- SysBusDevice busdev;
+ SysBusDevice parent_obj;
+
MemoryRegion iomem;
DeviceState *nand;
uint8_t ctl;
@@ -147,7 +151,7 @@ static void sl_flash_register(PXA2xxState *cpu, int size)
{
DeviceState *dev;
- dev = qdev_create(NULL, "sl-nand");
+ dev = qdev_create(NULL, TYPE_SL_NAND);
qdev_prop_set_uint8(dev, "manf_id", NAND_MFR_SAMSUNG);
if (size == FLASH_128M)
@@ -159,12 +163,11 @@ static void sl_flash_register(PXA2xxState *cpu, int size)
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, FLASH_BASE);
}
-static int sl_nand_init(SysBusDevice *dev) {
- SLNANDState *s;
+static int sl_nand_init(SysBusDevice *dev)
+{
+ SLNANDState *s = SL_NAND(dev);
DriveInfo *nand;
- s = FROM_SYSBUS(SLNANDState, dev);
-
s->ctl = 0;
nand = drive_get(IF_MTD, 0, 0);
s->nand = nand_init(nand ? nand->bdrv : NULL, s->manf_id, s->chip_id);
@@ -1027,7 +1030,7 @@ static void sl_nand_class_init(ObjectClass *klass, void *data)
}
static const TypeInfo sl_nand_info = {
- .name = "sl-nand",
+ .name = TYPE_SL_NAND,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(SLNANDState),
.class_init = sl_nand_class_init,