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));