diff options
Diffstat (limited to 'hw/sd.c')
-rw-r--r-- | hw/sd.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -31,7 +31,6 @@ #include "hw.h" #include "block.h" -#include "block_int.h" #include "sd.h" //#define DEBUG_SD 1 @@ -420,14 +419,10 @@ static void sd_reset(SDState *sd, BlockDriverState *bdrv) sd->pwd_len = 0; } -static void sd_cardchange(void *opaque, int reason) +static void sd_cardchange(void *opaque) { SDState *sd = opaque; - if (!(reason & CHANGE_MEDIA)) { - return; - } - qemu_set_irq(sd->inserted_cb, bdrv_is_inserted(sd->bdrv)); if (bdrv_is_inserted(sd->bdrv)) { sd_reset(sd, sd->bdrv); @@ -435,6 +430,10 @@ static void sd_cardchange(void *opaque, int reason) } } +static const BlockDevOps sd_block_ops = { + .change_media_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 @@ -449,7 +448,8 @@ SDState *sd_init(BlockDriverState *bs, int is_spi) sd->enable = 1; sd_reset(sd, bs); if (sd->bdrv) { - bdrv_set_change_cb(sd->bdrv, sd_cardchange, sd); + bdrv_attach_dev_nofail(sd->bdrv, sd); + bdrv_set_dev_ops(sd->bdrv, &sd_block_ops, sd); } return sd; } |