From patchwork Mon Feb 13 18:43:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 653218 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2581894wrr; Mon, 13 Feb 2023 10:47:19 -0800 (PST) X-Google-Smtp-Source: AK7set/3bITCeIDO0wjbVg4ktVDeW/GEKurLhIsNN5RXfuaSyMLO8uEA733C6Oo177lOhlaHSoNy X-Received: by 2002:ad4:5d6c:0:b0:56e:af4a:11f8 with SMTP id fn12-20020ad45d6c000000b0056eaf4a11f8mr10030687qvb.4.1676314039488; Mon, 13 Feb 2023 10:47:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676314039; cv=none; d=google.com; s=arc-20160816; b=QvV/9EqXPmVSt8QoM1aJ+MpiEQoP+SKkZH6e1Xc/1DUk8dsMcOdaTLt0tzAm4zV8C/ 9O7FJ1OPKPRjzN+93SUIUqjccpgBOzVo4sr/XULTK990YA8YVu9GeKGz548JghPm5kHY uK3kqXuWDlJWsEPCNJk9kzf5HEFAIcMVBsVYNaoBVoP6RZVpwz/W8sARkUh+5zvswJ8j nlCIpxjFiFU4OeUC+soASp/GmkE/m0R5ia26QJaba8QUEfwcjJtPI+oKGgsHjq8cjR/G xwWaoYZmQygFpHaZ8pL3Xzo7lUGmHJgUpql1S8+lu4GBUzhWRWakhlpEaYZcGDBwGxn+ MYhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lbFFSEwuPaiVjYWiGHnO40wk80nlXCVErHPDaxFN7V8=; b=YBOqTEJadNHgVEASiaKR0eqsPYuHhmNY/Y4X/p9RB57pb9LCrRr6dy+N7UPLUWEJrf uUfzBiQDe5TX/pd1sXqlNB2Xsdvh8aUNYHfy2mcBMT/lzW/T4aCjsig0U8heWmajTOyq YjZ2LO+2SyleCkrQHwpID0BZynpc3td11tmzqkgewsoWaEAbQf0a7YqMbB8kNJ0JVcBW suzKPBvhWizugYPM/3LqRADhOPsZzw0dbIUsKKRvI70uzG9Zw6VqPn+U1QLjGqmQYiPD pMXsyHWAdL3Eg0FdVZ3JwwPXBSQdAfxCORN0IF2keFgP2+AGROhRWr8rLkodl9F1Ubrh e4SA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IrXHoLjJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m15-20020a05620a13af00b00708084c79f3si9093978qki.610.2023.02.13.10.47.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Feb 2023 10:47:19 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IrXHoLjJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRdon-0001tb-Gu; Mon, 13 Feb 2023 13:44:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pRdoi-0001qI-RV for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:44:45 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRdoh-0008Vz-6A for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:44:44 -0500 Received: by mail-wm1-x32b.google.com with SMTP id n33so3342179wms.0 for ; Mon, 13 Feb 2023 10:44:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lbFFSEwuPaiVjYWiGHnO40wk80nlXCVErHPDaxFN7V8=; b=IrXHoLjJvRO9HbHPw2U4rArVJbApZYzgT816Q/pq4Jyd2LDWRJAuEVdwriT218Lzn7 ye/qO2wqhc68fUyeCPd7xThRwUqnuN2T3yCFCnwa6gsOaR9IEufcrVOiWnnen96v6EFc e9ZV+oqDtSmMP9lb/+t9Ficg3RCWoRLrXwEPgfBwNLuZZzgxFHkmJJwAh7nylUCsm+IW 7+QpvroKmoYkNWfaNE8jRpLod7LclueYvIyp93PG6fv+YWkiPYF1OtWtJHrMUG1W1m6G 6N6sIlvxhh+kQiWM5xtP1EEB/3Pwlzme8VjPXAnjdo6crbpn3Hsd0nGOazZzVF99lVpF XKaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lbFFSEwuPaiVjYWiGHnO40wk80nlXCVErHPDaxFN7V8=; b=XNTVfTbjaKl2YBzchxQIbi11DbFJ8kYANzu3bvb6rqUhRbGbKXjHrSvE3rEh+LijNR IoxacG5Rl8aifVhUpWX/M/eYnNhmmLy9O/Q8HICR6XEg5AnQGmTU5wycjU4X1AENrywT p2XQdfGTvVJyJONQ4TVBg4HaRU9d/hMoRc0blqQfFH/P01enakdjMRA8atP+HlAaREYi oHolf3CLqWUahLfX0u6CSgPc4BKZUh+NkrOqYbMHoOX0ufyu1z0vfJf3P9nTkolyBapH EbLTsNUS4M4kkNgby4m2ZWkJH2NgB7XKNMfzXHdjWkCc3729hIYYYFjBELD/9FLX7N4x iZxw== X-Gm-Message-State: AO0yUKXexTDu4rVbXnf6/MwY5ffIbzgKRgBzlSjbAk6lwTzCzJPj+eRQ Vv4MTvn6TFN8yoOqgNbRjCCJtuY1A4TELHte X-Received: by 2002:a05:600c:3403:b0:3dc:572f:edb7 with SMTP id y3-20020a05600c340300b003dc572fedb7mr5131983wmp.1.1676313881348; Mon, 13 Feb 2023 10:44:41 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id w19-20020a05600c475300b003e11f280b8bsm12751880wmo.44.2023.02.13.10.44.39 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Feb 2023 10:44:41 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Eduardo Habkost Cc: qemu-block@nongnu.org, Hu Tao , Gonglei Arei , Richard Henderson , Li Qiang , Thomas Huth , Cao jin , xiaoqiang zhao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Paolo Bonzini , Fam Zheng Subject: [PATCH v3 11/14] hw/scsi/scsi-bus: Replace DO_UPCAST(SCSIBus) by SCSI_BUS() Date: Mon, 13 Feb 2023 19:43:35 +0100 Message-Id: <20230213184338.46712-12-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230213184338.46712-1-philmd@linaro.org> References: <20230213184338.46712-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Use the SCSI_BUS() QOM type-checking macro to avoid DO_UPCAST(). Signed-off-by: Philippe Mathieu-Daudé --- hw/scsi/scsi-bus.c | 12 ++++++------ include/hw/scsi/scsi.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index 7b2a82b335..c4525515ab 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -104,7 +104,7 @@ static void scsi_device_unrealize(SCSIDevice *s) int scsi_bus_parse_cdb(SCSIDevice *dev, SCSICommand *cmd, uint8_t *buf, size_t buf_len, void *hba_private) { - SCSIBus *bus = DO_UPCAST(SCSIBus, qbus, qdev_get_parent_bus(DEVICE(dev))); + SCSIBus *bus = SCSI_BUS(qdev_get_parent_bus(DEVICE(dev))); int rc; assert(cmd->len == 0); @@ -250,7 +250,7 @@ static bool scsi_bus_check_address(BusState *qbus, DeviceState *qdev, Error **er static void scsi_qdev_realize(DeviceState *qdev, Error **errp) { SCSIDevice *dev = SCSI_DEVICE(qdev); - SCSIBus *bus = DO_UPCAST(SCSIBus, qbus, qdev_get_parent_bus(DEVICE(dev))); + SCSIBus *bus = SCSI_BUS(qdev_get_parent_bus(qdev)); bool is_free; Error *local_err = NULL; @@ -705,7 +705,7 @@ SCSIRequest *scsi_req_alloc(const SCSIReqOps *reqops, SCSIDevice *d, SCSIRequest *scsi_req_new(SCSIDevice *d, uint32_t tag, uint32_t lun, uint8_t *buf, size_t buf_len, void *hba_private) { - SCSIBus *bus = DO_UPCAST(SCSIBus, qbus, qdev_get_parent_bus(DEVICE(d))); + SCSIBus *bus = SCSI_BUS(qdev_get_parent_bus(DEVICE(d))); const SCSIReqOps *ops; SCSIDeviceClass *sc = SCSI_DEVICE_GET_CLASS(d); SCSIRequest *req; @@ -1353,7 +1353,7 @@ int scsi_req_parse_cdb(SCSIDevice *dev, SCSICommand *cmd, uint8_t *buf, void scsi_device_report_change(SCSIDevice *dev, SCSISense sense) { - SCSIBus *bus = DO_UPCAST(SCSIBus, qbus, qdev_get_parent_bus(DEVICE(dev))); + SCSIBus *bus = SCSI_BUS(qdev_get_parent_bus(DEVICE(dev))); scsi_device_set_ua(dev, sense); if (bus->info->change) { @@ -1698,7 +1698,7 @@ static int put_scsi_requests(QEMUFile *f, void *pv, size_t size, const VMStateField *field, JSONWriter *vmdesc) { SCSIDevice *s = pv; - SCSIBus *bus = DO_UPCAST(SCSIBus, qbus, qdev_get_parent_bus(DEVICE(s))); + SCSIBus *bus = SCSI_BUS(qdev_get_parent_bus(DEVICE(s))); SCSIRequest *req; QTAILQ_FOREACH(req, &s->requests, next) { @@ -1726,7 +1726,7 @@ static int get_scsi_requests(QEMUFile *f, void *pv, size_t size, const VMStateField *field) { SCSIDevice *s = pv; - SCSIBus *bus = DO_UPCAST(SCSIBus, qbus, qdev_get_parent_bus(DEVICE(s))); + SCSIBus *bus = SCSI_BUS(qdev_get_parent_bus(DEVICE(s))); int8_t sbyte; while ((sbyte = qemu_get_sbyte(f)) > 0) { diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h index 843dde8851..eb558c145a 100644 --- a/include/hw/scsi/scsi.h +++ b/include/hw/scsi/scsi.h @@ -177,7 +177,7 @@ static inline void scsi_bus_init(SCSIBus *bus, size_t bus_size, static inline SCSIBus *scsi_bus_from_device(SCSIDevice *d) { - return DO_UPCAST(SCSIBus, qbus, qdev_get_parent_bus(DEVICE(d))); + return SCSI_BUS(qdev_get_parent_bus(DEVICE(d))); } SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockBackend *blk,