[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 13/20] hw/usb/msd: Add status to usb_msd_packet_complete() functio
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 13/20] hw/usb/msd: Add status to usb_msd_packet_complete() function |
Date: |
Sat, 14 Dec 2024 00:30:48 +0100 |
From: Nicholas Piggin <npiggin@gmail.com>
This is a convenience change that accepts a status when completing a
packet.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20241110034000.379463-2-npiggin@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/usb/dev-storage.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c
index 341e505bd0a..4f1e8b7f6cb 100644
--- a/hw/usb/dev-storage.c
+++ b/hw/usb/dev-storage.c
@@ -177,7 +177,7 @@ static const USBDesc desc = {
.str = desc_strings,
};
-static void usb_msd_packet_complete(MSDState *s)
+static void usb_msd_packet_complete(MSDState *s, int status)
{
USBPacket *p = s->packet;
@@ -187,6 +187,7 @@ static void usb_msd_packet_complete(MSDState *s)
* usb_packet_complete returns.
*/
trace_usb_msd_packet_complete();
+ p->status = status;
s->packet = NULL;
usb_packet_complete(&s->dev, p);
}
@@ -196,8 +197,7 @@ static void usb_msd_fatal_error(MSDState *s)
trace_usb_msd_fatal_error();
if (s->packet) {
- s->packet->status = USB_RET_STALL;
- usb_msd_packet_complete(s);
+ usb_msd_packet_complete(s, USB_RET_STALL);
}
/*
@@ -255,8 +255,8 @@ void usb_msd_transfer_data(SCSIRequest *req, uint32_t len)
usb_msd_copy_data(s, p);
p = s->packet;
if (p && p->actual_length == p->iov.size) {
- p->status = USB_RET_SUCCESS; /* Clear previous ASYNC status */
- usb_msd_packet_complete(s);
+ /* USB_RET_SUCCESS status clears previous ASYNC status */
+ usb_msd_packet_complete(s, USB_RET_SUCCESS);
}
}
}
@@ -295,8 +295,8 @@ void usb_msd_command_complete(SCSIRequest *req, size_t
resid)
s->mode = USB_MSDM_CSW;
}
}
- p->status = USB_RET_SUCCESS; /* Clear previous ASYNC status */
- usb_msd_packet_complete(s);
+ /* USB_RET_SUCCESS status clears previous ASYNC status */
+ usb_msd_packet_complete(s, USB_RET_SUCCESS);
} else if (s->data_len == 0) {
s->mode = USB_MSDM_CSW;
}
@@ -332,8 +332,7 @@ void usb_msd_handle_reset(USBDevice *dev)
assert(s->req == NULL);
if (s->packet) {
- s->packet->status = USB_RET_STALL;
- usb_msd_packet_complete(s);
+ usb_msd_packet_complete(s, USB_RET_STALL);
}
memset(&s->csw, 0, sizeof(s->csw));
--
2.45.2
- [PULL 07/20] hw/nvram/fw_cfg: Skip FW_CFG_DATA_GENERATOR when no data to generate, (continued)
- [PULL 07/20] hw/nvram/fw_cfg: Skip FW_CFG_DATA_GENERATOR when no data to generate, Philippe Mathieu-Daudé, 2024/12/13
- [PULL 05/20] hw/nvram/fw_cfg: Rename fw_cfg_add_[file]_from_generator(), Philippe Mathieu-Daudé, 2024/12/13
- [PULL 08/20] hw/pci: Have PCI_BUS implement TYPE_FW_CFG_DATA_GENERATOR_INTERFACE, Philippe Mathieu-Daudé, 2024/12/13
- [PULL 10/20] hw: Use pci_bus_add_fw_cfg_extra_pci_roots(), Philippe Mathieu-Daudé, 2024/12/13
- [PULL 09/20] hw/pci: Add pci_bus_add_fw_cfg_extra_pci_roots() helper, Philippe Mathieu-Daudé, 2024/12/13
- [PULL 12/20] hw/net/can: clean-up unnecessary includes, Philippe Mathieu-Daudé, 2024/12/13
- [PULL 15/20] hw/usb/hcd-xhci-pci: Indentation fix, Philippe Mathieu-Daudé, 2024/12/13
- [PULL 11/20] hw/nvram/fw_cfg: Remove fw_cfg_add_extra_pci_roots(), Philippe Mathieu-Daudé, 2024/12/13
- [PULL 17/20] hw/ide/ahci: Extract TYPE_SYSBUS_AHCI into dedicated file, Philippe Mathieu-Daudé, 2024/12/13
- [PULL 14/20] hw/usb/hcd-xhci-nec: Remove unused XHCINecState::flags field, Philippe Mathieu-Daudé, 2024/12/13
- [PULL 13/20] hw/usb/msd: Add status to usb_msd_packet_complete() function,
Philippe Mathieu-Daudé <=
- [PULL 16/20] hw/ide/ahci: Decouple from PCI, Philippe Mathieu-Daudé, 2024/12/13
- [PULL 18/20] hw/mips: Include missing 'exec/tswap.h' header, Philippe Mathieu-Daudé, 2024/12/13
- [PULL 20/20] hw/xtensa: Include missing 'exec/tswap.h' header, Philippe Mathieu-Daudé, 2024/12/13
- [PULL 19/20] hw/sh4/r2d: Include missing 'exec/tswap.h' header, Philippe Mathieu-Daudé, 2024/12/13
- Re: [PULL 00/20] Misc HW patches for 2024-12-14, Stefan Hajnoczi, 2024/12/16