From patchwork Mon Feb 13 18:43:32 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: 653221 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2581921wrr; Mon, 13 Feb 2023 10:47:22 -0800 (PST) X-Google-Smtp-Source: AK7set8N9QrbjNMRh+hRuSWe4Mtzbwlh9RLHjPBUNj1F1cb7Xj8fZKbipgmNh6dLxPuBzaakE7bR X-Received: by 2002:a05:622a:1209:b0:3b8:6cb0:8d18 with SMTP id y9-20020a05622a120900b003b86cb08d18mr42268142qtx.5.1676314042615; Mon, 13 Feb 2023 10:47:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676314042; cv=none; d=google.com; s=arc-20160816; b=LWB4OJYBODlLdKkB07A3aHJFOb0x7CmCtLJpRbME6TMfnATU5M51aWRO08Me9tBVy1 CZRkatp3eSQQSnQn3blLofanQH9D+lFcwtb2hUAFcOkL992INqC1hfB+HB83+55PFLJH Rcq/I+eBHtnil5NiGXt3pmT/KHqh2ntvdDN+7iQQkQDIBo8sVtf2c4PRQ58/IY8yz0mX x9xsfg9MkbusYIEQjVmyBlJRPN/RRACDyfP3SkhJskiRwD0t3bhPUVbxkWcvrbT1eBCT ArosscXj63X4yCDYVzmYJsU81XgZHgNzHxmsDk2vSEciTvF2X12WvIVww/zgUZLhteVH sTaQ== 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=hdJsaSVVYFMD5ce5bQarDPbk/yfXAqiITeMkaxTmNmuerWrQBvTWIqZaBk7K/LcEwU cgU33lhUdcplCHZmpSM9Zmns2O4D5HWC2W1FSohVKrAyaaa2zhE6extDrbJs9BmII7gD 28aFJFuup68leDxNtQW3ZIdiyVK4QxIRx3zyWmiO2LCOXIKLmZVwF72O2JUfOtE4rZ99 6hjHDTLlaJ3FDELEOnrAbPe38T2TM18y10l5ZGh16X5h7sdsn/k2eX6LfbySHom44atu npvwPs/rQ1cnDVMCvhRO9k6beLZhH33mT9ZjdJx0TrGxto5/yS0xUv8M7el2Oh4yW+fu TwxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gP9ewFH4; 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 b6-20020ac87fc6000000b003b69fac5696si10307602qtk.695.2023.02.13.10.47.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Feb 2023 10:47: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=gP9ewFH4; 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 1pRdoV-0001Nh-LM; Mon, 13 Feb 2023 13:44:31 -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 1pRdoR-0001Hj-SC for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:44:27 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRdoP-0008Tc-Jn for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:44:27 -0500 Received: by mail-wm1-x334.google.com with SMTP id f47-20020a05600c492f00b003dc584a7b7eso11954767wmp.3 for ; Mon, 13 Feb 2023 10:44: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=VotmsYo6EZx1VvqMFkr1+QDMy3wRb1XAiA9w0UCQyq8=; b=gP9ewFH4awNxF2vi0b8jkzWKJ0I8idDoCPVWlFgHGp/VCPiDRsWJZEo/czC6DNh9wv iAZnHPe7ZusDLdDCCjbTBoUhmqMmzfGNK/m6/KPRttR6zVV7zbcqSUlq+674DTqlzQsr uTW6xLj/x220CydgFWuPc/YqthaVbmaQMIa7lMg6z1opRP86nPA7zDXhZ7pXc+sSdnLa FiLFiFUG1gm+rlqYjtxGHI+305ZxxY6CSGN1hTmGCgrYT5h7nMo0S1zmzjTa8MOrKUN2 ClSOO+Ly2qWes3kWcTbRUoUg70BZs7WWeR0X+fzE3vaJ1qEJN+pLBi/3mYhT6i8JiH2S 26yg== 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=2oKIaAx8GyuikKGHzkzr5nOmR5ykhI24OaxDnU+UTCXn78sTQUpbhTzxDJ62D3spJL /o+l29FCVfKglbnFE1ue10hZ4I46kwAmunvWTk60VQo6lTwNVItRMyfXqgV/AH3Qb+oG iRF1zDNge+IuEnJ+HMjfWjlWBzf8nqEF7jRsUOpmxKPH7qWVBF2liOP/MfGVnEd5pMXR acBVHn62CZnFRIDeFM3rng9/s9rgkRthmqKwHDeQHEhnJpj1WKo5MXEaApymnVm8x3rf ewYdRlhqyYSAKE1Hy6ZccpmgMaE4cD7E6OH+VHtMyZsFOr9Z4HnCvsf5kascPnDXheK9 pwhQ== X-Gm-Message-State: AO0yUKWAkCZ/enuGqAaujqw9PlAW15IurQf9i5oGzyCoM1TUTU/t153n OYKJPjkSvScQ6bdHQ49lrNIQhXoQFp1aI5S8 X-Received: by 2002:a05:600c:491d:b0:3da:2a78:d7a4 with SMTP id f29-20020a05600c491d00b003da2a78d7a4mr19705810wmp.21.1676313863858; Mon, 13 Feb 2023 10:44:23 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id d5-20020a1c7305000000b003dc4baaedd3sm17223550wmb.37.2023.02.13.10.44.22 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Feb 2023 10:44:23 -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?= , Jason Wang Subject: [PATCH v3 08/14] hw/net/ne2000-pci: Replace DO_UPCAST(PCINE2000State) by PCI_NE2000() Date: Mon, 13 Feb 2023 19:43:32 +0100 Message-Id: <20230213184338.46712-9-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::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.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,