summary refs log tree commit diff stats
path: root/hw/spitz.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2011-08-03 15:08:13 +0200
committerKevin Wolf <kwolf@redhat.com>2011-09-06 11:24:07 +0200
commit124386cc756f6a7975562d652d0e98a379292138 (patch)
tree304ef3c6284d42ec4486cdbb4b4373ce54b2cfaa /hw/spitz.c
parentf9e8fda4796c0e8aebfc1e7ddf9bed6865adab02 (diff)
downloadfocaccia-qemu-124386cc756f6a7975562d652d0e98a379292138.tar.gz
focaccia-qemu-124386cc756f6a7975562d652d0e98a379292138.zip
spitz tosa: Simplify "drive is suitable for microdrive" test
We try the drive defined with -drive if=ide,index=0 (or equivalent
sugar).  We use it only if (dinfo && bdrv_is_inserted(dinfo->bdrv) &&
!bdrv_is_removable(dinfo->bdrv)).  This is a convoluted way to test
for "drive media can't be removed".

The only way to create such a drive with -drive if=ide is media=cdrom.
And that sets dinfo->media_cd, so just test that.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/spitz.c')
-rw-r--r--hw/spitz.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/hw/spitz.c b/hw/spitz.c
index c05b5f7d56..0adae596b5 100644
--- a/hw/spitz.c
+++ b/hw/spitz.c
@@ -708,17 +708,13 @@ static void spitz_ssp_attach(PXA2xxState *cpu)
 static void spitz_microdrive_attach(PXA2xxState *cpu, int slot)
 {
     PCMCIACardState *md;
-    BlockDriverState *bs;
     DriveInfo *dinfo;
 
     dinfo = drive_get(IF_IDE, 0, 0);
-    if (!dinfo)
+    if (!dinfo || dinfo->media_cd)
         return;
-    bs = dinfo->bdrv;
-    if (bdrv_is_inserted(bs) && !bdrv_is_removable(bs)) {
-        md = dscm1xxxx_init(dinfo);
-        pxa2xx_pcmcia_attach(cpu->pcmcia[slot], md);
-    }
+    md = dscm1xxxx_init(dinfo);
+    pxa2xx_pcmcia_attach(cpu->pcmcia[slot], md);
 }
 
 /* Wm8750 and Max7310 on I2C */