diff options
author | Luiz Capitulino <lcapitulino@redhat.com> | 2012-02-17 11:05:21 -0200 |
---|---|---|
committer | Luiz Capitulino <lcapitulino@redhat.com> | 2012-02-22 17:23:21 -0200 |
commit | d88b1819dd6c6ba4b2270c98bf52ce67a315066d (patch) | |
tree | b5afd9cd7c853c7d75ab0dc76c8273c823007e33 /hw/ide/atapi.c | |
parent | f36f394952bd6703ca3ad8d649b41a9edd02db0c (diff) |
block: Don't call bdrv_eject() if the tray state didn't change
It's not needed. Besides we can then assume that bdrv_eject() is
only called when there's a tray state change, which is useful to
the DEVICE_TRAY_MOVED event (going to be added in a future
commit).
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/ide/atapi.c')
-rw-r--r-- | hw/ide/atapi.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c index 0adb27b799..5919cf52d8 100644 --- a/hw/ide/atapi.c +++ b/hw/ide/atapi.c @@ -883,8 +883,11 @@ static void cmd_start_stop_unit(IDEState *s, uint8_t* buf) ide_atapi_cmd_error(s, sense, ASC_MEDIA_REMOVAL_PREVENTED); return; } - bdrv_eject(s->bs, !start); - s->tray_open = !start; + + if (s->tray_open != !start) { + bdrv_eject(s->bs, !start); + s->tray_open = !start; + } } ide_atapi_cmd_ok(s); |