From 0e49de5232f47c9e58adb82c28d4f42be933d891 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 3 Aug 2011 15:07:41 +0200 Subject: block: Generalize change_cb() to BlockDevOps So we can more easily add device model callbacks. Signed-off-by: Markus Armbruster Signed-off-by: Kevin Wolf --- hw/sd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'hw/sd.c') diff --git a/hw/sd.c b/hw/sd.c index ab52634ec3..1f00910eff 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; } -- cgit v1.2.3-55-g7522