aboutsummaryrefslogtreecommitdiff
path: root/hw/sd.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2011-08-03 15:07:41 +0200
committerKevin Wolf <kwolf@redhat.com>2011-09-06 11:23:51 +0200
commit0e49de5232f47c9e58adb82c28d4f42be933d891 (patch)
treec0204e2cf08f38a843060372a4165d89ca38de61 /hw/sd.c
parentfa879d62eb51253d00b6920ce1d1d9d261370a49 (diff)
downloadqemu-0e49de5232f47c9e58adb82c28d4f42be933d891.zip
qemu-0e49de5232f47c9e58adb82c28d4f42be933d891.tar.gz
qemu-0e49de5232f47c9e58adb82c28d4f42be933d891.tar.bz2
block: Generalize change_cb() to BlockDevOps
So we can more easily add device model callbacks. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/sd.c')
-rw-r--r--hw/sd.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/hw/sd.c b/hw/sd.c
index ab52634..1f00910 100644
--- a/hw/sd.c
+++ b/hw/sd.c
@@ -435,6 +435,10 @@ static void sd_cardchange(void *opaque, int reason)
}
}
+static const BlockDevOps sd_block_ops = {
+ .change_cb = sd_cardchange,
+};
+
/* We do not model the chip select pin, so allow the board to select
whether card should be in SSI or MMC/SD mode. It is also up to the
board to ensure that ssi transfers only occur when the chip select
@@ -450,7 +454,7 @@ SDState *sd_init(BlockDriverState *bs, int is_spi)
sd_reset(sd, bs);
if (sd->bdrv) {
bdrv_attach_dev_nofail(sd->bdrv, sd);
- bdrv_set_change_cb(sd->bdrv, sd_cardchange, sd);
+ bdrv_set_dev_ops(sd->bdrv, &sd_block_ops, sd);
}
return sd;
}