diff mbox

[v2,33/45] xen: Clean up pci_piix3_xen_ide_unplug()'s test for "not a CD"

Message ID 1312376904-16115-34-git-send-email-armbru@redhat.com
State New
Headers show

Commit Message

Markus Armbruster Aug. 3, 2011, 1:08 p.m. UTC
pci_piix3_xen_ide_unplug() unplugs only disks, not CD-ROMs.  It peeks
into the DriveInfo's BlockDriverState to distinguish between the two.
Unclean; use DriveInfo member media_cd, like xen_config_dev_blk().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 hw/ide/piix.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/hw/ide/piix.c b/hw/ide/piix.c
index 00fb683..0430c1e 100644
--- a/hw/ide/piix.c
+++ b/hw/ide/piix.c
@@ -27,7 +27,6 @@ 
 #include <hw/pci.h>
 #include <hw/isa.h>
 #include "block.h"
-#include "block_int.h"
 #include "sysemu.h"
 #include "dma.h"
 
@@ -161,7 +160,7 @@  static int pci_piix3_xen_ide_unplug(DeviceState *dev)
 
     for (; i < 3; i++) {
         di = drive_get_by_index(IF_IDE, i);
-        if (di != NULL && di->bdrv != NULL && !di->bdrv->removable) {
+        if (di != NULL && !di->media_cd) {
             DeviceState *ds = bdrv_get_attached_dev(di->bdrv);
             if (ds) {
                 bdrv_detach_dev(di->bdrv, ds);