From nobody Tue Feb 10 04:15:19 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1614191559; cv=none; d=zohomail.com; s=zohoarc; b=DKnRSb1N0D8WfnbMqL3byUkE6zgEw/xURRtBP/fOtd21AY/x9ocppV1S+LK530WTpj37DSRCNOxk2fkndVmo03j5TCER/eezOmba78X+hm1cb/ga2yFsHmllpsvw8wHmSlZNDr5qLBvzzqtQrPplFXlUoauF4VId5vvbaIMP0Z0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614191559; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3w6Ug8GRqwYAgQamasa4rCbTfjIVmYeM2Cs+qcWf9kI=; b=exr8+sKICjSOjPL28NJl/Xb1hIyPj1j+ejKYMpX/jbOUoGmLJw/VSvEFBWv6Yu0VjwjUzaJOaDDVvOlqdwCJkP4l9JQ4otCH+I+NqeFU5RmbEVSgfnG2tX4udNljpyunfqP6YbKBMjM60Bt2sDr2XNkCqZg1M9j3sSNBIMDSo5s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1614191559340658.5067939241569; Wed, 24 Feb 2021 10:32:39 -0800 (PST) Received: from localhost ([::1]:57612 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lEyxi-0001mB-78 for importer@patchew.org; Wed, 24 Feb 2021 13:32:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37578) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lEyqM-0002Lg-KT for qemu-devel@nongnu.org; Wed, 24 Feb 2021 13:25:03 -0500 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]:41978) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lEyqK-0004nb-3X for qemu-devel@nongnu.org; Wed, 24 Feb 2021 13:25:02 -0500 Received: by mail-ej1-x630.google.com with SMTP id lr13so4610678ejb.8 for ; Wed, 24 Feb 2021 10:24:59 -0800 (PST) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id bw22sm1791172ejb.78.2021.02.24.10.24.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Feb 2021 10:24:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3w6Ug8GRqwYAgQamasa4rCbTfjIVmYeM2Cs+qcWf9kI=; b=DbLRHqLhUFrZCXRGrvyZg/EjQlC39PD0OyNU+bmaUHcbwQaYRDdaS1YEnKF0OuTeke dyJZB1CTXeRGEbSyBQGwC1Pn/nPUlE2YQNuzOGwaX62Ds8qLXDqkJ6iEco6kaLMcQVDL gQw1Y4oaEVycAEyBRE9OPmjjr4cYxntCW/KCv6rIWZD3OANDCs5/f0fxPWjsKTZ2gfyj Vj6GuHujMJ6y/DT0iMjxc1erSGllAFKuWpkW2OQBVmGamDYFyYcTuqxWOF9lgYukRc1K XZkXZIU9NfeipfOcHLOIthA6pFN1nIdUlEuV4XjBSGXzLw15gyxzhd56aMXAg5Uz/hbd j8hA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=3w6Ug8GRqwYAgQamasa4rCbTfjIVmYeM2Cs+qcWf9kI=; b=IwF6ZM90Nr8p318jLT+EhbHA3couxOVJRZ1PaCh0Xyqlhs6OROfKcDn9BPwgkr3Np/ fREJinryjp/mpO11Pbv3N9ircGou/Q27GMmKL35ueEquK1sPjluFC7tFr6hGjbB57S4a rl2URkcYXgGuPLQQCQwe8vIGPpzxpcHiZMdYz6uXTlXzeF+RR9w9s1UfZa2gcOFTpbXX YNN8C7RQsV71pfnEZDN2W7fnpFLjLRQSyQsr5RploM/aOMv/Ml9CwbVjTgwKRXEkHzRh GOlUkC70QU3DQLzz6YdugBtsBWVpPgf7YcL47UtHyJ5K2In+IKJ1IP/xxWM43FIM5duk lE+Q== X-Gm-Message-State: AOAM530CQ33PLBAV3uOZL5Y+aotFKRzCCRe2ylpMjrfwa2bVenNGEj4z tHtYaDClKSaopqXBNlF3SMg019GFOGA= X-Google-Smtp-Source: ABdhPJxBZNN74ZEIztr2xacqVg19/2tc53c7ibWf/9+F9YmxUO/A5mufeV6Qtw3Jg8wEknQDvUrKKQ== X-Received: by 2002:a17:906:82d3:: with SMTP id a19mr31871689ejy.505.1614191098809; Wed, 24 Feb 2021 10:24:58 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 06/10] scsi: drop 'result' argument from command_complete callback Date: Wed, 24 Feb 2021 19:24:49 +0100 Message-Id: <20210224182453.587731-7-pbonzini@redhat.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210224182453.587731-1-pbonzini@redhat.com> References: <20210224182453.587731-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::630; envelope-from=paolo.bonzini@gmail.com; helo=mail-ej1-x630.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: hare@suse.de Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Hannes Reinecke The command complete callback has a SCSIRequest as the first argument, and the status field of that structure is identical to the 'status' argument. So drop the argument from the callback. Signed-off-by: Hannes Reinecke Message-Id: <20201116184041.60465-3-hare@suse.de> Signed-off-by: Paolo Bonzini --- hw/scsi/esp-pci.c | 5 ++--- hw/scsi/esp.c | 7 +++---- hw/scsi/lsi53c895a.c | 6 +++--- hw/scsi/megasas.c | 6 ++---- hw/scsi/mptsas.c | 5 +++-- hw/scsi/scsi-bus.c | 2 +- hw/scsi/spapr_vscsi.c | 10 +++++----- hw/scsi/virtio-scsi.c | 5 ++--- hw/scsi/vmw_pvscsi.c | 4 ++-- hw/usb/dev-storage.c | 6 +++--- hw/usb/dev-uas.c | 7 +++---- include/hw/scsi/esp.h | 2 +- include/hw/scsi/scsi.h | 2 +- 13 files changed, 31 insertions(+), 36 deletions(-) diff --git a/hw/scsi/esp-pci.c b/hw/scsi/esp-pci.c index 2ce96dc56e..4d7c2cab56 100644 --- a/hw/scsi/esp-pci.c +++ b/hw/scsi/esp-pci.c @@ -329,13 +329,12 @@ static const VMStateDescription vmstate_esp_pci_scsi = =3D { } }; =20 -static void esp_pci_command_complete(SCSIRequest *req, uint32_t status, - size_t resid) +static void esp_pci_command_complete(SCSIRequest *req, size_t resid) { ESPState *s =3D req->hba_private; PCIESPState *pci =3D container_of(s, PCIESPState, esp); =20 - esp_command_complete(req, status, resid); + esp_command_complete(req, resid); pci->dma_regs[DMA_WBC] =3D 0; pci->dma_regs[DMA_STAT] |=3D DMA_STAT_DONE; } diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c index b84e0fe33e..93d9c9c7b9 100644 --- a/hw/scsi/esp.c +++ b/hw/scsi/esp.c @@ -485,8 +485,7 @@ static void esp_report_command_complete(ESPState *s, ui= nt32_t status) } } =20 -void esp_command_complete(SCSIRequest *req, uint32_t status, - size_t resid) +void esp_command_complete(SCSIRequest *req, size_t resid) { ESPState *s =3D req->hba_private; =20 @@ -495,11 +494,11 @@ void esp_command_complete(SCSIRequest *req, uint32_t = status, * interrupt has been handled. */ trace_esp_command_complete_deferred(); - s->deferred_status =3D status; + s->deferred_status =3D req->status; s->deferred_complete =3D true; return; } - esp_report_command_complete(s, status); + esp_report_command_complete(s, req->status); } =20 void esp_transfer_data(SCSIRequest *req, uint32_t len) diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c index 7d13c7dc1c..a4e58580e4 100644 --- a/hw/scsi/lsi53c895a.c +++ b/hw/scsi/lsi53c895a.c @@ -787,14 +787,14 @@ static int lsi_queue_req(LSIState *s, SCSIRequest *re= q, uint32_t len) } =20 /* Callback to indicate that the SCSI layer has completed a command. */ -static void lsi_command_complete(SCSIRequest *req, uint32_t status, size_t= resid) +static void lsi_command_complete(SCSIRequest *req, size_t resid) { LSIState *s =3D LSI53C895A(req->bus->qbus.parent); int out; =20 out =3D (s->sstat1 & PHASE_MASK) =3D=3D PHASE_DO; - trace_lsi_command_complete(status); - s->status =3D status; + trace_lsi_command_complete(req->status); + s->status =3D req->status; s->command_complete =3D 2; if (s->waiting && s->dbc !=3D 0) { /* Raise phase mismatch for short transfers. */ diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c index 5bfc92fca1..8f2389d2c6 100644 --- a/hw/scsi/megasas.c +++ b/hw/scsi/megasas.c @@ -1852,13 +1852,12 @@ static void megasas_xfer_complete(SCSIRequest *req,= uint32_t len) } } =20 -static void megasas_command_complete(SCSIRequest *req, uint32_t status, - size_t resid) +static void megasas_command_complete(SCSIRequest *req, size_t resid) { MegasasCmd *cmd =3D req->hba_private; uint8_t cmd_status =3D MFI_STAT_OK; =20 - trace_megasas_command_complete(cmd->index, status, resid); + trace_megasas_command_complete(cmd->index, req->status, resid); =20 if (req->io_canceled) { return; @@ -1873,7 +1872,6 @@ static void megasas_command_complete(SCSIRequest *req= , uint32_t status, return; } } else { - req->status =3D status; trace_megasas_scsi_complete(cmd->index, req->status, cmd->iov_size, req->cmd.xfer); if (req->status !=3D GOOD) { diff --git a/hw/scsi/mptsas.c b/hw/scsi/mptsas.c index f86616544b..7416e78706 100644 --- a/hw/scsi/mptsas.c +++ b/hw/scsi/mptsas.c @@ -1133,7 +1133,7 @@ static QEMUSGList *mptsas_get_sg_list(SCSIRequest *sr= eq) } =20 static void mptsas_command_complete(SCSIRequest *sreq, - uint32_t status, size_t resid) + size_t resid) { MPTSASRequest *req =3D sreq->hba_private; MPTSASState *s =3D req->dev; @@ -1143,7 +1143,8 @@ static void mptsas_command_complete(SCSIRequest *sreq, hwaddr sense_buffer_addr =3D req->dev->sense_buffer_high_addr | req->scsi_io.SenseBufferLowAddr; =20 - trace_mptsas_command_complete(s, req->scsi_io.MsgContext, status, resi= d); + trace_mptsas_command_complete(s, req->scsi_io.MsgContext, + sreq->status, resid); =20 sense_len =3D scsi_req_get_sense(sreq, sense_buf, SCSI_SENSE_BUF_SIZE); if (sense_len > 0) { diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index c349fb7f2d..dc4141ec8d 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -1483,7 +1483,7 @@ void scsi_req_complete(SCSIRequest *req, int status) =20 scsi_req_ref(req); scsi_req_dequeue(req); - req->bus->info->complete(req, req->status, req->resid); + req->bus->info->complete(req, req->resid); =20 /* Cancelled requests might end up being completed instead of cancelle= d */ notifier_list_notify(&req->cancel_notifiers, req); diff --git a/hw/scsi/spapr_vscsi.c b/hw/scsi/spapr_vscsi.c index 4aa0224c47..d653b5a6ad 100644 --- a/hw/scsi/spapr_vscsi.c +++ b/hw/scsi/spapr_vscsi.c @@ -551,19 +551,19 @@ static void vscsi_transfer_data(SCSIRequest *sreq, ui= nt32_t len) } =20 /* Callback to indicate that the SCSI layer has completed a transfer. */ -static void vscsi_command_complete(SCSIRequest *sreq, uint32_t status, siz= e_t resid) +static void vscsi_command_complete(SCSIRequest *sreq, size_t resid) { VSCSIState *s =3D VIO_SPAPR_VSCSI_DEVICE(sreq->bus->qbus.parent); vscsi_req *req =3D sreq->hba_private; int32_t res_in =3D 0, res_out =3D 0; =20 - trace_spapr_vscsi_command_complete(sreq->tag, status, req); + trace_spapr_vscsi_command_complete(sreq->tag, sreq->status, req); if (req =3D=3D NULL) { fprintf(stderr, "VSCSI: Can't find request for tag 0x%x\n", sreq->= tag); return; } =20 - if (status =3D=3D CHECK_CONDITION) { + if (sreq->status =3D=3D CHECK_CONDITION) { req->senselen =3D scsi_req_get_sense(req->sreq, req->sense, sizeof(req->sense)); trace_spapr_vscsi_command_complete_sense_data1(req->senselen, @@ -574,8 +574,8 @@ static void vscsi_command_complete(SCSIRequest *sreq, u= int32_t status, size_t re req->sense[12], req->sense[13], req->sense[14], req->sense= [15]); } =20 - trace_spapr_vscsi_command_complete_status(status); - if (status =3D=3D 0) { + trace_spapr_vscsi_command_complete_status(sreq->status); + if (sreq->status =3D=3D 0) { /* We handle overflows, not underflows for normal commands, * but hopefully nobody cares */ diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index 99ff261cea..358c0e70b0 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -500,8 +500,7 @@ static void virtio_scsi_complete_cmd_req(VirtIOSCSIReq = *req) virtio_scsi_complete_req(req); } =20 -static void virtio_scsi_command_complete(SCSIRequest *r, uint32_t status, - size_t resid) +static void virtio_scsi_command_complete(SCSIRequest *r, size_t resid) { VirtIOSCSIReq *req =3D r->hba_private; uint8_t sense[SCSI_SENSE_BUF_SIZE]; @@ -513,7 +512,7 @@ static void virtio_scsi_command_complete(SCSIRequest *r= , uint32_t status, } =20 req->resp.cmd.response =3D VIRTIO_SCSI_S_OK; - req->resp.cmd.status =3D status; + req->resp.cmd.status =3D r->status; if (req->resp.cmd.status =3D=3D GOOD) { req->resp.cmd.resid =3D virtio_tswap32(vdev, resid); } else { diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c index a63d25de48..0da378ed50 100644 --- a/hw/scsi/vmw_pvscsi.c +++ b/hw/scsi/vmw_pvscsi.c @@ -511,7 +511,7 @@ pvscsi_write_sense(PVSCSIRequest *r, uint8_t *sense, in= t len) } =20 static void -pvscsi_command_complete(SCSIRequest *req, uint32_t status, size_t resid) +pvscsi_command_complete(SCSIRequest *req, size_t resid) { PVSCSIRequest *pvscsi_req =3D req->hba_private; PVSCSIState *s; @@ -528,7 +528,7 @@ pvscsi_command_complete(SCSIRequest *req, uint32_t stat= us, size_t resid) pvscsi_req->cmp.hostStatus =3D BTSTAT_DATARUN; } =20 - pvscsi_req->cmp.scsiStatus =3D status; + pvscsi_req->cmp.scsiStatus =3D req->status; if (pvscsi_req->cmp.scsiStatus =3D=3D CHECK_CONDITION) { uint8_t sense[SCSI_SENSE_BUF_SIZE]; int sense_len =3D diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c index c49e8b819e..a5f76fc001 100644 --- a/hw/usb/dev-storage.c +++ b/hw/usb/dev-storage.c @@ -277,17 +277,17 @@ static void usb_msd_transfer_data(SCSIRequest *req, u= int32_t len) } } =20 -static void usb_msd_command_complete(SCSIRequest *req, uint32_t status, si= ze_t resid) +static void usb_msd_command_complete(SCSIRequest *req, size_t resid) { MSDState *s =3D DO_UPCAST(MSDState, dev.qdev, req->bus->qbus.parent); USBPacket *p =3D s->packet; =20 - trace_usb_msd_cmd_complete(status, req->tag); + trace_usb_msd_cmd_complete(req->status, req->tag); =20 s->csw.sig =3D cpu_to_le32(0x53425355); s->csw.tag =3D cpu_to_le32(req->tag); s->csw.residue =3D cpu_to_le32(s->data_len); - s->csw.status =3D status !=3D 0; + s->csw.status =3D req->status !=3D 0; =20 if (s->packet) { if (s->data_len =3D=3D 0 && s->mode =3D=3D USB_MSDM_DATAOUT) { diff --git a/hw/usb/dev-uas.c b/hw/usb/dev-uas.c index a51402bc0b..d2bd85d3f6 100644 --- a/hw/usb/dev-uas.c +++ b/hw/usb/dev-uas.c @@ -598,17 +598,16 @@ static void usb_uas_scsi_transfer_data(SCSIRequest *r= , uint32_t len) } } =20 -static void usb_uas_scsi_command_complete(SCSIRequest *r, - uint32_t status, size_t resid) +static void usb_uas_scsi_command_complete(SCSIRequest *r, size_t resid) { UASRequest *req =3D r->hba_private; =20 - trace_usb_uas_scsi_complete(req->uas->dev.addr, req->tag, status, resi= d); + trace_usb_uas_scsi_complete(req->uas->dev.addr, req->tag, r->status, r= esid); req->complete =3D true; if (req->data) { usb_uas_complete_data_packet(req); } - usb_uas_queue_sense(req, status); + usb_uas_queue_sense(req, r->status); scsi_req_unref(req->req); } =20 diff --git a/include/hw/scsi/esp.h b/include/hw/scsi/esp.h index 60cc3047a5..d8a6263c13 100644 --- a/include/hw/scsi/esp.h +++ b/include/hw/scsi/esp.h @@ -151,7 +151,7 @@ struct SysBusESPState { =20 void esp_dma_enable(ESPState *s, int irq, int level); void esp_request_cancelled(SCSIRequest *req); -void esp_command_complete(SCSIRequest *req, uint32_t status, size_t resid); +void esp_command_complete(SCSIRequest *req, size_t resid); void esp_transfer_data(SCSIRequest *req, uint32_t len); void esp_hard_reset(ESPState *s); uint64_t esp_reg_read(ESPState *s, uint32_t saddr); diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h index a8ef59c0f4..5d992e6e1d 100644 --- a/include/hw/scsi/scsi.h +++ b/include/hw/scsi/scsi.h @@ -123,7 +123,7 @@ struct SCSIBusInfo { int (*parse_cdb)(SCSIDevice *dev, SCSICommand *cmd, uint8_t *buf, void *hba_private); void (*transfer_data)(SCSIRequest *req, uint32_t arg); - void (*complete)(SCSIRequest *req, uint32_t arg, size_t resid); + void (*complete)(SCSIRequest *req, size_t resid); void (*cancel)(SCSIRequest *req); void (*change)(SCSIBus *bus, SCSIDevice *dev, SCSISense sense); QEMUSGList *(*get_sg_list)(SCSIRequest *req); --=20 2.29.2