From 522f253ca8c731aafc8e53087a18f6015c4e776e Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Fri, 29 Jul 2011 16:35:19 +0100 Subject: hw/nand: Pass block device state to init function Pass the BlockDeviceState to the nand_init() function rather than having it look it up via drive_get() itself. Signed-off-by: Peter Maydell Signed-off-by: Andrzej Zaborowski --- hw/nand.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'hw/nand.c') diff --git a/hw/nand.c b/hw/nand.c index 37e51d7..d6204d9 100644 --- a/hw/nand.c +++ b/hw/nand.c @@ -14,7 +14,6 @@ # include "hw.h" # include "flash.h" # include "blockdev.h" -/* FIXME: Pass block device as an argument. */ # define NAND_CMD_READ0 0x00 # define NAND_CMD_READ1 0x01 @@ -451,20 +450,17 @@ uint8_t nand_getio(NANDFlashState *s) return *(s->ioaddr ++); } -NANDFlashState *nand_init(int manf_id, int chip_id) +NANDFlashState *nand_init(BlockDriverState *bdrv, int manf_id, int chip_id) { int pagesize; NANDFlashState *s; - DriveInfo *dinfo; if (nand_flash_ids[chip_id].size == 0) { hw_error("%s: Unsupported NAND chip ID.\n", __FUNCTION__); } s = (NANDFlashState *) qemu_mallocz(sizeof(NANDFlashState)); - dinfo = drive_get(IF_MTD, 0, 0); - if (dinfo) - s->bdrv = dinfo->bdrv; + s->bdrv = bdrv; s->manf_id = manf_id; s->chip_id = chip_id; s->size = nand_flash_ids[s->chip_id].size << 20; -- cgit v1.1