[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 17/31] spitz tosa: Simplify "drive is suitable for m
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 17/31] spitz tosa: Simplify "drive is suitable for microdrive" test |
Date: |
Tue, 6 Sep 2011 17:39:32 +0200 |
From: Markus Armbruster <address@hidden>
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 <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
hw/spitz.c | 10 +++-------
hw/tosa.c | 10 +++-------
2 files changed, 6 insertions(+), 14 deletions(-)
diff --git a/hw/spitz.c b/hw/spitz.c
index c05b5f7..0adae59 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 */
diff --git a/hw/tosa.c b/hw/tosa.c
index a7967a2..7b407f4 100644
--- a/hw/tosa.c
+++ b/hw/tosa.c
@@ -51,17 +51,13 @@
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);
- }
+ md = dscm1xxxx_init(dinfo);
+ pxa2xx_pcmcia_attach(cpu->pcmcia[0], md);
}
static void tosa_out_switch(void *opaque, int line, int level)
--
1.7.6
- [Qemu-devel] [PATCH 03/31] qcow2: Fix error cases to run depedent requests, (continued)
- [Qemu-devel] [PATCH 03/31] qcow2: Fix error cases to run depedent requests, Kevin Wolf, 2011/09/06
- [Qemu-devel] [PATCH 05/31] block: Attach non-qdev devices as well, Kevin Wolf, 2011/09/06
- [Qemu-devel] [PATCH 06/31] block: Generalize change_cb() to BlockDevOps, Kevin Wolf, 2011/09/06
- [Qemu-devel] [PATCH 08/31] ide: Update command code definitions as per ACS-2 Table B.2, Kevin Wolf, 2011/09/06
- [Qemu-devel] [PATCH 07/31] block: Split change_cb() into change_media_cb(), resize_cb(), Kevin Wolf, 2011/09/06
- [Qemu-devel] [PATCH 09/31] ide: Clean up case label indentation in ide_exec_cmd(), Kevin Wolf, 2011/09/06
- [Qemu-devel] [PATCH 11/31] block/raw: Fix to forward method bdrv_media_changed(), Kevin Wolf, 2011/09/06
- [Qemu-devel] [PATCH 10/31] ide: Give vmstate structs internal linkage where possible, Kevin Wolf, 2011/09/06
- [Qemu-devel] [PATCH 17/31] spitz tosa: Simplify "drive is suitable for microdrive" test,
Kevin Wolf <=
- [Qemu-devel] [PATCH 12/31] block: Leave tracking media change to device models, Kevin Wolf, 2011/09/06
- [Qemu-devel] [PATCH 14/31] block: Clean up bdrv_flush_all(), Kevin Wolf, 2011/09/06
- [Qemu-devel] [PATCH 13/31] fdc: Make media change detection more robust, Kevin Wolf, 2011/09/06
- [Qemu-devel] [PATCH 15/31] savevm: Include writable devices with removable media, Kevin Wolf, 2011/09/06
- [Qemu-devel] [PATCH 20/31] VMDK: add twoGbMaxExtentSparse support, Kevin Wolf, 2011/09/06
- [Qemu-devel] [PATCH 16/31] xen: Clean up pci_piix3_xen_ide_unplug()'s test for "not a CD", Kevin Wolf, 2011/09/06
- [Qemu-devel] [PATCH 22/31] VMDK: Opening compressed extent., Kevin Wolf, 2011/09/06
- [Qemu-devel] [PATCH 23/31] VMDK: read/write compressed extent, Kevin Wolf, 2011/09/06
- [Qemu-devel] [PATCH 21/31] VMDK: separate vmdk_read_extent/vmdk_write_extent, Kevin Wolf, 2011/09/06
- [Qemu-devel] [PATCH 19/31] VMDK: enable twoGbMaxExtentFlat, Kevin Wolf, 2011/09/06