From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: aliguori@us.ibm.com
Subject: [Qemu-devel] [PATCH 2/5] virtio-scsi: factor checks for VIRTIO_SCSI_S_DRIVER_OK when reporting events
Date: Mon, 12 Nov 2012 15:03:28 +0100 [thread overview]
Message-ID: <1352729011-27799-3-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1352729011-27799-1-git-send-email-pbonzini@redhat.com>
Suggested by Laszlo Ersek.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/virtio-scsi.c | 8 +++++---
1 file modificato, 5 inserzioni(+), 3 rimozioni(-)
diff --git a/hw/virtio-scsi.c b/hw/virtio-scsi.c
index b54c789..30d3f8a 100644
--- a/hw/virtio-scsi.c
+++ b/hw/virtio-scsi.c
@@ -596,6 +596,10 @@ static void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev,
VirtIOSCSIEvent *evt;
int in_size;
+ if (!(s->vdev.status & VIRTIO_CONFIG_S_DRIVER_OK)) {
+ return;
+ }
+
if (!req) {
s->events_dropped = true;
return;
@@ -648,7 +652,6 @@ static void virtio_scsi_change(SCSIBus *bus, SCSIDevice *dev, SCSISense sense)
VirtIOSCSI *s = container_of(bus, VirtIOSCSI, bus);
if (((s->vdev.guest_features >> VIRTIO_SCSI_F_CHANGE) & 1) &&
- (s->vdev.status & VIRTIO_CONFIG_S_DRIVER_OK) &&
dev->type != TYPE_ROM) {
virtio_scsi_push_event(s, dev, VIRTIO_SCSI_T_PARAM_CHANGE,
sense.asc | (sense.ascq << 8));
@@ -659,8 +662,7 @@ static void virtio_scsi_hotplug(SCSIBus *bus, SCSIDevice *dev)
{
VirtIOSCSI *s = container_of(bus, VirtIOSCSI, bus);
- if (((s->vdev.guest_features >> VIRTIO_SCSI_F_HOTPLUG) & 1) &&
- (s->vdev.status & VIRTIO_CONFIG_S_DRIVER_OK)) {
+ if ((s->vdev.guest_features >> VIRTIO_SCSI_F_HOTPLUG) & 1) {
virtio_scsi_push_event(s, dev, VIRTIO_SCSI_T_TRANSPORT_RESET,
VIRTIO_SCSI_EVT_RESET_RESCAN);
}
--
1.7.12.1
next prev parent reply other threads:[~2012-11-12 14:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-12 14:03 [Qemu-devel] [PULL 1.3 0/5] SCSI updates for 2012-11-12 Paolo Bonzini
2012-11-12 14:03 ` [Qemu-devel] [PATCH 1/5] scsi: do not return short responses for emulated commands Paolo Bonzini
2012-11-12 14:03 ` Paolo Bonzini [this message]
2012-11-12 14:03 ` [Qemu-devel] [PATCH 3/5] scsi: remove superfluous call to scsi_device_set_ua Paolo Bonzini
2012-11-12 14:03 ` [Qemu-devel] [PATCH 4/5] megasas: do not include block_int.h Paolo Bonzini
2012-11-12 14:03 ` [Qemu-devel] [PATCH 5/5] scsi-disk: flush cache after disabling it Paolo Bonzini
2012-11-12 15:44 ` [Qemu-devel] [PULL 1.3 0/5] SCSI updates for 2012-11-12 Paolo Bonzini
2012-11-14 16:27 ` Anthony Liguori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1352729011-27799-3-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).