From patchwork Mon Feb 13 07:08:15 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: 653181 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2267245wrr; Sun, 12 Feb 2023 23:12:51 -0800 (PST) X-Google-Smtp-Source: AK7set9gSrkUDJ+/U+zw80liCuQfHcJOYIv3gKcCl/ABruz3MfY2hAbqZo1fnypPVp+GWBLG9j3B X-Received: by 2002:a05:6214:496:b0:535:5492:b427 with SMTP id pt22-20020a056214049600b005355492b427mr41290098qvb.28.1676272371543; Sun, 12 Feb 2023 23:12:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676272371; cv=none; d=google.com; s=arc-20160816; b=WikDN89KLFqKyEYOpRzuXn8EiCz4cGLnKVtLIofsGl4ylIhPPCpcWEpeKrErIZwq6p lo2jDUNGs6/HGejzple5JtPX09Fp+ePo4jZw1f7CnJ9GtsvBmtbHUkXX/AhhIpGXtcWM TGVCp4b5nHDd0nXNnqJfn05NaEYVGGI7rlM54coHyMnmBmR0bRORUCo2iROvCsvaAXSj T1IT4nUlSdWolv4eSUZYFSEcfTsBNxXu9Ue0ror0OXRQEGPb3Qzc+hmxr1ZBLFj/lB2y Q+qXrnK3U+rUuMIQPenFKiAjoPzR9CnGH2bdtpnj3NqQRI2TAKCd9Px6PhuO5wb3LG0r vICA== 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=GOJqX8v3/sh1eT6fwi4hqhcy8JYApnAmdmloXPtjUgo=; b=SKyD+2quubc8+xo09C3H3GfSCc/ti58ho3xiksgoqh7QQ2UjH1rjvLG3e9vEUc+BLG Sf0S7zRW+kiwGuLjJzvtVOo52Wgl2h5IB9zHxANoLuxYTHs/arHWO5bftIzAgsqTg00o n32QN9ZNLODkepzQ8r6a9MtBoETBa9Txq/040eemWkr4MH2pF5b0yroawdY3kTYKHEWu thMiuK+wOjkgR73uGqYbznBfdLg/NvbCrFKhpK+xXV0V/jLKkRO14/o4y52NTdZUK3aB ek7hr2QiSZOz6H1oOxBzt6xcSIyk3qU5hXSgQYEjVuZaPXT3Sz45v5j4aGn4Gav1WU/8 DEPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HzjxN457; 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 i1-20020a05620a248100b0071f40a59fedsi10142209qkn.653.2023.02.12.23.12.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 23:12:51 -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=HzjxN457; 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 1pRSyH-0003Jb-M0; Mon, 13 Feb 2023 02:09:53 -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 1pRSy3-00031h-VK for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:09:43 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRSy2-00020T-26 for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:09:39 -0500 Received: by mail-wm1-x331.google.com with SMTP id m16-20020a05600c3b1000b003dc4050c94aso8216842wms.4 for ; Sun, 12 Feb 2023 23:09:36 -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=GOJqX8v3/sh1eT6fwi4hqhcy8JYApnAmdmloXPtjUgo=; b=HzjxN4572CIY6DB37y4J/OK0KnDnerxhnEzlRuqnAOk5eZAGM3GYAF/spCfdmxDea1 TF43+hImJjpFKyPVWUQ0QWyVi6g/R6mbezTTuskFsa74h5K6WARv1tbebLJQU4FHQt1C PXR91bLKnCgKtO1gt7qUlz05uQ2Mb9PUQKaRFw/StfIjIE9zjL38PGA+22mFV/XB3+R1 x2s0Xgv3py3hznVIypu+RFEQzcCOLFV9hsKzLeAwqoThse+e8jlv6zY4Vo0QbXLXSNvN evyTo7tcE+zIs8J3plLwfd4GEoOg4iim33BHuGgSErXZLivAER6d4mJbIM+HXDUU+5Wr ViUA== 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=GOJqX8v3/sh1eT6fwi4hqhcy8JYApnAmdmloXPtjUgo=; b=rViBdULd7y0XvtXBkSp9RHwXuVrLNwiS06ZhPrwvYePVnjVviF4S/isePIFpjmXryn kITozS4/eLlL+XvWhf5EXKFq4Bp5Q5L8UB/Ms1IZAduYaB9QYCZLMdwGoYpUp284z9hM mmiQumCgVQ4h7ba8KX+bTwPWcJ/HSV3XEMgw6XTvsHr+5IvxGORZqSHSaP5MFvqJ/CHh Dhq45cCrtwiKvX88QZi07RuwDv7ZqI9LQ0oW4s1InII7c+yuh8AGGbYRaNpshqqW85F4 mi+miVxZTAvl5KDpEg4bsXoUWZ84TKrQHiMqjqZKgwPp9Krr2xKrYkPtllo83EO1MrBD +q3Q== X-Gm-Message-State: AO0yUKX1N1f3HU63wOoOEt5RFtCUgtnmQzRSo7Qzo1KhNwiMSbLddM8K BmBTmHYRtzknuQI//ONGQ7HqUYl2Npk34T6c X-Received: by 2002:a05:600c:3093:b0:3df:fbd5:690 with SMTP id g19-20020a05600c309300b003dffbd50690mr18109405wmn.17.1676272175642; Sun, 12 Feb 2023 23:09:35 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id o5-20020a1c7505000000b003dc48a2f997sm15921660wmc.17.2023.02.12.23.09.34 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 23:09:35 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Eduardo Habkost Cc: qemu-block@nongnu.org, Thomas Huth , Li Qiang , qemu-s390x@nongnu.org, Hu Tao , Gonglei Arei , Cao jin , xiaoqiang zhao , Paolo Bonzini , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Christian Borntraeger , Halil Pasic , Eric Farman , David Hildenbrand , Ilya Leoshkevich , Fam Zheng Subject: [PATCH v2 14/19] hw/scsi/scsi-bus: Inline two uses of scsi_bus_from_device() Date: Mon, 13 Feb 2023 08:08:15 +0100 Message-Id: <20230213070820.76881-15-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230213070820.76881-1-philmd@linaro.org> References: <20230213070820.76881-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.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 Signed-off-by: Philippe Mathieu-Daudé Acked-by: Eric Farman --- hw/s390x/ipl.c | 7 ++----- hw/scsi/scsi-bus.c | 2 +- include/hw/scsi/scsi.h | 5 ----- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c index 8612684d48..4f7f4e60d6 100644 --- a/hw/s390x/ipl.c +++ b/hw/s390x/ipl.c @@ -366,11 +366,8 @@ static CcwDevice *s390_get_ccw_device(DeviceState *dev_st, int *devtype) ccw_dev = CCW_DEVICE(vfio_ccw_dev); tmp_dt = CCW_DEVTYPE_VFIO; } else { - SCSIDevice *sd = (SCSIDevice *) - object_dynamic_cast(OBJECT(dev_st), - TYPE_SCSI_DEVICE); - if (sd) { - SCSIBus *sbus = scsi_bus_from_device(sd); + if (object_dynamic_cast(OBJECT(dev_st), TYPE_SCSI_DEVICE)) { + SCSIBus *sbus = SCSI_BUS(qdev_get_parent_bus(dev_st)); VirtIODevice *vdev = (VirtIODevice *) object_dynamic_cast(OBJECT(sbus->qbus.parent), TYPE_VIRTIO_DEVICE); diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index c4525515ab..ee72b86b13 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -679,7 +679,7 @@ SCSIRequest *scsi_req_alloc(const SCSIReqOps *reqops, SCSIDevice *d, uint32_t tag, uint32_t lun, void *hba_private) { SCSIRequest *req; - SCSIBus *bus = scsi_bus_from_device(d); + SCSIBus *bus = SCSI_BUS(qdev_get_parent_bus(DEVICE(d))); BusState *qbus = BUS(bus); const int memset_off = offsetof(SCSIRequest, sense) + sizeof(req->sense); diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h index eb558c145a..e3263dec0d 100644 --- a/include/hw/scsi/scsi.h +++ b/include/hw/scsi/scsi.h @@ -175,11 +175,6 @@ static inline void scsi_bus_init(SCSIBus *bus, size_t bus_size, scsi_bus_init_named(bus, bus_size, host, info, NULL); } -static inline SCSIBus *scsi_bus_from_device(SCSIDevice *d) -{ - return SCSI_BUS(qdev_get_parent_bus(DEVICE(d))); -} - SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockBackend *blk, int unit, bool removable, int bootindex, bool share_rw,