From patchwork Sun Feb 12 22:47:27 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: 652831 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2123376wrr; Sun, 12 Feb 2023 14:49:11 -0800 (PST) X-Google-Smtp-Source: AK7set8Y8ssi6Rr3vsBkSo2G+x+xeGWjwAtzi6x3xyLKxS57E+Iv9eMQBQue1SIEvkYPqnCmN/xR X-Received: by 2002:a05:622a:2d4:b0:3b8:6ca4:bb23 with SMTP id a20-20020a05622a02d400b003b86ca4bb23mr39974604qtx.15.1676242151645; Sun, 12 Feb 2023 14:49:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676242151; cv=none; d=google.com; s=arc-20160816; b=G61Qya45UXleu9mbepYc9gCyf9i8egPRr52WRMxVKTDpAKMNO1L5WE0/NAHAvRycZh bJHbBTH5twLBg9BxmGwGPgvHvwyyeNAqswFbt8v/ZTQlpmhiI6zT5aON/nBoXWDqeFJt XTnmCKIsCOmGOF3EwxgIJ9PjiNmPbcuT8iHoQkIgHDbiOxiLMg7Iw5jCkYXO5nCS62Ha gN6VLhek8OqgQpwkb1P1K/BStcj9qTjUlNJEE+NROClO4OQfYv5NZR00emYPnyJZzEyh ZRKdyIg4YAHYY70RZyByyEmJjn9ToqScca8UwdoTtJ2ylpEKxARIz9P+A9W26cZ+f7Xn Mk3w== 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=XKF2b7pEm6HyiNp404lQ+Vuu44DHRtt9tfJtec4bL+4=; b=e04mSy0mTzFNWJPKvWd+JucCZtKRY+73D2VdVqFgH8WT2n/9BMDFZN0oRzGZTfgUhV HpaPczib9nNpAGP8WEiZ7kZyrdWYLNsgtOcc9OIwH2ktrVmj6NrdgMWMpRBvHXkX/1Ez 0aJbJERKHigv3zGkBDMSjeZYqlPGLGqEceHNJ2h+ocaErnM8rQRFYGqhJXxsIeNrgQPH IEalUp0XSxUczj1tD+zeZFWzf+8QW2/kHtsLVOgfg8Wiv38sQFRHYMxTLqIW//T+TnqF FeH/s5qfLUDdltECmDb8WnW84wb+YUE/Q5GWn2KrF5qEunkmttgkYN/vvm7OQtRQ7CaU GKJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QJQhtvzx; 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 n9-20020a05622a11c900b003b68cf4ae53si8705204qtk.505.2023.02.12.14.49.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 14:49:11 -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=QJQhtvzx; 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 1pRL8I-0001Lx-5f; Sun, 12 Feb 2023 17:47:42 -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 1pRL8G-0001Lh-SI for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:47:40 -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 1pRL8F-0003Hw-CX for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:47:40 -0500 Received: by mail-wm1-x32a.google.com with SMTP id n33so1528880wms.0 for ; Sun, 12 Feb 2023 14:47:39 -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=XKF2b7pEm6HyiNp404lQ+Vuu44DHRtt9tfJtec4bL+4=; b=QJQhtvzxYRjF2+O2PHDmhkguSW4JY1s5NkcHw4pZ4WzebGxrwpRpgO/zqF0VGJztf3 uAeR1K9byj1Qng1ApxmHVgCPpWJ4kgwMAKBRGqA/Bx4JGet8T4PLeyxoWGyxswXLk7xK /L5F5HyuLgYpZtmY7r62mY7gMdbsknbBdRuI0Z3id7ZxI2wqoiFGpRob6kj8Rl2f5MP2 PjFzzEQA1VB1wHczXfzYrKq0CfV1J/8cayZMbkj1ajrf8f+UGCRjTEzj7XUkMdU+fYo/ H73u3p2u6jDO8txR5l8b/qWk/vajLlEFzrZNzTFQUWf82qgpe28Zj8I0JErlYMlg7ZhY 9lQA== 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=XKF2b7pEm6HyiNp404lQ+Vuu44DHRtt9tfJtec4bL+4=; b=DBb01OQKIunQOE7q+PeZOdLRQBE8cIpxGp6OS4DRLpINdEyDP+GNiYKGWzoKW+8RnM VFEhvYsTvFFevLBD12sJdBxFeo4mnAI9dcdw/u9WG/cgRC+EdpSm1Wz4ZTG2V0w2klSd nVCNCoPMeZ5TNXdyaY0z+4qSkiv2Excx14tguSV6o5oL2oQBpW66k6tDzszKeTL1ebd1 ez78U+iHZNyUq0JeACNs74Fso82Ar6QesjkHjbLyGz2Tbw0UuRHH+wa+J0YW7r45Fmm7 bkwPX5ytlrkQShdVaABi+LDkLLFTGpB1rzPoUXdNHUEv5W+bpf6JEY8coMUF3ywA5oUf 0LUA== X-Gm-Message-State: AO0yUKVqJZD52g/E5Khil9PptAAUri6UZExz0c62/5FchuzGWb1rGvDT lMI3sexWF/fmE56fE3L14pZLOcOL0DH+wCCw X-Received: by 2002:a05:600c:4485:b0:3e0:185:e93a with SMTP id e5-20020a05600c448500b003e00185e93amr17964854wmo.25.1676242057974; Sun, 12 Feb 2023 14:47:37 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id w23-20020a1cf617000000b003db1d9553e7sm15139526wmc.32.2023.02.12.14.47.36 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 14:47:37 -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 1/4] hw/qdev: Constify DeviceState* argument of qdev_get_parent_bus() Date: Sun, 12 Feb 2023 23:47:27 +0100 Message-Id: <20230212224730.51438-2-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::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 The structure is accessed read-only by qdev_get_parent_bus(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/core/qdev.c | 2 +- include/hw/qdev-core.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/core/qdev.c b/hw/core/qdev.c index d759c4602c..43d863b0c5 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -330,7 +330,7 @@ bool qdev_machine_modified(void) return qdev_hot_added || qdev_hot_removed; } -BusState *qdev_get_parent_bus(DeviceState *dev) +BusState *qdev_get_parent_bus(const DeviceState *dev) { return dev->parent_bus; } diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 35fddb19a6..f5b3b2f89a 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -715,7 +715,7 @@ static inline void qdev_init_gpio_in_named(DeviceState *dev, void qdev_pass_gpios(DeviceState *dev, DeviceState *container, const char *name); -BusState *qdev_get_parent_bus(DeviceState *dev); +BusState *qdev_get_parent_bus(const DeviceState *dev); /*** BUS API. ***/ From patchwork Sun Feb 12 22:47:28 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: 652829 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2123300wrr; Sun, 12 Feb 2023 14:48:50 -0800 (PST) X-Google-Smtp-Source: AK7set9rbL+4+gIOgaYjxEa6GrPCJiLpttTX2zO0EDmbpC9TGCfp7OepvsRq1wGR+TG/47wS67+d X-Received: by 2002:ad4:5ecf:0:b0:56e:a96b:a3a1 with SMTP id jm15-20020ad45ecf000000b0056ea96ba3a1mr6348529qvb.7.1676242130795; Sun, 12 Feb 2023 14:48:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676242130; cv=none; d=google.com; s=arc-20160816; b=DF1B0jJzjThH7KbDcwXqaZf2llFDMONraASq7m8/KvJxtyMM7qdivdPwQ4bngANCUh kLlykGi4WDqhuY0jxO4vp7lwrHQM9nig6kMddjtq9fFZcisr8Srk5wzaCnFF9+X56O7f P/6yNoBcjevKiGUT37c3lwP+AVpw7mGDBzzWLej/jpnFIJ0myki/NnycgnXBe5crl8JN 6cV6CEPQISgZTrZnzzgIQYQm1pDCqaWO3FNggyThQYZFxVhVR2+Z/40JHZrZfoBNn3se 4VqXYgdAYVqOnJu8csBjq0GIBQvKAhT0kTn3/yIfyqqcgc4KF0yyIO3HUS8i0EoW5Aqp tlyw== 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=0g+OKIY42HUqYw3UQ9cJG+AfIPwvafK4fS3QuXAucdQ=; b=wyNB7mNcIpIVMZlThn+iaUB1u6kruPHN8YgVSSZvfTlOC5nCfJ0PvxdlyWpBYz8gZO uLbOYH4yPW7AgKO1Bo7q4tdQxL8q8xLJglN4VY+x2SZCSpModBdvYXkqQ4aklDFrMjnG 4GdbSFT8bZVdd6tnOxwe1BCpzoE6wZRJFZNAA5fI99S4SRvwDAR1jWcvsfnWYEVbr2oZ AySR3wcs0nBTIK/5P2D591p7kTEOBGmOSWXsAZWD5+w8tfJmYghmSmcQMLNT1WCJS/iZ f1CtxFiQs/lOd3/g07ZDkbg3LZjX1aC7mkmMmfJ80Fv1I4jBIuoTju2T9yHsumH1IbxF oIvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=shXjCloI; 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 s13-20020a0ce30d000000b0056c124679e1si8840345qvl.553.2023.02.12.14.48.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 14:48:50 -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=shXjCloI; 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 1pRL8O-0001OL-Ui; Sun, 12 Feb 2023 17:47:48 -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 1pRL8N-0001Mb-BY for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:47:47 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRL8L-0003IM-Bp for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:47:47 -0500 Received: by mail-wm1-x333.google.com with SMTP id az4-20020a05600c600400b003dff767a1f1so7760702wmb.2 for ; Sun, 12 Feb 2023 14:47:45 -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=0g+OKIY42HUqYw3UQ9cJG+AfIPwvafK4fS3QuXAucdQ=; b=shXjCloISjiE+oHmYwgCh6KfYZbPp1ZyN2WMU3N56mqsYk5BwJN3uaci33/kWXNezY j8bwa4s7TH/62YFlnuhAMWcQu35MCI3iPyEUkBYDeZfjUC1aKtPJqeIIf0FKqlFR8FWN WpMpAJzyvoizWvIvcx2UgmvVpe5LIualcqNN4Tbat5P1xwZXJNVaoEXPuOpq/Getkssf +La+SHF1J22nVq526ontxrUgsX4ISKqCLpsFpla6xBsZMZPBWArPn+mfT2xjRtD+srrl PmY01Tg/+qN5WIenzX6uGBV520CNrYAL+gbCd/GOFnTZMZx6I7jTSpSLk/uf5/Vdftf4 j+qw== 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=0g+OKIY42HUqYw3UQ9cJG+AfIPwvafK4fS3QuXAucdQ=; b=RZsbqvFWftXvK+85OZ3f1Sb8NVXFDj0KGg35JtH47xTqfc3wej/ajLiWRmq5Ku9IuL mVTHOqjxRi5Wjrw8U7ujcAFpDj7mxwM8LpEPQBwgk/GdbRppg3773935FkSq1A+jLvo3 c5TD0GnVPCcoBuhof1BCFy92K4r1LFcpeFXlEQ4WHYfkf1yJWef1FH7BSeFZ6/LWOY9h VTqeHjZu/QShlU2CrSL8tzxSo7TleK8UgeHxcA76xXycF5BE95tRWpsvSi0t57Uwbd0u G9FZyvt0hw4QIgUdE9WX6qSlj/wH4druk2tfRrElFE3asr46uORvTFcMGFr7MxAsfrt/ zBBg== X-Gm-Message-State: AO0yUKUOWKqbb8oZaZQxzLFf4myQodtEQRwKRBFQLZ2/+xlOU0XxSfGV xTBDc3quZExz2vsi+dfjkKOvDMVaxIn/PpSQ X-Received: by 2002:a05:600c:490a:b0:3dc:433a:e952 with SMTP id f10-20020a05600c490a00b003dc433ae952mr17301775wmp.33.1676242063879; Sun, 12 Feb 2023 14:47:43 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id f24-20020a05600c491800b003dc0cb5e3f1sm11393219wmp.46.2023.02.12.14.47.42 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 14:47:43 -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?= , Gerd Hoffmann , John Snow , Kevin Wolf , Hanna Reitz , "Michael S. Tsirkin" , Jason Wang , Marcel Apfelbaum , Fam Zheng Subject: [PATCH 2/4] hw: Replace dev->parent_bus by qdev_get_parent_bus(dev) Date: Sun, 12 Feb 2023 23:47:28 +0100 Message-Id: <20230212224730.51438-3-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::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.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 DeviceState::parent_bus is an internal field and should be accessed by the qdev_get_parent_bus() helper. Replace all uses in hw/ except the QDev uses in hw/core/. Signed-off-by: Philippe Mathieu-Daudé Acked-by: Richard Henderson --- hw/audio/intel-hda.c | 2 +- hw/block/fdc.c | 2 +- hw/block/swim.c | 2 +- hw/ide/qdev.c | 4 ++-- hw/net/virtio-net.c | 2 +- hw/pci-bridge/pci_expander_bridge.c | 2 +- hw/scsi/scsi-bus.c | 2 +- hw/usb/bus.c | 2 +- hw/usb/desc.c | 2 +- hw/usb/dev-smartcard-reader.c | 16 ++++++++-------- 10 files changed, 18 insertions(+), 18 deletions(-) diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c index b9ed231fe8..6bc239a981 100644 --- a/hw/audio/intel-hda.c +++ b/hw/audio/intel-hda.c @@ -59,7 +59,7 @@ void hda_codec_bus_init(DeviceState *dev, HDACodecBus *bus, size_t bus_size, static void hda_codec_dev_realize(DeviceState *qdev, Error **errp) { - HDACodecBus *bus = HDA_BUS(qdev->parent_bus); + HDACodecBus *bus = HDA_BUS(qdev_get_parent_bus(qdev)); HDACodecDevice *dev = HDA_CODEC_DEVICE(qdev); HDACodecDeviceClass *cdc = HDA_CODEC_DEVICE_GET_CLASS(dev); diff --git a/hw/block/fdc.c b/hw/block/fdc.c index 64ae4a6899..31ad6f6ae0 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@ -466,7 +466,7 @@ static Property floppy_drive_properties[] = { static void floppy_drive_realize(DeviceState *qdev, Error **errp) { FloppyDrive *dev = FLOPPY_DRIVE(qdev); - FloppyBus *bus = FLOPPY_BUS(qdev->parent_bus); + FloppyBus *bus = FLOPPY_BUS(qdev_get_parent_bus(qdev)); FDrive *drive; bool read_only; int ret; diff --git a/hw/block/swim.c b/hw/block/swim.c index 333da08ce0..64e30e9e80 100644 --- a/hw/block/swim.c +++ b/hw/block/swim.c @@ -157,7 +157,7 @@ static Property swim_drive_properties[] = { static void swim_drive_realize(DeviceState *qdev, Error **errp) { SWIMDrive *dev = SWIM_DRIVE(qdev); - SWIMBus *bus = SWIM_BUS(qdev->parent_bus); + SWIMBus *bus = SWIM_BUS(qdev_get_parent_bus(qdev)); FDrive *drive; int ret; diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index 6f6c7462f3..96582ce49b 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -81,7 +81,7 @@ static char *idebus_get_fw_dev_path(DeviceState *dev) char path[30]; snprintf(path, sizeof(path), "%s@%x", qdev_fw_name(dev), - ((IDEBus*)dev->parent_bus)->bus_id); + ((IDEBus*)qdev_get_parent_bus(dev))->bus_id); return g_strdup(path); } @@ -90,7 +90,7 @@ static void ide_qdev_realize(DeviceState *qdev, Error **errp) { IDEDevice *dev = IDE_DEVICE(qdev); IDEDeviceClass *dc = IDE_DEVICE_GET_CLASS(dev); - IDEBus *bus = DO_UPCAST(IDEBus, qbus, qdev->parent_bus); + IDEBus *bus = DO_UPCAST(IDEBus, qbus, qdev_get_parent_bus(qdev)); if (dev->unit == -1) { dev->unit = bus->master ? 1 : 0; diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 3ae909041a..8bc160ab59 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -3423,7 +3423,7 @@ static bool failover_replug_primary(VirtIONet *n, DeviceState *dev, if (!pdev->partially_hotplugged) { return true; } - primary_bus = dev->parent_bus; + primary_bus = qdev_get_parent_bus(dev); if (!primary_bus) { error_setg(errp, "virtio_net: couldn't find primary bus"); return false; diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expander_bridge.c index e752a21292..8c0649c071 100644 --- a/hw/pci-bridge/pci_expander_bridge.c +++ b/hw/pci-bridge/pci_expander_bridge.c @@ -151,7 +151,7 @@ static char *pxb_host_ofw_unit_address(const SysBusDevice *dev) assert(position >= 0); pxb_dev_base = DEVICE(pxb_dev); - main_host = PCI_HOST_BRIDGE(pxb_dev_base->parent_bus->parent); + main_host = PCI_HOST_BRIDGE(qdev_get_parent_bus(pxb_dev_base)->parent); main_host_sbd = SYS_BUS_DEVICE(main_host); if (main_host_sbd->num_mmio > 0) { diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index ceceafb2cd..3127cd7273 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -1671,7 +1671,7 @@ void scsi_device_purge_requests(SCSIDevice *sdev, SCSISense sense) static char *scsibus_get_dev_path(DeviceState *dev) { SCSIDevice *d = SCSI_DEVICE(dev); - DeviceState *hba = dev->parent_bus->parent; + DeviceState *hba = qdev_get_parent_bus(dev)->parent; char *id; char *path; diff --git a/hw/usb/bus.c b/hw/usb/bus.c index 92d6ed5626..d7c3c71435 100644 --- a/hw/usb/bus.c +++ b/hw/usb/bus.c @@ -595,7 +595,7 @@ static void usb_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent) static char *usb_get_dev_path(DeviceState *qdev) { USBDevice *dev = USB_DEVICE(qdev); - DeviceState *hcd = qdev->parent_bus->parent; + DeviceState *hcd = qdev_get_parent_bus(qdev)->parent; char *id = qdev_get_dev_path(hcd); if (id) { diff --git a/hw/usb/desc.c b/hw/usb/desc.c index 7f6cc2f99b..2646515e26 100644 --- a/hw/usb/desc.c +++ b/hw/usb/desc.c @@ -553,7 +553,7 @@ void usb_desc_set_string(USBDevice *dev, uint8_t index, const char *str) */ void usb_desc_create_serial(USBDevice *dev) { - DeviceState *hcd = dev->qdev.parent_bus->parent; + DeviceState *hcd = qdev_get_parent_bus(DEVICE(dev))->parent; const USBDesc *desc = usb_device_get_usb_desc(dev); int index = desc->id.iSerialNumber; char *path, *serial; diff --git a/hw/usb/dev-smartcard-reader.c b/hw/usb/dev-smartcard-reader.c index 28164d89be..5e94b4f64a 100644 --- a/hw/usb/dev-smartcard-reader.c +++ b/hw/usb/dev-smartcard-reader.c @@ -1187,7 +1187,7 @@ void ccid_card_send_apdu_to_guest(CCIDCardState *card, uint8_t *apdu, uint32_t len) { DeviceState *qdev = DEVICE(card); - USBDevice *dev = USB_DEVICE(qdev->parent_bus->parent); + USBDevice *dev = USB_DEVICE(qdev_get_parent_bus(qdev)->parent); USBCCIDState *s = USB_CCID_DEV(dev); Answer *answer; @@ -1210,7 +1210,7 @@ void ccid_card_send_apdu_to_guest(CCIDCardState *card, void ccid_card_card_removed(CCIDCardState *card) { DeviceState *qdev = DEVICE(card); - USBDevice *dev = USB_DEVICE(qdev->parent_bus->parent); + USBDevice *dev = USB_DEVICE(qdev_get_parent_bus(qdev)->parent); USBCCIDState *s = USB_CCID_DEV(dev); ccid_on_slot_change(s, false); @@ -1221,7 +1221,7 @@ void ccid_card_card_removed(CCIDCardState *card) int ccid_card_ccid_attach(CCIDCardState *card) { DeviceState *qdev = DEVICE(card); - USBDevice *dev = USB_DEVICE(qdev->parent_bus->parent); + USBDevice *dev = USB_DEVICE(qdev_get_parent_bus(qdev)->parent); USBCCIDState *s = USB_CCID_DEV(dev); DPRINTF(s, 1, "CCID Attach\n"); @@ -1231,7 +1231,7 @@ int ccid_card_ccid_attach(CCIDCardState *card) void ccid_card_ccid_detach(CCIDCardState *card) { DeviceState *qdev = DEVICE(card); - USBDevice *dev = USB_DEVICE(qdev->parent_bus->parent); + USBDevice *dev = USB_DEVICE(qdev_get_parent_bus(qdev)->parent); USBCCIDState *s = USB_CCID_DEV(dev); DPRINTF(s, 1, "CCID Detach\n"); @@ -1244,7 +1244,7 @@ void ccid_card_ccid_detach(CCIDCardState *card) void ccid_card_card_error(CCIDCardState *card, uint64_t error) { DeviceState *qdev = DEVICE(card); - USBDevice *dev = USB_DEVICE(qdev->parent_bus->parent); + USBDevice *dev = USB_DEVICE(qdev_get_parent_bus(qdev)->parent); USBCCIDState *s = USB_CCID_DEV(dev); s->bmCommandStatus = COMMAND_STATUS_FAILED; @@ -1263,7 +1263,7 @@ void ccid_card_card_error(CCIDCardState *card, uint64_t error) void ccid_card_card_inserted(CCIDCardState *card) { DeviceState *qdev = DEVICE(card); - USBDevice *dev = USB_DEVICE(qdev->parent_bus->parent); + USBDevice *dev = USB_DEVICE(qdev_get_parent_bus(qdev)->parent); USBCCIDState *s = USB_CCID_DEV(dev); s->bmCommandStatus = COMMAND_STATUS_NO_ERROR; @@ -1275,7 +1275,7 @@ static void ccid_card_unrealize(DeviceState *qdev) { CCIDCardState *card = CCID_CARD(qdev); CCIDCardClass *cc = CCID_CARD_GET_CLASS(card); - USBDevice *dev = USB_DEVICE(qdev->parent_bus->parent); + USBDevice *dev = USB_DEVICE(qdev_get_parent_bus(qdev)->parent); USBCCIDState *s = USB_CCID_DEV(dev); if (ccid_card_inserted(s)) { @@ -1291,7 +1291,7 @@ static void ccid_card_realize(DeviceState *qdev, Error **errp) { CCIDCardState *card = CCID_CARD(qdev); CCIDCardClass *cc = CCID_CARD_GET_CLASS(card); - USBDevice *dev = USB_DEVICE(qdev->parent_bus->parent); + USBDevice *dev = USB_DEVICE(qdev_get_parent_bus(qdev)->parent); USBCCIDState *s = USB_CCID_DEV(dev); Error *local_err = NULL; 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; From patchwork Sun Feb 12 22:47:30 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: 652830 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2123351wrr; Sun, 12 Feb 2023 14:49:04 -0800 (PST) X-Google-Smtp-Source: AK7set+49kpCiugwgd5jWdWKr6NFppbvM9He2F2sGbpPNCQQA/fgC1sfkVwnH8zwcPUAnDE1chji X-Received: by 2002:a05:622a:208:b0:3b6:334b:2cbc with SMTP id b8-20020a05622a020800b003b6334b2cbcmr38417369qtx.65.1676242144767; Sun, 12 Feb 2023 14:49:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676242144; cv=none; d=google.com; s=arc-20160816; b=tPs4SrjlolHKOG8014R3o3szZo6RSmZn80RVFNDAWrlL0LFl5CyIVx8F12LvlA9XTP tPAOA4KOII1u+e2FRyhEIKcKhgp00ToGmcewOjWreDhmzM2RZlWdyhInDQV0O6s/k9rU uBx86OfAFAQHGEHzoLtWcWESoXyMCrZXRHRukLu69MC2T6/3EH3us0tQQqlmEsPM+WSq jGqqZBRoHX/kttOBHdRjqsaJyYso3rMWbXrRiCYHM3E4flkNYe77fiB41MEwh65rtKfM B5LdVxSDSEywSTFr0BFSUM3dWBmlPuhpED5LxwwbZ9MptiZLnTAHlUfwe9qFbnBD2FxU cErg== 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=md/V7qS9+MXg+4Y+2ycjl2bad9V4Bp92Z+1RWOwRBno=; b=Qt2YkzwYr4CuRV1RUpO5AOgHyW/9PMRakSt5/qRRY0Oxullw2dwLtGWt6UwP+/lQJw D7hP4DT+n26rq18eGgwYq6O+HZ+Q/vc36/6Fil2sCgvKOfV71cPQnqQwOLum8ZIMPC/C MGkVIEngRdS0QkbTAGoKUUB1RfJUo+XMwMiZCaUBSPRMiyFI0CBVLsJ+O53C5/S9AgQh oLTmKhutDKmDty2dhie7ZRFHoX5Eq2OZKULtcKbSGaBZfuPMe93ah8FyGuRvdjjx8nmI v/YX50IyFrjBl3VwElq0x1OFZ2JKPI8YZlbX+S4ekhl1Wyif6RRCKoWtd/1i2U0ectSJ i+6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OmzXMfDg; 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 x11-20020a05622a000b00b003b62c3eb9b1si8348566qtw.572.2023.02.12.14.49.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 14:49:04 -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=OmzXMfDg; 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 1pRL8Y-0001QG-E8; Sun, 12 Feb 2023 17:47:58 -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 1pRL8X-0001Q0-9u for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:47:57 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRL8V-0003KT-Pl for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:47:57 -0500 Received: by mail-wr1-x430.google.com with SMTP id by3so9129073wrb.10 for ; Sun, 12 Feb 2023 14:47:55 -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=md/V7qS9+MXg+4Y+2ycjl2bad9V4Bp92Z+1RWOwRBno=; b=OmzXMfDgenPT28XW7WDtCqaEJT9TIi+Yf3WHmkumz2tKR51kiVSQJwICEJK9FTEI+J wOu2GaoZjIu6LXvRWAckPelm4z6jGGTDcNzYpVVEfrUJfiDLT3JhBsBhcvuidoqzv0vN 25P9jsAudYtqqGlgn/bBNj86Hlm9FcKvXPpNnWG13aW1W8ytgOyEkmU84tzesRvYHonn 3WVzOE/tTmg9yAwEMjeqSFInNh81twqd7qP8rLFugpRSpyflb5GqY8xLs8+qxq55XYz7 f/42x7sWFUSrcTBk+DUvn3q15wM1tN8YAJRO0wVz01XU6Y4iukyez39BcSgd9LRcyFP7 g3tQ== 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=md/V7qS9+MXg+4Y+2ycjl2bad9V4Bp92Z+1RWOwRBno=; b=7VbtpfzXEFRxabOiDu7rmiBtKaq2LyG7W70zhz0P9UcneeqC9cAxtXhU38LCdq+08g Y5SWIj6fS3qwmGQSWUseMMWJFAIiuljIlSdh0eoUTpkBN7Y5M7KFbVVap6SXVMHxhklH okJZy0nfH/7pmO2ejAgyZhOaR0T/dW49DVlQ+cNOP13QHveY7G+CO10jyBu/FGHOxcbr E2sn11oz1Cn6IFUiRgdWzEWh7GucKbP9fRftfWMbKLrUnKuf7qWXfow4L7cX8SaRe105 hBLHDnB6Mn18dlYtisynkrIUfbdAfe2Mhl+7/dMw1VOtHVHm9D2wptkLlMIn3exbdKPL Ujlg== X-Gm-Message-State: AO0yUKXiGPth9TIJwnoRgdjC3jEHNqVmijoKRr3x+3MMnKkc+l3Jw7ds 8t6XLpC6zfZEyFnnSM43tgI7nL+KXpffjMVX X-Received: by 2002:a5d:4090:0:b0:2c5:5933:1752 with SMTP id o16-20020a5d4090000000b002c559331752mr897799wrp.52.1676242074157; Sun, 12 Feb 2023 14:47:54 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id b5-20020a5d4d85000000b002c54b0e1405sm6624600wru.88.2023.02.12.14.47.53 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 14:47:53 -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 4/4] qdev-monitor: Use qdev_get_parent_bus() in bus_print_dev() Date: Sun, 12 Feb 2023 23:47:30 +0100 Message-Id: <20230212224730.51438-5-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::430; envelope-from=philmd@linaro.org; helo=mail-wr1-x430.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é Reviewed-by: Richard Henderson --- softmmu/qdev-monitor.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c index 820e7f52ad..12e4899f0d 100644 --- a/softmmu/qdev-monitor.c +++ b/softmmu/qdev-monitor.c @@ -770,9 +770,9 @@ static void qdev_print_props(Monitor *mon, DeviceState *dev, Property *props, } } -static void bus_print_dev(BusState *bus, Monitor *mon, DeviceState *dev, int indent) +static void bus_print_dev(Monitor *mon, DeviceState *dev, int indent) { - BusClass *bc = BUS_GET_CLASS(bus); + BusClass *bc = BUS_GET_CLASS(qdev_get_parent_bus(dev)); if (bc->print_dev) { bc->print_dev(mon, dev, indent); @@ -811,7 +811,7 @@ static void qdev_print(Monitor *mon, DeviceState *dev, int indent) qdev_print_props(mon, dev, DEVICE_CLASS(class)->props_, indent); class = object_class_get_parent(class); } while (class != object_class_by_name(TYPE_DEVICE)); - bus_print_dev(dev->parent_bus, mon, dev, indent); + bus_print_dev(mon, dev, indent); QLIST_FOREACH(child, &dev->child_bus, sibling) { qbus_print(mon, child, indent); }