From patchwork Sun Feb 12 22:47:29 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: 652828 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2123243wrr; Sun, 12 Feb 2023 14:48:39 -0800 (PST) X-Google-Smtp-Source: AK7set/prM1JrA+so2vzDByK8mGWU/8/5UQrK8Xy6qmtmz1SKzw6gprKitX7cq9rZeg4A1W9QBun X-Received: by 2002:a05:622a:2cb:b0:3b8:3a7c:d208 with SMTP id a11-20020a05622a02cb00b003b83a7cd208mr38393428qtx.34.1676242118966; Sun, 12 Feb 2023 14:48:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676242118; cv=none; d=google.com; s=arc-20160816; b=yvTqdXhypHibxuirx4/xoQvX1GMoQ3mnqOrA6+b/B492Fs46goH/3UP0e83euVuQyW 9bwrEQI8PKD8o8rBxyPaqdpZ+RKAnJ7ks/hBuY8aHd41Md/MXGE/JmyIsmcdl/exAX0j UsSXj4chYUUzpSgOU+wzKpv7A2CCHvOH1fpZiIDIsyh7eZAMIQnuifqqxM3eG/QWkkro 7VdHNhSQoi6ZNjwKYEiv5RoCYkCqPFdw6RURiMfj2fbCgm/Bj+hIQG95Hq/Ve1RsvZCt J8iktsXJ/YV7nAHKlGAiDX6Q87V9UzPTCV9qz26s6aQs/BvlDw3JOqM4fpkGon9PgeMl BILg== 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=9E9FEd3Tu+4S+Gw8JExKzSs7Qwdz1/Mjy+Z3v6Jr7cU=; b=TRYJrNGBoM14525NKM2ZUMlUwFyj52AjF4Fry3Dep6kGMIGNbTco06f15JO846w5ck rMIx8DaOcZjrSGQ/BEoPUr2HTS7R3JqKrvcmw6MS0DS0lfsBJBUpNwf0Sw9JkMdpBBcM RJAgstTesXkkQIv2h2Wjon/nKFnkfHmvGtYCc3PAAnKIwLvAlHDgKMmqVCmTBOFJ9UZz EprmVf9T9pT9SpdbtWsBTj6iN+71cQiBrGxp2eLdanMihaifa/sA3YS5Pwv7uvrses+R ydEGOV9jOrTdbtSFnvQWjA4/tXcwlS0aTuJW/kepYvlpdKLTsVd5SqZW6ajZfGQdQ8Wg kxiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CT0ICUD7; 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 d18-20020ac86152000000b003b27a36b134si7710443qtm.782.2023.02.12.14.48.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 14:48:38 -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=CT0ICUD7; 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 1pRL8U-0001PR-Ow; Sun, 12 Feb 2023 17:47:54 -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 1pRL8T-0001P6-8U for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:47:53 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRL8R-0003K1-Hu for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:47:52 -0500 Received: by mail-wr1-x436.google.com with SMTP id h16so10411916wrz.12 for ; Sun, 12 Feb 2023 14:47:51 -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=9E9FEd3Tu+4S+Gw8JExKzSs7Qwdz1/Mjy+Z3v6Jr7cU=; b=CT0ICUD7yUsLLt1k58jhfr/5JwMrCOVnKcoEVcIU9XhTJtp65CZlwuHTLui1EDRE7D kSmHJS8D79SGfKEm8EiDJusd1m4+yNsx5RUX7wpi6PLtK0GtMfbquYcykeVBDO7K3qaZ JUZ8yVlrqMunBNNFYwEkr8vli8R4r3WB6GsrRiVa8d82nXuRj0cBLI4XqEboNno5B/f/ ivcUtcZ6IHvGDuKXTILhCxfhu1cnPRoFoFY0vnxbf/3SLekyCWX+hbi4MqjoEUrwht9f CQE7+VQ8/7ndhxCgGGo9ulK1AHG5BSvbpw1m8Z1N4XhhyOv4OZXoRynP7hdbX51WxL/8 Q0HQ== 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=9E9FEd3Tu+4S+Gw8JExKzSs7Qwdz1/Mjy+Z3v6Jr7cU=; b=EWs21O8nEuOf+0D+4TOJkJitDD3m4QbRvGaTkYzb2d5PRGItabMbwpXD67x7jGsTuu Tnok15T7fAR8Sj91LOWTR0XWwMoXu+NFzlhguo/RufWxk5yUDOUp1m7Sr32dTxQaL4SB 6zj1hQm5Giitcm8RVD+N2uCTh758fcBML0X2CBk2PImPtX09kl2yjXcv83rY3RON04H9 /pmIHVHibymHTEsdyOm7ZEFtX2yx+eCJHvo/ql5q+Fafagf8q//Ed/GCaeTjjzT8gAWX TG6YzE5FJtl94Gw+QpkU8G6CTUaZZim/ElAr1voBCmcr5WC7lM88Wbu7ANwOkiIGsFmv bYwQ== X-Gm-Message-State: AO0yUKVuLvuqUYffcBxIDrqRazrz6XZpP8nhHMwTUSQR+cJ9Ag2zQIM/ RhGz6eXgRQPgml0vjPjRy+lO9CH29+UupUQA X-Received: by 2002:adf:de8d:0:b0:2c5:4c64:d35b with SMTP id w13-20020adfde8d000000b002c54c64d35bmr5781611wrl.15.1676242069025; Sun, 12 Feb 2023 14:47:49 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id v18-20020a05600c445200b003de77597f16sm13141561wmn.21.2023.02.12.14.47.48 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 14:47:48 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, "Gonglei (Arei)" , Eduardo Habkost , Laurent Vivier , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Dani?= =?utf-8?q?el_P=2E_Berrang=C3=A9?= Subject: [PATCH 3/4] hw: Use qdev_get_parent_bus() in qdev_get_own_fw_dev_path_from_handler() Date: Sun, 12 Feb 2023 23:47:29 +0100 Message-Id: <20230212224730.51438-4-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230212224730.51438-1-philmd@linaro.org> References: <20230212224730.51438-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=philmd@linaro.org; helo=mail-wr1-x436.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 No need to pass 'dev' and 'dev->parent_bus' when we can retrieve 'parent_bus' with qdev_get_parent_bus(). Signed-off-by: Philippe Mathieu-Daudé --- hw/core/qdev-fw.c | 9 +++++---- include/hw/qdev-core.h | 2 +- softmmu/bootdevice.c | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/hw/core/qdev-fw.c b/hw/core/qdev-fw.c index a31958355f..c2df1f4796 100644 --- a/hw/core/qdev-fw.c +++ b/hw/core/qdev-fw.c @@ -41,9 +41,10 @@ static char *bus_get_fw_dev_path(BusState *bus, DeviceState *dev) return NULL; } -static char *qdev_get_fw_dev_path_from_handler(BusState *bus, DeviceState *dev) +static char *qdev_get_fw_dev_path_from_handler(DeviceState *dev) { Object *obj = OBJECT(dev); + BusState *bus = qdev_get_parent_bus(dev); char *d = NULL; while (!d && obj->parent) { @@ -53,11 +54,11 @@ static char *qdev_get_fw_dev_path_from_handler(BusState *bus, DeviceState *dev) return d; } -char *qdev_get_own_fw_dev_path_from_handler(BusState *bus, DeviceState *dev) +char *qdev_get_own_fw_dev_path_from_handler(DeviceState *dev) { Object *obj = OBJECT(dev); - return fw_path_provider_try_get_dev_path(obj, bus, dev); + return fw_path_provider_try_get_dev_path(obj, qdev_get_parent_bus(dev), dev); } static int qdev_get_fw_dev_path_helper(DeviceState *dev, char *p, int size) @@ -67,7 +68,7 @@ static int qdev_get_fw_dev_path_helper(DeviceState *dev, char *p, int size) if (dev && dev->parent_bus) { char *d; l = qdev_get_fw_dev_path_helper(dev->parent_bus->parent, p, size); - d = qdev_get_fw_dev_path_from_handler(dev->parent_bus, dev); + d = qdev_get_fw_dev_path_from_handler(dev); if (!d) { d = bus_get_fw_dev_path(dev->parent_bus, dev); } diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index f5b3b2f89a..93718be156 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -774,7 +774,7 @@ bool bus_is_in_reset(BusState *bus); BusState *sysbus_get_default(void); char *qdev_get_fw_dev_path(DeviceState *dev); -char *qdev_get_own_fw_dev_path_from_handler(BusState *bus, DeviceState *dev); +char *qdev_get_own_fw_dev_path_from_handler(DeviceState *dev); void device_class_set_props(DeviceClass *dc, Property *props); diff --git a/softmmu/bootdevice.c b/softmmu/bootdevice.c index 2106f1026f..7834bf3333 100644 --- a/softmmu/bootdevice.c +++ b/softmmu/bootdevice.c @@ -214,7 +214,7 @@ static char *get_boot_device_path(DeviceState *dev, bool ignore_suffixes, if (!ignore_suffixes) { if (dev) { - d = qdev_get_own_fw_dev_path_from_handler(dev->parent_bus, dev); + d = qdev_get_own_fw_dev_path_from_handler(dev); if (d) { assert(!suffix); s = d;