Commit 124386cc authored by Markus Armbruster's avatar Markus Armbruster Committed by Kevin Wolf
Browse files

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: default avatarMarkus Armbruster <armbru@redhat.com>
Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
parent f9e8fda4
Loading
Loading
Loading
Loading
+3 −7
Original line number Diff line number Diff line
@@ -708,18 +708,14 @@ 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);
}
}

/* Wm8750 and Max7310 on I2C */

+3 −7
Original line number Diff line number Diff line
@@ -51,18 +51,14 @@
static void tosa_microdrive_attach(PXA2xxState *cpu)
{
    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[0], md);
}
}

static void tosa_out_switch(void *opaque, int line, int level)
{