From patchwork Mon Feb 13 07:08:02 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: 653168 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2266028wrr; Sun, 12 Feb 2023 23:08:41 -0800 (PST) X-Google-Smtp-Source: AK7set+6hm1MhfoVRAU+qmCuc49Boc49kyQq1WiyhH7gBD5zTscPzXzIBKPeerqw5A9mJF22ahGN X-Received: by 2002:ac8:7d43:0:b0:3b9:b70c:9697 with SMTP id h3-20020ac87d43000000b003b9b70c9697mr36475680qtb.5.1676272120935; Sun, 12 Feb 2023 23:08:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676272120; cv=none; d=google.com; s=arc-20160816; b=jcdZxq2rWjV/FZpS2Ee2vQdaa6bVxZC/gafo/bGkOLpNQ3md4FSTUm+N4w8YsT3D9a NEj+JwupZ7HsypEsLO9m1wERWZcluZjDDXGOaaqtM63XaQH7xX0Gxh+jGisCaN5mLxHr g3JN+fQG8hlsbaMt67t92Mp8tnWB5SUtaOK0ZhR0d+m6EZ+mvp4Lr7nFvNdpE5eVZvmm Xp5Mprz2GkB8jBUmq2EueZsYCzv5dfSBuaN9DHvExddAwsppzNnd31c5CnBQbxjPrqRj 30fBNbUiQS32+c7acBE/usCLsg545gYOlC4MxzlHOkZr46lrNV89SBlwDZgpkfKBVN1X jk8g== 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=Nx8Xgm2tW9Gq4Bio8ruD+Zbqqbx7fjg7obd5raLzp9c=; b=CiBOLGYfZaXx35tkEf4nEeuLIo3DdUT/ObxCPBchIZ+yAtq0kr7dpZobTdaiJC/cGH F4Rd8eERhltDrNyzzHqGv1OqxBUkKopxlzx4S3ckQ5QzkHWEaAvOE0et1QcEP/WFM+Ah 8R8h8d0kK/zbRObgaw/0F6bd9q93V+duX2SzSKO9c55V15oa8zjWRg3e+LL91DeQJROi hYyyx5SMdMzwjI8u+puG4QCyrCLrXFG3OhlZVMtcFNiToU2EHRSLChOJ5FOg5q8yzfU4 zTIOJv2kAKnKlPpuAR9F3zxmwRV8pk8gBVQtLETgT/Fye69MTp1k99Abe5V6UnwLefKQ Fmig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mQmWMD6n; 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 y77-20020a376450000000b006ff11725074si8048586qkb.328.2023.02.12.23.08.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 23:08:40 -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=mQmWMD6n; 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 1pRSwy-0000Fx-Jr; Mon, 13 Feb 2023 02:08:32 -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 1pRSww-0000Cd-81 for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:08:30 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRSwu-0001jR-FX for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:08:29 -0500 Received: by mail-wm1-x329.google.com with SMTP id z13so8014047wmp.2 for ; Sun, 12 Feb 2023 23:08:28 -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=Nx8Xgm2tW9Gq4Bio8ruD+Zbqqbx7fjg7obd5raLzp9c=; b=mQmWMD6nLEGl+tqcC2mzyPGVismArp6f8JBrlVjmZWjwKkvX6bdJpH0gHuocV8Bro6 YgfZOec60Wmm/TFIQ7rALZTa0dsYQsUWK0A8h7rDxQtYNVbRMBv84DaMfwUo8obAc7oJ mk1D/uHS7cy8VkVDayZ1UPbjlWOFwXKHG3uEdqSyy9kZ9TmPFXW/vwGX1pClILc63loW +N+yTL6AcrmhM/hLuDxH4J+QglS0FQcCyZ1NWjVnI8YAMmL7mSiIuV+wNRjGi1XqOBG2 KFhUBpUJ2VaGjW3IpzFeVJgb7kyXllV0yv3IZ+2IRvbt+krjZQYqKZNEKp6J/OtfPcDc mgPw== 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=Nx8Xgm2tW9Gq4Bio8ruD+Zbqqbx7fjg7obd5raLzp9c=; b=K1u4vKslnQnRfvjyVDUYXg8dbIa6PXec4T4K1vv/lWSByFKbnt0A721AizbePNo6Il qBwulK/Uob3aPw3VTzmYMgi/5/FXjx5tvs3H1d4wfeQ8zL0PlUcBWiURlskdN11VIPpF 5w/0zX5chlzsUQfdg63EYo4aL8MTsae1KMkr6cr2kZGY+odQdcVPH3CKGGIUWjiERSj+ zasKZQtJa3o6p0COmSIlHQCprvGqT/79XXqTDdwGUBu6FrPfvBHQvMIIsl6UXbWX4XB6 OKweyYM+pQLDnMjuzN5y95/f4M5syitgNJNieAD6fSyfc47YKr3iyceMz2qfHwrpobtu 5bEQ== X-Gm-Message-State: AO0yUKUno931Oqq3vh7DSBmRdmSkpq1UnM9Wx3CAS9vXPKHdd3z7eoEz ZDcaOj2HvVS6FWjz2LEvNFZ04MUv1sA21WdW X-Received: by 2002:a05:600c:4b1b:b0:3dc:53da:328b with SMTP id i27-20020a05600c4b1b00b003dc53da328bmr21988012wmp.14.1676272107534; Sun, 12 Feb 2023 23:08:27 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id bd6-20020a05600c1f0600b003e0015c8618sm16346624wmb.6.2023.02.12.23.08.26 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 23:08:27 -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?= , "Michael S. Tsirkin" , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PATCH v2 01/19] hw/char/serial-pci: Replace DO_UPCAST(PCISerialState) by PCI_SERIAL() Date: Mon, 13 Feb 2023 08:08:02 +0100 Message-Id: <20230213070820.76881-2-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::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.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=ham 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 Use the PCI_SERIAL() QOM type-checking macro to avoid DO_UPCAST(). Signed-off-by: Philippe Mathieu-Daudé --- hw/char/serial-pci.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hw/char/serial-pci.c b/hw/char/serial-pci.c index 801b769aba..9689645cac 100644 --- a/hw/char/serial-pci.c +++ b/hw/char/serial-pci.c @@ -36,7 +36,10 @@ #include "qom/object.h" struct PCISerialState { + /*< private >*/ PCIDevice dev; + /*< public >*/ + SerialState state; uint8_t prog_if; }; @@ -46,7 +49,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(PCISerialState, PCI_SERIAL) static void serial_pci_realize(PCIDevice *dev, Error **errp) { - PCISerialState *pci = DO_UPCAST(PCISerialState, dev, dev); + PCISerialState *pci = PCI_SERIAL(dev); SerialState *s = &pci->state; if (!qdev_realize(DEVICE(s), NULL, errp)) { @@ -63,7 +66,7 @@ static void serial_pci_realize(PCIDevice *dev, Error **errp) static void serial_pci_exit(PCIDevice *dev) { - PCISerialState *pci = DO_UPCAST(PCISerialState, dev, dev); + PCISerialState *pci = PCI_SERIAL(dev); SerialState *s = &pci->state; qdev_unrealize(DEVICE(s)); From patchwork Mon Feb 13 07:08:03 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: 653171 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2266235wrr; Sun, 12 Feb 2023 23:09:24 -0800 (PST) X-Google-Smtp-Source: AK7set+5dK8IqqKSKKSJ5PJoM9gToirpTcckg28onpqBDaKQzh0Fej97/HXK8oeuzreJUjMK4c7V X-Received: by 2002:ac8:5a4d:0:b0:3b6:2f31:efc4 with SMTP id o13-20020ac85a4d000000b003b62f31efc4mr42641485qta.66.1676272164417; Sun, 12 Feb 2023 23:09:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676272164; cv=none; d=google.com; s=arc-20160816; b=Nwfq5d2Sn3lGxuj5sFFEZikOuDdI3yF/q3HH6DCZO2oPLyliPYiSQA0q1ONQGUS1+2 1cjuXgMfeyuaFo1kytbLJVphVrrtqytvrxH8pw6+iXOQqanuNBoXtV6ZzYy2gXocygpl FFr0Zg8jAAr4+lf3iJR5ltamUFiMKuA/aLMDwGl7OvFNQXmgw79LVKHb8GFuZbLQj0rN 4X/+WSoPLh9V+qkggZOGyVcIxXFKtlnlayi+icefKHWSo4a4iwZuy1nUdGMng+PsDBds 0KzCiU6AIfud2YBYDSOOjJqVkvKX2P7Ec1xL3eTrNa6u/OD+GQx3HFslwZPphUwQTFf1 RvAA== 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=iJ+QRHFZYIqXqYbl7DIdWxHc+GN5ZGRCj3hAlbpC3f0=; b=d6EI+FkmH8AQwm9YzFuljK1srHwumd5gImeuBTP561zKXn8uPLO3nUMdvgA98rUkRm /Mv7n3VCCE8P3EcMopOIzEwSKIWVkfb2Wp/IRikL5e8mGxTbJN898fDRLTgidjb4myrv FXdQLdrUOg76BjoakaDJA9zlF5jDlMWFQCe3fhn7H9jfJKzqFgQU48XBe0r4Soy0Dpl0 DLLnriON5umiqf8OwzRLTp2elpEXs3DuEBkmN2wqoCzxQGgyo01TPqHTFr0AlvwXcl8D RzfX4Jd3T8UNMDAIuyyY7aopjv7GkowAkp8htHQx6gCYaX9xewqAeSwdSLBHlPtjnOH0 Dsqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=u3Gh+Iux; 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 s4-20020ac85cc4000000b003a546627acesi9430251qta.376.2023.02.12.23.09.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 23:09:24 -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=u3Gh+Iux; 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 1pRSx3-0000Hf-P9; Mon, 13 Feb 2023 02:08:37 -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 1pRSx2-0000HB-7X for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:08:36 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRSx0-0001lq-Ge for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:08:35 -0500 Received: by mail-wr1-x431.google.com with SMTP id k3so3422279wrv.5 for ; Sun, 12 Feb 2023 23:08:34 -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=iJ+QRHFZYIqXqYbl7DIdWxHc+GN5ZGRCj3hAlbpC3f0=; b=u3Gh+IuxjomrsTNOql+YKiEbzndy9U+yy1HbwkQSwGAJerXhhnqmcnTLwrjVlyRFab f7pJBbzQwm4nb01vIXEiKRvW1/D5lY3xYsvr7taAQ91BSFC74BVe5xaMa2u2YpPwImXO SaTEmLCNQtxK75TAUNvXxtTlmvjcPOXNODV9+CkieieCYTcn8qwm1mKvkMIH5S37w64Q /3mJIQmcBzTefPnXhvn7YN20G4kBOFfu9NPxvZcF/AKlVdr7/Thv3OX0olh4Ryhv1SDw RXIEw80tVZP+FJ6A2CQsu81kOSQMwuvgZWOpjvFXS2HsyO5iNsTE2B7zd76c3JCBa+js ROFg== 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=iJ+QRHFZYIqXqYbl7DIdWxHc+GN5ZGRCj3hAlbpC3f0=; b=ScgCj8cRYFmkq1CFC1oU3tpCp7+dEEPNHzDaJG8DnKr/R2f05qkUqFOWZxi03xoXkC V9Eh38VNA8jtx7ShzUO5YNTK2vGcNt+jEWRjb2k4LhVhbHTqmlRhE2aX2dBrV+HVVHM+ UqlEhRYVDuGMng5kbQj6APXFLJXaCFeSvP4x6bdwbt/y1/7LoAUAg2GFyVHSd42+n4q+ oyz3xse76vMxxb9TujUmTC6Vq4CgBoSh5coUtTYsB9W4CNbWV87+gPdlD18qs3a1Be8O RT67qyv0GaTxKJNGRNdymHcxEAbFaHft+XvKRVCWpnHrUs2qefc8Fyd9pK9CO3PMMasQ gqpg== X-Gm-Message-State: AO0yUKV90VzDjUufmuimwgTve7vTxzmk/Q7msEVfKvBL0wd3iny6pFYu 013WFBaN77oBrKbGjoUePTz6TpL11Yckswas X-Received: by 2002:a05:6000:1091:b0:2c3:e142:5fd0 with SMTP id y17-20020a056000109100b002c3e1425fd0mr21131243wrw.49.1676272112763; Sun, 12 Feb 2023 23:08:32 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id p3-20020adff203000000b002c3f6d7d5fesm9816027wro.44.2023.02.12.23.08.31 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 23:08:32 -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?= , "Michael S. Tsirkin" , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PATCH v2 02/19] hw/char/serial-pci-multi: Batch register types using DEFINE_TYPES macro Date: Mon, 13 Feb 2023 08:08:03 +0100 Message-Id: <20230213070820.76881-3-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::431; envelope-from=philmd@linaro.org; helo=mail-wr1-x431.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=ham 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 See rationale in commit 38b5d79b2e ("qom: add helper macro DEFINE_TYPES()"). Signed-off-by: Philippe Mathieu-Daudé --- hw/char/serial-pci-multi.c | 52 +++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 29 deletions(-) diff --git a/hw/char/serial-pci-multi.c b/hw/char/serial-pci-multi.c index f18b8dcce5..54768d3d53 100644 --- a/hw/char/serial-pci-multi.c +++ b/hw/char/serial-pci-multi.c @@ -189,34 +189,28 @@ static void multi_serial_init(Object *o) } } -static const TypeInfo multi_2x_serial_pci_info = { - .name = "pci-serial-2x", - .parent = TYPE_PCI_DEVICE, - .instance_size = sizeof(PCIMultiSerialState), - .instance_init = multi_serial_init, - .class_init = multi_2x_serial_pci_class_initfn, - .interfaces = (InterfaceInfo[]) { - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { }, - }, +static const TypeInfo multi_serial_pci_types[] = { + { + .name = "pci-serial-2x", + .parent = TYPE_PCI_DEVICE, + .instance_size = sizeof(PCIMultiSerialState), + .instance_init = multi_serial_init, + .class_init = multi_2x_serial_pci_class_initfn, + .interfaces = (InterfaceInfo[]) { + { INTERFACE_CONVENTIONAL_PCI_DEVICE }, + { }, + }, + }, { + .name = "pci-serial-4x", + .parent = TYPE_PCI_DEVICE, + .instance_size = sizeof(PCIMultiSerialState), + .instance_init = multi_serial_init, + .class_init = multi_4x_serial_pci_class_initfn, + .interfaces = (InterfaceInfo[]) { + { INTERFACE_CONVENTIONAL_PCI_DEVICE }, + { }, + }, + } }; -static const TypeInfo multi_4x_serial_pci_info = { - .name = "pci-serial-4x", - .parent = TYPE_PCI_DEVICE, - .instance_size = sizeof(PCIMultiSerialState), - .instance_init = multi_serial_init, - .class_init = multi_4x_serial_pci_class_initfn, - .interfaces = (InterfaceInfo[]) { - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { }, - }, -}; - -static void multi_serial_pci_register_types(void) -{ - type_register_static(&multi_2x_serial_pci_info); - type_register_static(&multi_4x_serial_pci_info); -} - -type_init(multi_serial_pci_register_types) +DEFINE_TYPES(multi_serial_pci_types) From patchwork Mon Feb 13 07:08:04 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: 653169 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2266090wrr; Sun, 12 Feb 2023 23:08:53 -0800 (PST) X-Google-Smtp-Source: AK7set9ICdAt+wsCXJqfNQ6AuxDTeB5kPh+Cuic48yLzM+l1qkUxu/ohJr5JxIBoVMZoMQ7ImQjz X-Received: by 2002:a05:622a:651:b0:3b6:3a7a:d3c8 with SMTP id a17-20020a05622a065100b003b63a7ad3c8mr37221035qtb.17.1676272133236; Sun, 12 Feb 2023 23:08:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676272133; cv=none; d=google.com; s=arc-20160816; b=uwGSibR8XL2Oa0PPckn9R7uJy8rwfmKttz+WHtZDM3LP5s6cpRegpqTg+j/u5XZOSO S9Yh9QLkKlW3agPUYtqIBahrSifprbPNAxrZIS3oebYUcno4Oi1AM4xdbg2cacy9qc2D y5uMOjVOyk19dc0prFsoKRh7cT2UIwiM++CNCIe5NNPCfGuatlXOjEp4IzMizVEQLWae 4AHmuzmoV3XCaeaaexJqoKXE9JvQT/MBRUt/+p0YAwjJTyWZXh61R2xtOzF+x+lFxISu TfnRzuYoUhk+mEq0DlZoZ8P3AiHSokA6CIMHJXjyV7+iwV90dgz4IBN5y0phtW+pqOOO MwDg== 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=HT2d2u/vjaA1vHLklOaaqzhfI86GF9Vdz9cSYHww3bI=; b=KoEftpCltd/436jbsCfBQPYaWZGdOc52uix1GP+YG53Yn2MBtUbyifjhwSpBmyj0R4 +rdDuxSV/NPcNqzPCYM1TqANVXZT+0Sa6PyKUJ92yVhyWm5n1mf16pnI11GbvEX9pnwx cB6/etFidvOXmy5R65axegjtkBEPqCFeWc4q4qWlYS0cqFWBGsBi6ESfMi1VvQFx5g/i frO6QRxjtiwZpoTVfuLdeorNoA+YNvS8r1gs2tDx5waqbrJ6O9mGXa6R8BPw4nZr2xvV D4+2Q380WRcWPyNyHF1i1zPtP9X9PZCFPxRM+EkfkPQxD7dnriQWa/2FoNI+RjUoAudh NhpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=APYH9iN5; 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 c5-20020ac80085000000b003b688677fc1si8036550qtg.732.2023.02.12.23.08.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 23:08:53 -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=APYH9iN5; 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 1pRSx9-0000OI-Ly; Mon, 13 Feb 2023 02:08:43 -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 1pRSx7-0000MA-N3 for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:08:41 -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 1pRSx5-0001mt-Ij for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:08:41 -0500 Received: by mail-wm1-x32a.google.com with SMTP id k8-20020a05600c1c8800b003dc57ea0dfeso10562826wms.0 for ; Sun, 12 Feb 2023 23:08: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=HT2d2u/vjaA1vHLklOaaqzhfI86GF9Vdz9cSYHww3bI=; b=APYH9iN5Yuli2RTervmm7poWJgfdpSWNr20Bc7I0/Ru50f4lng5oJTyPtYcpccs85O 6ZdRj2Qyh/oVsctPVYGy9W3OVyYfhOhwNaipyUXjuF2/RADbZRgSPy0OQxvF+ayJYeik FueHekoNAt9sLAhrA/ZbH3eTJ9hfNKohUjivB2P/8R5Av7u/LdtolUzuKR3rxsyi36bV X6tXwydt3wngsoqSyOuvgrxn+MKvcIj1UB0zGf6BOvhv5JwANJxzvfprcDOytVt4UUSw P4wTFkZUlkZN8TdWX1uMHexMJ6spjsnDXB/p2QC+3coe3Cmh17PYNNeo956/bEcj5qUH 6BCQ== 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=HT2d2u/vjaA1vHLklOaaqzhfI86GF9Vdz9cSYHww3bI=; b=SlAkOoxXyJrCAq3yQnxvHMfUQlYDQTJgmitAXlOBBJUej5jDxCYIbHArWhrX+JwDFc 5rQpO2oQv5WTAr9+lKIIO57MKWSQDr9dRUKbeKcnl2TF7akeRKX1ucCiuG85tl40or1k sympjuc/Atc+0Pxdp8k/zB+peH4yzF0zWr9UPDYDGe13nrzMV/al1/xPbI2jdirbYHG3 D2B3En5PDoIZ1BfG00fVVEDG6AY8IQeLT3Gk0+ABkaN1sgnGQNMYkJOV8FkYAqaZYxgh Va1d441gRXCsT3JIZT/kKIBFeOfYloL3PEEuw8QSfqj0GRTLZZITgByQHTQ5zycntqt5 LPfQ== X-Gm-Message-State: AO0yUKUmIoul6l++6ESeWP7d4nXT9LQG6Yov2vMgPyQssb7CYU3WZJYs nenUjDSnqoHrI/QDK0EcsPeadDXp5SpHBlxX X-Received: by 2002:a05:600c:2ac8:b0:3db:66e:cfdd with SMTP id t8-20020a05600c2ac800b003db066ecfddmr17990179wme.9.1676272118072; Sun, 12 Feb 2023 23:08:38 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id z4-20020a05600c220400b003dfe8c4c497sm16214893wml.39.2023.02.12.23.08.36 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 23:08:37 -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?= , "Michael S. Tsirkin" , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PATCH v2 03/19] hw/char/serial-pci-multi: Introduce PCI_MULTISERIAL QOM abstract parent Date: Mon, 13 Feb 2023 08:08:04 +0100 Message-Id: <20230213070820.76881-4-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::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 Introduce PCI_MULTISERIAL ("pci-serial"), QOM abstract parent of "pci-serial-2x" and "pci-serial-4x". Signed-off-by: Philippe Mathieu-Daudé --- hw/char/serial-pci-multi.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/hw/char/serial-pci-multi.c b/hw/char/serial-pci-multi.c index 54768d3d53..faeb0a9476 100644 --- a/hw/char/serial-pci-multi.c +++ b/hw/char/serial-pci-multi.c @@ -38,8 +38,15 @@ #define PCI_SERIAL_MAX_PORTS 4 -typedef struct PCIMultiSerialState { +#define TYPE_PCI_MULTISERIAL "pci-serial" + +OBJECT_DECLARE_SIMPLE_TYPE(PCIMultiSerialState, PCI_MULTISERIAL) + +struct PCIMultiSerialState { + /*< private >*/ PCIDevice dev; + /*< public >*/ + MemoryRegion iobar; uint32_t ports; char *name[PCI_SERIAL_MAX_PORTS]; @@ -47,7 +54,7 @@ typedef struct PCIMultiSerialState { uint32_t level[PCI_SERIAL_MAX_PORTS]; qemu_irq *irqs; uint8_t prog_if; -} PCIMultiSerialState; +}; static void multi_serial_pci_exit(PCIDevice *dev) { @@ -191,25 +198,23 @@ static void multi_serial_init(Object *o) static const TypeInfo multi_serial_pci_types[] = { { - .name = "pci-serial-2x", - .parent = TYPE_PCI_DEVICE, - .instance_size = sizeof(PCIMultiSerialState), - .instance_init = multi_serial_init, - .class_init = multi_2x_serial_pci_class_initfn, - .interfaces = (InterfaceInfo[]) { + .name = TYPE_PCI_MULTISERIAL, + .parent = TYPE_PCI_DEVICE, + .instance_size = sizeof(PCIMultiSerialState), + .instance_init = multi_serial_init, + .abstract = true, + .interfaces = (InterfaceInfo[]) { { INTERFACE_CONVENTIONAL_PCI_DEVICE }, { }, }, + }, { + .name = "pci-serial-2x", + .parent = TYPE_PCI_MULTISERIAL, + .class_init = multi_2x_serial_pci_class_initfn, }, { .name = "pci-serial-4x", - .parent = TYPE_PCI_DEVICE, - .instance_size = sizeof(PCIMultiSerialState), - .instance_init = multi_serial_init, + .parent = TYPE_PCI_MULTISERIAL, .class_init = multi_4x_serial_pci_class_initfn, - .interfaces = (InterfaceInfo[]) { - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { }, - }, } }; From patchwork Mon Feb 13 07:08:05 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: 653175 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2266437wrr; Sun, 12 Feb 2023 23:10:01 -0800 (PST) X-Google-Smtp-Source: AK7set9LU7Zleojw8WDzCVCPhQ2VVzAu7Vs5l4U66txETl7zoo1QvcIJRGbMp7tvSZAwFgHGW70U X-Received: by 2002:a05:6214:d43:b0:56e:a0eb:9b28 with SMTP id 3-20020a0562140d4300b0056ea0eb9b28mr13593173qvr.3.1676272201310; Sun, 12 Feb 2023 23:10:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676272201; cv=none; d=google.com; s=arc-20160816; b=yOsk+pWzz3ACRCUi6E95+WwlaGdPRJni8LANknglI5zv8iAkIR1QdP7AlTqywfDlI+ bW7gua//OgQbQ3WRmtvaDLtc+fZdK+MrHq7y1Y5T15GTfYYB38FwC/asHbfKi5PzCv42 J7+kFiXWv9Xz5/DVdYMXF/e7bTza9gF3vzSANewJ8ry34P5jS5OhkW4ACnC79mXRNe5F BYSuT9SGP2Q9dyqynhUyAYyEjvGnJ/KEcIISpJqHsaGyWtuE9dEiudUqfAl+yza1znok 6REdz1Orawm4g27Q3NVv8BuyXVD6TklSBXgt7MizJ3FPeb53TwbrrGrrY+UYnQFMTfFM geXA== 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=kdvTBIlDDxD/zp1XWppgssK6e1Eedl76M1G0yZJNLN8=; b=s+v86scKF8TQcEiH2usO4irqD1kAEyOuDdEh372hXvnT3OZ/Dcg2TDvhO3NwYY+sg3 M8BUFf0YtTrLPp2ZO/TboenTzT1LV5UWtEM7MKcKqGRya3dWg3lurxT6ynLiEc2rDOjm jjdVroZ74m442O6n/XHmnjtB3arT0I2dy6l9gIahfuJpsxqWuxMPaGCuNaT8lJQxo2nO bEIAQSj5Hz3RwMQ5mstLd47YEqDfcg18zCGgF9ooARpEkYByHPS9yIuCSyb75J0QBYdH D/1EiIW7+v3YG8snMPzwz2gYishFLP1qGyHXXtHRxLBqm7tJsduTn/sNQiGplbdFdrva +YpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="nz/6EonH"; 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 v2-20020a0ce1c2000000b0056ea9c2a139si2565843qvl.90.2023.02.12.23.10.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 23:10:01 -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="nz/6EonH"; 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 1pRSxD-0000PV-Fh; Mon, 13 Feb 2023 02:08:47 -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 1pRSxB-0000Ou-Rt for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:08:45 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRSxA-0001lq-6D for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:08:45 -0500 Received: by mail-wr1-x431.google.com with SMTP id k3so3422625wrv.5 for ; Sun, 12 Feb 2023 23:08:43 -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=kdvTBIlDDxD/zp1XWppgssK6e1Eedl76M1G0yZJNLN8=; b=nz/6EonH8MuEfjox7EOv7zUF+Fn4NI7c/Y7qQfyoJOjns0ZmhtE5loZOROmseqKbl0 fiQAVBAS0uyf6zGOZhXjKwvpXA2Z6nujpC0BkcRZhPgVim/Regy02xfktG6r9xiRTaB4 P0cfMJ67YG6UMGh+Tjcopdeo8byWqOHBApVe9piwtCD8UZ/bVrOCeuDzdlxvpieU4WO4 rOKU165f7qIinX8VbzK44cUC84z3sitWM0zsgL0vgB9vGRgD0QLfaDxMh6idc7G6sAym kpP95YW/Fc4bJ5i5q86DOmGssGWJIIrsn19KwrBaWQzVbFdncsp5kce/WE3K61MdiZlz g1Zw== 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=kdvTBIlDDxD/zp1XWppgssK6e1Eedl76M1G0yZJNLN8=; b=w2c5oNwbG4tjL/3kODzHwbItnDFF2k8DC5agYhTJ96MubetH6FsxIvxSLAKwf3vgaF EGN3e2yXcsPsjW/sXN4Bk5s28cDC2eeEqAZwr48XD0MsMjWhboWt3HBVbIIcaPUyqKNo 3sd6nkrRVccZCIFfbzW8J4HpqZPzWu/9s3nx6iy7kjqVmIhCos0xUWrmjQlBMl2YuIem aN1F9TevE8PbujBLyinhm0Al4yAwGBsXHKo8mU0TbbI/0EMAZiO5VOePqYbaipGrkb2H rQuhQxk1QOP6hFFmA34qg4lBOyVvWyXXcdeY7tYBQCFhCUW8f1KB67/HCkkURWli7AKY Tr8Q== X-Gm-Message-State: AO0yUKXFPvRhyqVI8Goquo8Iq42Hiy9e22cimS4nywgHN4J7rvKTSA2x akku+Eos6WQfXm7vaLB31o4wMWkqN1bV4jUK X-Received: by 2002:adf:f851:0:b0:2c5:598a:dd05 with SMTP id d17-20020adff851000000b002c5598add05mr1144701wrq.2.1676272123284; Sun, 12 Feb 2023 23:08:43 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id b5-20020a5d4d85000000b002c54b0e1405sm7287242wru.88.2023.02.12.23.08.42 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 23:08:42 -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?= , "Michael S. Tsirkin" , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PATCH v2 04/19] hw/char/serial-pci-multi: Factor multi_serial_class_initfn() out Date: Mon, 13 Feb 2023 08:08:05 +0100 Message-Id: <20230213070820.76881-5-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::431; envelope-from=philmd@linaro.org; helo=mail-wr1-x431.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=ham 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 Extract code common to multi_2x_serial_pci_class_initfn() and multi_4x_serial_pci_class_initfn() to multi_serial_class_initfn(). Signed-off-by: Philippe Mathieu-Daudé --- hw/char/serial-pci-multi.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/hw/char/serial-pci-multi.c b/hw/char/serial-pci-multi.c index faeb0a9476..cd5af24bd2 100644 --- a/hw/char/serial-pci-multi.c +++ b/hw/char/serial-pci-multi.c @@ -155,14 +155,14 @@ static Property multi_4x_serial_pci_properties[] = { DEFINE_PROP_END_OF_LIST(), }; -static void multi_2x_serial_pci_class_initfn(ObjectClass *klass, void *data) +static void multi_serial_class_initfn(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *pc = PCI_DEVICE_CLASS(klass); + pc->realize = multi_serial_pci_realize; pc->exit = multi_serial_pci_exit; pc->vendor_id = PCI_VENDOR_ID_REDHAT; - pc->device_id = PCI_DEVICE_ID_REDHAT_SERIAL2; pc->revision = 1; pc->class_id = PCI_CLASS_COMMUNICATION_SERIAL; dc->vmsd = &vmstate_pci_multi_serial; @@ -170,19 +170,22 @@ static void multi_2x_serial_pci_class_initfn(ObjectClass *klass, void *data) set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } +static void multi_2x_serial_pci_class_initfn(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + PCIDeviceClass *pc = PCI_DEVICE_CLASS(klass); + + pc->device_id = PCI_DEVICE_ID_REDHAT_SERIAL2; + device_class_set_props(dc, multi_2x_serial_pci_properties); +} + static void multi_4x_serial_pci_class_initfn(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *pc = PCI_DEVICE_CLASS(klass); - pc->realize = multi_serial_pci_realize; - pc->exit = multi_serial_pci_exit; - pc->vendor_id = PCI_VENDOR_ID_REDHAT; + pc->device_id = PCI_DEVICE_ID_REDHAT_SERIAL4; - pc->revision = 1; - pc->class_id = PCI_CLASS_COMMUNICATION_SERIAL; - dc->vmsd = &vmstate_pci_multi_serial; device_class_set_props(dc, multi_4x_serial_pci_properties); - set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } static void multi_serial_init(Object *o) @@ -202,6 +205,7 @@ static const TypeInfo multi_serial_pci_types[] = { .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(PCIMultiSerialState), .instance_init = multi_serial_init, + .class_init = multi_serial_class_initfn, .abstract = true, .interfaces = (InterfaceInfo[]) { { INTERFACE_CONVENTIONAL_PCI_DEVICE }, From patchwork Mon Feb 13 07:08:06 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: 653172 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2266382wrr; Sun, 12 Feb 2023 23:09:52 -0800 (PST) X-Google-Smtp-Source: AK7set/+8Jkx1aBkV6plQyuDYenZDquCFN7FTlsUlRuTMkNG0YowwIoIdvTzy59UJscbcWApG6a6 X-Received: by 2002:ac8:5884:0:b0:3b8:696b:95e8 with SMTP id t4-20020ac85884000000b003b8696b95e8mr40876504qta.1.1676272191866; Sun, 12 Feb 2023 23:09:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676272191; cv=none; d=google.com; s=arc-20160816; b=u/87EofBbF4h0Ili2P1GsJUg37j2wfBMoTo+hmyB+r+u8a9a+b6+cAiGTbPaiaTGqZ Ap52acpalzTQpB2owYl4LkhqcD064Zk5gh2iwFATscUd8z+V0wm1k31GZ/WXU/nhTH9k mPjTFFk+Gg5cXSPDqrYtlj7Cg7YhZL5altiBGgFbOh9HeBymvuXzGminq/oJGNmIP9fM fINWzr8HRmApbIbbBNodacACVEKiIZnNgvoijDBU+jYKMIlHKpEOj2QamYQ1XHBHRSxl YZLFQKmmeS1pbWikE87RvtDghi8h6QANNO+44jQUyoFvdJLxuFKI+Lck+Pw8Qrsh0rhK TXrw== 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=t/FK4XDdiJG7RHelAiRbUeIilzHxima3ZnBYQtTcGTM=; b=aX4WF//a82DbH/pLyiLT+PR7PTLTSCcfLQ5Uc4rrIPTT9GRBPTkFoVs1nTjeY4OaCA p6tQVbtzu5rTc6H0YpyOfGETzdMBc5+zPw8PDTNfbG1E2EWNvWlZTWDeVM9qGOXJz+CR Ep5hZjaNPq/UavcZubm3cWF3bf4A/zI7kWoQyvj6eIBXtEp4O9ft+9cPxyDRlbAskWfy SzKWwHrY+je+pttNOEFKrVcSU+eHzg1qCFqxVNQCIpmyzHuiJMK/zjnZCpVBKIyLSStR khgIkPZjgAlPXjrTm26LYJXo4b79yHsok1CJ24Edbm07o7VppIRGjricON70tivKbdIv T72Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=L3aKW+Lc; 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 bm25-20020a05620a199900b0071b14ed19f6si9404018qkb.215.2023.02.12.23.09.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 23:09: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=L3aKW+Lc; 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 1pRSxI-0000lW-L4; Mon, 13 Feb 2023 02:08:52 -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 1pRSxH-0000hJ-53 for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:08:51 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRSxF-0001ny-Hc for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:08:50 -0500 Received: by mail-wr1-x42d.google.com with SMTP id o18so11074366wrj.3 for ; Sun, 12 Feb 2023 23:08:49 -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=t/FK4XDdiJG7RHelAiRbUeIilzHxima3ZnBYQtTcGTM=; b=L3aKW+LchH1HrxXhm5hLdl6Zq1Y/TuSg7p65IwM8x599O5chOKRo2cUdBzgpL519lq 7o5tG7wWtNV57jlnCgQCq2dvCfjA0/JCaInFDFS9pTx3kZMQa0VVhuBd3mKu4bC33kz5 l4tt4yr4z3i6sXmUpp1OX664e+uBYDiq56J30kLdmtpulGaa/YUZnbSDshHygCMdkoWW Rh7mNiEtbepJX76jMBqcilhlDo2iK3OuSrBlIi6NErF4rXJQJdqf1v1wL0kA0qMFOvkO LagTTyG4rnys7duHzgiIqiEBYPerTzXDDDxdVKoKZk77h/wpGzZxymkxJKTF7ALN7B2U AeUw== 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=t/FK4XDdiJG7RHelAiRbUeIilzHxima3ZnBYQtTcGTM=; b=TMzTArKuiHH6FxwLdd5pmRlBPOv/H+YztmhG3SCqXZz01x2X8dAKXB18v2nwfxDpiN l6mjMpA5Fv9h+z7FbgEJ3HQ/brYMxG/iLOHGBIPmy8r7YaAx34XI6bN0MclLCODe319s JTlPxhuJNH7XCzksLYnqD8hpblMHyCAPi49kPZn0mYrGNeFAPKagjww9VexBxdxy9n/8 MA6lSRMWF79pgcgy9XHFkYuiOMEkZcskmLk49z8wME6e60J1GYMN2JkO5Zyw06dSDKgz y/gtJLCJDPJwPw6VO+4C3NvqsgZLbowfYits29gbqRqsqUD+9GKpH/15bqPTW+Z/jMes u1LA== X-Gm-Message-State: AO0yUKUV1jy7rhWRBDKt1YCfFEcJhQer83SU/Uu9Igbwi01sO4xlMdXa hAD7FIYeNFj085V17cSCxpFxl9c3wjM+n9Wk X-Received: by 2002:adf:ffc3:0:b0:2c5:4154:9f32 with SMTP id x3-20020adfffc3000000b002c541549f32mr8981840wrs.65.1676272128612; Sun, 12 Feb 2023 23:08:48 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id d7-20020adfe887000000b002c551f7d452sm4453690wrm.98.2023.02.12.23.08.47 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 23:08:48 -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?= , "Michael S. Tsirkin" , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PATCH v2 05/19] hw/char/serial-pci-multi: Replace DO_UPCAST() by PCI_MULTISERIAL() Date: Mon, 13 Feb 2023 08:08:06 +0100 Message-Id: <20230213070820.76881-6-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::42d; envelope-from=philmd@linaro.org; helo=mail-wr1-x42d.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=ham 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 Use the PCI_MULTISERIAL() QOM type-checking macro to avoid the few DO_UPCAST(PCIMultiSerialState) calls. Signed-off-by: Philippe Mathieu-Daudé --- hw/char/serial-pci-multi.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/hw/char/serial-pci-multi.c b/hw/char/serial-pci-multi.c index cd5af24bd2..6f4491210d 100644 --- a/hw/char/serial-pci-multi.c +++ b/hw/char/serial-pci-multi.c @@ -58,7 +58,7 @@ struct PCIMultiSerialState { static void multi_serial_pci_exit(PCIDevice *dev) { - PCIMultiSerialState *pci = DO_UPCAST(PCIMultiSerialState, dev, dev); + PCIMultiSerialState *pci = PCI_MULTISERIAL(dev); SerialState *s; int i; @@ -97,11 +97,10 @@ static size_t multi_serial_get_port_count(PCIDeviceClass *pc) g_assert_not_reached(); } - static void multi_serial_pci_realize(PCIDevice *dev, Error **errp) { PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(dev); - PCIMultiSerialState *pci = DO_UPCAST(PCIMultiSerialState, dev, dev); + PCIMultiSerialState *pci = PCI_MULTISERIAL(dev); SerialState *s; size_t i, nports = multi_serial_get_port_count(pc); @@ -190,9 +189,8 @@ static void multi_4x_serial_pci_class_initfn(ObjectClass *klass, void *data) static void multi_serial_init(Object *o) { - PCIDevice *dev = PCI_DEVICE(o); - PCIMultiSerialState *pms = DO_UPCAST(PCIMultiSerialState, dev, dev); - size_t i, nports = multi_serial_get_port_count(PCI_DEVICE_GET_CLASS(dev)); + PCIMultiSerialState *pms = PCI_MULTISERIAL(o); + size_t i, nports = multi_serial_get_port_count(PCI_DEVICE_GET_CLASS(o)); for (i = 0; i < nports; i++) { object_initialize_child(o, "serial[*]", &pms->state[i], TYPE_SERIAL); From patchwork Mon Feb 13 07:08:07 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: 653183 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2267417wrr; Sun, 12 Feb 2023 23:13:28 -0800 (PST) X-Google-Smtp-Source: AK7set/SUFg9s8tONQt0c0V6lxPwYOOmPfNkLa6iL7UtkW3fFmzWDDmE24fvumZHJhbjqamersft X-Received: by 2002:ac8:7455:0:b0:3b9:bc8c:c209 with SMTP id h21-20020ac87455000000b003b9bc8cc209mr20904523qtr.20.1676272408553; Sun, 12 Feb 2023 23:13:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676272408; cv=none; d=google.com; s=arc-20160816; b=02ATNV7nIcuP9s/A5QG0SvWNc2AA99xtjgsMfrZ4sn1zqtiigfh/Yo49vQtcQ59kon 1+HeZ2luSGTcv3cecrldBz+ekcdSNGSQ2Ce5leCr9BAazx8byN0O8Jh3WOj0TZtxWByY fWnP6/S7/Wu0l7g2ESpwvHT/V1pUzWmD3g8rcIBVY9G1hBQacvheJJWFdG8xhtSKiq3K BRNNsyPTj/dCe7dwaRO5QAX53UY0U7knqiOrDWGCvL5irO66xUHDOljOc+jv1IcDBlHF IBonfRl/Xi2pXrMbbmrh9I94lryN0LETvrMAcbvtaEPTzYEh2okpnKefmCbSKVlpm7yN lK0A== 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=JeDWNjpVkKdLbShBUyGUp3JADBIyaux21T6WZ6Gmeuk=; b=zTtAXNS+D3CxsmGljHCDLV/YDis6qO2IYl6/KAzwKBozPmF9EyAg1K1+SfhUO87cE3 2YRUxBmRd8rsT0AGdZlrUZbCaJWNSBliQUxDC36zmc/vUYrxKV9QyxMdlwvZ0gNQbAAx 20GHkngOiYS9zORXVUKQOHCRpRcNC80wBbAI5ilv/we77bvvawo7Y7w/od59b6b5C6o9 odIT2To1ivzHACslChWPPdNMDfxON6NDIdM5U9WumxZ/CTeuss1VGPQ58FOCNq9mJnL3 dCw1IUeKMs1+z1/pSzfMMwZfRwJXoj2nceApd7/pr1bA8tb/Ud8CD048SKCoqKFWOJqM lhjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="dlEV6i/v"; 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 w4-20020a05620a444400b0071cb5762182si10491126qkp.261.2023.02.12.23.13.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 23:13:28 -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="dlEV6i/v"; 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 1pRSxP-0000wh-H1; Mon, 13 Feb 2023 02:08:59 -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 1pRSxM-0000sI-V7 for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:08:57 -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 1pRSxL-0001mt-En for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:08:56 -0500 Received: by mail-wm1-x32a.google.com with SMTP id k8-20020a05600c1c8800b003dc57ea0dfeso10563173wms.0 for ; Sun, 12 Feb 2023 23:08:54 -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=JeDWNjpVkKdLbShBUyGUp3JADBIyaux21T6WZ6Gmeuk=; b=dlEV6i/vpB5jizGkEZriREb5mm6/PbmR09qw+yNoAxt9+icoW8iEy5C395JiR5cTo7 JqnCQY7udpEamijvPylmt7r9tdcBmdYgFd2DXizqKFKvP8TFVF1E0DOs53knoSJwd1/I TEZUp85eDBL/tWiDRrtJWisIoF03pJcKtVlH46Xc1ta7CNfi2DUfv6cZOUj3tfABaUAw 5LcIEuyVozYQFbZbqHt48Wu6YLy8JV4GoErOlnsGi4YqYWxOphdBXJbEJkaQ+n8aV5nc KqldCR4ITjgBBsxEyIi+ZfCB+o2maQToIbUWRgkNXZ3GV5RhuoFWXzIL9kDvvk4HZeIH aSDQ== 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=JeDWNjpVkKdLbShBUyGUp3JADBIyaux21T6WZ6Gmeuk=; b=pVo8fpDnZgDHSUCrMyIP6/sbN9OVID304ccopzO8iTOlFmRWZlymTuTi4GqFLU+Xgk L0Q1vROwABLWm57eHrGeGYUVcYZH683x0cKShdUTJqt0m1VhvSrDcUNNAcUX3EqCxX/q GzG5euCFpDp5QOW5fQ1RwjxuVzMhy4ii5u0kyVpM739+7QTcWJcf34X5P8FLaDHtIA2A sscgjOt12DlnSzeQ3NEHqDX0bBMv1d8aa5HcjL0+7s3bOHTHX35Tlw1wtWAFJUM/7crt X4i4UtxGW9VtD+lQTom1FhBmO3BAsZief/XMJF9rZg/8qFQRpZWckhs9wGEzcug9NtOX r5yg== X-Gm-Message-State: AO0yUKXE5XWWp55Q7tDtCCq2CFEPgTy5+yILiBLHk5iaNR8k0QvB8CBu CvyF+9O8IdsVZ4Z9FuPIHWFi4Txi8beaAJb1 X-Received: by 2002:a05:600c:4386:b0:3df:94c3:4725 with SMTP id e6-20020a05600c438600b003df94c34725mr18034618wmn.38.1676272133800; Sun, 12 Feb 2023 23:08:53 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id g10-20020a05600c4eca00b003dec22de1b1sm14022202wmq.10.2023.02.12.23.08.52 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 23:08:53 -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?= , John Snow Subject: [PATCH v2 06/19] hw/ide/qdev: Replace DO_UPCAST(IDEDevice) by IDE_DEVICE() Date: Mon, 13 Feb 2023 08:08:07 +0100 Message-Id: <20230213070820.76881-7-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::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=ham 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 Use the IDE_DEVICE() QOM type-checking macro to avoid DO_UPCAST(). Signed-off-by: Philippe Mathieu-Daudé --- hw/ide/qdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index 6ae2627a56..1ead62fd18 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -133,7 +133,7 @@ IDEDevice *ide_create_drive(IDEBus *bus, int unit, DriveInfo *drive) qdev_prop_set_drive_err(dev, "drive", blk_by_legacy_dinfo(drive), &error_fatal); qdev_realize_and_unref(dev, &bus->qbus, &error_fatal); - return DO_UPCAST(IDEDevice, qdev, dev); + return IDE_DEVICE(dev); } int ide_get_geometry(BusState *bus, int unit, From patchwork Mon Feb 13 07:08:08 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: 653182 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2267389wrr; Sun, 12 Feb 2023 23:13:22 -0800 (PST) X-Google-Smtp-Source: AK7set+GQnXU7TOhr1+BPnZfcud1zwibUEBiC1a3zN4q8O8knq1CSdwCyKnXOrOieDHmBF5c4TYU X-Received: by 2002:a05:622a:64b:b0:3bb:89be:8b45 with SMTP id a11-20020a05622a064b00b003bb89be8b45mr20524147qtb.65.1676272402171; Sun, 12 Feb 2023 23:13:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676272402; cv=none; d=google.com; s=arc-20160816; b=vNM9axkO49yUB1K2OtYfzgCfN6Z4LXxjPddTWtvmMQbQByUB9ttzY3lVrl6WtlWTRI olKGnpQot37YlaqIDsDwZzg6H7he26yIEOrnOkGh5CAPDQE19eCrv+xuoLLUvcXm4i1f vWqJHOiEEib5LZfiWj78DL4aRshwm4X9oI+oqJVptfvs/sxpFzd2XoYJX5h1PGQ0kmnY emP36NTeB7YlLc6DrbiB7/yAkHDp9D20hLuLQlq26w2WJ4v8+MfVjiwp0rpNt7pAEg4R eBlEP/uFxjgwlHZFLQLPXJ2Vn1zd6kst0qlQIAXNgVzQnKaNut/zEerj43LDtSygtmfc whkA== 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=/hnCzjPfxFE+jbV/pOTQTvC2sGuBuierxSlf21esNXo=; b=hYUPBKE1S89egmye2c8RsXzKxECREbkHYxtN+eJ36k+K4UlU5+BxH0zBNHXQsMt+YY dJ8uZ8KkGQ8RawA/L94jFLEqr1za+CBL+jxgSti4in+3aYafMv0uqxyncOLvpzc2I8SR GltTr359cFISGANW3t2trgotioJ5n3YeKbqdRC6AOmgoCaPLqtpmXbVbfhRBfoJ/VvQ2 DY8avZQi7KdE54Gv6FKC/5yXuVjjXkiW2ZouQh0mQkZuMGjUvFHmTuH2o0LYKXp7LHhW +ObndQRg4X8N6I6ygxL+qRtvViITuGM6NQuBu+56qib3vzTtv6dRLUW8+fWXX5MCnAu9 vYmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=c4HfOXEF; 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 f28-20020a05622a1a1c00b0039ce6373d32si9672118qtb.534.2023.02.12.23.13.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 23:13:22 -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=c4HfOXEF; 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 1pRSxU-00016E-Np; Mon, 13 Feb 2023 02:09:04 -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 1pRSxR-0000x9-UN for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:09:02 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRSxQ-0001r8-CB for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:09:01 -0500 Received: by mail-wr1-x42d.google.com with SMTP id co8so7304162wrb.1 for ; Sun, 12 Feb 2023 23:08:59 -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=/hnCzjPfxFE+jbV/pOTQTvC2sGuBuierxSlf21esNXo=; b=c4HfOXEF7QeK9jrqu4iQcxBupJAS4471RrUqgSPXgazXFK62u5io44A867KLehpn50 1Cr4KeWlJCvfsmRus/6EsHOL36VkCcKo+1Z0j/rmu9IKtE47JZVWpuNJEYhux4Xtfmac 3FdJuGtqXr5h9Dj9ja3sU/Bwn3iQml7m2XoRbQQQ4Ta+59vPEo0Sh1j4b/waGumi4CPD unDwEFsBxXVC/kErgiY31p6H/5H1jWNcMLpXiVC3Se1HJ1n5ACJzfEaJrwPaRG/Bosd7 kbRH8n9KScGzlduIdPW4WMKrmDqPpd6AGodq9tkztPzCuKwzP02b1f/e6MlVVDaMww5I 7g4g== 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=/hnCzjPfxFE+jbV/pOTQTvC2sGuBuierxSlf21esNXo=; b=qKukesQp1Y5qpJ0IP8KQF7EapH65Hf9H39821jj5GhYi8ZUFs/a8qWDanXrQ4eDkt/ feh8V4EAQXO1dzbcG9wmngGy8JzZT0dV6CHq01qBPCAXivziAq3GlC8KUuhirkJC8ph1 3K/Uz8t7zvNMzpVQTDXIk+JGJCbCfDmS8qzSKr8cpL012WbR6diYTE9wTPMkP0AjtJsX aQ4jCttJzgoHIoQOZU+qgIsSaaIfMB4gV9nrzEvDkBSqqlPU7TciPohqkLTbnGOgmKjP 29tR1u809DXtYQFch5pOv/wMCP8JB4zkY4iwtwSaXliiuvfNnAJgu2sP1+HW2DiM+Lvp NKaw== X-Gm-Message-State: AO0yUKXJYiy5bd1byVKyIF2ZSwKCeiI3ljm/19t7DSxlMLJOX+n2/AiK V2jVZCnEf+oq9sYVp3cJnZ+iV9cS8gFoIxEY X-Received: by 2002:adf:dcd2:0:b0:2c5:5a68:958 with SMTP id x18-20020adfdcd2000000b002c55a680958mr983845wrm.33.1676272138910; Sun, 12 Feb 2023 23:08:58 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id i8-20020a5d4388000000b002c5493a17efsm7719780wrq.25.2023.02.12.23.08.57 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 23:08:58 -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?= , John Snow Subject: [PATCH v2 07/19] hw/ide/qdev: Replace DO_UPCAST(IDEBus) by IDE_BUS() Date: Mon, 13 Feb 2023 08:08:08 +0100 Message-Id: <20230213070820.76881-8-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::42d; envelope-from=philmd@linaro.org; helo=mail-wr1-x42d.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 Use the IDE_BUS() QOM type-checking macro to avoid DO_UPCAST(). Signed-off-by: Philippe Mathieu-Daudé --- hw/ide/qdev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index 1ead62fd18..a168643266 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -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_get_parent_bus(qdev)); + IDEBus *bus = IDE_BUS(qdev_get_parent_bus(qdev)); if (dev->unit == -1) { dev->unit = bus->master ? 1 : 0; @@ -139,7 +139,7 @@ IDEDevice *ide_create_drive(IDEBus *bus, int unit, DriveInfo *drive) int ide_get_geometry(BusState *bus, int unit, int16_t *cyls, int8_t *heads, int8_t *secs) { - IDEState *s = &DO_UPCAST(IDEBus, qbus, bus)->ifs[unit]; + IDEState *s = &IDE_BUS(bus)->ifs[unit]; if (s->drive_kind != IDE_HD || !s->blk) { return -1; @@ -153,7 +153,7 @@ int ide_get_geometry(BusState *bus, int unit, int ide_get_bios_chs_trans(BusState *bus, int unit) { - return DO_UPCAST(IDEBus, qbus, bus)->ifs[unit].chs_trans; + return IDE_BUS(bus)->ifs[unit].chs_trans; } /* --------------------------------- */ @@ -164,7 +164,7 @@ typedef struct IDEDrive { static void ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind, Error **errp) { - IDEBus *bus = DO_UPCAST(IDEBus, qbus, qdev_get_parent_bus(DEVICE(dev))); + IDEBus *bus = IDE_BUS(qdev_get_parent_bus(DEVICE(dev))); IDEState *s = bus->ifs + dev->unit; int ret; From patchwork Mon Feb 13 07:08:09 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: 653179 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2267183wrr; Sun, 12 Feb 2023 23:12:37 -0800 (PST) X-Google-Smtp-Source: AK7set/sUEZPvWvUbQsoDbCu1svWOtsOhWID3nAanLWu+tGeVFY/0hOdULiWAL+8nILXhQqOzKsG X-Received: by 2002:ac8:5f92:0:b0:3ba:13d8:67b5 with SMTP id j18-20020ac85f92000000b003ba13d867b5mr36338357qta.36.1676272357271; Sun, 12 Feb 2023 23:12:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676272357; cv=none; d=google.com; s=arc-20160816; b=Uut9Sex5/QhEef1WKm0v7zMObz0RuiUkVXO3HRmqIO3CFSEy/qRIhwLKxoBsc1GjZc 61W+7qIgcXZpUFWdk+CpaTkPLlIhgX3968msCN3CBvQHQiT7ThMw7y1vWGso44f3QeHz lrIQbT6kA5JpY2cq0u6gobXJUYGGEQjeMUPzuuEz6s3bcEhNpSjxf7fgjywm07qFXvlR HpFZzJu6UbSu5OP1KMLZhoWRYdHs5NqBK43GMPXYg5LjcpGcIUmIv1ecwVZZbkFd97md YqmOOWSMnRCFNoyIEQQO2+1fFHKZktBGHg+I5JhI1vt4a5yuq21FRGDu48xOoGFTlASF LYpQ== 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=XrL23td/SqJ6TLHwH0jeBHZYA8cTqwvHD0D623uYOIU=; b=qRHg1cBvH86fNsx933myUJgarDe7IIcKHIOpQ5MWJi+w506kU0TtqmZ5tTOFrMBK9a LTXAjBOmkrVtGCC5Ntb1E7XuB6DTYzTfMsjLc7vrHJurodHRu6eALuUaZxI1t2QMd9zT AoARzKMm2sgYk0ba6dTdeSbAQNvSEUTRVi/DiP4hjvqTbpm9BNnQp+aUhVqClYYzdHXx ujuPA4wrLSKZAao8LYq95i1SuqhAORtgvmVnf9mwaOQcHypM/xtnnf9WXoeToC6ZNw5H krCa96GfwFVLFsodEZIaVVYuqLo8cKDrjV5d+Y02WhFbtakr7NZPPnl322mfYiTYzOHT o4+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LWxWbfPU; 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 l23-20020ac84597000000b003ba35744382si8412042qtn.216.2023.02.12.23.12.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 23:12:37 -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=LWxWbfPU; 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 1pRSxa-0001R0-TU; Mon, 13 Feb 2023 02:09: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 1pRSxX-0001DW-OQ for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:09:07 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRSxV-0001ll-20 for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:09:07 -0500 Received: by mail-wr1-x434.google.com with SMTP id r2so11040065wrv.7 for ; Sun, 12 Feb 2023 23:09: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=XrL23td/SqJ6TLHwH0jeBHZYA8cTqwvHD0D623uYOIU=; b=LWxWbfPUIPzqD8om+TUcUCM4IthTRA43s8m8VW+ekjLsvBhu2aDOqgJLgpb+7fVNJC P4b5w2aZcqDBQmkbWcGDl+NL87/RYKvxZfNLw7crODYFdGGv3WawqTFq3YWutxc6bnJ+ CIATB2FyLCeYVfYWE4BQuS9q0AXrae+Luw2dYDMy/QvLpfKaQ+jgBGnvwJ6gmKpqbaKq Yg/y/AkAQiQZttCiWKRNXk7wfT2GbEzoke6PtZz70HA9A5W9hQFwdpmwMgMPQI3/FBJL kmOkULLnIAX+T2Qgdi+4ba8DbkCGVs+fpHEJ3GW8TKDiHNiNySv8KUAMZ1PAEDSwTy5R pRKw== 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=XrL23td/SqJ6TLHwH0jeBHZYA8cTqwvHD0D623uYOIU=; b=smEtqt0dooFRBU0B3CXZ0RSPUrm/FBCTLmPlGN8yKjuaHBZG68OD34QZZumwkiG3Ug dWYVjm7n00a72LNCHszmc/zclD/IDQnNo5/1r3l+DjquA2CqUk78K0mv+6g8gdOr4LpB 96tXSFWh9MFwYvxLEQbU5fg+WimJ3oFNifSAA6Mg/lv+9JI+PFvwRaoglCGo/VokMI+8 etGscupT6ufnNoSdKG0LvJ0eha+YcCIKMpJ+CIqJcNkPK+xBQLzNginXnOT5RKyqHpUg Mt42YQ9Q3GK7LkaSRzOTwG6M472LC3Rbb4CCkFMtp9Io635gB1lmyBGfaI0Ha00S85in ZJlw== X-Gm-Message-State: AO0yUKWzrgRtpZ82j3IKzEx+lGzuKVJjJLTdSJZ91iSeTsPkiiMfiSZd 5DOSFo4PAkTnZ1+a8dNrpRokecITZdpQ3crM X-Received: by 2002:adf:d08a:0:b0:236:695b:82d4 with SMTP id y10-20020adfd08a000000b00236695b82d4mr21142772wrh.30.1676272144053; Sun, 12 Feb 2023 23:09:04 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id p3-20020adff203000000b002c3f6d7d5fesm9817057wro.44.2023.02.12.23.09.02 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 23:09:03 -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?= , Stefan Weil , Jason Wang Subject: [PATCH v2 08/19] hw/net/eepro100: Introduce TYPE_EEPRO100 QOM abstract parent Date: Mon, 13 Feb 2023 08:08:09 +0100 Message-Id: <20230213070820.76881-9-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::434; envelope-from=philmd@linaro.org; helo=mail-wr1-x434.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 Have all the EEPRO100-based devices share a common (abstract) QOM parent. Signed-off-by: Philippe Mathieu-Daudé --- hw/net/eepro100.c | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c index dc07984ae9..dac42ba17b 100644 --- a/hw/net/eepro100.c +++ b/hw/net/eepro100.c @@ -235,8 +235,14 @@ typedef enum { ru_ready = 4 } ru_state_t; -typedef struct { +#define TYPE_EEPRO100 "eepro100" +OBJECT_DECLARE_SIMPLE_TYPE(EEPRO100State, EEPRO100) + +struct EEPRO100State { + /*< private >*/ PCIDevice dev; + /*< public >*/ + /* Hash register (multicast mask array, multiple individual addresses). */ uint8_t mult[8]; MemoryRegion mmio_bar; @@ -279,7 +285,7 @@ typedef struct { /* Quasi static device properties (no need to save them). */ uint16_t stats_size; bool has_extended_tcb_support; -} EEPRO100State; +}; /* Word indices in EEPROM. */ typedef enum { @@ -2082,21 +2088,27 @@ static void eepro100_class_init(ObjectClass *klass, void *data) k->subsystem_id = info->subsystem_id; } +static const TypeInfo eepro100_info = { + .name = TYPE_EEPRO100, + .parent = TYPE_PCI_DEVICE, + .class_init = eepro100_class_init, + .abstract = true, + .instance_size = sizeof(EEPRO100State), + .instance_init = eepro100_instance_init, + .interfaces = (InterfaceInfo[]) { + { INTERFACE_CONVENTIONAL_PCI_DEVICE }, + { }, + }, +}; + static void eepro100_register_types(void) { - size_t i; - for (i = 0; i < ARRAY_SIZE(e100_devices); i++) { - TypeInfo type_info = {}; - E100PCIDeviceInfo *info = &e100_devices[i]; + type_register_static(&eepro100_info); - type_info.name = info->name; - type_info.parent = TYPE_PCI_DEVICE; - type_info.class_init = eepro100_class_init; - type_info.instance_size = sizeof(EEPRO100State); - type_info.instance_init = eepro100_instance_init; - type_info.interfaces = (InterfaceInfo[]) { - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { }, + for (size_t i = 0; i < ARRAY_SIZE(e100_devices); i++) { + TypeInfo type_info = { + .name = e100_devices[i].name, + .parent = TYPE_EEPRO100, }; type_register(&type_info); From patchwork Mon Feb 13 07:08:10 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: 653177 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2266496wrr; Sun, 12 Feb 2023 23:10:14 -0800 (PST) X-Google-Smtp-Source: AK7set82H1huu4EawD8NznXYyy197sPVIjkEdnRq8E158gvPjovIfI2nIgUUDxSJR6s29nhrgKpk X-Received: by 2002:ad4:4ee8:0:b0:56e:a4c5:9d9d with SMTP id dv8-20020ad44ee8000000b0056ea4c59d9dmr11392311qvb.22.1676272214445; Sun, 12 Feb 2023 23:10:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676272214; cv=none; d=google.com; s=arc-20160816; b=Cx4pgC4x0nr3FwjObCT0YHtMKVTI/w+whgEJ0aPRV0BfjJI4NW6bLbY7bWnFYE6Fmp q5krQiWpMGdtAya0w5qKyaR1fyybxWZc2seDEyhzSOUFPB8ONBJmtnIbun9z/iSwIEUe 8QwXSSII0pszwTXLxTlIFUHbtFYogkrPoTJDZocwmJBYV1RknZVnnbsTX0GLFj3+j45/ 9HjMs8N1cX8ORcxCZn1t7VgqU2Vl3t4LLVVZW1tUdXLkg43gBwGBkgSJ1/HwTTEpYBbW hGsBrJY9cmdVypMA9hr601QgVAD9/Yv51r/Sk8WhNvqW9mTBWgRjIYcGUdMVzt3AsRSv 1deA== 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=3aGr4pdXOmnCeHpCx27ssdrfJ2Facg5vKvJw+VkmOyc=; b=t9bTIo2tDXQ39ciFPWaP+ISYINlAsjEnTfQ2bf9mnMrZrkCdoe2lKeH/LV9omVjF/l tSwU2HNHQ8Dsprm4a/w9Z72lkmC8J7E22n969MJxhKlIqw20ov9cN7+uHLK0Ln0xcGmH tANiinL82dOIGwxUAcWYAxxynZFa8o8R/+JwYDZKazPobkgBIW6ypshea22DNy1SkW5i 2xa6K/DztY4DRWaW/Ma5NzQnF8t+ckkwbirwfrNS/6C0eKCV4C4wM7j46Ms8CBqYa/f5 i8t5uiVaAhJqyjJMRgBN/GQPyQiXj3CE3wdgRUH0nUg5r6PX64EY3N/1Qn8gJl9SZSdM NpeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qMllGUGA; 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 j10-20020a0cab8a000000b005376967dad1si8533338qvb.578.2023.02.12.23.10.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 23:10:14 -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=qMllGUGA; 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 1pRSxe-0001lR-Ka; Mon, 13 Feb 2023 02:09:14 -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 1pRSxc-0001Yg-Jt for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:09:12 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRSxa-0001ny-72 for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:09:12 -0500 Received: by mail-wr1-x42d.google.com with SMTP id o18so11075070wrj.3 for ; Sun, 12 Feb 2023 23:09:09 -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=3aGr4pdXOmnCeHpCx27ssdrfJ2Facg5vKvJw+VkmOyc=; b=qMllGUGA7JoyWdxTdjkmgcJSrE8ykvf29RBUdYxXZ5mjkJ2m4WCwIk3+YU83fSsiG8 H6xS0I63Lr+E8/XQbKa22b3H1dJj2N9J3zUyU3n0G3S8aJZd+WFJsV9JAYZ5awtGXdws s2L9tXbtB4d1boZ8EW3sqryIYZRKDaHou1w03ktLIsqQxQyuAKiAiuuZ3f/B64XKUvzH +Kkye24IcxKeOLn8cQtlMKopsCsF8Y050R8pwFf7D5dR824hagf5syp05DzSQYusqo0P 6P8JYS8jmZDP88Hn+9Tx6qIrypUKFWGA60ytycARcktRuZM2hDidOO4fZWQXIdeEj92z FHrg== 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=3aGr4pdXOmnCeHpCx27ssdrfJ2Facg5vKvJw+VkmOyc=; b=dgUsIvp3m3DFn9eBYzrnRo6nW4oHa+ViXcL75nBS2qlxSpnNIgy59ZeZk4zTEasSJU rf7NiqBUKubWPxYqHUzespxeFsdBog3hLdIHjC4jaX9mCu/1G3vFRs9UqThQ7Nlryoln fr7/v2f07uuFxm1AUWnWW1sI7iiKec7FYosMWNHH950jBja0LYr7Z2VoDMEhOtSEC/Wo ioQK25ZHG03cXKiQLMII8KFLU9iJgq5/usbCcCdyWfm7cXz6tVBveEKHFc9r9v0pdoTk PALPyGo5ItBAeXEqfDYpXkQlc/OkSw0RZE5ftXpSeAySWjnxsqrki9BBY3SN05nYPoTd CRUA== X-Gm-Message-State: AO0yUKV3HznAs+YLTOinMM6+k5/SKhmuCX+6dPZu1cZCf25DmldfEmQb K+oRJkVBQaWZOuGD076EE+eKegncf5nn26YY X-Received: by 2002:a5d:6292:0:b0:2c5:52ef:b46b with SMTP id k18-20020a5d6292000000b002c552efb46bmr3887840wru.6.1676272149281; Sun, 12 Feb 2023 23:09:09 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id d7-20020adff2c7000000b002c55ed9e314sm328399wrp.64.2023.02.12.23.09.08 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 23:09:08 -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?= , Stefan Weil , Jason Wang Subject: [PATCH v2 09/19] hw/net/eepro100: Replace DO_UPCAST(EEPRO100State) by EEPRO100() Date: Mon, 13 Feb 2023 08:08:10 +0100 Message-Id: <20230213070820.76881-10-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::42d; envelope-from=philmd@linaro.org; helo=mail-wr1-x42d.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 Use the EEPRO100() QOM type-checking macro to avoid DO_UPCAST(). Signed-off-by: Philippe Mathieu-Daudé --- hw/net/eepro100.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c index dac42ba17b..915935a818 100644 --- a/hw/net/eepro100.c +++ b/hw/net/eepro100.c @@ -1828,7 +1828,7 @@ static const VMStateDescription vmstate_eepro100 = { static void pci_nic_uninit(PCIDevice *pci_dev) { - EEPRO100State *s = DO_UPCAST(EEPRO100State, dev, pci_dev); + EEPRO100State *s = EEPRO100(pci_dev); vmstate_unregister(VMSTATE_IF(&pci_dev->qdev), s->vmstate, s); g_free(s->vmstate); @@ -1844,7 +1844,7 @@ static NetClientInfo net_eepro100_info = { static void e100_nic_realize(PCIDevice *pci_dev, Error **errp) { - EEPRO100State *s = DO_UPCAST(EEPRO100State, dev, pci_dev); + EEPRO100State *s = EEPRO100(pci_dev); E100PCIDeviceInfo *info = eepro100_get_class(s); Error *local_err = NULL; @@ -1895,7 +1895,7 @@ static void e100_nic_realize(PCIDevice *pci_dev, Error **errp) static void eepro100_instance_init(Object *obj) { - EEPRO100State *s = DO_UPCAST(EEPRO100State, dev, PCI_DEVICE(obj)); + EEPRO100State *s = EEPRO100(obj); device_add_bootindex_property(obj, &s->conf.bootindex, "bootindex", "/ethernet-phy@0", DEVICE(s)); From patchwork Mon Feb 13 07:08:11 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: 653174 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2266424wrr; Sun, 12 Feb 2023 23:09:58 -0800 (PST) X-Google-Smtp-Source: AK7set9k2tRRWMV8jdP17HrDcurfyCt+k3tdzkxmlap89mm0N9keK6LrpKscLtc69DvRZBMw+P2O X-Received: by 2002:ac8:7d03:0:b0:3b6:3ab8:6396 with SMTP id g3-20020ac87d03000000b003b63ab86396mr41860398qtb.36.1676272198586; Sun, 12 Feb 2023 23:09:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676272198; cv=none; d=google.com; s=arc-20160816; b=UX3by/S198y3IL/L6Bb2A/pNtn6sPCu5Mg5B5oLa3TWLpen5opAmeVwfcYNA66a1rY 99p7jsh1G+hur4+1YjWPGpzO5L9TTx4dPUijvdgwYnxSsJDlgq9v38zz+0xcjmNU9UV+ nKnB3xyjFuC/tw1pExbY2GrZ3P5e/Lfsqii0meflp9nqB1gg2iz+k6Ukn5zyB4ylKKW/ RkcphFx07wd5E1mXRo7G8IQluF1Yyu/G+QNS0Yns7fULQzsxJRtebbCM63E4GY0cfZ8w ScAAv3LJ8vLOWuUn1X/Wf7f//XL/wtyCeZJL+prZDbu1HJE4CtulvuLHk/MQLkLoB/KI lnfw== 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=VotmsYo6EZx1VvqMFkr1+QDMy3wRb1XAiA9w0UCQyq8=; b=I8Txk8QKMAl1q1UVmIAfddxm4tY3Dc+qeyAh3cmEE/5pvPoih/ifQHMEB/sg1FQxjX zZrCNsM2la/b68u2Z3ULMr9+pkjSlTDV+N9QJFZ9QiUSxtM8oz4GCjSHclyiPU3CDiCS 8ZF/84Hbqqw4JnGkVizgp9RpT1AWS4QsaTba/yMWwhQAIB48bM1ppaTqpY3ZQsEs2mH0 eal7OEPjgh9c4oEGJB5R15Fp8vMfaAhVhgRl/OjUcPPm9vRLzKVf2Q83X3NscwUYMET1 rok72OFSZ4DwzpprSW/a4YzBpknMOzcinEIzpqvv9ioMnYmO5mQ3IRV9SexlqK/i5kk5 Ktzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ogaGkjAs; 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 s20-20020ac85cd4000000b003ab73b7bb03si9405391qta.624.2023.02.12.23.09.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 23:09:58 -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=ogaGkjAs; 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 1pRSxk-00024c-07; Mon, 13 Feb 2023 02:09:20 -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 1pRSxh-0001xh-VC for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:09:17 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRSxf-0001wA-RW for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:09:17 -0500 Received: by mail-wr1-x42b.google.com with SMTP id by3so9740246wrb.10 for ; Sun, 12 Feb 2023 23:09:15 -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=VotmsYo6EZx1VvqMFkr1+QDMy3wRb1XAiA9w0UCQyq8=; b=ogaGkjAs5SdqnGs+wckd6uiKcKSFwUUeoWXrNIkRoPX0bYTeVm8G7NRkXpBBqZEYvV 08t2J2gmL8MoapEEnOrSQYZNDW4uRzsqEzOaHQ82sWtkU2PYNf8cJrCwUo+ceeyJYDHg +h28C88vyz4/FlxXgMf2yuFburSPOCRlUc2q9POka4uLOfPu8wq428xZbOFpFgiWMtIS x5Ua0zd8MeOk/4GFyjpT8jWz+Y5fyT3kF84JY/4W1HN5eqBLBkvLxXTKQ8JOc4asYN8U dviIYfkhIy0Fm9EuAcfO0fEUY8vQnFyV8CqgCgzTyRVGp8AAVheRBFU0K6iIUfcIlrJp CRwA== 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=VotmsYo6EZx1VvqMFkr1+QDMy3wRb1XAiA9w0UCQyq8=; b=iffop0a9Sm1tVKqdTSKsgD0tCgTZE1OQKRon7wnEH/iE2SxYOuZnsK+uDSFC+/k25j SF7qY4ljYRyWkXqfJi2AUnGemFsoA7jw79AOOx10jCJEiynD/ho14UFp4yFYmnSvAEw1 IcROfPVfsPtQQntmiE38kyj1mpWmLPdX45CMdUS5/AlWOGS7ji6uUHwf+vTDZjbGKam8 NGT8kvrbH8Vk7kb5HIOyOZ7LVzhiaWevSKg2P7TLYae2IJrVSv36qqlatnYQ08TYPg2j T00djZkdyflYRMiUWxGwrAscJ0Jad0h3D+/fiEX8stjyfX0TQrO0yzjVnf716XjDRZEP H/7Q== X-Gm-Message-State: AO0yUKWpofUk3/7wNLj3HLGYsKf/gvUagplEBIHNim9qSebIQX8FFdxU 7FchndfP7BmYYiwzDEe4J7g005AQqfyoB8OX X-Received: by 2002:a5d:6b83:0:b0:2c5:52f9:8e9b with SMTP id n3-20020a5d6b83000000b002c552f98e9bmr3302042wrx.29.1676272154325; Sun, 12 Feb 2023 23:09:14 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id b15-20020a5d550f000000b002c55ebe37ddsm416002wrv.115.2023.02.12.23.09.13 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 23:09:14 -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?= , Jason Wang Subject: [PATCH v2 10/19] hw/net/ne2000-pci: Replace DO_UPCAST(PCINE2000State) by PCI_NE2000() Date: Mon, 13 Feb 2023 08:08:11 +0100 Message-Id: <20230213070820.76881-11-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::42b; envelope-from=philmd@linaro.org; helo=mail-wr1-x42b.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 Define TYPE_PCI_NE2000 and the QOM PCI_NE2000() macro. Use PCI_NE2000() instead of DO_UPCAST(). Signed-off-by: Philippe Mathieu-Daudé --- hw/net/ne2000-pci.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/hw/net/ne2000-pci.c b/hw/net/ne2000-pci.c index edc6689d33..0332e7f616 100644 --- a/hw/net/ne2000-pci.c +++ b/hw/net/ne2000-pci.c @@ -30,10 +30,16 @@ #include "ne2000.h" #include "sysemu/sysemu.h" -typedef struct PCINE2000State { +#define TYPE_PCI_NE2000 "ne2k_pci" +OBJECT_DECLARE_SIMPLE_TYPE(PCINE2000State, PCI_NE2000) + +struct PCINE2000State { + /*< private >*/ PCIDevice dev; + /*< public >*/ + NE2000State ne2000; -} PCINE2000State; +}; static const VMStateDescription vmstate_pci_ne2000 = { .name = "ne2000", @@ -54,7 +60,7 @@ static NetClientInfo net_ne2000_info = { static void pci_ne2000_realize(PCIDevice *pci_dev, Error **errp) { - PCINE2000State *d = DO_UPCAST(PCINE2000State, dev, pci_dev); + PCINE2000State *d = PCI_NE2000(pci_dev); NE2000State *s; uint8_t *pci_conf; @@ -77,7 +83,7 @@ static void pci_ne2000_realize(PCIDevice *pci_dev, Error **errp) static void pci_ne2000_exit(PCIDevice *pci_dev) { - PCINE2000State *d = DO_UPCAST(PCINE2000State, dev, pci_dev); + PCINE2000State *d = PCI_NE2000(pci_dev); NE2000State *s = &d->ne2000; qemu_del_nic(s->nic); @@ -87,7 +93,7 @@ static void pci_ne2000_exit(PCIDevice *pci_dev) static void ne2000_instance_init(Object *obj) { PCIDevice *pci_dev = PCI_DEVICE(obj); - PCINE2000State *d = DO_UPCAST(PCINE2000State, dev, pci_dev); + PCINE2000State *d = PCI_NE2000(pci_dev); NE2000State *s = &d->ne2000; device_add_bootindex_property(obj, &s->c.bootindex, @@ -117,7 +123,7 @@ static void ne2000_class_init(ObjectClass *klass, void *data) } static const TypeInfo ne2000_info = { - .name = "ne2k_pci", + .name = TYPE_PCI_NE2000, .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(PCINE2000State), .class_init = ne2000_class_init, From patchwork Mon Feb 13 07:08:12 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: 653173 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2266381wrr; Sun, 12 Feb 2023 23:09:52 -0800 (PST) X-Google-Smtp-Source: AK7set/Q8j99QfCaQza4qG3/qVk5YtvaU0vJ12Bz/kd6POoZ9Qbh6tiyaL9Hv1jj0r7bYq7YBxzp X-Received: by 2002:ac8:7f8d:0:b0:3ad:202f:8797 with SMTP id z13-20020ac87f8d000000b003ad202f8797mr43313328qtj.9.1676272191854; Sun, 12 Feb 2023 23:09:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676272191; cv=none; d=google.com; s=arc-20160816; b=j39YwT4XNyoJ8nhXZ3oL2ataOetB51tdk1Nxoy75atie1qsyIFGRGr+dVN5cOj96SL hlmX3z/M5NUEpiMhYYtQlwMMmR5C2Z3WGNHhW+58bgyB1efkRAc2vzViFdDXOhJ5G9T4 TJ49SJJzIMoPjX/Du3J10iOF2lxDX7nGNHVrANwjJLKFd3Iwfq5S0d7LxJh0eOoSOl/F xXwVm7rzNmOTYMc5vgeOrwJJcTnHyAega2VKEsiWgW+dMtWbOtO9dTe6XXcnb8f1bifC 90m/1/Eh3ske9KXKacSPJVsRyXvMlKSYxnkpizLCPlE4voBC8IzgCXKfx4cRN/qobC55 TZSg== 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=fD8XsrjHaA7eijBs8OwmQ3XFemQ30TcP+DXj6h7knEg=; b=vF3QCn2WiQbOvBwtEfWJSw3cjLAOfml+fgFmY+5GNiTPlr8K79E90KlDJT+oLsoMdP ms0s1iQLXjaFySEF53ivlw+k7/omFdwiNTS5E/83/Xpk33iKm0xTqo46Dttd6LjerUBb Sa9NJOPdJxmCVTxBcbHzzmk25t83k078WP+VUR7Fh/kjOVwfxHiJ9iyDSyO/dhVaukOa 56l5Fhyy7lM7Rc4TlU7Su4QvRe57Drhj5Xuy+W5WfNTEhG6VAlBrGtpejoXR88zV2Jr1 sHrBCsf/1mlBCamcK9kIPLZemeihpk0xqo21NWrbhZGaGJkbOI793D3/bsFjSwyJKNxC kTCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AUHUxMS5; 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 u11-20020a05620a430b00b006fef612fcfesi9199574qko.23.2023.02.12.23.09.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 23:09: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=AUHUxMS5; 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 1pRSxo-0002Z7-TN; Mon, 13 Feb 2023 02:09:24 -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 1pRSxn-0002NZ-EA for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:09:23 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRSxk-0001ll-IW for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:09:23 -0500 Received: by mail-wr1-x434.google.com with SMTP id r2so11040566wrv.7 for ; Sun, 12 Feb 2023 23:09:20 -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=fD8XsrjHaA7eijBs8OwmQ3XFemQ30TcP+DXj6h7knEg=; b=AUHUxMS5pIjp4dqOgnRBuhpoT6Smnx6s3P/ZhWdXjwRB5r5+VKclUCB/SASsRYZBr3 P5Y8dXFAm0QnDvhWsD6yIH+i3KMxNbNo4sGe3gbuN060YhFpHmcsRB3YOFF3RzAIfF9m mzCaAoDu/HCzxi8hW3nGkSaBwgY2ejE8t622G+CacnpQAsYmXf+34LvB8s8urY8YTvoY MzhC7jaPPNcaHYR+cK7EwYMGOg/15oy8v46ALrdDs/oC9bQLy+ROAlBSooNPtjiCKAXw yVXbNn9XN8xdgaIji2lV3TKuiixXG/Wg+ApNBh6UCiKoaX/MeL3J2MSzM9ViKw5GRvZ7 hn2w== 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=fD8XsrjHaA7eijBs8OwmQ3XFemQ30TcP+DXj6h7knEg=; b=Nz3YwATSLkhUcdf+HQZCp2H2mZT/o7wWK+rZePH3KD86qcAq5MT3Hg11Hm52xbRZGO Q+akgYUVFup7ej+wDvdWhW4UfrGLwFUfyWt3RLr94hxAYmbDGi6jzojYQpykOxTnSVei OkEzj1YcnT4o9bPDFF+017R9ulNMnJaRk5m1vHhc2+wb1rXN/SN7Wu1ugigr8Edg9jn1 awpUGmhlY0uVgPN3EpK+gaDqFMfWcMXv/JrNoCHAaiGz2z4WkAZmjwROib4ZmIG/Zndd zZ9QCiuNyNbstwydKrFrrPOoshMGC+oVpM9bD4yA8QuIl99aZ7GOrv4YDEyQAk0fDlXV OpIg== X-Gm-Message-State: AO0yUKWG0XWjDX1FKREHg1Ps1jEUWWWH/OnAYzvhfGWDoKfKIElbr69g YJ0oYArAt25n7X5UfsaqTQKjnq1oCc2ym8IK X-Received: by 2002:a5d:43cb:0:b0:2c5:54a7:3636 with SMTP id v11-20020a5d43cb000000b002c554a73636mr3115095wrr.2.1676272159667; Sun, 12 Feb 2023 23:09:19 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id e14-20020adfe7ce000000b002c54f367fe4sm5071779wrn.100.2023.02.12.23.09.18 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 23:09:19 -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?= , Sven Schnelle , Jason Wang Subject: [PATCH v2 11/19] hw/net/tulip: Finish QOM conversion Date: Mon, 13 Feb 2023 08:08:12 +0100 Message-Id: <20230213070820.76881-12-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::434; envelope-from=philmd@linaro.org; helo=mail-wr1-x434.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 Use the TULIP() and DEVICE() QOM type-checking macros. Remove uses of DO_UPCAST(). Signed-off-by: Philippe Mathieu-Daudé --- hw/net/tulip.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/hw/net/tulip.c b/hw/net/tulip.c index 915e5fb595..990507859d 100644 --- a/hw/net/tulip.c +++ b/hw/net/tulip.c @@ -19,7 +19,10 @@ #include "net/eth.h" struct TULIPState { + /*< private >*/ PCIDevice dev; + /*< public >*/ + MemoryRegion io; MemoryRegion memory; NICConf c; @@ -959,7 +962,7 @@ static void tulip_fill_eeprom(TULIPState *s) static void pci_tulip_realize(PCIDevice *pci_dev, Error **errp) { - TULIPState *s = DO_UPCAST(TULIPState, dev, pci_dev); + TULIPState *s = TULIP(pci_dev); uint8_t *pci_conf; pci_conf = s->dev.config; @@ -967,7 +970,7 @@ static void pci_tulip_realize(PCIDevice *pci_dev, Error **errp) qemu_macaddr_default_if_unset(&s->c.macaddr); - s->eeprom = eeprom93xx_new(&pci_dev->qdev, 64); + s->eeprom = eeprom93xx_new(DEVICE(pci_dev), 64); tulip_fill_eeprom(s); memory_region_init_io(&s->io, OBJECT(&s->dev), &tulip_ops, s, @@ -983,27 +986,26 @@ static void pci_tulip_realize(PCIDevice *pci_dev, Error **errp) s->nic = qemu_new_nic(&net_tulip_info, &s->c, object_get_typename(OBJECT(pci_dev)), - pci_dev->qdev.id, s); + DEVICE(pci_dev)->id, s); qemu_format_nic_info_str(qemu_get_queue(s->nic), s->c.macaddr.a); } static void pci_tulip_exit(PCIDevice *pci_dev) { - TULIPState *s = DO_UPCAST(TULIPState, dev, pci_dev); + TULIPState *s = TULIP(pci_dev); qemu_del_nic(s->nic); qemu_free_irq(s->irq); - eeprom93xx_free(&pci_dev->qdev, s->eeprom); + eeprom93xx_free(DEVICE(s), s->eeprom); } static void tulip_instance_init(Object *obj) { - PCIDevice *pci_dev = PCI_DEVICE(obj); - TULIPState *d = DO_UPCAST(TULIPState, dev, pci_dev); + TULIPState *s = TULIP(obj); - device_add_bootindex_property(obj, &d->c.bootindex, + device_add_bootindex_property(obj, &s->c.bootindex, "bootindex", "/ethernet-phy@0", - &pci_dev->qdev); + DEVICE(obj)); } static Property tulip_properties[] = { From patchwork Mon Feb 13 07:08:13 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: 653176 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2266442wrr; Sun, 12 Feb 2023 23:10:01 -0800 (PST) X-Google-Smtp-Source: AK7set+hrbfsgsrJZ+Ao+ETpVv0hGdwSL+M4Zl5sjJ4LZCbjoXmgXU8UR1uW25ItC22HjYOnwILE X-Received: by 2002:a05:6214:519b:b0:56e:b273:fb49 with SMTP id kl27-20020a056214519b00b0056eb273fb49mr4208525qvb.21.1676272201752; Sun, 12 Feb 2023 23:10:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676272201; cv=none; d=google.com; s=arc-20160816; b=U12yOLgrsMTYacyhv1lriulEzQ40lqareHZwhYs7UwjUcoCYcYpY+OY4XLViY4a5mr 5CwolHFjf6bkx+PAQpcclTkJRMvt4m+bITE0med4FzMT8cIj2E4LiPUWtRzFmjmwwfRD XyNBoIzNVVSxP/nL6Jh1TZCMEpunBDv+sPO8DwXgnJ5VV4eGFg/EDwvkjo7+uyDKGClA yFjUDWSUBiTBUj9lOi9OCP92CSPNTAiJqkSC2q/SwPs0pHbVdBKqcDdlxknU5ezCzjIg lcEawJioXGodnOtll9gqhZvS7Vs28XVjZeS1KsWAi7SBb92bI3Z+wBv9KOWBKc3iHWlK NGPA== 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=3YnlWYrFQuWXt1rppNJud8kwI6R078rMYORIY8x9Pr4=; b=BmV0IVnpc8MsMxsw3EN5swtFvc/Ii86xPWsXjao6Jv7bib6Y1I5R6W5j94rh7v8l4A DY7FPrrGmGDSUrjrvwnWeqKgnlSUbVVXrg7LaHHKrxqdnhZlNxJqrPeW1Oc19p4knTKn +r2Sh3YG7vKNQS1WtTpAEK3dubAQ9Ub2/EZNJYRt5Vo4V3ShW4rGS8yjZOY6X7kblsFr bshD7Pi0EYRrjLR3A83l5W/kQMVGy8pp2qNRiYBU+3iRcjXU0vRJCyRkBmiZe5R6teDt kBz1Pij59RczZenbF0s6mjtCqWVmBYCzog7+q6uVJUKYnCm/htjdA+m0hVRiimv4uf1k V42A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZSanReyF; 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 y12-20020a0cf14c000000b0056e9a4f58eesi5407651qvl.2.2023.02.12.23.10.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 23:10:01 -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=ZSanReyF; 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 1pRSxy-0002u5-Cu; Mon, 13 Feb 2023 02:09:36 -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 1pRSxs-0002pT-DE for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:09:28 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRSxq-0001yb-FN for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:09:28 -0500 Received: by mail-wm1-x330.google.com with SMTP id j32-20020a05600c1c2000b003dc4fd6e61dso10536204wms.5 for ; Sun, 12 Feb 2023 23:09:25 -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=3YnlWYrFQuWXt1rppNJud8kwI6R078rMYORIY8x9Pr4=; b=ZSanReyF0SBsFI0wzV6A/ny79s0DghjZiGjdjjTSj6b3YE5MVqJHj+eWMgBAzDtXMi T9IPaWLo72d24Cx7e6AwBKAYTUyqALec+zvpOHNcg/S7pdt23W31wh4AaN8a7mhVNOzu Z6KJiJVAHNM9Uq4LpeQoOQ8hTzqXrBNnutRinhPi7Tk+2l3c6g448AzUVMJ3TxM4hml+ 2vLdIhsFsq9JC8/m1QqU6z82WCA+olaK1AhmNhOiZ6o+QYn1aGe8aA8KtV1kiX/Os4fo pVeUqZj8CmDZjcltYWSDUm73FfhDp6Nk9f15EEGQH1kZDD5Z9qTnw1X/b5O79jMOJCPx YPbA== 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=3YnlWYrFQuWXt1rppNJud8kwI6R078rMYORIY8x9Pr4=; b=ZxAolnZGL/Cj/nFoAu85SiCNHsEOvdNXKdwwnjr71gRldBIUiTivXNMOuodFXd7hrF VgOW8s+qy2vRpAdOejiH8mYL8pA5WfsfV0b35mvB3LZoxEqDbRTAbiPTuqK0wsnGmKWD TOYCUCvlU7MsPdg5VBz6dBswUiM+LoBG9gFHU5TNwq8zUOPrLoyPxLDMC+3BRRyQZBtI SNeSPF4pUonM+D46/szS+3+4JoL+W1JD+Nh3VrWdbcZMkJwT1y+fnG4lqbnwfuIurOxh P0mXGeBsAl1YZri6CgFqlbneriDj/oZ7jMAfkK+NHUZu2gJuwk83Wm187zhsKQjorYzP zTHA== X-Gm-Message-State: AO0yUKW8ajQG/1q14Cx7/IyAH6Khfz30SHuddpsX6WqCVrgGUi99Da1R CFmrXsfHnpT2mcX52qAsAT2SyAOWf0sLClui X-Received: by 2002:a05:600c:4b1b:b0:3df:fbc7:5b10 with SMTP id i27-20020a05600c4b1b00b003dffbc75b10mr17580759wmp.0.1676272164922; Sun, 12 Feb 2023 23:09:24 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id t14-20020a05600c198e00b003dff870ce0esm17259160wmq.2.2023.02.12.23.09.23 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 23:09:24 -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?= , "Michael S. Tsirkin" , Marcel Apfelbaum Subject: [PATCH v2 12/19] hw/pci/pci: Replace DO_UPCAST(PCIBus) by PCI_BUS() Date: Mon, 13 Feb 2023 08:08:13 +0100 Message-Id: <20230213070820.76881-13-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::330; envelope-from=philmd@linaro.org; helo=mail-wm1-x330.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 Use the PCI_BUS() QOM type-checking macro to avoid DO_UPCAST(). Signed-off-by: Philippe Mathieu-Daudé --- hw/pci/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 2e785e3aef..ae5c33adb6 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -391,7 +391,7 @@ void pci_device_reset(PCIDevice *dev) */ static void pcibus_reset(BusState *qbus) { - PCIBus *bus = DO_UPCAST(PCIBus, qbus, qbus); + PCIBus *bus = PCI_BUS(qbus); int i; for (i = 0; i < ARRAY_SIZE(bus->devices); ++i) { From patchwork Mon Feb 13 07:08:14 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: 653180 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2267198wrr; Sun, 12 Feb 2023 23:12:40 -0800 (PST) X-Google-Smtp-Source: AK7set9TwsGxulsJEWpLln3vzVftLwCuxUa0VbYwr4c50K8emq3rNoJ8sLZcAuUhfMCzxidIQubk X-Received: by 2002:a05:6214:230e:b0:56b:ff69:7df8 with SMTP id gc14-20020a056214230e00b0056bff697df8mr43975875qvb.51.1676272360052; Sun, 12 Feb 2023 23:12:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676272360; cv=none; d=google.com; s=arc-20160816; b=jyPioxYaS38B278YppmOZ28xe1sIHb6cXVa7fvLXWax0eraNOaw0zU8O90j5LHw8aw iGUpFVLYDLQXTOTDRFeFogh54dTCNAMsWF6/H0n74rdK5OJlYRRU/r4VkNnRVvQhOMjn yEofDKwP/AyFcjZPavAciuAyGDnWd3fYryaLedF2CSubZbCXyPWOXMq3UnvZQ/3xZpJN mxZZwB15V6GXuVkz/1Gylt5wyRWvQm+OWr5ZqER39AI0fAxd5oVEs2W35hfA9XEP/IBn L3nAcpQb0IKGKBtwH2GcrAcB9zSgViZTEHwSnD4vqipU1v40v+kjIgbBRA50MdrjV1Af rvwA== 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=lbFFSEwuPaiVjYWiGHnO40wk80nlXCVErHPDaxFN7V8=; b=MYlXpYHV0QXsO0ZQFq1YQS0Y7U3qFv0jplHXLkUzITIt0Akx8cs+Aqr3V7cO/N4SnG RAZ0Mi7l5rN/x2izPf+KsvPY9UGmxl/EUhANoBZOkaF5MIGKlY+z/qukD6/ePTDKEwK1 /76Cm6WiDJMKSjqexn8h3OTqRxlVLQXVDmgGuEVRjgWNan2uxPx7c2hLl/9YIWqK+Mdf dE6JzhI+8xA4dijPrK6CvCqYIhruHwdUiunilI3Cf2VwD1ICD4+0EdPPDVBy59Yll4tP H5ZVRdiLcguvsksLK2DHQnVHLE6wIjrW5qlRUEZn+ffDZBDqLVXDr45HD89B/7BwoytB z7ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=h0AXilZP; 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 q3-20020a0cf5c3000000b0053428216ed9si3607455qvm.216.2023.02.12.23.12.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 23:12:40 -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=h0AXilZP; 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 1pRSyC-00033u-R9; Mon, 13 Feb 2023 02:09:49 -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 1pRSxy-0002uc-2V for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:09:34 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRSxv-0001zZ-PM for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:09:33 -0500 Received: by mail-wr1-x42d.google.com with SMTP id m10so2143228wrn.4 for ; Sun, 12 Feb 2023 23:09:31 -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=lbFFSEwuPaiVjYWiGHnO40wk80nlXCVErHPDaxFN7V8=; b=h0AXilZPMuuifXWn6Ugjch0fjOxNNFm1Ku88Ao8UPtppFwS1pd0kCUN61yO05g8WzJ clunATwYD3FpW5rnhw4E2Tz70teBS8BxJcmVJiIbJ3a3YS6fOcMGnKpnGA580CKNyzfc DMSKnNyTE66DfLvHAiRG9bxgvhYPXcmxlEUvDc9mP24cEzKNL9jGWxLxnn0vZkYvzAXp ws3rNFRUjRIEdnvrC1GQo0tp+1ZfRd+zRMHTtMBOTd+9w6/Q5NBaRjAbHzhcnYUlZuxZ ui0UCTEfPj+c4M2WVywtLVBA3vLao6vER2mLi1k8jxX/jTJ2o6Gaxp14EE6fbPT5w0ai SLlw== 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=lbFFSEwuPaiVjYWiGHnO40wk80nlXCVErHPDaxFN7V8=; b=39Mk1eWk3QKjaM9boUEMtET4LsxmRkUDBfN2BW34w58tgv8uoDCYr47yH/CzdFUeCa Q0MXdykABbIDN2r1NG7urk0TASKBkumjcjOro0J0BrUvd375ASyICpBE+FDQnvA1L3MQ HaEtXYaz9ssWqP/rm5Ju+BkzjqgGxUSsNUWgZEBZmaHA2Dewg+hLtP3ut1jz4II8ccCx YuHogu4Xfdh/KNF2TTH0decX3JJiVOSxvvOVsPOam3mrlTCuVeXEvjLcjjVKvg3IAtQT 0igdaPHK5PmnM0m+QdtIPisr8ft87MTIyIS9sFE5uYpN8QVF8yuNZ0G/Z2aXLl/Ujx8t Ushw== X-Gm-Message-State: AO0yUKXmKrQG1cPuz31l8ddD5OXMdCSI8zjx++gSV4J51jXuhISGLMu5 TL+JoedQPYK4kkzYbHMMEcfzEznI7Y6xYBeS X-Received: by 2002:adf:ec0b:0:b0:2c5:5ef8:fa36 with SMTP id x11-20020adfec0b000000b002c55ef8fa36mr256695wrn.70.1676272170305; Sun, 12 Feb 2023 23:09:30 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id q13-20020adff94d000000b002be099f78c0sm9634618wrr.69.2023.02.12.23.09.28 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 23:09:29 -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?= , Fam Zheng Subject: [PATCH v2 13/19] hw/scsi/scsi-bus: Replace DO_UPCAST(SCSIBus) by SCSI_BUS() Date: Mon, 13 Feb 2023 08:08:14 +0100 Message-Id: <20230213070820.76881-14-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::42d; envelope-from=philmd@linaro.org; helo=mail-wr1-x42d.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 Use the SCSI_BUS() QOM type-checking macro to avoid DO_UPCAST(). Signed-off-by: Philippe Mathieu-Daudé --- hw/scsi/scsi-bus.c | 12 ++++++------ include/hw/scsi/scsi.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index 7b2a82b335..c4525515ab 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -104,7 +104,7 @@ static void scsi_device_unrealize(SCSIDevice *s) int scsi_bus_parse_cdb(SCSIDevice *dev, SCSICommand *cmd, uint8_t *buf, size_t buf_len, void *hba_private) { - SCSIBus *bus = DO_UPCAST(SCSIBus, qbus, qdev_get_parent_bus(DEVICE(dev))); + SCSIBus *bus = SCSI_BUS(qdev_get_parent_bus(DEVICE(dev))); int rc; assert(cmd->len == 0); @@ -250,7 +250,7 @@ static bool scsi_bus_check_address(BusState *qbus, DeviceState *qdev, Error **er static void scsi_qdev_realize(DeviceState *qdev, Error **errp) { SCSIDevice *dev = SCSI_DEVICE(qdev); - SCSIBus *bus = DO_UPCAST(SCSIBus, qbus, qdev_get_parent_bus(DEVICE(dev))); + SCSIBus *bus = SCSI_BUS(qdev_get_parent_bus(qdev)); bool is_free; Error *local_err = NULL; @@ -705,7 +705,7 @@ SCSIRequest *scsi_req_alloc(const SCSIReqOps *reqops, SCSIDevice *d, SCSIRequest *scsi_req_new(SCSIDevice *d, uint32_t tag, uint32_t lun, uint8_t *buf, size_t buf_len, void *hba_private) { - SCSIBus *bus = DO_UPCAST(SCSIBus, qbus, qdev_get_parent_bus(DEVICE(d))); + SCSIBus *bus = SCSI_BUS(qdev_get_parent_bus(DEVICE(d))); const SCSIReqOps *ops; SCSIDeviceClass *sc = SCSI_DEVICE_GET_CLASS(d); SCSIRequest *req; @@ -1353,7 +1353,7 @@ int scsi_req_parse_cdb(SCSIDevice *dev, SCSICommand *cmd, uint8_t *buf, void scsi_device_report_change(SCSIDevice *dev, SCSISense sense) { - SCSIBus *bus = DO_UPCAST(SCSIBus, qbus, qdev_get_parent_bus(DEVICE(dev))); + SCSIBus *bus = SCSI_BUS(qdev_get_parent_bus(DEVICE(dev))); scsi_device_set_ua(dev, sense); if (bus->info->change) { @@ -1698,7 +1698,7 @@ static int put_scsi_requests(QEMUFile *f, void *pv, size_t size, const VMStateField *field, JSONWriter *vmdesc) { SCSIDevice *s = pv; - SCSIBus *bus = DO_UPCAST(SCSIBus, qbus, qdev_get_parent_bus(DEVICE(s))); + SCSIBus *bus = SCSI_BUS(qdev_get_parent_bus(DEVICE(s))); SCSIRequest *req; QTAILQ_FOREACH(req, &s->requests, next) { @@ -1726,7 +1726,7 @@ static int get_scsi_requests(QEMUFile *f, void *pv, size_t size, const VMStateField *field) { SCSIDevice *s = pv; - SCSIBus *bus = DO_UPCAST(SCSIBus, qbus, qdev_get_parent_bus(DEVICE(s))); + SCSIBus *bus = SCSI_BUS(qdev_get_parent_bus(DEVICE(s))); int8_t sbyte; while ((sbyte = qemu_get_sbyte(f)) > 0) { diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h index 843dde8851..eb558c145a 100644 --- a/include/hw/scsi/scsi.h +++ b/include/hw/scsi/scsi.h @@ -177,7 +177,7 @@ static inline void scsi_bus_init(SCSIBus *bus, size_t bus_size, static inline SCSIBus *scsi_bus_from_device(SCSIDevice *d) { - return DO_UPCAST(SCSIBus, qbus, qdev_get_parent_bus(DEVICE(d))); + return SCSI_BUS(qdev_get_parent_bus(DEVICE(d))); } SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockBackend *blk, 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, From patchwork Mon Feb 13 07:08:16 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: 653178 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2266525wrr; Sun, 12 Feb 2023 23:10:21 -0800 (PST) X-Google-Smtp-Source: AK7set9YGHM7tVOr93wKevMJfDRlCqw6VTg5zYKqxlJN9DZNoQoObrXa5KHgKu1KXkWxj+TQsVhX X-Received: by 2002:a05:6214:529c:b0:56e:a9cf:8dae with SMTP id kj28-20020a056214529c00b0056ea9cf8daemr7298263qvb.44.1676272221140; Sun, 12 Feb 2023 23:10:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676272221; cv=none; d=google.com; s=arc-20160816; b=SyhZ1lWRk3WuWaHQWmyX1xuzbOEkF931JRZm0jt7wmhS+WgHCAxXKgWQYsu8gdLLYO JggrnjAnYJAr/7hze3lo25QMC7MwaW6H7pD0gMkkctehcjgKz/7RWFiD+PrLTp2pZG1Y Zonl8SK94cP5Lc5dynioNXmNkfAxL9Rmf9hvARXn5cLIxk05r929gL9cwxSqWAQHUoAi m6uHqZQ62VWraAuttxx+gKHn4MBBSLw0StyXM2M+q8wMfQ+GnPkt+65e80Lj8OwXPiUZ ODWYeypmN9zd2cx5LKNknRFYL66XOdcHH8s8a0hZcJeU3RcbmK3izdfVyA9TcPkviX6a tltQ== 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=3lPcQ4RHMZ3h7WGdkWu74gz5pDiRQhZMKvDRNLxsYVM=; b=nuFrIJVM0N3yb/js9i7HkxdmXpBGJm/yAf3YmdTMeLPRNEWfxaadzHU0DZy97vx829 JOiEtFIEFxhtSFfQ60omM/O+fPFkmFdIYKh4bZRuHuw0DeAzCo3F5kN66bKRxjUPys8P TDqXzHHU98mvN6g/J0rmCzyc169gVtEBMwBzvbKY60VseJA+xNpsTnga9Eppo8HsLkVb 5AkFO/8Z/YbuvjI/ZYlfop9pE/oPDd4fpI6/PgcbSz4iwj6sjRjzQGDLr4IMcLYCwkCf eVL8hKAUCdmeFLgmIIl2YEowYu5lhrzAjXj1HeTrJ0APMvy+V8qV5KCG4Pmo8n9wa4lV JLRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wyPLaCOR; 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 o21-20020a05620a2a1500b007058429719dsi9552503qkp.300.2023.02.12.23.10.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 23:10:21 -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=wyPLaCOR; 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 1pRSyJ-0003Ut-Jy; Mon, 13 Feb 2023 02:09:56 -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 1pRSyA-000346-TI for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:09:47 -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 1pRSy7-00021f-OE for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:09:46 -0500 Received: by mail-wm1-x32a.google.com with SMTP id l21-20020a05600c1d1500b003dfe462b7e4so8027409wms.0 for ; Sun, 12 Feb 2023 23:09:41 -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=3lPcQ4RHMZ3h7WGdkWu74gz5pDiRQhZMKvDRNLxsYVM=; b=wyPLaCOROiDrV3rkwxSm3BX+Khn9+ppsF3yoF3tSm4blOeFJkfIjnHVY1Y4Fk5rHIM ms3UKjk7AUEZYPAX1xb/7Y/ljcQch47holiGwTaNILzvdQtry4KZn2ykj9TtGgqi/Bbu jWc1C1jvr2G/MF+VYt2AtjvylsJ3/1OOsbeYgzBsCmV2Asvl9T/XPxmfTUVhOEZP3MM2 Oy8YlXK2GVlV5FhbgYLV4Z4YwuIAqmt7VVV9v37xCEsnKWJ8k8PcMi6SLH7qZmDeb5i9 1u23fGGvwM4oJpjLbmaeDOAYXCNu+nezMJdNkYIIuNyH2F6hmJZqiatIz7mmeT12RGjv ftBg== 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=3lPcQ4RHMZ3h7WGdkWu74gz5pDiRQhZMKvDRNLxsYVM=; b=MOzor00VZiOvmHS6EIgvcQN2k9/K4lwJ+Wmsy2sRBSkLIEdt+VnKG/gBjluOXaKuIM Yh+rxGxcLxOfsGiIMsl1nfT0+a8vfTwmS67s8F1hk1sPcdL2MgONuTZVCy2wttBeDoxS VbQtegYr/GWotJNBLZwwHwXLFc0LApwpP/IvT7iv+ySPCf7U1KQT1XNkcTDWpSLrVjEs 1Mt3MlPlyHYCUEJiiGBSSnOhwYTBX0q7930449HvwXMj41MYZJh1dKIBNhjSYT5SXCfc CjYOcA1K8AaCfDzaWDWtmnYHs+uwoF1LmflGlPfqVTzWgD+XLGSy6vFZXthYYwS66TD6 6nwQ== X-Gm-Message-State: AO0yUKW87id1zcpYkp2NRaquRKhJZ5f8eHNq12T9GfiCLeeCPbCuHTBk 9n4GukvpSr1zureA2xLM1ZdYP5/e5uBIhR/A X-Received: by 2002:a05:600c:4da2:b0:3dc:51f6:8f58 with SMTP id v34-20020a05600c4da200b003dc51f68f58mr18304792wmp.6.1676272180875; Sun, 12 Feb 2023 23:09:40 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id s12-20020a05600c45cc00b003dfe5190376sm13794724wmo.35.2023.02.12.23.09.39 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 23:09:40 -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?= , Halil Pasic , Christian Borntraeger , Eric Farman , David Hildenbrand , Ilya Leoshkevich Subject: [PATCH v2 15/19] hw/s390x/event-facility: Replace DO_UPCAST(SCLPEvent) by SCLP_EVENT() Date: Mon, 13 Feb 2023 08:08:16 +0100 Message-Id: <20230213070820.76881-16-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::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 Use the SCLP_EVENT() QOM type-checking macro to avoid DO_UPCAST(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Eric Farman --- hw/s390x/event-facility.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/s390x/event-facility.c b/hw/s390x/event-facility.c index faa51aa4c7..6891e3cd73 100644 --- a/hw/s390x/event-facility.c +++ b/hw/s390x/event-facility.c @@ -64,8 +64,7 @@ static bool event_pending(SCLPEventFacility *ef) SCLPEventClass *event_class; QTAILQ_FOREACH(kid, &ef->sbus.qbus.children, sibling) { - DeviceState *qdev = kid->child; - event = DO_UPCAST(SCLPEvent, qdev, qdev); + event = SCLP_EVENT(kid->child); event_class = SCLP_EVENT_GET_CLASS(event); if (event->event_pending && event_class->get_send_mask() & ef->receive_mask) { From patchwork Mon Feb 13 07:08:17 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: 653184 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2267490wrr; Sun, 12 Feb 2023 23:13:44 -0800 (PST) X-Google-Smtp-Source: AK7set9rAxZVEwg9S+ZG0USW4QJtCbCjKMWrxE5+GY1pMDk1/7wtjusdmPr1z4+G29KxsSJcXisL X-Received: by 2002:ac8:5955:0:b0:3b3:7d5:a752 with SMTP id 21-20020ac85955000000b003b307d5a752mr40078394qtz.50.1676272424512; Sun, 12 Feb 2023 23:13:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676272424; cv=none; d=google.com; s=arc-20160816; b=d3AuhQqG2F5Fo4AvTMN7/8hjizR++EG9DaX/RFqNZbLVDIZbc766R/y6xuui5KuL+s l/rsgFXASJPkqIjZ0ITiR+rGaPBIAxU+UF+DVO6LmbR8Em2HWKENSOjYaQ8IkhnE7Y4Q L/+rNAQiUJyhE+Mkrk/HLLnH7uCgbR7z3Th68b9NseWPYquzPQtK9PYoj49RB/2ytRrA eU16OnNujz+AfRbNWGATa7Qd7+JyDRt5GRb0eucSkUDGCUKWBv850wf+TMY7BAm2T+jI r+xf/IhW6wz8HlrtAFTGIpYxWJEoiYCKwhDEdkyyf0Xf5BEFpUESnFWvCMoKqTdysOH7 XTYQ== 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=bInkmnburNvSek0igY2MOEI+V86XMbjL1VMr60EEqDs=; b=IVuGEos0aZe+kjkULW2lbPNrL/BM5f+MV+mpdqZREQWd4NmlXAZ/yFA72iAbE1h909 YwTAnkKQPgpSCzhjC74DGamamfLH6ws2zHdP76uEt0E0ItJXx9/dMU5jyCLGctFVINUt EyW+12NDPo/W1VbgnpLJ68LRgUCWsAsEjLm/reLxSiDyKfOQ57O2dTnXhpZP0jWVsWty bnWzhABYVMTzKGQwBpgopPnb6gnChIfj2M52QENCVmM6tBsd2t6TcILfUeCXX4TQ1KoS e8VOAwEuvanB6Pj8aVNSnUNvr/fbzTPEOEyn4DvzrkSsUcEtTCv1pPmfLmw5ajw6TK4Z tjCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NdZ2jjxH; 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 17-20020ac85911000000b003b1db7f5648si9228853qty.189.2023.02.12.23.13.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 23:13:44 -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=NdZ2jjxH; 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 1pRSyt-0004gV-7w; Mon, 13 Feb 2023 02:10:32 -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 1pRSyF-0003Di-MD for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:09:52 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRSyB-00022Z-Kl for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:09:50 -0500 Received: by mail-wr1-x42b.google.com with SMTP id by3so9741306wrb.10 for ; Sun, 12 Feb 2023 23:09:47 -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=bInkmnburNvSek0igY2MOEI+V86XMbjL1VMr60EEqDs=; b=NdZ2jjxHfwKHVO3zxd9GWFL/7DG4seCf3p1lLGLysBNRih2X39+4ns8/RaqThZKT+D yJ8kv2NHjwfUnK0zfQAM420F2LUFUIiX/s7fg+fFcxZmpilm2EPyvL6qgdGdZf1qfLXX vE8XDRqb3cK9iwlfk+J0apqoKKOl13UsLSAtk9TUQnBCa4GatpguXldyht7KpgwsVLN9 rnWczNb6TBF+dDLy7ATcAVbTrCR5KuAzaANS+0waGYK9zNspH7BLn3msI/oQzeqUe3WL X8k/kdODFYyScOykY8GIn5eZ4uQrvKHIvquWXmyUYaFp87C+2ZnHN1A+UVyp1jRIMkA6 ytEw== 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=bInkmnburNvSek0igY2MOEI+V86XMbjL1VMr60EEqDs=; b=HfR3Olsp2RintwGpOSEEc0w4T9AHRsR4rOGG3fL+99ThnE3oND1mIazSuuYpP6zmpa iO9R5PjUNPn9p+cP3ogmGT3Zur82W7iMrQu0n+KN+QgqtUVMzU4yifTgBJdIp9hobrH2 P3GXAj61/CcmRoVMsZOs4lQWxNj1HTb/gVqhwJ0Ze0W5xaFMwzA7XA6S+TGjeomFvigH KxZXMivDF4HCgVHMXfK9OUGAZRFQooxn5Uh9RXmUmaeD+X1c7szojuwRZUIGHsAMfguK q9T/M1SByOsdVgb4sdDPIMS2RRVVxRrpV5LCdl5dAZtktWcxUxYNpmjsnEmZwQ99GeJI p87w== X-Gm-Message-State: AO0yUKUGuMms2gYgCqNF7Ijrs+MoI6jMlQC4t+RImF/2Tr0/WrfFw8pb 1rDQGHiJq9GCCYKqY8p5DL62JUZX/hWVZHy3 X-Received: by 2002:a5d:6707:0:b0:2c3:d69a:1da7 with SMTP id o7-20020a5d6707000000b002c3d69a1da7mr18641043wru.0.1676272186099; Sun, 12 Feb 2023 23:09:46 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id u10-20020a5d514a000000b002c3e28d0343sm9540429wrt.85.2023.02.12.23.09.44 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 23:09:45 -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?= , Alex Williamson , Eric Farman , Matthew Rosato Subject: [PATCH v2 16/19] hw/vfio/ccw: Replace DO_UPCAST(VFIOCCWDevice) by VFIO_CCW() Date: Mon, 13 Feb 2023 08:08:17 +0100 Message-Id: <20230213070820.76881-17-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::42b; envelope-from=philmd@linaro.org; helo=mail-wr1-x42b.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 Use the VFIO_CCW() QOM type-checking macro to avoid DO_UPCAST(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Eric Farman --- hw/vfio/ccw.c | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c index 0354737666..a8aa5b48c4 100644 --- a/hw/vfio/ccw.c +++ b/hw/vfio/ccw.c @@ -76,8 +76,7 @@ struct VFIODeviceOps vfio_ccw_ops = { static IOInstEnding vfio_ccw_handle_request(SubchDev *sch) { - S390CCWDevice *cdev = sch->driver_data; - VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev); + VFIOCCWDevice *vcdev = VFIO_CCW(sch->driver_data); struct ccw_io_region *region = vcdev->io_region; int ret; @@ -125,8 +124,7 @@ again: static IOInstEnding vfio_ccw_handle_store(SubchDev *sch) { - S390CCWDevice *cdev = sch->driver_data; - VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev); + VFIOCCWDevice *vcdev = VFIO_CCW(sch->driver_data); SCHIB *schib = &sch->curr_status; struct ccw_schib_region *region = vcdev->schib_region; SCHIB *s; @@ -170,8 +168,7 @@ static IOInstEnding vfio_ccw_handle_store(SubchDev *sch) static int vfio_ccw_handle_clear(SubchDev *sch) { - S390CCWDevice *cdev = sch->driver_data; - VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev); + VFIOCCWDevice *vcdev = VFIO_CCW(sch->driver_data); struct ccw_cmd_region *region = vcdev->async_cmd_region; int ret; @@ -210,8 +207,7 @@ again: static int vfio_ccw_handle_halt(SubchDev *sch) { - S390CCWDevice *cdev = sch->driver_data; - VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev); + VFIOCCWDevice *vcdev = VFIO_CCW(sch->driver_data); struct ccw_cmd_region *region = vcdev->async_cmd_region; int ret; @@ -252,8 +248,8 @@ again: static void vfio_ccw_reset(DeviceState *dev) { CcwDevice *ccw_dev = DO_UPCAST(CcwDevice, parent_obj, dev); - S390CCWDevice *cdev = DO_UPCAST(S390CCWDevice, parent_obj, ccw_dev); - VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev); + S390CCWDevice *cdev = S390_CCW_DEVICE(ccw_dev); + VFIOCCWDevice *vcdev = VFIO_CCW(cdev); ioctl(vcdev->vdev.fd, VFIO_DEVICE_RESET); } @@ -588,9 +584,10 @@ static void vfio_ccw_put_device(VFIOCCWDevice *vcdev) static void vfio_ccw_get_device(VFIOGroup *group, VFIOCCWDevice *vcdev, Error **errp) { - char *name = g_strdup_printf("%x.%x.%04x", vcdev->cdev.hostid.cssid, - vcdev->cdev.hostid.ssid, - vcdev->cdev.hostid.devid); + S390CCWDevice *cdev = S390_CCW_DEVICE(vcdev); + char *name = g_strdup_printf("%x.%x.%04x", cdev->hostid.cssid, + cdev->hostid.ssid, + cdev->hostid.devid); VFIODevice *vbasedev; QLIST_FOREACH(vbasedev, &group->device_list, next) { @@ -611,14 +608,14 @@ static void vfio_ccw_get_device(VFIOGroup *group, VFIOCCWDevice *vcdev, */ vcdev->vdev.ram_block_discard_allowed = true; - if (vfio_get_device(group, vcdev->cdev.mdevid, &vcdev->vdev, errp)) { + if (vfio_get_device(group, cdev->mdevid, &vcdev->vdev, errp)) { goto out_err; } vcdev->vdev.ops = &vfio_ccw_ops; vcdev->vdev.type = VFIO_DEVICE_TYPE_CCW; vcdev->vdev.name = name; - vcdev->vdev.dev = &vcdev->cdev.parent_obj.parent_obj; + vcdev->vdev.dev = &cdev->parent_obj.parent_obj; return; @@ -657,9 +654,9 @@ static void vfio_ccw_realize(DeviceState *dev, Error **errp) { VFIOGroup *group; CcwDevice *ccw_dev = DO_UPCAST(CcwDevice, parent_obj, dev); - S390CCWDevice *cdev = DO_UPCAST(S390CCWDevice, parent_obj, ccw_dev); - VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev); + S390CCWDevice *cdev = S390_CCW_DEVICE(ccw_dev); S390CCWDeviceClass *cdc = S390_CCW_DEVICE_GET_CLASS(cdev); + VFIOCCWDevice *vcdev = VFIO_CCW(cdev); Error *err = NULL; /* Call the class init function for subchannel. */ @@ -729,9 +726,9 @@ out_err_propagate: static void vfio_ccw_unrealize(DeviceState *dev) { CcwDevice *ccw_dev = DO_UPCAST(CcwDevice, parent_obj, dev); - S390CCWDevice *cdev = DO_UPCAST(S390CCWDevice, parent_obj, ccw_dev); - VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev); + S390CCWDevice *cdev = S390_CCW_DEVICE(ccw_dev); S390CCWDeviceClass *cdc = S390_CCW_DEVICE_GET_CLASS(cdev); + VFIOCCWDevice *vcdev = VFIO_CCW(cdev); VFIOGroup *group = vcdev->vdev.group; vfio_ccw_unregister_irq_notifier(vcdev, VFIO_CCW_REQ_IRQ_INDEX); From patchwork Mon Feb 13 07:08:18 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: 653186 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2267503wrr; Sun, 12 Feb 2023 23:13:46 -0800 (PST) X-Google-Smtp-Source: AK7set+kYems5Y3P5jyf1L8eoov3/BiRZFXbr6M899aKLiYvhyXuEP2Qz8q04c9n8bvfdOTeeDMf X-Received: by 2002:ad4:5aa4:0:b0:56e:a2a1:a4b2 with SMTP id u4-20020ad45aa4000000b0056ea2a1a4b2mr12188541qvg.15.1676272426769; Sun, 12 Feb 2023 23:13:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676272426; cv=none; d=google.com; s=arc-20160816; b=aAOEI7HA6WTYAo2Vl8wPw5U6moJLFfLJFMNtRggnUK8v4eAEnnphmTSLfnTAS5DfbO ieCPqfbSb62Ppe+9qhS02cCBZf0D5gFJHp1LF7noktIqqSSxjCQjOQz9SVJ8O8xFXgsS 8WRD4HUdwpGdkF9DY8UVAFhuFOxmp1Q5M56l1dh0hl3R+fP7wXSL/uwBhdmiij98/vq0 qjOFNUg2nRxG3ahmQ2q1i3qgP87tTn8/JuU+PGqdltjh4gi8YeZgcfrShohaWwUB5cRX kQKAqRorv7dQKfUgbaFT7fnt7ViE4gCu3157KY6vsJh/8KTsM7JLQ0v89h4ECsobEMhe tabw== 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=yI1y6XZsaobmGFW1lR+eKSaDWZj5kiLu704LCMt3Xc4=; b=IzNCq0U+GS4qI9sN1b6RWsvVK/9XPTPPiXTZw6J6kBusg/6kNikQqw15Skz+63qGnI aem/4SSBVPs9ZpzrVagmlD3yNFADL6byrXoqfDVW/XA5R2aMtRqvlEjOMedayLHonwEi Uz7P4UkVJ8TVcnoJRgqkZH82yhRfRAj4TG/6m0nIv2pUk316rnC5UCrCQIGk8zdkWqUu bKi4vzP+RtkCULsVw5VEj8QrY64dX2Ve0DBaQctDRwb+rYhO/zfgo7mn90qPB5RJxCiz QuTMA9O262wYZWNINop0h3YRurKfjXcDCX24u/hVGCJk/38pQx0FV/7DShAnL1jHdYAz qsvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PEjnApu6; 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 w4-20020a0ce104000000b00563a0593d03si8981886qvk.92.2023.02.12.23.13.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 23:13:46 -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=PEjnApu6; 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 1pRSyy-0004r0-De; Mon, 13 Feb 2023 02:10:36 -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 1pRSyN-0003tk-D1 for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:09:59 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRSyH-00024E-9l for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:09:57 -0500 Received: by mail-wr1-x42d.google.com with SMTP id a2so11055231wrd.6 for ; Sun, 12 Feb 2023 23:09:52 -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=yI1y6XZsaobmGFW1lR+eKSaDWZj5kiLu704LCMt3Xc4=; b=PEjnApu6TTu698sYM55m8Z3E3/9k4DcRWXeMXGGS6/Ng6vwAHn2HDfe9kzhADYBZib KSW5j24X7L8h4h2EafI7llrkn2FtUjcOnMgieyawDbd6go+K4pDy5VXLW64brXWD0mbv e+igIDPauhKe01U2a3AAyaW7q6ln8e2zrzeJ4aNS+5zvDxT6V7E6BcCsFv7L2Q4L9UfX +sC1uRltwHtHzDsxE/sZkKDR/mI2uiig3vQHF6hYw3CKAMlTGLoFEJyz1+laVhCgKFIV IYIB5Em6jEeO8GtJ6ExjimV/vr0sNghViv5d4qk7/MibdMltXhMgJzL0GOevYa8D5XTi YqOA== 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=yI1y6XZsaobmGFW1lR+eKSaDWZj5kiLu704LCMt3Xc4=; b=2YEU/+FfawCvkL8UZpVM/1yGAhutldb6bJ/2MSRyPrqHSmux8ZCLYijPpGgQ5cwpp5 OSVjPSaRCQBQwaO5OPCU0DyCveUXvL/+1bFZfuk48Y8dEZuK+NY1UVl3oY4vGP/OhQEp e+FMYFqnVGOWwtdrwQRlYGdW8UQ+Rfib9aR7eatt29xQOH53/HXa0DdHX+NsOEO14yH9 vH3LRkQWZ0VsUVHwzhICEJmW8msMJvTJkEdoi5F1y8hadVlF9EaMAgSU9u1I14buQdNG /aNQwMQjwvADraZ/IKGaSx+ELEXtH4wRbuZlGZhjOm2TICWUU5npl1ievRHTrbSEkclG 4KwQ== X-Gm-Message-State: AO0yUKVsqFoc+9eCGPUlzjOKVb959OBtbIaxuYmUTc++yNrKn4oWwvmf I2k3lbLMZ3uxywadMqnKsb7BkJHwFNq0oplo X-Received: by 2002:a5d:6206:0:b0:2c3:e868:cf54 with SMTP id y6-20020a5d6206000000b002c3e868cf54mr22337418wru.13.1676272191218; Sun, 12 Feb 2023 23:09:51 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id d1-20020adffd81000000b002bfe08c566fsm9616056wrr.106.2023.02.12.23.09.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 23:09:50 -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?= , Gerd Hoffmann Subject: [PATCH v2 17/19] hw/usb/dev-hub: Use QOM USB_HUB() macro instead of casting Date: Mon, 13 Feb 2023 08:08:18 +0100 Message-Id: <20230213070820.76881-18-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::42d; envelope-from=philmd@linaro.org; helo=mail-wr1-x42d.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 Use the safer USB_HUB() QOM type-checking macro instead of casts. Signed-off-by: Philippe Mathieu-Daudé --- hw/usb/dev-hub.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/usb/dev-hub.c b/hw/usb/dev-hub.c index a6b50dbc8d..4734700e3e 100644 --- a/hw/usb/dev-hub.c +++ b/hw/usb/dev-hub.c @@ -350,7 +350,7 @@ static const char *feature_name(int feature) static void usb_hub_handle_control(USBDevice *dev, USBPacket *p, int request, int value, int index, int length, uint8_t *data) { - USBHubState *s = (USBHubState *)dev; + USBHubState *s = USB_HUB(dev); int ret; trace_usb_hub_control(s->dev.addr, request, value, index, length); @@ -523,7 +523,7 @@ static void usb_hub_handle_control(USBDevice *dev, USBPacket *p, static void usb_hub_handle_data(USBDevice *dev, USBPacket *p) { - USBHubState *s = (USBHubState *)dev; + USBHubState *s = USB_HUB(dev); switch(p->pid) { case USB_TOKEN_IN: @@ -568,7 +568,7 @@ static void usb_hub_handle_data(USBDevice *dev, USBPacket *p) static void usb_hub_unrealize(USBDevice *dev) { - USBHubState *s = (USBHubState *)dev; + USBHubState *s = USB_HUB(dev); int i; for (i = 0; i < s->num_ports; i++) { From patchwork Mon Feb 13 07:08:19 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: 653187 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2267506wrr; Sun, 12 Feb 2023 23:13:47 -0800 (PST) X-Google-Smtp-Source: AK7set9wgQqz3r/Lax/Dew6ksWCBoFp4115R2NJ51CUUWHq6Q7JA0O5SFJ078bYNhnlvWtNNlitz X-Received: by 2002:a05:6214:27ce:b0:56e:913c:5b2f with SMTP id ge14-20020a05621427ce00b0056e913c5b2fmr24184105qvb.11.1676272427091; Sun, 12 Feb 2023 23:13:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676272427; cv=none; d=google.com; s=arc-20160816; b=gaDqZW1ztd6dkoQCCFTiBYNNZq3xUB1PPkGrdqi1xzxdAwflOMaFDQcnBdwriSWrKL bODXTs8CtF9H254hp/VQsljUb4CIUGe1FrtjyuP/l87LLrdMiH+ZwC12yvNKnSIQ0mbc N/9M2svLArHPTa0+ckAGs6T1cQjheLPpU95OHlmyr8YgGxhij9Ob0UzEKuL1hX0r/2s9 iiycMaE04WGmY8w6n7unaNT+OKFW90z++5MQd3Ic98ruPXpXgxMXnAJEgbvvZu3t6Nn+ rtSYAjHT1T2oWpYJ7X8lzan3f7E3uw234I+K4YMuskDeXMWcMOsTOUPow4ahRM2UMMZE nZww== 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=BCofvFRozrpBRIR6kzkyhIQPbWbeiNV/KXSS7SVLec8=; b=ltDIPqPGV7HXKMaRrToo6cO5Y2R+WfpJ4elQ5AffVQHVvQyh69dxGMEHzCW+ketCTi mHf9LQFv8RGQcHYqasSluHmsS1w7DDy4H1WvFKa4KGHoDU0NUbrSvcKL0XgV0Jh3MiEy NHy+FdOHi9Je92C0dqWNU11LpDcpDXzCyGvTT1oQdfqh4qB78UkdRuNwGUZimBBudd5c sd3m/fAhSNKmDMPvcRPuZxxZysdr+/LKRKTimnd8npMIVzCdgD3cOM4dTFN3mqDa1Pkj CacEsaCYmMuvSeDAwFaAh8Z1I8UbM7yTFI4POzLC9zdeF8b6GjTxCAXQZURu3oqInQRU KrDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DmjN9A8N; 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 x20-20020a0ce0d4000000b00529831bf68fsi8993326qvk.199.2023.02.12.23.13.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 23:13:47 -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=DmjN9A8N; 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 1pRSyy-0004qw-Dg; Mon, 13 Feb 2023 02:10:36 -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 1pRSyP-0004Gx-US for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:10:03 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRSyN-000258-3k for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:10:01 -0500 Received: by mail-wr1-x434.google.com with SMTP id a2so11055383wrd.6 for ; Sun, 12 Feb 2023 23:09:57 -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=BCofvFRozrpBRIR6kzkyhIQPbWbeiNV/KXSS7SVLec8=; b=DmjN9A8NmF78QSEwr/50ppyqm0pQQUOMfAO/KZGqKnHj6eet2/ggUCdnjMGltLz9Xl t+G+2Z8rExOZ3DR6NYrn6CefSivzueggKCjhxJcdfos8ka9vCuih0sHjtg46YOjgpEWo QRwV4JF8/3EUrFzXF3Sp79UbaplTiv+JdykmCICSH5LNZOv//oRm5lA+Ajk/nigXNBlf yWWkAkbCtZwNFr89RtBFMpQLcUPoMRpVaYgeEUIn5PWDPwwELiSa/CR0Ejn7c5aQD9Ga M4qFfnTHEpNa7Dj/A0Rhedv+VaceLwDR9SLLoAsZ2WKuqYZMm4yBzUj7QAK+oTwMdTwm D7YQ== 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=BCofvFRozrpBRIR6kzkyhIQPbWbeiNV/KXSS7SVLec8=; b=oWo9fHx7APDQdKcZ14lIOUU0NHUVxfEUoc1e++COlkvSqqxmygQgcwgyEWL2wSgdjO 6ESLmotj+eQoS5V6KtZ2+fYqH1xzUmudG1ub6T+MvGLkAqBk6JrGDHyxA0eDtvfLHa0S aMBxsRji8C2gSXP2swUFaGSDIOvV4Cz3gQ4AJ1BXEgGNHzNx+hxx+bK+9YeYJ8VKUGUG aul6ZAYnMyCdX2FjFW9/Ie5vjXFyTViXIdK015WwtcVnqXu3lbbavwscJqqv2G8X+Zg0 ZpL70RDE5yxIzgcSaB6YoY4OGyiN4eWE39rpY7qhF2S3jL3mzD4Ks7R/fi9rA/OIqRuH EkTg== X-Gm-Message-State: AO0yUKWiuP46M2+6wz07Ezyw8Np5ginOpQ0xh4op4e99aZp3zD5Ovibd M+a8ApWV0gAOQXVQEjgPC9HU4tk1HiDSNPaF X-Received: by 2002:adf:fec7:0:b0:2c5:4cf1:a57b with SMTP id q7-20020adffec7000000b002c54cf1a57bmr6930067wrs.35.1676272196366; Sun, 12 Feb 2023 23:09:56 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id k6-20020adfe8c6000000b002c55551e6e9sm2958632wrn.108.2023.02.12.23.09.55 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 23:09:56 -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?= , Gerd Hoffmann Subject: [PATCH v2 18/19] hw/usb: Replace DO_UPCAST(USBBus) by USB_BUS() Date: Mon, 13 Feb 2023 08:08:19 +0100 Message-Id: <20230213070820.76881-19-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::434; envelope-from=philmd@linaro.org; helo=mail-wr1-x434.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 Use the USB_BUS() QOM type-checking macro to avoid DO_UPCAST(). Signed-off-by: Philippe Mathieu-Daudé --- include/hw/usb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/hw/usb.h b/include/hw/usb.h index b2111bb1c7..f743a5e945 100644 --- a/include/hw/usb.h +++ b/include/hw/usb.h @@ -520,7 +520,7 @@ void usb_check_attach(USBDevice *dev, Error **errp); static inline USBBus *usb_bus_from_device(USBDevice *d) { - return DO_UPCAST(USBBus, qbus, qdev_get_parent_bus(DEVICE(d))); + return USB_BUS(qdev_get_parent_bus(DEVICE(d))); } extern const VMStateDescription vmstate_usb_device; From patchwork Mon Feb 13 07:08:20 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: 653185 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2267500wrr; Sun, 12 Feb 2023 23:13:46 -0800 (PST) X-Google-Smtp-Source: AK7set//21X+fnkTvyoUywnK2ZlduTHxvRbOeIQOKuwNbBAahrn20CbK0k7AlpQvTM9M5kWWL5eq X-Received: by 2002:a05:622a:1044:b0:3b8:6cb3:e54a with SMTP id f4-20020a05622a104400b003b86cb3e54amr43900795qte.5.1676272426446; Sun, 12 Feb 2023 23:13:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676272426; cv=none; d=google.com; s=arc-20160816; b=WiFiaXeFruuWnqmEb00idcxV619GBhiA+vK5eKFOMcDpfGNGOsVRBG1LBdiXx6ggO5 HJ+fn9jY4qVQ06Aq9x8oHork8n95CVX1ycAvgLFfwRU9yBLCwWhD5cFwHTShCgRFUVVr QvtDB8cy+alHlLzXRdaUYqmmEtlSQc++WGZ6qxUpW0pi7EjBDP7ePyKZOmi+CEKYZGsl kJVgtNR1WqvAZmUm87OJCw0rQfbPw/WS1DxV37R5x7C6za1MbB6G3khzgSI/mtmKArQL /1bYcl+YnscGEBhVpgdsoOYY8pMaDexfDEun/mH49NfvDzbmfJyzyCxUChj3QaE2pd2+ 8mdQ== 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=Y7MPn97FcL/7BFhSjHMb1CUqDm78YK7bxAD/KSpYvWc=; b=nrdGv/sh/HvF8T2fZYGKppC0Zn7u836XhEPd/lJb0G/qt8300uRBwDupix8K6rxGOi 8uselly8/w6UQ5vVz3um/nNIPIr9Fdwa+TfTvYeCe35qc+Vtskpb2uKAedraIkNNolHt 6l1l2EgX2XCWEZQVS7HazkLIuc6I06XXA0M+FKsNiOfgtBGYnQIahCVsvDNHg3STicLE HCwEFC9mwinvNHm76xBIPwj6P1M+Nd8drLLJmiJDuJXdTekckexmFEYTK1zQ4RzOgdK1 lkkqWtcwc+3CXl/sx8/CUlLl9mLzOrOm/+OBnDPYxilRVgqif780u911Z4dZq9XWnBB0 htNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PbIjnEK0; 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 16-20020a370410000000b0073878c12330si8146202qke.8.2023.02.12.23.13.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 23:13:46 -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=PbIjnEK0; 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 1pRSz3-0005mi-Lt; Mon, 13 Feb 2023 02:10:41 -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 1pRSyU-0004Mb-10 for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:10:10 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRSyR-000277-3S for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:10:05 -0500 Received: by mail-wm1-x32e.google.com with SMTP id j32-20020a05600c1c2000b003dc4fd6e61dso10536966wms.5 for ; Sun, 12 Feb 2023 23:10:02 -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=Y7MPn97FcL/7BFhSjHMb1CUqDm78YK7bxAD/KSpYvWc=; b=PbIjnEK0vOkIy6Q5r92K0uSv2HnIhKwWJ3NgRPeg3bBu3+qEK/Xxf1Fz1K0lzwef6x n6ppT6pyFrmMfNQuHHTOZwNA71hcJ3g1D5olFHDVMum9ZKgtRI78t8eBpdWYbgEePOoR 6JfF7TCjSKRDWnlmxLZA/ddPQLY56974DG/aTqNuBLnf/UFeOTrNeasHTRo18sL3KTWG hWh1fJmBQSMW4g5QgbkQc1nIbuYcCn7opQiYlWTasZR37YL0IkMdHgbsNt7JmUdItIOd kjNYSJwSRG9Jy9tvXIIhI4a09uM0V2m9czsIAl+Xg/uMbbSx/tep93CyNtqbDDxfMi4J NxQQ== 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=Y7MPn97FcL/7BFhSjHMb1CUqDm78YK7bxAD/KSpYvWc=; b=cW5PWRqfSOUElhKHd5gC6L24zP9g/XiSnBCAeiFJlq1jC7JDyqrsMSdYb+NDTO5cdz iiSPMWlE/y8bz1DZ9u3frscR4XjYLdCEgEgyCi92CunSP1pYmRDvePgqW8z6xhtcZCob 0eVgOtycHAC72p52ynaqh707HCtwirZNzOa0AiD5rAhUKcIZH9jerfwg9ei/ywDy89J2 UGSi4TzZQr5qRtguR1x2UnE4cJdEBATU/jocpIDE5p/sxxtblee0XAzJqg18+7y29Sv/ A9Jx7opHjx6CSV3Ul+3PH3dw8/gb+SyWQCMve077nHuPbSMmoZUpNlNI1mYzrOYz5E2H yxyw== X-Gm-Message-State: AO0yUKVqS4qYOOclexCfKLlW4Yo0ExIxTyA6Y+iK60PlFO640g2KKggS Uqe//br//gLiIDDb9utUpD3LzvdOYGzM7JhE X-Received: by 2002:a05:600c:4d90:b0:3de:1d31:1042 with SMTP id v16-20020a05600c4d9000b003de1d311042mr22502422wmp.23.1676272201598; Sun, 12 Feb 2023 23:10:01 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id x7-20020a05600c188700b003cffd3c3d6csm12504916wmp.12.2023.02.12.23.10.00 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 23:10:01 -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?= , Gerd Hoffmann , Samuel Thibault Subject: [RFC PATCH v2 19/19] hw/usb: Inline usb_bus_from_device() Date: Mon, 13 Feb 2023 08:08:20 +0100 Message-Id: <20230213070820.76881-20-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::32e; envelope-from=philmd@linaro.org; helo=mail-wm1-x32e.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é --- RFC Other devices don't use such helper. Maybe it should be the other way around, introduce more bus_from_device() helpers? --- hw/usb/bus.c | 10 +++++----- hw/usb/core.c | 6 +++--- hw/usb/dev-hub.c | 4 ++-- hw/usb/dev-serial.c | 10 +++++----- hw/usb/hcd-xhci.c | 2 +- include/hw/usb.h | 5 ----- 6 files changed, 16 insertions(+), 21 deletions(-) diff --git a/hw/usb/bus.c b/hw/usb/bus.c index d7c3c71435..4a1b67761c 100644 --- a/hw/usb/bus.c +++ b/hw/usb/bus.c @@ -427,7 +427,7 @@ void usb_unregister_port(USBBus *bus, USBPort *port) void usb_claim_port(USBDevice *dev, Error **errp) { - USBBus *bus = usb_bus_from_device(dev); + USBBus *bus = USB_BUS(qdev_get_parent_bus(DEVICE(dev))); USBPort *port; USBDevice *hub; @@ -473,7 +473,7 @@ void usb_claim_port(USBDevice *dev, Error **errp) void usb_release_port(USBDevice *dev) { - USBBus *bus = usb_bus_from_device(dev); + USBBus *bus = USB_BUS(qdev_get_parent_bus(DEVICE(dev))); USBPort *port = dev->port; assert(port != NULL); @@ -517,7 +517,7 @@ static void usb_mask_to_str(char *dest, size_t size, void usb_check_attach(USBDevice *dev, Error **errp) { - USBBus *bus = usb_bus_from_device(dev); + USBBus *bus = USB_BUS(qdev_get_parent_bus(DEVICE(dev))); USBPort *port = dev->port; char devspeed[32], portspeed[32]; @@ -555,7 +555,7 @@ void usb_device_attach(USBDevice *dev, Error **errp) int usb_device_detach(USBDevice *dev) { - USBBus *bus = usb_bus_from_device(dev); + USBBus *bus = USB_BUS(qdev_get_parent_bus(DEVICE(dev))); USBPort *port = dev->port; assert(port != NULL); @@ -583,7 +583,7 @@ static const char *usb_speed(unsigned int speed) static void usb_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent) { USBDevice *dev = USB_DEVICE(qdev); - USBBus *bus = usb_bus_from_device(dev); + USBBus *bus = USB_BUS(qdev_get_parent_bus(qdev)); monitor_printf(mon, "%*saddr %d.%d, port %s, speed %s, name %s%s\n", indent, "", bus->busnr, dev->addr, diff --git a/hw/usb/core.c b/hw/usb/core.c index 975f76250a..f358f0313a 100644 --- a/hw/usb/core.c +++ b/hw/usb/core.c @@ -95,7 +95,7 @@ void usb_device_reset(USBDevice *dev) void usb_wakeup(USBEndpoint *ep, unsigned int stream) { USBDevice *dev = ep->dev; - USBBus *bus = usb_bus_from_device(dev); + USBBus *bus = USB_BUS(qdev_get_parent_bus(DEVICE(dev))); if (!phase_check(PHASE_MACHINE_READY)) { /* @@ -556,7 +556,7 @@ void usb_packet_check_state(USBPacket *p, USBPacketState expected) return; } dev = p->ep->dev; - bus = usb_bus_from_device(dev); + bus = USB_BUS(qdev_get_parent_bus(DEVICE(dev))); trace_usb_packet_state_fault(bus->busnr, dev->port->path, p->ep->nr, p, usb_packet_state_name(p->state), usb_packet_state_name(expected)); @@ -567,7 +567,7 @@ void usb_packet_set_state(USBPacket *p, USBPacketState state) { if (p->ep) { USBDevice *dev = p->ep->dev; - USBBus *bus = usb_bus_from_device(dev); + USBBus *bus = USB_BUS(qdev_get_parent_bus(DEVICE(dev))); trace_usb_packet_state_change(bus->busnr, dev->port->path, p->ep->nr, p, usb_packet_state_name(p->state), usb_packet_state_name(state)); diff --git a/hw/usb/dev-hub.c b/hw/usb/dev-hub.c index 4734700e3e..4a0bcc4093 100644 --- a/hw/usb/dev-hub.c +++ b/hw/usb/dev-hub.c @@ -572,7 +572,7 @@ static void usb_hub_unrealize(USBDevice *dev) int i; for (i = 0; i < s->num_ports; i++) { - usb_unregister_port(usb_bus_from_device(dev), + usb_unregister_port(USB_BUS(qdev_get_parent_bus(DEVICE(dev))), &s->ports[i].port); } @@ -611,7 +611,7 @@ static void usb_hub_realize(USBDevice *dev, Error **errp) s->intr = usb_ep_get(dev, USB_TOKEN_IN, 1); for (i = 0; i < s->num_ports; i++) { port = &s->ports[i]; - usb_register_port(usb_bus_from_device(dev), + usb_register_port(USB_BUS(qdev_get_parent_bus(DEVICE(dev))), &port->port, s, i, &usb_hub_port_ops, USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL); usb_port_location(&port->port, dev->port, i+1); diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c index 63047d79cf..0194bb541b 100644 --- a/hw/usb/dev-serial.c +++ b/hw/usb/dev-serial.c @@ -190,7 +190,7 @@ static void usb_serial_set_flow_control(USBSerialState *s, uint8_t flow_control) { USBDevice *dev = USB_DEVICE(s); - USBBus *bus = usb_bus_from_device(dev); + USBBus *bus = USB_BUS(qdev_get_parent_bus(DEVICE(dev))); /* TODO: ioctl */ s->flow_control = flow_control; @@ -200,7 +200,7 @@ static void usb_serial_set_flow_control(USBSerialState *s, static void usb_serial_set_xonxoff(USBSerialState *s, int xonxoff) { USBDevice *dev = USB_DEVICE(s); - USBBus *bus = usb_bus_from_device(dev); + USBBus *bus = USB_BUS(qdev_get_parent_bus(DEVICE(dev))); s->xon = xonxoff & 0xff; s->xoff = (xonxoff >> 8) & 0xff; @@ -221,7 +221,7 @@ static void usb_serial_reset(USBSerialState *s) static void usb_serial_handle_reset(USBDevice *dev) { USBSerialState *s = USB_SERIAL(dev); - USBBus *bus = usb_bus_from_device(dev); + USBBus *bus = USB_BUS(qdev_get_parent_bus(DEVICE(dev))); trace_usb_serial_reset(bus->busnr, dev->addr); @@ -261,7 +261,7 @@ static void usb_serial_handle_control(USBDevice *dev, USBPacket *p, int length, uint8_t *data) { USBSerialState *s = USB_SERIAL(dev); - USBBus *bus = usb_bus_from_device(dev); + USBBus *bus = USB_BUS(qdev_get_parent_bus(DEVICE(dev))); int ret; trace_usb_serial_handle_control(bus->busnr, dev->addr, request, value); @@ -479,7 +479,7 @@ static void usb_serial_token_in(USBSerialState *s, USBPacket *p) static void usb_serial_handle_data(USBDevice *dev, USBPacket *p) { USBSerialState *s = USB_SERIAL(dev); - USBBus *bus = usb_bus_from_device(dev); + USBBus *bus = USB_BUS(qdev_get_parent_bus(DEVICE(dev))); uint8_t devep = p->ep->nr; struct iovec *iov; int i; diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index b89b618ec2..94c2e58aaf 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -3268,7 +3268,7 @@ static void xhci_complete(USBPort *port, USBPacket *packet) static void xhci_child_detach(USBPort *uport, USBDevice *child) { - USBBus *bus = usb_bus_from_device(child); + USBBus *bus = USB_BUS(qdev_get_parent_bus(DEVICE(child))); XHCIState *xhci = container_of(bus, XHCIState, bus); xhci_detach_slot(xhci, child->port); diff --git a/include/hw/usb.h b/include/hw/usb.h index f743a5e945..4a2987c477 100644 --- a/include/hw/usb.h +++ b/include/hw/usb.h @@ -518,11 +518,6 @@ void usb_device_attach(USBDevice *dev, Error **errp); int usb_device_detach(USBDevice *dev); void usb_check_attach(USBDevice *dev, Error **errp); -static inline USBBus *usb_bus_from_device(USBDevice *d) -{ - return USB_BUS(qdev_get_parent_bus(DEVICE(d))); -} - extern const VMStateDescription vmstate_usb_device; #define VMSTATE_USB_DEVICE(_field, _state) { \