From patchwork Mon Feb 13 18:43:33 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: 653214 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2581495wrr; Mon, 13 Feb 2023 10:46:27 -0800 (PST) X-Google-Smtp-Source: AK7set8oi8SBe5dM8L0g8I+6jberE3TJeYcePw++GOqyxtKj7RTPMQVjyyBC3jJRvAplqIB/2Gd/ X-Received: by 2002:ac8:4e88:0:b0:3b8:8756:6de8 with SMTP id 8-20020ac84e88000000b003b887566de8mr42568965qtp.67.1676313986903; Mon, 13 Feb 2023 10:46:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676313986; cv=none; d=google.com; s=arc-20160816; b=L/qMlHJqFRnzFwShxrTvSTQCkhhaD7iigLdF6f09K343rrLdv1qcshsJ992LEy3CU3 QtoI3RHnBxjW0PL2oOgMrLR5kPKezz01eEaL4XZPd7AWTxGKXtEimeKO4WVnip+a53Nj eHjxbKe3MOmF7vgElzT8UYaE5okEICGjwoEcHJhT/DX3M4vEQhOiZW8XWy3OiDMuUre5 EjqZ9KQRrMiDlbRwwHERN4np6sm6BS9w3WEMnAqPBPXmZxbpatEiPm0Sve4wllOLOinw IROVeFGFXAGpmJDwVr+rbTncakS48mlkXQf26J80aRXF8JzRTbrnp3yb1vCNlKXaRpFk MvGQ== 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=XsDI23IblddGe2vuk/NWNbErXf2fkJmkTt3QdNlIRwqZKMC6UCzXZ1rO2WIBxLTCqW 0B4PxNmfL+Xd7/SRcX89mOPGw4+tBR2UtjY8XXnKvaizUHBSIuo7gILmfGAwuzGPdLRp G5TKfxifte3ZCyeI4gBp2gWKgwFstJ24CozDtN+In6fMxdOtJh4s8Z1WK6hmoZNSOu+0 tvXjH8JmTMnbAgJCNxZiqFQ1WlAc1b+vTCPAc3yT2Ee1CNxu/cQtcP9NQ7AGp3rt0KCi IfVOw0b+iGT4++OTlRmx4h5CSnvNNOVlY5TvsRbGhkzkGuVWI6EuVFlFUEiPEP2LdrPA F9Jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="JclyZ9/U"; 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 w8-20020ac87e88000000b003b62ebf878dsi10379784qtj.347.2023.02.13.10.46.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Feb 2023 10:46:26 -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="JclyZ9/U"; 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 1pRdoW-0001Sd-WF; Mon, 13 Feb 2023 13:44:33 -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 1pRdoW-0001Nx-2N for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:44:32 -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 1pRdoU-0008S7-JE for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:44:31 -0500 Received: by mail-wr1-x42b.google.com with SMTP id bu23so13251067wrb.8 for ; Mon, 13 Feb 2023 10:44:30 -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=JclyZ9/UqBA9BGGqA55SoSo+LpL1ZYdxe3PslvYu0+Yxk9KVvZ9IAaUZaDBkNXcQGO Iir74BDi18LUqcAmsy0C6cWDzj1wTIhCbQt6E1iZG7JN2uoyRDBlh4FG7cdGXPGQNgwe qQSkeYZeigYr4Wq+SCC6Wmb8hzuTPSFS+B0toflyI8TiFIYuTQ5OJS4t9q02HFVEVpW1 vZ16spJxrCwlh6KhD5iGgrir1VcX3GE+/e5FXFIA6j7zecRrS4froZyBhb01JANmQCci AhmEqrixRAzaIeb3/kjzNuMfHJ7VHo38IYbBkWyBk0rKgusieKEatRh0wDn2yw03EFpW f4bA== 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=k+Rv//Ub0ixjtp5q1oWbrdazRhMFirlhLjyHcmhg54Z1XcPqW5A5wAGImNUggICISE oLgHIOxHFRb11Fmv3c96J8/kno6KeRtzGjQ9rjz+rbU1ZW+6y0E8jAes04jLQh+Xp8MD X9GhitLxBTMcN4GtULOzN1uAjr1EF1EWux3mcY4n4W81gZeEuFxhua5qpMH+phdkrnCs OqZHE4UzGWAjIlmqThtL0vAGARWwazEV66cyklh39ntoe7Z2bYhkqKIwAHQcX7PX/qNL 1ghIxP1K9BpTUkq7d1O2oarUUFUeFZwVfDeHNniN8Fi/t50AV5+rRJRfawf4hBjULdo+ BrGg== X-Gm-Message-State: AO0yUKV+kveJsITDY7S3Bd8ejwGS+XbUtYomiyF1w5QKn1nDN+JY8a0K vUkE3Adzat4oBp+fGng9V5ct1AVqTuLQWz4x X-Received: by 2002:a5d:4577:0:b0:2c5:4ec7:a466 with SMTP id a23-20020a5d4577000000b002c54ec7a466mr6889035wrc.31.1676313869723; Mon, 13 Feb 2023 10:44:29 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id z6-20020a1c4c06000000b003d1d5a83b2esm17393991wmf.35.2023.02.13.10.44.28 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Feb 2023 10:44:29 -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?= , Sven Schnelle , Jason Wang Subject: [PATCH v3 09/14] hw/net/tulip: Finish QOM conversion Date: Mon, 13 Feb 2023 19:43:33 +0100 Message-Id: <20230213184338.46712-10-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::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 TULIP() and DEVICE() QOM type-checking macros. Remove uses of DO_UPCAST(). Signed-off-by: Philippe Mathieu-Daudé Acked-by: Jason Wang --- 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[] = {