[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 08/37] usb-storage: remove MSDState->residue
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 08/37] usb-storage: remove MSDState->residue |
Date: |
Thu, 7 Jun 2012 11:30:57 +0200 |
We have the field twice, once in MSDState directly and one in the status
word struct. Drop one.
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/usb/dev-storage.c | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c
index a96c0b9..e6652f9 100644
--- a/hw/usb/dev-storage.c
+++ b/hw/usb/dev-storage.c
@@ -51,7 +51,6 @@ typedef struct {
uint32_t scsi_len;
uint8_t *scsi_buf;
uint32_t data_len;
- uint32_t residue;
struct usb_msd_csw csw;
SCSIRequest *req;
SCSIBus bus;
@@ -229,11 +228,10 @@ static void usb_msd_command_complete(SCSIRequest *req,
uint32_t status, size_t r
USBPacket *p = s->packet;
DPRINTF("Command complete %d tag 0x%x\n", status, req->tag);
- s->residue = s->data_len;
s->csw.sig = cpu_to_le32(0x53425355);
s->csw.tag = cpu_to_le32(req->tag);
- s->csw.residue = cpu_to_le32(s->residue);
+ s->csw.residue = cpu_to_le32(s->data_len);
s->csw.status = status != 0;
if (s->packet) {
@@ -378,7 +376,7 @@ static int usb_msd_handle_data(USBDevice *dev, USBPacket *p)
}
DPRINTF("Command tag 0x%x flags %08x len %d data %d\n",
tag, cbw.flags, cbw.cmd_len, s->data_len);
- s->residue = 0;
+ assert(le32_to_cpu(s->csw.residue) == 0);
s->scsi_len = 0;
s->req = scsi_req_new(s->scsi_dev, tag, 0, cbw.cmd, NULL);
scsi_req_enqueue(s->req);
@@ -397,7 +395,7 @@ static int usb_msd_handle_data(USBDevice *dev, USBPacket *p)
if (s->scsi_len) {
usb_msd_copy_data(s, p);
}
- if (s->residue) {
+ if (le32_to_cpu(s->csw.residue)) {
int len = p->iov.size - p->result;
if (len) {
usb_packet_skip(p, len);
@@ -458,7 +456,7 @@ static int usb_msd_handle_data(USBDevice *dev, USBPacket *p)
if (s->scsi_len) {
usb_msd_copy_data(s, p);
}
- if (s->residue) {
+ if (le32_to_cpu(s->csw.residue)) {
int len = p->iov.size - p->result;
if (len) {
usb_packet_skip(p, len);
--
1.7.1
- [Qemu-devel] [PULL 00/37] usb patch queue, Gerd Hoffmann, 2012/06/07
- [Qemu-devel] [PATCH 02/37] uhci: use bottom half, Gerd Hoffmann, 2012/06/07
- [Qemu-devel] [PATCH 23/37] ehci: move ehci_flush_qh, Gerd Hoffmann, 2012/06/07
- [Qemu-devel] [PATCH 14/37] xhci: trace: run+stop, Gerd Hoffmann, 2012/06/07
- [Qemu-devel] [PATCH 28/37] ehci: schedule async bh on async packet completion, Gerd Hoffmann, 2012/06/07
- [Qemu-devel] [PATCH 25/37] ehci: tweak queue initialization, Gerd Hoffmann, 2012/06/07
- [Qemu-devel] [PATCH 08/37] usb-storage: remove MSDState->residue,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 03/37] uhci: make bandwidth tunable, Gerd Hoffmann, 2012/06/07
- [Qemu-devel] [PATCH 17/37] xhci: trace: endpoints, Gerd Hoffmann, 2012/06/07
- [Qemu-devel] [PATCH 29/37] ehci: kick async schedule on wakeup, Gerd Hoffmann, 2012/06/07
- [Qemu-devel] [PATCH 05/37] uhci: zap uhci_pre_save, Gerd Hoffmann, 2012/06/07
- [Qemu-devel] [PATCH 30/37] ehci: fix reset, Gerd Hoffmann, 2012/06/07
- [Qemu-devel] [PATCH 04/37] uhci: fix trace format strings, Gerd Hoffmann, 2012/06/07
- [Qemu-devel] [PATCH 09/37] usb-storage: add usb_msd_packet_complete(), Gerd Hoffmann, 2012/06/07
- [Qemu-devel] [PATCH 32/37] ehci: update status bits in ehci_set_state, Gerd Hoffmann, 2012/06/07
- [Qemu-devel] [PATCH 27/37] ehci: move async schedule to bottom half, Gerd Hoffmann, 2012/06/07
- [Qemu-devel] [PATCH 01/37] uhci: fix bandwidth management, Gerd Hoffmann, 2012/06/07