From patchwork Sun Feb 12 22:51:39 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: 652851 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2125035wrr; Sun, 12 Feb 2023 14:55:33 -0800 (PST) X-Google-Smtp-Source: AK7set8S9CTrRTCOz8PD9WCg5lM5NwTBciGY5cEgO6yC8Y3HwAYe40DmBZBabY++q8Wnc0Wl8aLh X-Received: by 2002:ad4:5b87:0:b0:56b:fe7d:4a5e with SMTP id 7-20020ad45b87000000b0056bfe7d4a5emr35424839qvp.44.1676242532971; Sun, 12 Feb 2023 14:55:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676242532; cv=none; d=google.com; s=arc-20160816; b=v1aviTM9JUDoIoUP5vJeWELAmIqAlAensa1zkVuG+ayWZxxMoQAQM0sTlxOnYLiY9Q eeC65aX+EKrW5yO8KgWnU6UwF6aSS3DOgpI+EZZAr6kbq5ukR+KpVRSntHnLciBLAbIc 5KzIp3/t6QOap+kB9CHjBqp29mUqVwCpkAAcB5NjBlWehqmuXVhR11CE1D6eVZvaday7 Y1ybtYt0W3bqkvAuCYfvoM9lmM0rZ41kzGmowFNhzWjJmkBa/x+k8+E+EoeBgbA8pZSW pKABHUFQepWmGgMNhlp57VzKGOCU0yzhI6lSWOCLlhZcnHKEHj36S0+GYU/Ja8BE+Xfy mt1Q== 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=LKsXht54rDUTkJKqHQqtb4Pds5COe3w7PRc1ZjYr30M=; b=sKOzfDSwOb/O10dV4QqpRoYnQUp41fitOE3xVC0TbPDdgL48bkQ9gUihiBgL3vhZWi BayY4XnfKk3oji/lcGE0AHgWOWxAN9mtCb24MbwYlOXmWFZwHPd1uPYM4Y1EEWIdwt79 7HsLgAT12OSxV8b/D0bKkqp/Se9KnhR0cUNp2jkM3LUu2U8Dfj3HBzOZaBhMTC+dDciu RZnJIAwoxhmkD1TrQLaf6Qev8fwAkg75yOiMBxBX3s03Tt+utHStZvQ10NsHN/OtnHU5 dlGWKAGOOn3/c7mYHfHHSnhZkzr+Cdusfkt/IYUkR2l/e48uDvqj1x1iuJYRAth31KdM ynEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sfrz6HR9; 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 t65-20020a37aa44000000b00706741aa9a8si8026747qke.202.2023.02.12.14.55.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 14:55:32 -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=sfrz6HR9; 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 1pRLDa-0007WV-Ic; Sun, 12 Feb 2023 17:53:10 -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 1pRLDX-0007Io-2L for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:53:07 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRLDV-0004Bq-6M for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:53:06 -0500 Received: by mail-wr1-x42c.google.com with SMTP id k3so2817491wrv.5 for ; Sun, 12 Feb 2023 14:53:04 -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=LKsXht54rDUTkJKqHQqtb4Pds5COe3w7PRc1ZjYr30M=; b=sfrz6HR9V2dqOypvsdhdHvLfc1g4znf+bLlv6r7ACKtPm236EXKEpPVNVoSHdYsiGk PHn90E0rROR90hXNbH5aKujTa7NKutEn5lrjA/35ay6TZEhZaE8FOK+QUpXyBoqI4Ey7 eUQv0jrs1sl5CIrtHS4rtFdP7hlh2o/3/n7LcXbKl7Lf8AJrvsOk3kbHtv9IwSAOAqZR JsjuCbApn7tJ4+GD7rF6KSJuHEYqW6vnFMFngA+z4FTDYxyyV+f+AuDua4qn1A+HA3Z9 XVtakH61+4cH4onDjryiUUqAzI6svjNro4OAFSBJ64nw3nRG92vcZ+puyyuKx/oYp2S4 dtnQ== 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=LKsXht54rDUTkJKqHQqtb4Pds5COe3w7PRc1ZjYr30M=; b=1vB0ZY7BJCPJCw1SUWnn4x7FrqDyF638P1gdtCoQi39r3c5Md9nic9nwEn5e6HAITd MXwyVyAQ4wtGAbSTEOWIrh9wXI/lrJji7nqGeQHHQGAjaBr5TVORu17PpQiPSEASwkOM F6hpXoZ7hnmkVPft6yGStlIqE27n6thjcvkTuMDNjLtB98ayJOek5FLq5XfQ7pu2ZkyH GI/QKN0v1M24sp1HciiRP5LQyQmS3tR5pEHnfUlNnbUWrFVqThcU1NRStFxT3xJ9LG9H d/AiARo0APgNCE302VK85rH5AT2NLyInD28SjnoA6dL8teTzebBKTY9z34ZBrnOL98Ug vIQw== X-Gm-Message-State: AO0yUKXiUCheaJWjVlp2knojRowvWISLDIX2E4BKJG5CMhFQ0ayFRaml z6ralPAgjoZzrKk8jMnyEMjWPA== X-Received: by 2002:adf:d08a:0:b0:236:695b:82d4 with SMTP id y10-20020adfd08a000000b00236695b82d4mr20256109wrh.30.1676242383050; Sun, 12 Feb 2023 14:53:03 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id q4-20020a05600000c400b002c54737e908sm7356335wrx.91.2023.02.12.14.53.01 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 14:53:02 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Eduardo Habkost , qemu-devel@nongnu.org Cc: Richard Henderson , xiaoqiang zhao , Hu Tao , Thomas Huth , qemu-block@nongnu.org, qemu-s390x@nongnu.org, Gonglei Arei , Cao jin , Li Qiang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Christian Borntraeger , David Hildenbrand , Ilya Leoshkevich , Halil Pasic , Eric Farman , Paolo Bonzini , Fam Zheng Subject: [PATCH 14/19] hw/scsi/scsi-bus: Inline two uses of scsi_bus_from_device() Date: Sun, 12 Feb 2023 23:51:39 +0100 Message-Id: <20230212225144.58660-15-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230212225144.58660-1-philmd@linaro.org> References: <20230212225144.58660-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=philmd@linaro.org; helo=mail-wr1-x42c.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é --- 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 29b65a9b54..802bed2abc 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,