From patchwork Sun Feb 12 22:51:35 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: 652842 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2124623wrr; Sun, 12 Feb 2023 14:53:54 -0800 (PST) X-Google-Smtp-Source: AK7set9Tt8cEk/dIW1eSiQYmKzn9Bg2+LU4tg6PleDLJ96WSNAK8wZjWoR/XnrbbXZsk+hQAgHl9 X-Received: by 2002:a05:6214:dcd:b0:53a:5812:1434 with SMTP id 13-20020a0562140dcd00b0053a58121434mr43831860qvt.16.1676242434569; Sun, 12 Feb 2023 14:53:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676242434; cv=none; d=google.com; s=arc-20160816; b=B7xAulBspCsryM8pOrK3q567jlCMtfEQWfgJfAzPK4Vv2J+Jp366jDV9aw+KtXgtWR y7LqMJZOo70fNAjmMF/fqfnRkUi71hvMUXFGoW71IyOATqRll1LJ4oInSWrMfXJSuUh8 MCy8IAIGVixeQkYSivDjkKUxOWKW2WXJP6NOrUoogNRDV552CaQfyz09XpghWU82tpV6 m0uLIccCFPpTCXHjmnsRT9XBUMFtFDJFlCzbVuO+uUtI600tmHiHcwPFXjIH87P3fYny plgmCjabx8avgIGV3yyrb9fN56pYeS+8hw+3OXLeOQgHJH86ZddUIwIXzx0CK9WbfYs6 HAaA== 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=TtfTpH4MEEWs7KywSD+Yvmf62gOYjFUXcNK7MIpj52yqfGtrQWBeML6RBbRQ6zKBVl hCAo63j8WQOLTN3CACK923R4EU3pV+kXv9xqktbVp47MWdxalAK1x0WWUtDtYCLmw9g0 fNI9CsiT/PTTJhLcd5wPLBUSb/rWwp+AieNF4A1LnbvCwJn+g/O3W1RX0F0wK1wPVXYG kGYVNuXRPmh/RExjHety7acOlZ75s9cvKjvLhKOmu76XK05hrRcsKOnI58v37Rxz4MtV MSnWm3ObAyBcLT6aIGk2IQBFD0IEaFNkFnYRbYRZrbeCNVJv74CfA3BqypeGwCh/iaFK +n6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Ywlz/uy9"; 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 e15-20020a0cb44f000000b0056bf04b6a81si7962566qvf.580.2023.02.12.14.53.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 14:53:54 -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="Ywlz/uy9"; 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 1pRLDE-0006rJ-F9; Sun, 12 Feb 2023 17:52: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 1pRLDA-0006hK-Lt for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:52:44 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRLD8-00046u-VD for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:52:44 -0500 Received: by mail-wm1-x32b.google.com with SMTP id u10so7536732wmj.3 for ; Sun, 12 Feb 2023 14:52:42 -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=Ywlz/uy9Jxzl38ShTUU5KnBeIep9MrDy9Q2HGidtumag+9jQvq+5/fe3Yk6paa7HEP 4qkuGAr3GMkfEjTjfqankAwmcMsCumxRjumc0e7qrOGS2OzuRDv1Laik5MtWf5kkTB+J 9HmTTfVFfzhPQmnxiMh3ydpbbqOQrvxj3Fpq6GxC3q3IsSdDsBvgzGU7qsd/2TDFDYvG q+X0pQUvlhul+Fy5x3IYIAXKPS7JGU7vVynI+QIoyf1HnmH9cncbk8IsEY35GBb38KHU qbEK286zA53KkRWJcHPr1S/jzAbddbIaKH1hokAF/ZDDBON9oqTC2+kB7IdBnkBc2xzt JycA== 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=e98+OUU8/826FAjcsiS+b8n7GfpJ7Ins+cjNHChmevT8L6IYZQl58yhoEWslDPHz+Y KRLtEwXHESZUgXXKVOaL7xXaMLVsHpQtD5f5sNv4wyJtk/3ATun8NIBP3h6IEdtQCARm g4lFdIjAmrdGe1Cftm5GRFFHHrpcC+q340xK1jL9arcmts2rRQycEoaC8c/zu7N/8ffN bC15jK/rMFqU5SlKPd6YkXah61u5rDHqIsYQuiVEUplLmk8Wa4SMP3qCbr5xA2y+HW5M b3IueUVfhVt85MBb6ptFrHcAQtPsdVZWgSMHPKqZo+Glp3JfQ4FrxULl71xafLTI/kPu YLuw== X-Gm-Message-State: AO0yUKVDmt4wfwbo/AqNWSXYvt4ZSXPM37LamLl8tsOhvc4180OOtItD oXqW7YtT1z6MVQwi5FRIvoIJcA== X-Received: by 2002:a05:600c:a290:b0:3dc:5a9f:1c7a with SMTP id hu16-20020a05600ca29000b003dc5a9f1c7amr17931410wmb.30.1676242361653; Sun, 12 Feb 2023 14:52:41 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id i14-20020adff30e000000b00241fab5a296sm9102845wro.40.2023.02.12.14.52.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 14:52:41 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Eduardo Habkost , qemu-devel@nongnu.org Cc: Richard Henderson , xiaoqiang zhao , Hu Tao , Thomas Huth , qemu-block@nongnu.org, qemu-s390x@nongnu.org, Gonglei Arei , Cao jin , Li Qiang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Jason Wang Subject: [PATCH 10/19] hw/net/ne2000-pci: Replace DO_UPCAST(PCINE2000State) by PCI_NE2000() Date: Sun, 12 Feb 2023 23:51:35 +0100 Message-Id: <20230212225144.58660-11-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230212225144.58660-1-philmd@linaro.org> References: <20230212225144.58660-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.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 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,