aboutsummaryrefslogtreecommitdiff
path: root/hw/scsi-generic.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2009-11-26 15:34:00 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2009-12-03 09:41:37 -0600
commited3a34a3c8dcae6f46556ae7e2a667e6c16c8daa (patch)
tree8cd220129db344fef2e540adff3b87d158880e1e /hw/scsi-generic.c
parent251882b7e4532cb42fca89412bb6670dcec4158f (diff)
scsi: move status to SCSIRequest.
Also add and use the scsi_req_complete() helper function for calling the completion callback. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/scsi-generic.c')
-rw-r--r--hw/scsi-generic.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/hw/scsi-generic.c b/hw/scsi-generic.c
index 31bd0669f5..f60ad96d79 100644
--- a/hw/scsi-generic.c
+++ b/hw/scsi-generic.c
@@ -88,30 +88,28 @@ static void scsi_command_complete(void *opaque, int ret)
{
SCSIGenericReq *r = (SCSIGenericReq *)opaque;
SCSIGenericState *s = DO_UPCAST(SCSIGenericState, qdev, r->req.dev);
- uint32_t tag;
- int status;
s->driver_status = r->io_header.driver_status;
if (s->driver_status & SG_ERR_DRIVER_SENSE)
s->senselen = r->io_header.sb_len_wr;
if (ret != 0)
- status = BUSY << 1;
+ r->req.status = BUSY << 1;
else {
if (s->driver_status & SG_ERR_DRIVER_TIMEOUT) {
- status = BUSY << 1;
+ r->req.status = BUSY << 1;
BADF("Driver Timeout\n");
} else if (r->io_header.status)
- status = r->io_header.status;
+ r->req.status = r->io_header.status;
else if (s->driver_status & SG_ERR_DRIVER_SENSE)
- status = CHECK_CONDITION << 1;
+ r->req.status = CHECK_CONDITION << 1;
else
- status = GOOD << 1;
+ r->req.status = GOOD << 1;
}
DPRINTF("Command complete 0x%p tag=0x%x status=%d\n",
- r, r->req.tag, status);
- tag = r->req.tag;
- r->req.bus->complete(r->req.bus, SCSI_REASON_DONE, tag, status);
+ r, r->req.tag, r->req.status);
+
+ scsi_req_complete(&r->req);
scsi_remove_request(r);
}