From patchwork Mon Feb 13 18:43:25 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: 653215 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2581525wrr; Mon, 13 Feb 2023 10:46:30 -0800 (PST) X-Google-Smtp-Source: AK7set9sViCAIp1NSYCYW2l92mQAB0ujnQjRRs4VAeuOE/2M+daORbEnh99k7nEYQpEIcOzjt1Bh X-Received: by 2002:a05:622a:211:b0:3b9:b2c3:9d2a with SMTP id b17-20020a05622a021100b003b9b2c39d2amr42995478qtx.22.1676313989987; Mon, 13 Feb 2023 10:46:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676313989; cv=none; d=google.com; s=arc-20160816; b=sCoJmzWqSWWG3gSyDQxBWrLJOzseAUkp80Ve4T7O4VG6s2dmQISDH2+xZLy4mSp1+d zb6nxFgzubAFLTQ19nNXPnBbawnA+AwVHzf2CBePPI+YHDulI3QyWMrAmbf9ww4ROdnP 04Wjii3zoQzdJOJjsSI42XCes7M1SJRJjYHfihWJpf/+zbAbnWnzuLmo7g6KXcd5/YEQ HbQWIlk237+o09+HVDdbVjmIeSXxLl1HtAQPZqUxsVcBDUe83vRf7A/b7DifgNOdeDQp 8M6h81x/Ep1BVb66UCiK+qY0q5wWfQJ1sS5FJjfm4aoxSJ8M1XdS4UByIj0ziTti37Yg GbAg== 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=0i7BYGZnPH/gQDeSu7yfSuG7DvJDA6GjfJptKA4SBjOVlDvh2g0uwyC2VPQo2VatmT 6dxAMySzGyukXFPuKLn5jjYahsmGGDD1WkOkkIOTxmY9FFBa6uiPZHWgn5bEYc7912k9 Ykiup2wr+EcBJ/DtGmA3eoxhfR5gT4QVP8lkyH8MBdgATjSXb8MY5QNMEzFQSrgQvUmA 3EcDGQmrsgBZGypbOWsdpwap8urxl8v+Sa+2E62pOWuHwR72aHRZUzpuuCqLsz7bldsu HwPc/9MaGWP8BRm0aqE46Niah9y55KIks9k8KMErqJ7Nwu0P7kwmwsk2gCXgKCMDnY0s bvWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LjekvQ6J; 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 f7-20020ac87f07000000b003b634217ff8si10100862qtk.774.2023.02.13.10.46.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Feb 2023 10:46:29 -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=LjekvQ6J; 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 1pRdo1-0000tW-VB; Mon, 13 Feb 2023 13:44:01 -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 1pRdnq-0000r2-2d for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:43:51 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRdnn-0008No-Kv for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:43:49 -0500 Received: by mail-wm1-x333.google.com with SMTP id he5so1531754wmb.3 for ; Mon, 13 Feb 2023 10:43: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=Nx8Xgm2tW9Gq4Bio8ruD+Zbqqbx7fjg7obd5raLzp9c=; b=LjekvQ6JXpGK9dEvBMxMKFxxhnOcCFNY+4jwJOIDh0fLNC0AtqqzbU6VQ1lpfEzSSH wlsQsqXnZCz6btSBwVjnYOLogTpKPuHGFiT8IuD07rdmelaZvUrjFbW2yFe4Ubn0PCOl UQWm2tAE90R9PJY0yCVLMMl0IdUR8VB7rhsdKMGMNhl4DMYMhDTadDyLkWWhG9q9PkgO sc+VNF4y0IWpWhaCLxlr9kcuC5u9z8FAvcmtx4Z5J+RkHpZowPapme2Aes2i9wqOjJzK k6EdP16Tj4kEWXDftea8cXGm0x7+Fm2enUun1Csa8T6LIILLHH8k788jfy9ADFqzKrbA 7dew== 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=T9xoR4dLYjlA9OUem8Z6QV2PUOC3qhfaiIQ+AmHxJLKjRzpYgTCce2w+FlPISXAHDa hHbpDSiAMZTT7B8Tr2q0t3/DrhGYbOY6G+m8JszS7ejtgwfnhWkek8guKfnyw+Fj5V4L mHrY7vL82xVDxpymzVGvd4ich1ZiDsO6G89X0odFDdpjsZT+ebZk11bzyswb9lG60bVw J+AfnYt6rrJ5F5BE7mLozzi4TiUyJ4zeJ8uWR5WYd4n7DrFjHdjBuBhFhFQuvgXWy7oE nHT/e10fZ3W+MDTEd7eJv896XgVGYvkI+NLzQx4S8uluFOw1qeH7KDTbohsXArfSsgY3 3QnA== X-Gm-Message-State: AO0yUKUQKsxSEQ3vj8z1iD1mwOzB/vmnJt5F+4pPWwdO91zw5V0+l9Ok AdjlbdbbZ+3he+moL+P4sO6sBQX9GQ3GrmFI X-Received: by 2002:a05:600c:1608:b0:3df:dc0d:f0b3 with SMTP id m8-20020a05600c160800b003dfdc0df0b3mr19706716wmn.9.1676313825971; Mon, 13 Feb 2023 10:43:45 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id j6-20020a05600c42c600b003df245cd853sm13850313wme.44.2023.02.13.10.43.44 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Feb 2023 10:43:45 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Eduardo Habkost Cc: qemu-block@nongnu.org, Hu Tao , Gonglei Arei , Richard Henderson , Li Qiang , Thomas Huth , Cao jin , xiaoqiang zhao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PATCH v3 01/14] hw/char/serial-pci: Replace DO_UPCAST(PCISerialState) by PCI_SERIAL() Date: Mon, 13 Feb 2023 19:43:25 +0100 Message-Id: <20230213184338.46712-2-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230213184338.46712-1-philmd@linaro.org> References: <20230213184338.46712-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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));