From patchwork Mon Feb 13 07:04:22 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: 653166 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2265637wrr; Sun, 12 Feb 2023 23:07:20 -0800 (PST) X-Google-Smtp-Source: AK7set9NnoqzO9ZMRbE2abuO+MeBZ+HskqHOzMTsPjvFIjpzMtG8URLECB8SF2+7pFaiHtKL0oWv X-Received: by 2002:ad4:5bac:0:b0:56b:f061:c3c6 with SMTP id 12-20020ad45bac000000b0056bf061c3c6mr43993330qvq.33.1676272039975; Sun, 12 Feb 2023 23:07:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676272039; cv=none; d=google.com; s=arc-20160816; b=nReuQ9q/+j8KRl0sW6goyMXe09yr8x4K/sbjbxGYBZUVt8pWMF4utXiKx2gCZahkdU njO39uJloBgX2Myf3WPykLsi6TitYly8a8I+ErtYqFomk5SkU7j72bDTgfHoR/X2QJBm HEXOadZ4KfcbymfyixlttswF7lky93JJN2RhDfG4s3qfdquBJHQOjg7+ee73ErHhve/2 H3jSNIy6GPnLgD+i/D3MUe3BIw6Vk4nWvfg+JlkNpPJt/tH8XKxE/I7zwh/7Hss7pin7 NHYEUg+7C0KM9fGLjoivtNqAiu6VlLijuIv6IM7G5zDGW2h1HXiUBasnT9YG97Abzs23 LFDg== 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=udir6j5wcZcCf1vpbZtNE32xpqiqWVEkYnRh+/rPhvWVSPq3D5ojCeA/0b4EcPuEBp 10qLk4gdn7o5xdfURRu6TytvGODOn/PAGFFN0m6IQYLc3URKCZRSqYc1Yn2+oVAtzdWm M4d/mJ7DFOuR3MzEeRZYTaXqp9L899nI95oAQurWZTHZjgVvxhtcFvsJ52SCvs50gkQ9 DrZCT/R+3pKXdIyfkBvmeUY0vwutchVSNx5FmOoDfjpRkSYZhAJNbHeRSGYJOODlCX8E ZaY/yf8eL9Gq+z7BOMuLWWumDRLJy0alF7HG3DpgpXpFcjQluKVhyO0Hb3n0k8SyRmod lwfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bUUnjBSK; 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 l9-20020a0c9789000000b0056e8ecf84d0si7061771qvd.491.2023.02.12.23.07.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 23:07: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=bUUnjBSK; 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 1pRStl-00013J-Aa; Mon, 13 Feb 2023 02:05:13 -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 1pRSti-0000wV-To for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:05:11 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRStg-0000rN-FE for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:05:10 -0500 Received: by mail-wm1-x32a.google.com with SMTP id m16-20020a05600c3b1000b003dc4050c94aso8210627wms.4 for ; Sun, 12 Feb 2023 23:05:07 -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=bUUnjBSKzaRsrleogEo75EbxRP6nFkA33ZkVb0a9Mhmk9OZl3oym4PiEzotXZEHc8g HlxuIPXznNfvKKzfAlaGln5xNZ1W4zwcrp4PinxtlJvwdB8llWyCW245l/4gPRvDgchn lxRgt/SAk2lt0yC/vscwHXq36GauRbUuvTTh0JIA9fI3nsjsksPzG3YZp2C2t6GEfRpo qVCarLZDmIlRU3kqGADxrYqw33KoxWA0GOcrobdpDQq8U9Ni7slefMn7PB4lpHvOdu77 80oTXB6rH0HL1eRq09vgne9f5kouPqkfrz/xIbR13H7WreW+2XDQzBO4fgPiz3uKcPZJ 5RQw== 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=K0q7h/kwziHknKHADjbo/Vv0726+mo0lNuj8tD+AvjqAFVXEFs0VN1jU6ESCEdgUXS LUTFoC3mqJAxJulmlnP4u7cYsP572AOFyh6qtVHSAiWxZpvBrCADg92IhPAVGwrzkFJ6 VR86oLyHOTYs+lMYxWXVJTIf1L+j+PusYe0sO/pYBXLpKJ3XQbRHRGLcfnRXOKJBv0PL O6LyuV3AjaO3K/X5BoNriuUQzb1Qn0UqccReXtRj4FxDpI26NmwJ+S3to66dsDG5cr/n 1+wqEE+SfnJN7buY+3edoTeLDyrXp/iQpUuKGSSTjigsHWMLGvpWeY2r+UvfOeABRb2L cmRA== X-Gm-Message-State: AO0yUKU4OhgFsKZ+TvXkhozKJP7QMyRab01E3ASEkbOUjkz0uLOmutPx xGhQf+dgU2D1emB2Jpc02VmoXrGhRSPGOLK1 X-Received: by 2002:a05:600c:3c8a:b0:3df:efdc:6505 with SMTP id bg10-20020a05600c3c8a00b003dfefdc6505mr4712038wmb.0.1676271906790; Sun, 12 Feb 2023 23:05:06 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id s21-20020a1cf215000000b003e001119927sm15611430wmc.24.2023.02.12.23.05.05 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 23:05:06 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Eduardo Habkost Cc: Gonglei Arei , Li Qiang , Cao jin , Hu Tao , qemu-block@nongnu.org, qemu-ppc@nongnu.org, xiaoqiang zhao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= Subject: [PATCH v2 8/9] hw: Use qdev_get_parent_bus() in qdev_get_own_fw_dev_path_from_handler() Date: Mon, 13 Feb 2023 08:04:22 +0100 Message-Id: <20230213070423.76428-9-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230213070423.76428-1-philmd@linaro.org> References: <20230213070423.76428-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=philmd@linaro.org; helo=mail-wm1-x32a.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;