diff options
author | Gerd Hoffmann | 2009-11-26 15:34:00 +0100 |
---|---|---|
committer | Anthony Liguori | 2009-12-03 16:41:37 +0100 |
commit | ed3a34a3c8dcae6f46556ae7e2a667e6c16c8daa (patch) | |
tree | 8cd220129db344fef2e540adff3b87d158880e1e /hw/scsi-generic.c | |
parent | scsi: move dinfo to SCSIDevice (diff) | |
download | qemu-ed3a34a3c8dcae6f46556ae7e2a667e6c16c8daa.tar.gz qemu-ed3a34a3c8dcae6f46556ae7e2a667e6c16c8daa.tar.xz qemu-ed3a34a3c8dcae6f46556ae7e2a667e6c16c8daa.zip |
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.c | 18 |
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); } |