From: Hannes Reinecke <hare@suse.de>
To: qemu-devel@nongnu.org
Cc: stefanha@gmail.com, nab@linux-iscsi.org, kraxel@redhat.com
Subject: [Qemu-devel] [PATCH 11/15] Remove 'bus' argument from SCSI command completion callbacks
Date: Wed, 24 Nov 2010 12:16:06 +0100 [thread overview]
Message-ID: <1290597370-21365-12-git-send-email-hare@suse.de> (raw)
In-Reply-To: <1290597370-21365-1-git-send-email-hare@suse.de>
The 'bus' argument is now pointless, as we already pass the
request itself and the bus can be derived from it.
Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
hw/esp.c | 5 ++---
hw/lsi53c895a.c | 5 ++---
hw/scsi-bus.c | 3 +--
hw/scsi-disk.c | 8 ++++----
hw/scsi-generic.c | 6 +++---
hw/scsi.h | 3 +--
hw/usb-msd.c | 5 ++---
7 files changed, 15 insertions(+), 20 deletions(-)
diff --git a/hw/esp.c b/hw/esp.c
index 2784bec..d55bb6d 100644
--- a/hw/esp.c
+++ b/hw/esp.c
@@ -390,10 +390,9 @@ static void esp_do_dma(ESPState *s)
}
}
-static void esp_command_complete(SCSIBus *bus, int reason, SCSIRequest *req,
- uint32_t arg)
+static void esp_command_complete(SCSIRequest *req, int reason, uint32_t arg)
{
- ESPState *s = DO_UPCAST(ESPState, busdev.qdev, bus->qbus.parent);
+ ESPState *s = DO_UPCAST(ESPState, busdev.qdev, req->bus->qbus.parent);
if (reason == SCSI_REASON_DONE) {
DPRINTF("SCSI Command complete\n");
diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c
index 82a5d39..858c8f4 100644
--- a/hw/lsi53c895a.c
+++ b/hw/lsi53c895a.c
@@ -688,10 +688,9 @@ static int lsi_queue_tag(LSIState *s, uint32_t tag, uint32_t arg)
}
/* Callback to indicate that the SCSI layer has completed a transfer. */
-static void lsi_command_complete(SCSIBus *bus, int reason, SCSIRequest *req,
- uint32_t arg)
+static void lsi_command_complete(SCSIRequest *req, int reason, uint32_t arg)
{
- LSIState *s = DO_UPCAST(LSIState, dev.qdev, bus->qbus.parent);
+ LSIState *s = DO_UPCAST(LSIState, dev.qdev, req->bus->qbus.parent);
int out;
out = (s->sstat1 & PHASE_MASK) == PHASE_DO;
diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
index bb88a56..0f8fd57 100644
--- a/hw/scsi-bus.c
+++ b/hw/scsi-bus.c
@@ -594,6 +594,5 @@ void scsi_req_complete(SCSIRequest *req)
{
assert(req->status != -1);
scsi_req_dequeue(req);
- req->bus->complete(req->bus, SCSI_REASON_DONE,
- req, req->status);
+ req->bus->complete(req, SCSI_REASON_DONE, req->status);
}
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index 0ccb627..a4f387d 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -156,7 +156,7 @@ static void scsi_read_complete(void * opaque, int ret)
DPRINTF("Data ready tag=0x%x len=%zd\n", r->req.tag, iov_len);
- r->req.bus->complete(r->req.bus, SCSI_REASON_DATA, &r->req, iov_len);
+ r->req.bus->complete(&r->req, SCSI_REASON_DATA, iov_len);
}
@@ -179,7 +179,7 @@ static void scsi_read_data(SCSIRequest *req)
if (r->sector_count == (uint32_t)-1) {
DPRINTF("Read buf_len=%zd\n", r->iov[0].iov_len);
r->sector_count = 0;
- r->req.bus->complete(r->req.bus, SCSI_REASON_DATA, &r->req,
+ r->req.bus->complete(&r->req, SCSI_REASON_DATA,
r->iov[0].iov_len);
return;
}
@@ -229,7 +229,7 @@ static int scsi_handle_rw_error(SCSIDiskReq *r, int error, int type)
vm_stop(0);
} else {
if (type == SCSI_REQ_STATUS_RETRY_READ) {
- r->req.bus->complete(r->req.bus, SCSI_REASON_DATA, &r->req, 0);
+ r->req.bus->complete(&r->req, SCSI_REASON_DATA, 0);
}
switch (error) {
case EBADR:
@@ -280,7 +280,7 @@ static void scsi_write_complete(void * opaque, int ret)
r->iov[0].iov_len = len;
}
DPRINTF("Write complete tag=0x%x more=%d\n", r->req.tag, len);
- r->req.bus->complete(r->req.bus, SCSI_REASON_DATA, &r->req, len);
+ r->req.bus->complete(&r->req, SCSI_REASON_DATA, len);
}
}
diff --git a/hw/scsi-generic.c b/hw/scsi-generic.c
index ed085a1..d4edc48 100644
--- a/hw/scsi-generic.c
+++ b/hw/scsi-generic.c
@@ -196,7 +196,7 @@ static void scsi_read_complete(void * opaque, int ret)
DPRINTF("Data ready tag=0x%x len=%d\n", r->req.tag, len);
r->len = -1;
- r->req.bus->complete(r->req.bus, SCSI_REASON_DATA, &r->req, len);
+ r->req.bus->complete(&r->req, SCSI_REASON_DATA, len);
if (len == 0)
scsi_command_complete(r, 0);
}
@@ -226,7 +226,7 @@ static void scsi_read_data(SCSIRequest *req)
DPRINTF("Sense: %d %d %d %d %d %d %d %d\n",
r->buf[0], r->buf[1], r->buf[2], r->buf[3],
r->buf[4], r->buf[5], r->buf[6], r->buf[7]);
- r->req.bus->complete(r->req.bus, SCSI_REASON_DATA, &r->req, s->senselen);
+ r->req.bus->complete(&r->req, SCSI_REASON_DATA, s->senselen);
/* Clear sensebuf after REQUEST_SENSE */
scsi_clear_sense(s);
return;
@@ -272,7 +272,7 @@ static int scsi_write_data(SCSIRequest *req)
if (r->len == 0) {
r->len = r->buflen;
- r->req.bus->complete(r->req.bus, SCSI_REASON_DATA, &r->req, r->len);
+ r->req.bus->complete(&r->req, SCSI_REASON_DATA, r->len);
return 0;
}
diff --git a/hw/scsi.h b/hw/scsi.h
index 202d680..c2d3300 100644
--- a/hw/scsi.h
+++ b/hw/scsi.h
@@ -18,8 +18,7 @@ typedef struct SCSIBus SCSIBus;
typedef struct SCSIDevice SCSIDevice;
typedef struct SCSIDeviceInfo SCSIDeviceInfo;
typedef struct SCSIRequest SCSIRequest;
-typedef void (*scsi_completionfn)(SCSIBus *bus, int reason, SCSIRequest *req,
- uint32_t arg);
+typedef void (*scsi_completionfn)(SCSIRequest *req, int reason, uint32_t arg);
enum SCSIXferMode {
SCSI_XFER_NONE, /* TEST_UNIT_READY, ... */
diff --git a/hw/usb-msd.c b/hw/usb-msd.c
index b4540c4..ae4d2d4 100644
--- a/hw/usb-msd.c
+++ b/hw/usb-msd.c
@@ -174,10 +174,9 @@ static void usb_msd_send_status(MSDState *s)
memcpy(s->usb_buf, &csw, 13);
}
-static void usb_msd_command_complete(SCSIBus *bus, int reason, SCSIRequest *req,
- uint32_t arg)
+static void usb_msd_command_complete(SCSIRequest *req, int reason, uint32_t arg)
{
- MSDState *s = DO_UPCAST(MSDState, dev.qdev, bus->qbus.parent);
+ MSDState *s = DO_UPCAST(MSDState, dev.qdev, req->bus->qbus.parent);
USBPacket *p = s->packet;
if (req->tag != s->tag) {
--
1.6.0.2
next prev parent reply other threads:[~2010-11-24 11:13 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-24 11:15 [Qemu-devel] [PATCH 00/15] Megasas HBA emulation and SCSI update v.3 Hannes Reinecke
2010-11-24 11:15 ` [Qemu-devel] [PATCH 01/15] scsi: Increase the number of possible devices Hannes Reinecke
2010-11-24 11:15 ` [Qemu-devel] [PATCH 02/15] scsi: Return SAM status codes Hannes Reinecke
2010-11-24 16:51 ` Christoph Hellwig
2010-11-24 11:15 ` [Qemu-devel] [PATCH 03/15] scsi: INQUIRY VPD fixes Hannes Reinecke
2010-11-24 11:15 ` [Qemu-devel] [PATCH 04/15] scsi: Move sense handling into the driver Hannes Reinecke
2010-11-24 11:16 ` [Qemu-devel] [PATCH 05/15] scsi-disk: Remove duplicate cdb parsing Hannes Reinecke
2010-11-24 11:16 ` [Qemu-devel] [PATCH 06/15] scsi: Update sense code handling Hannes Reinecke
2010-11-25 14:33 ` Kevin Wolf
2010-12-21 11:56 ` Hannes Reinecke
2010-11-24 11:16 ` [Qemu-devel] [PATCH 07/15] lsi53c895a: Rename 'sense' to 'status' Hannes Reinecke
2010-11-24 11:16 ` [Qemu-devel] [PATCH 08/15] scsi-disk: Allocate iovec dynamically Hannes Reinecke
2010-11-24 11:16 ` [Qemu-devel] [PATCH 09/15] scsi: Use 'SCSIRequest' directly Hannes Reinecke
2010-11-24 11:16 ` [Qemu-devel] [PATCH 10/15] scsi-disk: add data direction checking Hannes Reinecke
2010-11-24 11:16 ` Hannes Reinecke [this message]
2010-11-24 11:16 ` [Qemu-devel] [PATCH 12/15] scsi: Implement 'get_sense' callback Hannes Reinecke
2010-11-24 11:16 ` [Qemu-devel] [PATCH 13/15] scsi: Implement alloc_req_iov callback Hannes Reinecke
2010-11-24 16:52 ` Christoph Hellwig
2010-11-25 8:53 ` Hannes Reinecke
2010-11-25 15:29 ` Christoph Hellwig
2010-11-25 16:21 ` Hannes Reinecke
2010-11-26 0:06 ` Paul Brook
2010-11-24 11:16 ` [Qemu-devel] [PATCH 14/15] megasas: LSI Megaraid SAS emulation Hannes Reinecke
2010-11-25 14:36 ` [Qemu-devel] " Stefan Hajnoczi
2010-11-25 14:50 ` Hannes Reinecke
2010-11-25 14:52 ` Stefan Hajnoczi
2010-11-25 20:47 ` Sebastian Herbszt
2010-12-21 12:06 ` Hannes Reinecke
2010-11-24 11:16 ` [Qemu-devel] [PATCH 15/15] Make SCSI HBA configurable Hannes Reinecke
2010-11-24 16:50 ` [Qemu-devel] [PATCH 00/15] Megasas HBA emulation and SCSI update v.3 Christoph Hellwig
2010-12-10 22:14 ` [Qemu-devel] " Paolo Bonzini
2010-12-13 7:32 ` Hannes Reinecke
2010-12-16 1:45 ` Benjamin Herrenschmidt
2010-12-16 1:48 ` Benjamin Herrenschmidt
2010-12-16 8:34 ` Stefan Hajnoczi
2010-12-16 14:58 ` Kevin Wolf
2010-12-20 14:59 ` [Qemu-devel] " Christoph Hellwig
2010-12-20 15:25 ` Hannes Reinecke
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=1290597370-21365-12-git-send-email-hare@suse.de \
--to=hare@suse.de \
--cc=kraxel@redhat.com \
--cc=nab@linux-iscsi.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
/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).