From nobody Fri May 17 11:05:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1676313990; cv=none; d=zohomail.com; s=zohoarc; b=QtZwpQxAUSEeRwXcrV0EKCzU2RxXaqSw21d1c8gtRFe12RZikXJ/j1MpFM2nLVtCwVKKbDiLHIk98dN8ES/Rw3+zKU2svE2Tf99hFRGAWb/VUxKYi02TuLtznBcRUi0+/15fvmBfENLVXDk6TiuW8HpFkkRrAy7sHGY7kgBovw4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676313990; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Nx8Xgm2tW9Gq4Bio8ruD+Zbqqbx7fjg7obd5raLzp9c=; b=FLNU0VPHXQI2oId7TeNvoX/PQdIvnirAGbfPV/5mgdSXW9jVLrpWrghek6qhY9HiLeWGKjF01f23Bi/tLN/YYVEpp/SvxmTLqGqcj34jkO7yAu4oJSrjjo6cVxltrxDrkIJ9kebEhkWULG0sfkhy/uHZktFZ1XjVKJ4tzw1Fx0g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1676313990165423.7748153160676; Mon, 13 Feb 2023 10:46:30 -0800 (PST) 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) 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) 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-Google-Smtp-Source: AK7set+FwJGFsSXEfvfUL0CgboLVrU25L6brOiePRnxkdixl5y2FZ1krjxLy5QYdix4Uc7Pd2AOopA== 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) From: =?UTF-8?q?Philippe=20Mathieu-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=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1676313990492100005 Use the PCI_SERIAL() QOM type-checking macro to avoid DO_UPCAST(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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" =20 struct PCISerialState { + /*< private >*/ PCIDevice dev; + /*< public >*/ + SerialState state; uint8_t prog_if; }; @@ -46,7 +49,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(PCISerialState, PCI_SERIAL) =20 static void serial_pci_realize(PCIDevice *dev, Error **errp) { - PCISerialState *pci =3D DO_UPCAST(PCISerialState, dev, dev); + PCISerialState *pci =3D PCI_SERIAL(dev); SerialState *s =3D &pci->state; =20 if (!qdev_realize(DEVICE(s), NULL, errp)) { @@ -63,7 +66,7 @@ static void serial_pci_realize(PCIDevice *dev, Error **er= rp) =20 static void serial_pci_exit(PCIDevice *dev) { - PCISerialState *pci =3D DO_UPCAST(PCISerialState, dev, dev); + PCISerialState *pci =3D PCI_SERIAL(dev); SerialState *s =3D &pci->state; =20 qdev_unrealize(DEVICE(s)); --=20 2.38.1 From nobody Fri May 17 11:05:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1676313933; cv=none; d=zohomail.com; s=zohoarc; b=ISsn9x4xq5pm8Xlco9K8ri9BCIhjIxLXxr6zZdanR0gDMLr5PN6DAhfMSfMZxvsbw2ojkoilRA5vQiV9p04hNrCWjomWP2GMk/AVHvx32VeDC62SIoHYhMKKO7bFek80P00rKoNIoo7otGrPi7/kydL4CSwQHMRMt72e4QqljE4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676313933; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=iJ+QRHFZYIqXqYbl7DIdWxHc+GN5ZGRCj3hAlbpC3f0=; b=k9VMKID/XsKC60y/XUj3GZAK/C9X90ZEH/LvDNgySZk2rVhysqp7cqoIYYi+9c9DZ1gF9zP8TfjvCNHp3eFbgJz5jR6D/7WFkkim3S3dyKIORmgbAeuylS+vtpIe2NcCbkH7Y2OfBxgVd5soDAeI4HZc15Vvc/VOKWN5spf+Zpc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1676313933797931.6240641795873; Mon, 13 Feb 2023 10:45:33 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRdo8-0000xo-NW; Mon, 13 Feb 2023 13:44:08 -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 1pRdnv-0000sJ-2R for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:43:56 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRdnt-0008OX-9t for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:43:54 -0500 Received: by mail-wm1-x331.google.com with SMTP id k8-20020a05600c1c8800b003dc57ea0dfeso11991136wms.0 for ; Mon, 13 Feb 2023 10:43:52 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id k21-20020a05600c1c9500b003e01493b136sm18406084wms.43.2023.02.13.10.43.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Feb 2023 10:43:51 -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=iJ+QRHFZYIqXqYbl7DIdWxHc+GN5ZGRCj3hAlbpC3f0=; b=hxWM/HalDBWkWTKXW8PAyZ7JCyWlypLHbOkZE+hvCtdPG3AH3ab/kBkDGMzf3r5GIB EUJMistvc/Fd7tiDDmng0a2+iab8eed8zx7PvJNIchVZbcj40U246C+ypoY+8dR6TKdP Vc3rvmvfvvqtNJk/2yAbdEOjYss4cSOhg0bpvb0dBrUfW3hT3WpunMxoqICJc+P7x1+B 2AGnXITbPFx4UD1fQ/w770OGmRYY/7QWwYDQqaOIk2vOY4Rb08hZzc43+pNftyJ4zd17 ZMLmVI12hfYgwWZCvRUoHGlAl1d0lMB5TU+bNA2QS39bxPLMI2aVr86Bx0hptSo8m1Xe ihZw== 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=iJ+QRHFZYIqXqYbl7DIdWxHc+GN5ZGRCj3hAlbpC3f0=; b=lno/aEKqjIzwuw82sqFgT+zs+HPiC3EJrXRgMhh9gQKC8Y1dKn03WddAhLM6hKULR7 m0QM0lweJ6TEcDY1Q7QdUhxn/ZuGvG5TYAnGvYnnRp6CPgyaeCqqpOVRqz4haLYU0htH N/VKwoKSY3mKQ81qE/MOa01IvEOimnEepmXw53xlDumAcmjTjCEbgosNZA4XJkSCSAq0 d3A6Y7etzWIy2o1iQa1xJvb+ZjJ+0O6wkakRoOrZOuWZpkYX/zdW8Ufv942u6NMkPB/6 jOddXy0WxXUAMzGlVsiMtB6m+r2BGHi8JBGKNHHfPAT4OwuM/frakRhuHFJBoyLXfNtP 4J3A== X-Gm-Message-State: AO0yUKWcPx/Q1tOXA8Uv0cz0zZcA7rpz5DSH35tBlyhmFsoRG7asPZhB OB3m+ZG7DE93T47vRAyGtaVMD6VLpkr2qjIE X-Google-Smtp-Source: AK7set82QTwQEsZquQpE/eYBLM4wg+rjrgrMgkFJsfZWh4VYNtOHMZT1VvEN4FICp37eoZQbCvJTpQ== X-Received: by 2002:a05:600c:4b1c:b0:3df:eb5d:c583 with SMTP id i28-20020a05600c4b1c00b003dfeb5dc583mr19498820wmp.17.1676313831607; Mon, 13 Feb 2023 10:43:51 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-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=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH v3 02/14] hw/char/serial-pci-multi: Batch register types using DEFINE_TYPES macro Date: Mon, 13 Feb 2023 19:43:26 +0100 Message-Id: <20230213184338.46712-3-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1676313934172100001 See rationale in commit 38b5d79b2e ("qom: add helper macro DEFINE_TYPES()"). Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/char/serial-pci-multi.c | 52 +++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 29 deletions(-) diff --git a/hw/char/serial-pci-multi.c b/hw/char/serial-pci-multi.c index f18b8dcce5..54768d3d53 100644 --- a/hw/char/serial-pci-multi.c +++ b/hw/char/serial-pci-multi.c @@ -189,34 +189,28 @@ static void multi_serial_init(Object *o) } } =20 -static const TypeInfo multi_2x_serial_pci_info =3D { - .name =3D "pci-serial-2x", - .parent =3D TYPE_PCI_DEVICE, - .instance_size =3D sizeof(PCIMultiSerialState), - .instance_init =3D multi_serial_init, - .class_init =3D multi_2x_serial_pci_class_initfn, - .interfaces =3D (InterfaceInfo[]) { - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { }, - }, +static const TypeInfo multi_serial_pci_types[] =3D { + { + .name =3D "pci-serial-2x", + .parent =3D TYPE_PCI_DEVICE, + .instance_size =3D sizeof(PCIMultiSerialState), + .instance_init =3D multi_serial_init, + .class_init =3D multi_2x_serial_pci_class_initfn, + .interfaces =3D (InterfaceInfo[]) { + { INTERFACE_CONVENTIONAL_PCI_DEVICE }, + { }, + }, + }, { + .name =3D "pci-serial-4x", + .parent =3D TYPE_PCI_DEVICE, + .instance_size =3D sizeof(PCIMultiSerialState), + .instance_init =3D multi_serial_init, + .class_init =3D multi_4x_serial_pci_class_initfn, + .interfaces =3D (InterfaceInfo[]) { + { INTERFACE_CONVENTIONAL_PCI_DEVICE }, + { }, + }, + } }; =20 -static const TypeInfo multi_4x_serial_pci_info =3D { - .name =3D "pci-serial-4x", - .parent =3D TYPE_PCI_DEVICE, - .instance_size =3D sizeof(PCIMultiSerialState), - .instance_init =3D multi_serial_init, - .class_init =3D multi_4x_serial_pci_class_initfn, - .interfaces =3D (InterfaceInfo[]) { - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { }, - }, -}; - -static void multi_serial_pci_register_types(void) -{ - type_register_static(&multi_2x_serial_pci_info); - type_register_static(&multi_4x_serial_pci_info); -} - -type_init(multi_serial_pci_register_types) +DEFINE_TYPES(multi_serial_pci_types) --=20 2.38.1 From nobody Fri May 17 11:05:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1676313888; cv=none; d=zohomail.com; s=zohoarc; b=dyeVZi/0qvkNpkp9S7V5nTznswvoAMFegOW8NpQZrkJ1/md5ZkIxuU0iJoOS5KE19nIQSWnmIcZ7wfIlqhQcfZHMEzQBtAOzAG2gra7hmgfQCjkhhGfQLTciKOqEdfxCXT/z5Ox+rXrvOkuzuQIgMHvEca8A1GEHo2ztaz3gsHc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676313888; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xzELhgE3er5tMNQ9I7jJncHCuwtWilKXAa2ONw84yPk=; b=ScyKnjGISLiDkGC2wU0WDNhcjT8N01KGb5WcCRTTHk62y6j3aVa6QqM+w3qVvfCBAHnfwjs36FursP3gHL9XsMIDE5tLBaCWwWpFZZxH+wZdGIsaumjZWoq1xlek/+F/6pbs9euVAUK8cP8lYLAk6239I39PV8f9IuZG16lUruo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1676313888367833.1880530951846; Mon, 13 Feb 2023 10:44:48 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRdo9-0000y6-Bl; Mon, 13 Feb 2023 13:44:09 -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 1pRdo0-0000tq-U8 for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:44:01 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRdny-0008P1-BW for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:44:00 -0500 Received: by mail-wm1-x331.google.com with SMTP id m20-20020a05600c3b1400b003e1e754657aso3520756wms.2 for ; Mon, 13 Feb 2023 10:43:57 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id j37-20020a05600c1c2500b003daf6e3bc2fsm25423793wms.1.2023.02.13.10.43.55 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Feb 2023 10:43:56 -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=xzELhgE3er5tMNQ9I7jJncHCuwtWilKXAa2ONw84yPk=; b=M21viOpHSiCy0/ZKOZq0RXEE4xTGLz5+ydd2Mf8zV77TFadu504ztwdREBGwdgwnW4 IG2/RbyCPcw3K1584adJg5/nAAGdzwFdJaiCkiWZwOa4dsxGNB2VALCKOPOfk27B3gSk xMq7LPElYcQXPGw3OmT9fcGKYUBh1Oj9aKzck7gTMDsfXrTsNW6vUTAizeXs4v+sud1r t+UtepaqnAQb+TFDieh3v6WO2kjv+EV0hiq7wVPQLDEpIKpxzIyZT0IiP6ip9K1s0bbI J9B3jcryhcBHPV1NKkW3oHbPyAqS+BiayDap5beGM984GTWvjI87jn9+9FNw3Vb3Ry9U J2ZA== 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=xzELhgE3er5tMNQ9I7jJncHCuwtWilKXAa2ONw84yPk=; b=zEzBg93nwUgBJIOGLC9/W2+BN7bFT9sML9SKkk2CXMd0R4NBedV4DnErHXxJ+w622c EnwFlaQ9M/VwFZ654t8olpCISmBZL8dYURT01RyrZYxAZTVh8Yy9NzlJ9pxp1aAGHeGM Rqqs3fEXd/rSiaE+IrKAOa9odRn8J/1Plg2vfekOwL3tOCPJfXX4ozp+kxNTVl/OQfwj 4dAaLB+2qmfeO6Ejx7bPWySukLjhh1MICcDs94A7+9brAZqd92AICFKxy6uAPl9WzMsp M3amgqI1VBCrMl5KbGekFxfBnVcnwZxU8hux6MZWUhCjzlWwrbrX0PfVcGUQT01fBgKv F3Uw== X-Gm-Message-State: AO0yUKUM43684r7VGgMe1laKHdUdSqRNRfhtHfpGT0ouqZVQNdml3Bvf Wz8d2UQipShiwQtdcJSX4T8EO2kOgODMolil X-Google-Smtp-Source: AK7set869JzSwWbaUjraUvTkfaSo6qECxTObZB+u5E4mKPQzEdZIX8MnxlsoRG65zs23nQV6woe2tA== X-Received: by 2002:a05:600c:4d0a:b0:3dc:50c1:5fd4 with SMTP id u10-20020a05600c4d0a00b003dc50c15fd4mr24174441wmp.15.1676313836939; Mon, 13 Feb 2023 10:43:56 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-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=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH v3 03/14] hw/char/serial-pci-multi: Introduce PCI_MULTISERIAL QOM abstract parent Date: Mon, 13 Feb 2023 19:43:27 +0100 Message-Id: <20230213184338.46712-4-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1676313890381100001 Introduce PCI_MULTISERIAL ("pci-serial"), QOM abstract parent of "pci-serial-2x" and "pci-serial-4x". Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/char/serial-pci-multi.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/hw/char/serial-pci-multi.c b/hw/char/serial-pci-multi.c index 54768d3d53..e56c0bc841 100644 --- a/hw/char/serial-pci-multi.c +++ b/hw/char/serial-pci-multi.c @@ -38,8 +38,15 @@ =20 #define PCI_SERIAL_MAX_PORTS 4 =20 -typedef struct PCIMultiSerialState { +#define TYPE_PCI_MULTISERIAL "pci-serial-multi" + +OBJECT_DECLARE_SIMPLE_TYPE(PCIMultiSerialState, PCI_MULTISERIAL) + +struct PCIMultiSerialState { + /*< private >*/ PCIDevice dev; + /*< public >*/ + MemoryRegion iobar; uint32_t ports; char *name[PCI_SERIAL_MAX_PORTS]; @@ -47,7 +54,7 @@ typedef struct PCIMultiSerialState { uint32_t level[PCI_SERIAL_MAX_PORTS]; qemu_irq *irqs; uint8_t prog_if; -} PCIMultiSerialState; +}; =20 static void multi_serial_pci_exit(PCIDevice *dev) { @@ -191,25 +198,23 @@ static void multi_serial_init(Object *o) =20 static const TypeInfo multi_serial_pci_types[] =3D { { - .name =3D "pci-serial-2x", - .parent =3D TYPE_PCI_DEVICE, - .instance_size =3D sizeof(PCIMultiSerialState), - .instance_init =3D multi_serial_init, - .class_init =3D multi_2x_serial_pci_class_initfn, - .interfaces =3D (InterfaceInfo[]) { + .name =3D TYPE_PCI_MULTISERIAL, + .parent =3D TYPE_PCI_DEVICE, + .instance_size =3D sizeof(PCIMultiSerialState), + .instance_init =3D multi_serial_init, + .abstract =3D true, + .interfaces =3D (InterfaceInfo[]) { { INTERFACE_CONVENTIONAL_PCI_DEVICE }, { }, }, + }, { + .name =3D "pci-serial-2x", + .parent =3D TYPE_PCI_MULTISERIAL, + .class_init =3D multi_2x_serial_pci_class_initfn, }, { .name =3D "pci-serial-4x", - .parent =3D TYPE_PCI_DEVICE, - .instance_size =3D sizeof(PCIMultiSerialState), - .instance_init =3D multi_serial_init, + .parent =3D TYPE_PCI_MULTISERIAL, .class_init =3D multi_4x_serial_pci_class_initfn, - .interfaces =3D (InterfaceInfo[]) { - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { }, - }, } }; =20 --=20 2.38.1 From nobody Fri May 17 11:05:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1676313895; cv=none; d=zohomail.com; s=zohoarc; b=JhCC+/Va/hD7bAbikCxzlq0dB6z+l5I5rlkuOz8XPjcy5vCrJYQMjSF+RMiggHbHTyXtDHGa3LGXNdXBNmvDomjvq07os4N9s2obV3cEFfLUcTGchR42tCucxZuFH56CqVS3ypO9ojfyeD+bWBmAQtFOZzqxYQANAC3VFMOLqPg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676313895; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=fmzU+qV6CluU3J1xGV1AbokblN6ppa6B541b+KpiIv4=; b=gLnsdXK20+PzFVzYrECizoZyzymD6yyu0m0Zt9E90+BCD6J1sdHmmxleHwsC/FV2HjpuHJdE9D1iXnTBZqv62EnwsbP4Ol3Ko8ypOgkLbdN1DeQATXzzZPrHxYL2bfERfItVrjkfeCjCrRQS4r2qxNXdnPo/TOzLCe+PQ1UFdC8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1676313895762920.9418779608217; Mon, 13 Feb 2023 10:44:55 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRdoD-0000zX-Hg; Mon, 13 Feb 2023 13:44:13 -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 1pRdo7-0000wl-HN for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:44:07 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRdo3-0008R1-Si for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:44:06 -0500 Received: by mail-wm1-x331.google.com with SMTP id n33so3340959wms.0 for ; Mon, 13 Feb 2023 10:44:03 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id hg8-20020a05600c538800b003e1202744f2sm11839097wmb.31.2023.02.13.10.44.00 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Feb 2023 10:44:01 -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=fmzU+qV6CluU3J1xGV1AbokblN6ppa6B541b+KpiIv4=; b=hhFsKwfl8RPPanqxZ1cHxyJlC3FJrQVRW+AtRh0s31aXN+MrVZi8uM1elzp0JpPIBf ExkFH45g/sDVuilF3PL5MUfJKHSQIa3tuzzVCryMyJG2a5u+075Zv1nFk7f3Dan5J4K6 9ZYANehzrjXAtor9E8q8U0jWkZJs5QflJi+zt/5qwfxpy4d0UASXh9daQgzwR4Fn1nqN Nfzbtfb+16vcuZWJXJ43P+1ZcsF1AOlajBuQGEkXjWPvnZpSt3N+J4exbUfGDjpsz7Ac AW9oaDeoDPjV6aIK24MgonzHL/vFvBRICQxegVy1F0IYpK9HPLdDcj5KN2JFeK4cXre+ vQ5w== 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=fmzU+qV6CluU3J1xGV1AbokblN6ppa6B541b+KpiIv4=; b=BaHcKSBx6dc8tKMukrgwW7frYtGd7o1rOLFgndmD6Lwrh5gm9MjKYGrSrCO5FG/Vhd GCOW0JwFN9P9CHbUUZHu2laZvaJv1lKe2hoJky59ytvzHS0H/pf1y88dS16xqcPDy+Od 5fLIRnxblB4bcx7YTYv+xDkrJI4d9tNvXX6Y7qs8O53noil9RwXHT7A7qEk0IeETxRkq oVq4h3wygUOD5HdJ3lMks979f3PBC1GBgjO9ASZkuppb4XjHg5nWljb8TcE2jE2yeYKb AznnE1VWc7iB+gLbAHmYSdbQzb8de210H9fUcMyGYFxFjaF1GK+xvOZxrst4yeQSSfzg /x7g== X-Gm-Message-State: AO0yUKWcAnAkC2iyFXt/+8F3BlwOvcW5/DEmGRxL2HQW5BYVSktD5McW 0CKejcMeDkbZDwGO3t/sdSWrJSyDjCOGZTez X-Google-Smtp-Source: AK7set/eEHjVShMKK0yCQbKzE0CZnaPeQ8T3wPxbneoVn1Bv/s9YaSEmz2GFwRn+FU6eCx/180Zpug== X-Received: by 2002:a05:600c:3299:b0:3dc:496f:ad56 with SMTP id t25-20020a05600c329900b003dc496fad56mr18699541wmp.14.1676313842212; Mon, 13 Feb 2023 10:44:02 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-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=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH v3 04/14] hw/char/serial-pci-multi: Factor multi_serial_class_initfn() out Date: Mon, 13 Feb 2023 19:43:28 +0100 Message-Id: <20230213184338.46712-5-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1676313896012100001 Extract code common to multi_2x_serial_pci_class_initfn() and multi_4x_serial_pci_class_initfn() to multi_serial_class_initfn(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/char/serial-pci-multi.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/hw/char/serial-pci-multi.c b/hw/char/serial-pci-multi.c index e56c0bc841..704be5c294 100644 --- a/hw/char/serial-pci-multi.c +++ b/hw/char/serial-pci-multi.c @@ -155,14 +155,14 @@ static Property multi_4x_serial_pci_properties[] =3D { DEFINE_PROP_END_OF_LIST(), }; =20 -static void multi_2x_serial_pci_class_initfn(ObjectClass *klass, void *dat= a) +static void multi_serial_class_initfn(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); PCIDeviceClass *pc =3D PCI_DEVICE_CLASS(klass); + pc->realize =3D multi_serial_pci_realize; pc->exit =3D multi_serial_pci_exit; pc->vendor_id =3D PCI_VENDOR_ID_REDHAT; - pc->device_id =3D PCI_DEVICE_ID_REDHAT_SERIAL2; pc->revision =3D 1; pc->class_id =3D PCI_CLASS_COMMUNICATION_SERIAL; dc->vmsd =3D &vmstate_pci_multi_serial; @@ -170,19 +170,22 @@ static void multi_2x_serial_pci_class_initfn(ObjectCl= ass *klass, void *data) set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } =20 +static void multi_2x_serial_pci_class_initfn(ObjectClass *klass, void *dat= a) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + PCIDeviceClass *pc =3D PCI_DEVICE_CLASS(klass); + + pc->device_id =3D PCI_DEVICE_ID_REDHAT_SERIAL2; + device_class_set_props(dc, multi_2x_serial_pci_properties); +} + static void multi_4x_serial_pci_class_initfn(ObjectClass *klass, void *dat= a) { DeviceClass *dc =3D DEVICE_CLASS(klass); PCIDeviceClass *pc =3D PCI_DEVICE_CLASS(klass); - pc->realize =3D multi_serial_pci_realize; - pc->exit =3D multi_serial_pci_exit; - pc->vendor_id =3D PCI_VENDOR_ID_REDHAT; + pc->device_id =3D PCI_DEVICE_ID_REDHAT_SERIAL4; - pc->revision =3D 1; - pc->class_id =3D PCI_CLASS_COMMUNICATION_SERIAL; - dc->vmsd =3D &vmstate_pci_multi_serial; device_class_set_props(dc, multi_4x_serial_pci_properties); - set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } =20 static void multi_serial_init(Object *o) @@ -202,6 +205,7 @@ static const TypeInfo multi_serial_pci_types[] =3D { .parent =3D TYPE_PCI_DEVICE, .instance_size =3D sizeof(PCIMultiSerialState), .instance_init =3D multi_serial_init, + .class_init =3D multi_serial_class_initfn, .abstract =3D true, .interfaces =3D (InterfaceInfo[]) { { INTERFACE_CONVENTIONAL_PCI_DEVICE }, --=20 2.38.1 From nobody Fri May 17 11:05:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1676313963; cv=none; d=zohomail.com; s=zohoarc; b=nQZGVzHtUNXvUBacACdkzENZs+pLP8T0QJCFP9+O/7EWKp3f5E1p992T539HlS/4z55ztMkZuBZFO9B0muHCgW3LiZ5ki89MHshrDkxAcNViY6r6gZa4Ew/O79TGiF+E054U62Sp9TGzMMQaX2yznFB8yao7j4zHGPSTmo/LuCk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676313963; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yz6IoxjWNiku5kCSpBghWuT3DdtWubTdcdH43JCupO0=; b=PwLxTy1ISl/Qq3v3eljupWSZm9Fj61dGCuFbwOVW1zUdfcwLDwfi40HOaW0CzGTkIlAoF0iQyaUPrO8YFKBRyp+GrnLJsPWWKWikzTfb24RO+omcwki7hwinm5B+9rHO4cU4ASB5qONblAEV7+OeH4js/sWc8ZUQdiGCR+jNhuQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1676313963044474.3698130460406; Mon, 13 Feb 2023 10:46:03 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRdoE-00014i-OW; Mon, 13 Feb 2023 13:44:14 -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 1pRdoA-0000zA-FK for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:44:10 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRdo8-0008P1-KE for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:44:10 -0500 Received: by mail-wm1-x331.google.com with SMTP id m20-20020a05600c3b1400b003e1e754657aso3521092wms.2 for ; Mon, 13 Feb 2023 10:44:08 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id v18-20020a05600c445200b003de77597f16sm16157583wmn.21.2023.02.13.10.44.06 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Feb 2023 10:44:07 -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=yz6IoxjWNiku5kCSpBghWuT3DdtWubTdcdH43JCupO0=; b=jI1P/tOjW9ruO26diB/wqKvoc4LbkvFcbqid/SNBffoSTAE8C5sMngFDii/eXeDXID 8Gg+AOi/4iEjqTyKkMG11hVagnBMxrLKPpVhoQk74yTap6wcWbjZX3D5oMZJACT2RnnV aQOFMecmRpsqqgDCMneXD2h7zJJFeDXCP4nwMVWwxhogdUpG63yIwW+rx/Crgrq0r08p Kdn48Oq5VVJ7BysstFHyujnqIOrP+p57y4ia5GPkxoOkeSn67E1CHt3Ucy5WTq3DA8Ud xb0iPbPDsjdBG6apMN1Ddj0zzYbq80DGcOmgrBVQVOrrdrevY3w7mHc+yXIeOcgstu+H CVtg== 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=yz6IoxjWNiku5kCSpBghWuT3DdtWubTdcdH43JCupO0=; b=MigPJRKL7bvGU3gquy7TlVMTbp5TRwIY7Tq0/hshd/UDe7VJ/Cft/4k5P6fuOezqBV CUSE4Pzu5/BLb3hmJQFBDAFaebQGn/LBB4atGg4jJVlBYH4r6mlknNYpUSaPpWkXC/qx yN0dHkkTkS/774/GANZC4Bo7LIct6bFz70ZfCX+PY3/F7uFA0u/cqWYCpYsBGHuCxC5B LPtjqTJzRiwqZgdaErDtjSNiwoqFl/DfykIFR+EeDmLhBWfzRQrV3mOiMQk4/h7DKQav PMIiNn2ZUDMsP5heJTberdCK2FABJNZFFE4Wo+9J6Peb6zSMX68EWVd9C2F2Rvztv3dM rVIg== X-Gm-Message-State: AO0yUKX8e3LzYkyxhVK1/vuKboxtErqLGZQxuXRlgffrw6J4+MlSwgJE xo7NQ/VkUSixDzNytrXG9fXDugeaCF6A1Ila X-Google-Smtp-Source: AK7set+0Pp4E918vOEyEA7jUtXVkZeCMxMXElateD+1e4UJKmouCtmYWmVAPEdGnwUbpYe14OHoEjg== X-Received: by 2002:a05:600c:1895:b0:3dc:4aa6:a8a9 with SMTP id x21-20020a05600c189500b003dc4aa6a8a9mr19187855wmp.7.1676313847532; Mon, 13 Feb 2023 10:44:07 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-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=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH v3 05/14] hw/char/serial-pci-multi: Replace DO_UPCAST() by PCI_MULTISERIAL() Date: Mon, 13 Feb 2023 19:43:29 +0100 Message-Id: <20230213184338.46712-6-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1676313964364100001 Use the PCI_MULTISERIAL() QOM type-checking macro to avoid the few DO_UPCAST(PCIMultiSerialState) calls. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/char/serial-pci-multi.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/hw/char/serial-pci-multi.c b/hw/char/serial-pci-multi.c index 704be5c294..d660b6fa97 100644 --- a/hw/char/serial-pci-multi.c +++ b/hw/char/serial-pci-multi.c @@ -58,7 +58,7 @@ struct PCIMultiSerialState { =20 static void multi_serial_pci_exit(PCIDevice *dev) { - PCIMultiSerialState *pci =3D DO_UPCAST(PCIMultiSerialState, dev, dev); + PCIMultiSerialState *pci =3D PCI_MULTISERIAL(dev); SerialState *s; int i; =20 @@ -97,11 +97,10 @@ static size_t multi_serial_get_port_count(PCIDeviceClas= s *pc) g_assert_not_reached(); } =20 - static void multi_serial_pci_realize(PCIDevice *dev, Error **errp) { PCIDeviceClass *pc =3D PCI_DEVICE_GET_CLASS(dev); - PCIMultiSerialState *pci =3D DO_UPCAST(PCIMultiSerialState, dev, dev); + PCIMultiSerialState *pci =3D PCI_MULTISERIAL(dev); SerialState *s; size_t i, nports =3D multi_serial_get_port_count(pc); =20 @@ -190,9 +189,8 @@ static void multi_4x_serial_pci_class_initfn(ObjectClas= s *klass, void *data) =20 static void multi_serial_init(Object *o) { - PCIDevice *dev =3D PCI_DEVICE(o); - PCIMultiSerialState *pms =3D DO_UPCAST(PCIMultiSerialState, dev, dev); - size_t i, nports =3D multi_serial_get_port_count(PCI_DEVICE_GET_CLASS(= dev)); + PCIMultiSerialState *pms =3D PCI_MULTISERIAL(o); + size_t i, nports =3D multi_serial_get_port_count(PCI_DEVICE_GET_CLASS(= o)); =20 for (i =3D 0; i < nports; i++) { object_initialize_child(o, "serial[*]", &pms->state[i], TYPE_SERIA= L); --=20 2.38.1 From nobody Fri May 17 11:05:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1676313964; cv=none; d=zohomail.com; s=zohoarc; b=OBrPDYH93/CKrJmxDFYiKcJDnBhSny3o0a8SUSYfyNlxQvjxzFQsnfU9iAwYF6tAU3XbbMZBXh5R8e29q7XMgSsCjjvqEx/mRdlZdg6rmZRqsIAtE8ebq9J4Kvmc++i7Rv+S2BzjmC+6TLxwyx6P7iLeTtVWlZMOEHGhBnhVWNI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676313964; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=JeDWNjpVkKdLbShBUyGUp3JADBIyaux21T6WZ6Gmeuk=; b=Llr1n9hquAviV0FVdd/9bAqXR+4t+PBaTvGcejxEaS38zuUA7BMGSnRC0zY3j2x5IQdEXuGHCsknjHaJpj+el5uv+vkfQT0RN50r1LVCEEGJ103QwDc2seS98nz6oWUJwdQVCYfn97iAjLbI7lKi3NwG9l1wWC5DSzGYKbE6tdM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1676313964697368.40399018940093; Mon, 13 Feb 2023 10:46:04 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRdoI-00018c-2h; Mon, 13 Feb 2023 13:44:18 -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 1pRdoG-00017e-G1 for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:44:16 -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 1pRdoE-0008S7-FA for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:44:16 -0500 Received: by mail-wr1-x42b.google.com with SMTP id bu23so13250387wrb.8 for ; Mon, 13 Feb 2023 10:44:14 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id d7-20020adfe887000000b002c551f7d452sm5849414wrm.98.2023.02.13.10.44.11 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Feb 2023 10:44:12 -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=JeDWNjpVkKdLbShBUyGUp3JADBIyaux21T6WZ6Gmeuk=; b=wyGNJ1e9rn/cDhznCSVxUi9QrvUJeeLe8uPIVaQFHCRyHTpKxt2Ypmp10tI6tUxfB0 sRoKpqNXV7RKip9Zc4kvT8+TygwQdjYtYghtf+HCqxiYCo41uqy5VuWVd4IJaE0LFjao E0mbxveHTg9HG2TAjcMMZVRKAivzx/2x9wDzJJgE+YhRsm5baDHC6JBA5I1cuQvgh/zj 3mlprAZ9z/U0phbuPrcs8ylB2nhWVEyHQ9jQEHR1eCu3/3AMAm54xj1XDz+Z0krnMl3H EkrRuQ8Kx+o9+VFy0QP5L8SQf0Gxz3lzHBa0iHHVSR3mzhyraF5058ynu7rE8/5/LX6C iSfw== 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=JeDWNjpVkKdLbShBUyGUp3JADBIyaux21T6WZ6Gmeuk=; b=uZwcHTgMk0oCtF39RATeBZCX4o0DegQk2tYJP7eYTI1fVycdBfDhJu0tgLk/QVI98P dKAkITN8bMuB2Cjnbriane2JQBxGtW+zUfVrDLBfgwEnOp5aiXlpJfAuERYGopFgq1N4 ABBymGicJeB7WValiCf/eRJI5DgMzwgo/VaiuBrQUE3MwFNrL8trFiKQDHnr0BAPUvVa bsOH71TvCrBku6820huRW40RKhwFrlrLa6aMnWyheArfjrk9M1oVdLN+tqtspUz915Dn Jq1iG9ZQr3s8ziX5FJe65EFSZ5CWdeHIWKB8fEiKzqaXw3K0nGN7NEay8B1nviVSvv7S 39Aw== X-Gm-Message-State: AO0yUKVUL/0/sWoY5km7enjKA5kwr5PWOLwAbgNb9cjwkIL/raCC3rbW cbpVZxzs6M2OVyh4SMyvkTuJ3ykS6Wt+NDPZ X-Google-Smtp-Source: AK7set/MQgoBNoqrrPeAqBp71FtJAW50sAiDiEq9GDKq+W4U1A3FYyyT6lXdSuXvj8jhF1TXO0W77w== X-Received: by 2002:adf:e7d0:0:b0:2c5:586b:f53d with SMTP id e16-20020adfe7d0000000b002c5586bf53dmr4442166wrn.48.1676313852972; Mon, 13 Feb 2023 10:44:12 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-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=20Mathieu-Daud=C3=A9?= , John Snow Subject: [PATCH v3 06/14] hw/ide/qdev: Replace DO_UPCAST(IDEDevice) by IDE_DEVICE() Date: Mon, 13 Feb 2023 19:43:30 +0100 Message-Id: <20230213184338.46712-7-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1676313966403100009 Use the IDE_DEVICE() QOM type-checking macro to avoid DO_UPCAST(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/ide/qdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index 6ae2627a56..1ead62fd18 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -133,7 +133,7 @@ IDEDevice *ide_create_drive(IDEBus *bus, int unit, Driv= eInfo *drive) qdev_prop_set_drive_err(dev, "drive", blk_by_legacy_dinfo(drive), &error_fatal); qdev_realize_and_unref(dev, &bus->qbus, &error_fatal); - return DO_UPCAST(IDEDevice, qdev, dev); + return IDE_DEVICE(dev); } =20 int ide_get_geometry(BusState *bus, int unit, --=20 2.38.1 From nobody Fri May 17 11:05:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1676314030; cv=none; d=zohomail.com; s=zohoarc; b=meuVfqJ6t3qAmxY007i7mrhKY4XU/+HbyIMMHbA1dq9i45aI+X5qx3NyG/rEsXUU5rF7bTllmBH3kjw5IOhiadK9VM9N4+GGy3tz4TnpIsiNlXrDFvlhho8jHONv5AwMqVj4tehBTP2AqMPv1fVul0z8kV9guXeXSYBGMlBLUzw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676314030; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/hnCzjPfxFE+jbV/pOTQTvC2sGuBuierxSlf21esNXo=; b=bPU8cAYEmgJZWlM7a89XZem3x0/uAY7xeYhqtzBalvdZ4NNimt3LycWf7osY4VhRnLNM0myfgi8DU5QnDUHxx3JjUp+yI3n4IV/PBAbGwiDOprUEyzGhUlyqbOMjTcjutrGmjwa2H1NZ+A35bdqmW7PDFHWw1NPRZvHr1E7TMks= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1676314030072593.2194393709084; Mon, 13 Feb 2023 10:47:10 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRdoO-0001At-Gr; Mon, 13 Feb 2023 13:44:24 -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 1pRdoL-00019i-Mq for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:44:21 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRdoJ-0008TB-PA for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:44:21 -0500 Received: by mail-wr1-x42d.google.com with SMTP id k3so5634959wrv.5 for ; Mon, 13 Feb 2023 10:44:19 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id v18-20020a05600c445200b003de77597f16sm16158016wmn.21.2023.02.13.10.44.17 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Feb 2023 10:44:17 -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=/hnCzjPfxFE+jbV/pOTQTvC2sGuBuierxSlf21esNXo=; b=IX9uVrlK4z4v5wHmT/ms9nRTa9td+Wtl2M9zlza8++IaYw7ZXYjHQ2VrFrHfN7KwFl FnxP9XhB7nBrp9qunnp67yNoGbX736q7NpdRXv3exJluCAnHZCx5UuHqDKJegR5GI/Cd d8ojIQYm/E+aiuHTRFEV+RUh39hLJ+ZlD5eSJsmxrhwGKpRsp2vu3f0R0+J1ZQoE+c3p vsVk8Y148lADz+/LkloHBZWHSqwXRqNqbLTl35a3ArLXs0hKZgNbItcbRGAHltbc94Cm tQ396zmUAOvHv9imYwrxaD3hg02o080qMYD/rZ4IF4NxqKt9PgLzk4Clg4ACaPcnQRfp kbTQ== 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=/hnCzjPfxFE+jbV/pOTQTvC2sGuBuierxSlf21esNXo=; b=qxittwVlHPlGGaMJOLbWiR84Z5gOcaRfzpCytU+H39WqTbzjpCQAJlceJUCD6zEp8H PtagJr+wFZSRwOXu2fKmNJBt1m8HW5N+/VZnjKruFoasb12LymKKqIozG0qVT0oxIala 6tlxc2Hg1b7G7yw85aKuhELRcZBcYsdzFw2T/UpDLbCGd6DfPI6r55ZVve0prK/oPFZK JQGEY13oYFhddSmgCuAgz+FfYOnMHrh8ByT3zLxizi/WsWieOaw8nUu0Kd0VfOIlhjHM GtWt1LY9RD1Guxvf+VmJr8NZDNzwEK0fUoVdTnqA3RyB5iqDeGDS7sts3fvWgesjonjd OxGw== X-Gm-Message-State: AO0yUKVVhwzi2lWwwC2Ad+GD80I2JnR4Nxw8FfJM8/mL0gvx54L9J2e4 GyE1mA/0sExhw+N/im86FYU2FRqC/pVO6FGZ X-Google-Smtp-Source: AK7set/fPAAMQj/95nERDCqSiBR95w+sxR1I7ZgkvFM3+BKM5OtHu/dLh8JCdg6fNgKtjRRMFcBq2A== X-Received: by 2002:a5d:4ec6:0:b0:2c5:587e:75ba with SMTP id s6-20020a5d4ec6000000b002c5587e75bamr4147313wrv.55.1676313858144; Mon, 13 Feb 2023 10:44:18 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-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=20Mathieu-Daud=C3=A9?= , John Snow Subject: [PATCH v3 07/14] hw/ide/qdev: Replace DO_UPCAST(IDEBus) by IDE_BUS() Date: Mon, 13 Feb 2023 19:43:31 +0100 Message-Id: <20230213184338.46712-8-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=philmd@linaro.org; helo=mail-wr1-x42d.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1676314030660100001 Use the IDE_BUS() QOM type-checking macro to avoid DO_UPCAST(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/ide/qdev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index 1ead62fd18..a168643266 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -90,7 +90,7 @@ static void ide_qdev_realize(DeviceState *qdev, Error **e= rrp) { IDEDevice *dev =3D IDE_DEVICE(qdev); IDEDeviceClass *dc =3D IDE_DEVICE_GET_CLASS(dev); - IDEBus *bus =3D DO_UPCAST(IDEBus, qbus, qdev_get_parent_bus(qdev)); + IDEBus *bus =3D IDE_BUS(qdev_get_parent_bus(qdev)); =20 if (dev->unit =3D=3D -1) { dev->unit =3D bus->master ? 1 : 0; @@ -139,7 +139,7 @@ IDEDevice *ide_create_drive(IDEBus *bus, int unit, Driv= eInfo *drive) int ide_get_geometry(BusState *bus, int unit, int16_t *cyls, int8_t *heads, int8_t *secs) { - IDEState *s =3D &DO_UPCAST(IDEBus, qbus, bus)->ifs[unit]; + IDEState *s =3D &IDE_BUS(bus)->ifs[unit]; =20 if (s->drive_kind !=3D IDE_HD || !s->blk) { return -1; @@ -153,7 +153,7 @@ int ide_get_geometry(BusState *bus, int unit, =20 int ide_get_bios_chs_trans(BusState *bus, int unit) { - return DO_UPCAST(IDEBus, qbus, bus)->ifs[unit].chs_trans; + return IDE_BUS(bus)->ifs[unit].chs_trans; } =20 /* --------------------------------- */ @@ -164,7 +164,7 @@ typedef struct IDEDrive { =20 static void ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind, Error **errp) { - IDEBus *bus =3D DO_UPCAST(IDEBus, qbus, qdev_get_parent_bus(DEVICE(dev= ))); + IDEBus *bus =3D IDE_BUS(qdev_get_parent_bus(DEVICE(dev))); IDEState *s =3D bus->ifs + dev->unit; int ret; =20 --=20 2.38.1 From nobody Fri May 17 11:05:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1676314043; cv=none; d=zohomail.com; s=zohoarc; b=mKqFnxry1zwDDwLAHq7bCY3vK82P5TYs7TuYTvyjNDK5kG7xX/9W+EISoRiJC5DGiN5QYzezX6rlcHxQNay97R18inaa9v+cFwnbMrfxBX+VK/euHsGoSNZ/C4a6LLAc2FjHPKmHsEVpIEzdksva1KpDNo2mDGIXeSa03b/ShXY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676314043; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VotmsYo6EZx1VvqMFkr1+QDMy3wRb1XAiA9w0UCQyq8=; b=OEecm9lNVmEMMFtdkKXri18HdMeh0cnKmig/3DOgmYxdnu/2BOfPcsBWyTTse1UENFOIzd2UzRXCAAA8+vzguYEng89LygFI+6XBktyNmaz+2eFoZdOZ8J2FXZ09D/hiG8qGek3/k3jQxDJ87IGFkvuRGS4OoBN93YYF5dytsjg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1676314043115381.2125852082138; Mon, 13 Feb 2023 10:47:23 -0800 (PST) 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) 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) 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-Google-Smtp-Source: AK7set+ttktzTE0funo+iFA5a2T8gBjUoqvrzkcZ/Ca8lK9NiXCf5sXy+/grsVOUzSNomaTkYfeJ5Q== 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) From: =?UTF-8?q?Philippe=20Mathieu-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=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1676314044751100013 Define TYPE_PCI_NE2000 and the QOM PCI_NE2000() macro. Use PCI_NE2000() instead of DO_UPCAST(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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" =20 -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; +}; =20 static const VMStateDescription vmstate_pci_ne2000 =3D { .name =3D "ne2000", @@ -54,7 +60,7 @@ static NetClientInfo net_ne2000_info =3D { =20 static void pci_ne2000_realize(PCIDevice *pci_dev, Error **errp) { - PCINE2000State *d =3D DO_UPCAST(PCINE2000State, dev, pci_dev); + PCINE2000State *d =3D PCI_NE2000(pci_dev); NE2000State *s; uint8_t *pci_conf; =20 @@ -77,7 +83,7 @@ static void pci_ne2000_realize(PCIDevice *pci_dev, Error = **errp) =20 static void pci_ne2000_exit(PCIDevice *pci_dev) { - PCINE2000State *d =3D DO_UPCAST(PCINE2000State, dev, pci_dev); + PCINE2000State *d =3D PCI_NE2000(pci_dev); NE2000State *s =3D &d->ne2000; =20 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 =3D PCI_DEVICE(obj); - PCINE2000State *d =3D DO_UPCAST(PCINE2000State, dev, pci_dev); + PCINE2000State *d =3D PCI_NE2000(pci_dev); NE2000State *s =3D &d->ne2000; =20 device_add_bootindex_property(obj, &s->c.bootindex, @@ -117,7 +123,7 @@ static void ne2000_class_init(ObjectClass *klass, void = *data) } =20 static const TypeInfo ne2000_info =3D { - .name =3D "ne2k_pci", + .name =3D TYPE_PCI_NE2000, .parent =3D TYPE_PCI_DEVICE, .instance_size =3D sizeof(PCINE2000State), .class_init =3D ne2000_class_init, --=20 2.38.1 From nobody Fri May 17 11:05:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1676313987; cv=none; d=zohomail.com; s=zohoarc; b=GPKLbOOqws+ywp7HIIKRYElXXSIhqhID540a2I7vc/JwTEcOc/P9lJgNsEjdyvECFbsvj9nJRWYnsLYuc1gbsDatRi58CtEINx5OzbnxpL9P3HNsD+pP+8xjBBsPrkhq8me4tycTJyg4VxxMWkMJKIFGmZVGYTDc+qZNeS0hVWY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676313987; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=fD8XsrjHaA7eijBs8OwmQ3XFemQ30TcP+DXj6h7knEg=; b=jydvqe4gu7nSnOrK9wYH/PXKxRe+XZjpHdVO1HLNBDWceYeJ+31mDMU7PgP8ZY1h4xmvzxj3buMUE1JzKzD3DZis8TYaFMl6t8t+yJ9mGv/nrldB7DPNTT2tXx+lOU9vJW2el0/nW19VbDe0fZyxXUXgpTq8+SZq3p3aWb4rpeI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1676313987417573.5319250120905; Mon, 13 Feb 2023 10:46:27 -0800 (PST) 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) 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) 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-Google-Smtp-Source: AK7set+0F/IC3ACw97foscAd1Yh3dEJIa8CBVY8UR2vjeghYtXwz20EDRQqvYdIH121r17pg40+1Hw== 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) From: =?UTF-8?q?Philippe=20Mathieu-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=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1676313988536100001 Use the TULIP() and DEVICE() QOM type-checking macros. Remove uses of DO_UPCAST(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 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" =20 struct TULIPState { + /*< private >*/ PCIDevice dev; + /*< public >*/ + MemoryRegion io; MemoryRegion memory; NICConf c; @@ -959,7 +962,7 @@ static void tulip_fill_eeprom(TULIPState *s) =20 static void pci_tulip_realize(PCIDevice *pci_dev, Error **errp) { - TULIPState *s =3D DO_UPCAST(TULIPState, dev, pci_dev); + TULIPState *s =3D TULIP(pci_dev); uint8_t *pci_conf; =20 pci_conf =3D s->dev.config; @@ -967,7 +970,7 @@ static void pci_tulip_realize(PCIDevice *pci_dev, Error= **errp) =20 qemu_macaddr_default_if_unset(&s->c.macaddr); =20 - s->eeprom =3D eeprom93xx_new(&pci_dev->qdev, 64); + s->eeprom =3D eeprom93xx_new(DEVICE(pci_dev), 64); tulip_fill_eeprom(s); =20 memory_region_init_io(&s->io, OBJECT(&s->dev), &tulip_ops, s, @@ -983,27 +986,26 @@ static void pci_tulip_realize(PCIDevice *pci_dev, Err= or **errp) =20 s->nic =3D 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); } =20 static void pci_tulip_exit(PCIDevice *pci_dev) { - TULIPState *s =3D DO_UPCAST(TULIPState, dev, pci_dev); + TULIPState *s =3D TULIP(pci_dev); =20 qemu_del_nic(s->nic); qemu_free_irq(s->irq); - eeprom93xx_free(&pci_dev->qdev, s->eeprom); + eeprom93xx_free(DEVICE(s), s->eeprom); } =20 static void tulip_instance_init(Object *obj) { - PCIDevice *pci_dev =3D PCI_DEVICE(obj); - TULIPState *d =3D DO_UPCAST(TULIPState, dev, pci_dev); + TULIPState *s =3D TULIP(obj); =20 - 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)); } =20 static Property tulip_properties[] =3D { --=20 2.38.1 From nobody Fri May 17 11:05:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1676313963; cv=none; d=zohomail.com; s=zohoarc; b=DU9Ehekt56nVPj2vUIDHZFdz1UDxqpFgwtKxedfhJ4FBx3fgBwipmyAITjfgg2hyjK4RYHsTb5mqww/O+2ROewdVxiPSAnJmBQVC/orPu1vA4+K+iabre8X/sWFamyypBs4n5MVCyppu8wo9VxPiTsF1yxu6gBn2/qi2nu6i2Fw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676313963; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3YnlWYrFQuWXt1rppNJud8kwI6R078rMYORIY8x9Pr4=; b=hS58CjSNf7RWcarz/k6NHfBzjqAU1N7AlvuXjBVIB2PGZBa5dKVAZh1D/+U3i1tH2aCAt0UU2Ce3w/njwOqPYm+h2GnGRBbatWt81QlO5kK/eweGuIzF2qHfkQLbGYuKVJmTtgD5gspdoA03xO12wBAW4uAfR6uIqmuA55hIeIg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1676313963060113.46827271687164; Mon, 13 Feb 2023 10:46:03 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRdoe-0001nB-6I; Mon, 13 Feb 2023 13:44:40 -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 1pRdoc-0001hf-Bp for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:44:38 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRdoa-0008T9-Fz for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:44:37 -0500 Received: by mail-wr1-x42d.google.com with SMTP id m14so13242538wrg.13 for ; Mon, 13 Feb 2023 10:44:35 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id m17-20020a05600c3b1100b003df5be8987esm19080586wms.20.2023.02.13.10.44.34 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Feb 2023 10:44:35 -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=3YnlWYrFQuWXt1rppNJud8kwI6R078rMYORIY8x9Pr4=; b=BfsZ/BP4Bj77HitzpAxlAgqnSThR1vBBm4ORMLX3gPBBk+Yt9lLoiFO5JNcCQ/CrTQ 5ZLRYeMaTkKUIZpiCo5h6WzLQwUf1UOFFiyIGdFE+FaRHVruAZFaQ1il4/10R0jz/yhR DunoSIYVsXnAXXQ+Uhl89HK6YJDbaKCdLR9emwlSoObFYTL9YvtSetyVVcK82f9C/FVU TzX8A7LPSwPlSWSg3JVfGUJMIPdq+X1VaftsTe3iGjOdTYDLkvGQNgTN0QFsNi9pEOv7 ORjPr3HuW8kpgqHhaAa7KokUtEmdl0RDdSBp5W2DdLpBVAAzX5dUeUulpq23wNdmpjJE XVeA== 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=3YnlWYrFQuWXt1rppNJud8kwI6R078rMYORIY8x9Pr4=; b=nmw52/FNX6uSzEhb+kbb2a3avtTs6j1Zj5EQxsZRuXIYAkR4QrdEL6onFXPT5XxJKB W+Uq/0x1YIKvhuuRakgy+wUYO9//sHYwzxQx6ubMx/EdsdLWHgXRDm8pzEOSSJ20QfEk vfj6XoCKdUOtk/IPflBk9EItotDH2UJaqeeOhX6BNAaxsi3GOFUbnHZL2Cd/AJuJUDmn HDiLHxk8Vboa0ccav2+7Zuy1ht0xQnjrV5AcUuK9LX6mo6BKAHtZFqbCgrf54xlluwP4 9O8QfuqsFMcl8Hdvh4Lv9Tkatakow0gc2vqV6hsUT4eO+Ele1eINxBKS0TdJH3MT/iIb lRjg== X-Gm-Message-State: AO0yUKW6JU1teBBO80QXzEyOShs1686c326ZA4mtJ5W5sCOOP5NrhfMm r1+KQKycKSaFitTOwPp8FfHgJ7RtOQME+QJt X-Google-Smtp-Source: AK7set+SNr4ZuTEvP/gd8VtjCUM0EEHTi7QjIKQsOuz3b7ITdDO+q7mpfZMBrbPVemy/B9OjZYrzFA== X-Received: by 2002:a5d:5044:0:b0:2c3:eaff:aae9 with SMTP id h4-20020a5d5044000000b002c3eaffaae9mr21611803wrt.19.1676313875408; Mon, 13 Feb 2023 10:44:35 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-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=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Marcel Apfelbaum Subject: [PATCH v3 10/14] hw/pci/pci: Replace DO_UPCAST(PCIBus) by PCI_BUS() Date: Mon, 13 Feb 2023 19:43:34 +0100 Message-Id: <20230213184338.46712-11-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=philmd@linaro.org; helo=mail-wr1-x42d.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1676313964388100002 Use the PCI_BUS() QOM type-checking macro to avoid DO_UPCAST(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/pci/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 2e785e3aef..ae5c33adb6 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -391,7 +391,7 @@ void pci_device_reset(PCIDevice *dev) */ static void pcibus_reset(BusState *qbus) { - PCIBus *bus =3D DO_UPCAST(PCIBus, qbus, qbus); + PCIBus *bus =3D PCI_BUS(qbus); int i; =20 for (i =3D 0; i < ARRAY_SIZE(bus->devices); ++i) { --=20 2.38.1 From nobody Fri May 17 11:05:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1676314039; cv=none; d=zohomail.com; s=zohoarc; b=ioO4FHiOO//7fud5XRy7uP4u+4qgq9uX2qRIBkHiCju6v3J2L51F+b3ge7MbJ+FnXkCvuTk5DJkH0qOCefEy57C+8KJhNLFdVpSnyuah8rGWNpQe+Ze4fvbHjw7M4E4Ns6Wm9aRRqrJAcBnhpHa6o8jgzftzsfaGLSmBMvjkILk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676314039; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=lbFFSEwuPaiVjYWiGHnO40wk80nlXCVErHPDaxFN7V8=; b=NU7rEOM9vjgmDR4moam/jC3CNyEyBFiWFhYA1cMqg5FAe1i1GAohtPcksONBLLz5IBoFiq68vviaKN3F140mGOcSNJhjvPOvBNw6vRoxtqvp0HMivr2rmJSHzQfjc6yr7ucteYVjGFhjIEj+vZgSqevI5d/nd8lzQuVoVtGg6Ao= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1676314039788878.746882694449; Mon, 13 Feb 2023 10:47:19 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRdon-0001tb-Gu; Mon, 13 Feb 2023 13:44: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 1pRdoi-0001qI-RV for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:44:45 -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 1pRdoh-0008Vz-6A for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:44:44 -0500 Received: by mail-wm1-x32b.google.com with SMTP id n33so3342179wms.0 for ; Mon, 13 Feb 2023 10:44:42 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id w19-20020a05600c475300b003e11f280b8bsm12751880wmo.44.2023.02.13.10.44.39 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Feb 2023 10:44:41 -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=lbFFSEwuPaiVjYWiGHnO40wk80nlXCVErHPDaxFN7V8=; b=IrXHoLjJvRO9HbHPw2U4rArVJbApZYzgT816Q/pq4Jyd2LDWRJAuEVdwriT218Lzn7 ye/qO2wqhc68fUyeCPd7xThRwUqnuN2T3yCFCnwa6gsOaR9IEufcrVOiWnnen96v6EFc e9ZV+oqDtSmMP9lb/+t9Ficg3RCWoRLrXwEPgfBwNLuZZzgxFHkmJJwAh7nylUCsm+IW 7+QpvroKmoYkNWfaNE8jRpLod7LclueYvIyp93PG6fv+YWkiPYF1OtWtJHrMUG1W1m6G 6N6sIlvxhh+kQiWM5xtP1EEB/3Pwlzme8VjPXAnjdo6crbpn3Hsd0nGOazZzVF99lVpF XKaw== 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=lbFFSEwuPaiVjYWiGHnO40wk80nlXCVErHPDaxFN7V8=; b=XNTVfTbjaKl2YBzchxQIbi11DbFJ8kYANzu3bvb6rqUhRbGbKXjHrSvE3rEh+LijNR IoxacG5Rl8aifVhUpWX/M/eYnNhmmLy9O/Q8HICR6XEg5AnQGmTU5wycjU4X1AENrywT p2XQdfGTvVJyJONQ4TVBg4HaRU9d/hMoRc0blqQfFH/P01enakdjMRA8atP+HlAaREYi oHolf3CLqWUahLfX0u6CSgPc4BKZUh+NkrOqYbMHoOX0ufyu1z0vfJf3P9nTkolyBapH EbLTsNUS4M4kkNgby4m2ZWkJH2NgB7XKNMfzXHdjWkCc3729hIYYYFjBELD/9FLX7N4x iZxw== X-Gm-Message-State: AO0yUKXexTDu4rVbXnf6/MwY5ffIbzgKRgBzlSjbAk6lwTzCzJPj+eRQ Vv4MTvn6TFN8yoOqgNbRjCCJtuY1A4TELHte X-Google-Smtp-Source: AK7set8nIPN91DREOFKQvt+K55Z1k2Vl3+XAisCdkJ3vPKfF34AlyUm6jCwAeeVdey0Kjm76r8etMw== X-Received: by 2002:a05:600c:3403:b0:3dc:572f:edb7 with SMTP id y3-20020a05600c340300b003dc572fedb7mr5131983wmp.1.1676313881348; Mon, 13 Feb 2023 10:44:41 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-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=20Mathieu-Daud=C3=A9?= , Paolo Bonzini , Fam Zheng Subject: [PATCH v3 11/14] hw/scsi/scsi-bus: Replace DO_UPCAST(SCSIBus) by SCSI_BUS() Date: Mon, 13 Feb 2023 19:43:35 +0100 Message-Id: <20230213184338.46712-12-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1676314040706100001 Use the SCSI_BUS() QOM type-checking macro to avoid DO_UPCAST(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/scsi/scsi-bus.c | 12 ++++++------ include/hw/scsi/scsi.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index 7b2a82b335..c4525515ab 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -104,7 +104,7 @@ static void scsi_device_unrealize(SCSIDevice *s) int scsi_bus_parse_cdb(SCSIDevice *dev, SCSICommand *cmd, uint8_t *buf, size_t buf_len, void *hba_private) { - SCSIBus *bus =3D DO_UPCAST(SCSIBus, qbus, qdev_get_parent_bus(DEVICE(d= ev))); + SCSIBus *bus =3D SCSI_BUS(qdev_get_parent_bus(DEVICE(dev))); int rc; =20 assert(cmd->len =3D=3D 0); @@ -250,7 +250,7 @@ static bool scsi_bus_check_address(BusState *qbus, Devi= ceState *qdev, Error **er static void scsi_qdev_realize(DeviceState *qdev, Error **errp) { SCSIDevice *dev =3D SCSI_DEVICE(qdev); - SCSIBus *bus =3D DO_UPCAST(SCSIBus, qbus, qdev_get_parent_bus(DEVICE(d= ev))); + SCSIBus *bus =3D SCSI_BUS(qdev_get_parent_bus(qdev)); bool is_free; Error *local_err =3D NULL; =20 @@ -705,7 +705,7 @@ SCSIRequest *scsi_req_alloc(const SCSIReqOps *reqops, S= CSIDevice *d, SCSIRequest *scsi_req_new(SCSIDevice *d, uint32_t tag, uint32_t lun, uint8_t *buf, size_t buf_len, void *hba_private) { - SCSIBus *bus =3D DO_UPCAST(SCSIBus, qbus, qdev_get_parent_bus(DEVICE(d= ))); + SCSIBus *bus =3D SCSI_BUS(qdev_get_parent_bus(DEVICE(d))); const SCSIReqOps *ops; SCSIDeviceClass *sc =3D SCSI_DEVICE_GET_CLASS(d); SCSIRequest *req; @@ -1353,7 +1353,7 @@ int scsi_req_parse_cdb(SCSIDevice *dev, SCSICommand *= cmd, uint8_t *buf, =20 void scsi_device_report_change(SCSIDevice *dev, SCSISense sense) { - SCSIBus *bus =3D DO_UPCAST(SCSIBus, qbus, qdev_get_parent_bus(DEVICE(d= ev))); + SCSIBus *bus =3D SCSI_BUS(qdev_get_parent_bus(DEVICE(dev))); =20 scsi_device_set_ua(dev, sense); if (bus->info->change) { @@ -1698,7 +1698,7 @@ static int put_scsi_requests(QEMUFile *f, void *pv, s= ize_t size, const VMStateField *field, JSONWriter *vmdesc) { SCSIDevice *s =3D pv; - SCSIBus *bus =3D DO_UPCAST(SCSIBus, qbus, qdev_get_parent_bus(DEVICE(s= ))); + SCSIBus *bus =3D SCSI_BUS(qdev_get_parent_bus(DEVICE(s))); SCSIRequest *req; =20 QTAILQ_FOREACH(req, &s->requests, next) { @@ -1726,7 +1726,7 @@ static int get_scsi_requests(QEMUFile *f, void *pv, s= ize_t size, const VMStateField *field) { SCSIDevice *s =3D pv; - SCSIBus *bus =3D DO_UPCAST(SCSIBus, qbus, qdev_get_parent_bus(DEVICE(s= ))); + SCSIBus *bus =3D SCSI_BUS(qdev_get_parent_bus(DEVICE(s))); int8_t sbyte; =20 while ((sbyte =3D qemu_get_sbyte(f)) > 0) { diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h index 843dde8851..eb558c145a 100644 --- a/include/hw/scsi/scsi.h +++ b/include/hw/scsi/scsi.h @@ -177,7 +177,7 @@ static inline void scsi_bus_init(SCSIBus *bus, size_t b= us_size, =20 static inline SCSIBus *scsi_bus_from_device(SCSIDevice *d) { - return DO_UPCAST(SCSIBus, qbus, qdev_get_parent_bus(DEVICE(d))); + return SCSI_BUS(qdev_get_parent_bus(DEVICE(d))); } =20 SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockBackend *blk, --=20 2.38.1 From nobody Fri May 17 11:05:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1676314016; cv=none; d=zohomail.com; s=zohoarc; b=U2Rl3RSZUsncTvz89oHbR6F9kWTNYCXcZjy/fckmpkgoG3lmkvjT8QGWwAiwKsQy0wYycCJT1sex4GFO40G/7Cm2DOughhGVYAV+vFUugxaG9n9R9CnNM2JkJL2+LducNMSmVBHGES7MzMnUFlL+cEFQcD92R3erlT3R04Uw0BQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676314016; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tUBrGbpKKV7VXqQbLaZwgKrboQidPjnhwuwd1SCLF+8=; b=UqrZdEi7D+Ph6fkIJ+gU0ogbW9oNK8eu71vybC1gzQ3/sLy681bUecmTTh7kg0qzClk5w2+V3hatU6+bV9uunpbhVQkXdHrQA6IOXWkstzWTcga6swocomSmJNQAfKzybuBdm5SCZbwRLQoVcpqmfWAonkuDyWFG8HmnL+Ta8pg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1676314016336962.5809460211059; Mon, 13 Feb 2023 10:46:56 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRdot-0002BT-BA; Mon, 13 Feb 2023 13:44:55 -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 1pRdon-0001uI-T2 for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:44:50 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRdom-00005y-Ap for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:44:49 -0500 Received: by mail-wr1-x42d.google.com with SMTP id o15so9957003wrc.9 for ; Mon, 13 Feb 2023 10:44:47 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id u10-20020a5d514a000000b002c3e28d0343sm10858412wrt.85.2023.02.13.10.44.45 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Feb 2023 10:44:46 -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=tUBrGbpKKV7VXqQbLaZwgKrboQidPjnhwuwd1SCLF+8=; b=Y8Ti4NsiohEQUAwGn4nIW2vrzmlzBdyveHD0R2pymv7YcsEdcJH37KbcbKCHjxyi1c 5eCCOHQ8SJKZs9KJT0qWswgVIHttpgaMVc47pTxTa9+BnYx8ZXLi8UZcOnCGGtOZClsr sbvA+kP/7kN/CqLOCvsulEYrCEGktlO19cwXU2vK+z5F4zlsQletWkRSb5S1IDS5zHni MX7DpJcpW9cNlKZRIjiZ1lQigU8fXOkIitpLssFx+ZaQ8L/2bXJmG2oQU6jqUPDEJTAk 6IY6EUcK66jaoSkkjh5qZLhoEYVLPOqRdimD+To3BbYqHIDJp6p15SjS2H25lz76PD0y p8pA== 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=tUBrGbpKKV7VXqQbLaZwgKrboQidPjnhwuwd1SCLF+8=; b=xjMw/4FiUS/HU9wjotVjM79QtEkXB7B5eMw8y1NqfR2OR+o3CnU9GACFZWpHGaqd0G TQy2HspMhEDsShVBgiUaxnoVI5PR11CEBApmTPsY595hOxtskWyebPS9u04EqNWICp2/ 7MJz/qe9ZF0JuxnyJ5eP8eRryuquteLHrrlh4oh2EphUVUnPh4jT1LJW289HONBJGr4Q 5Jqjk2JgreHViG7Fg+ZM6ATZRm1z2qIHs8t0elpcx02lAot7JoeT3BDR7A0JVrkahiXG n40sPP4OX02apt+RipK/ZRvrTZOj/+EupiwjuxVD6n/+Gog2CjUqlnsuZrfiE9IjaoWL Tp4g== X-Gm-Message-State: AO0yUKVlHYQSg68XEimmgtaD7BxREnZjRvaF3vHgTRwj/Lzg73Sth6qw kC1FWuND9WT8TlvKUtgdQnb1YWqOlBypMywa X-Google-Smtp-Source: AK7set+kskLHDiP1Hyxq0fWbGVLWSLlCDYkSDl9OY7AR7MAuc1Luisy8En31AtlcFlkA3wdTZKt1+Q== X-Received: by 2002:a5d:4bc3:0:b0:2c5:5184:abc with SMTP id l3-20020a5d4bc3000000b002c551840abcmr5918859wrt.59.1676313886940; Mon, 13 Feb 2023 10:44:46 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-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=20Mathieu-Daud=C3=A9?= , Eric Farman , Christian Borntraeger , Halil Pasic , David Hildenbrand , Ilya Leoshkevich , Paolo Bonzini , Fam Zheng , qemu-s390x@nongnu.org Subject: [PATCH v3 12/14] hw/scsi/scsi-bus: Inline two uses of scsi_bus_from_device() Date: Mon, 13 Feb 2023 19:43:36 +0100 Message-Id: <20230213184338.46712-13-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=philmd@linaro.org; helo=mail-wr1-x42d.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1676314020619100001 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Eric Farman --- hw/s390x/ipl.c | 7 ++----- hw/scsi/scsi-bus.c | 2 +- include/hw/scsi/scsi.h | 5 ----- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c index 8612684d48..4f7f4e60d6 100644 --- a/hw/s390x/ipl.c +++ b/hw/s390x/ipl.c @@ -366,11 +366,8 @@ static CcwDevice *s390_get_ccw_device(DeviceState *dev= _st, int *devtype) ccw_dev =3D CCW_DEVICE(vfio_ccw_dev); tmp_dt =3D CCW_DEVTYPE_VFIO; } else { - SCSIDevice *sd =3D (SCSIDevice *) - object_dynamic_cast(OBJECT(dev_st), - TYPE_SCSI_DEVICE); - if (sd) { - SCSIBus *sbus =3D scsi_bus_from_device(sd); + if (object_dynamic_cast(OBJECT(dev_st), TYPE_SCSI_DEVICE)) { + SCSIBus *sbus =3D SCSI_BUS(qdev_get_parent_bus(dev_st)); VirtIODevice *vdev =3D (VirtIODevice *) object_dynamic_cast(OBJECT(sbus->qbus.parent), TYPE_VIRTIO_DEVICE); diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index c4525515ab..ee72b86b13 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -679,7 +679,7 @@ SCSIRequest *scsi_req_alloc(const SCSIReqOps *reqops, S= CSIDevice *d, uint32_t tag, uint32_t lun, void *hba_private) { SCSIRequest *req; - SCSIBus *bus =3D scsi_bus_from_device(d); + SCSIBus *bus =3D SCSI_BUS(qdev_get_parent_bus(DEVICE(d))); BusState *qbus =3D BUS(bus); const int memset_off =3D offsetof(SCSIRequest, sense) + sizeof(req->sense); diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h index eb558c145a..e3263dec0d 100644 --- a/include/hw/scsi/scsi.h +++ b/include/hw/scsi/scsi.h @@ -175,11 +175,6 @@ static inline void scsi_bus_init(SCSIBus *bus, size_t = bus_size, scsi_bus_init_named(bus, bus_size, host, info, NULL); } =20 -static inline SCSIBus *scsi_bus_from_device(SCSIDevice *d) -{ - return SCSI_BUS(qdev_get_parent_bus(DEVICE(d))); -} - SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockBackend *blk, int unit, bool removable, int bootin= dex, bool share_rw, --=20 2.38.1 From nobody Fri May 17 11:05:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1676313910; cv=none; d=zohomail.com; s=zohoarc; b=ch9yxco/2S1EJEt3LKzVqVmnquBBIBxnRaYBC5NQmVgBPBZ9L7Kajubq6g55CpZl3CYmqApiUR4tdbxDY6NUn8eC4B7U3TC6W5WcX9r3FuBokOiunonpOdbviUX1362gUnT+S2C5joE3o+S2qg/P32tjoiVHgQkclJgbrkyPpL0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676313910; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yI1y6XZsaobmGFW1lR+eKSaDWZj5kiLu704LCMt3Xc4=; b=caBuG4NCjUWg/Y4RRWZ1yg+YpF2FzU+vUSBrHUgDwWk2qd3HlJC8dQ6DDzqT8pWoVZEvUWlWsFAVZWg2K2vcvOYkV3wXBf+wKXj67DgNzdYttCuE6gtkFhBynJmHgrEf+QBagKpqLH9MZHsJ706pHv7gLZ0SrsR42ErUO/xgY2k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 167631391026618.11140519150149; Mon, 13 Feb 2023 10:45:10 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRdow-0002LY-RG; Mon, 13 Feb 2023 13:44:58 -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 1pRdot-0002DO-3x for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:44:55 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRdor-00008M-I6 for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:44:54 -0500 Received: by mail-wm1-x32a.google.com with SMTP id m16-20020a05600c3b1000b003dc4050c94aso9767055wms.4 for ; Mon, 13 Feb 2023 10:44:53 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id y6-20020a05600c364600b003df7b40f99fsm17139595wmq.11.2023.02.13.10.44.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Feb 2023 10:44:51 -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=yI1y6XZsaobmGFW1lR+eKSaDWZj5kiLu704LCMt3Xc4=; b=Ao75rupKEQ4AuOjLz8TKCzWe+lCHyAzKJ9Zo+E2WZlexKnJPUXtKTuKxpEhjQtEo1X 3mQ7Xk4mKQC0OJpigD9sNKdmrn/w8rNPXbAvLyy1G2kyWpYk9TMTo37Nec2CjxbxcEeE Q4fvP7+JphzgaCCFotnT4Y0yN0sU9gUQPIaqwu/PUbvKvPq4cvMVc+u+pM7TR1211pQp Wuges9BAp8uoVN9KBoQgbO7H6x3MN4Nk7wLTBSTyoxXWXDdS43zAH+sPh4lsBwr+W1dn /FNqiW7iuFsfZLALh9+KM1XJ7N0U/Lc3PBBnR3XUdLULeWa8wShtwRjBfXfkjX9py9fH K1rw== 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=yI1y6XZsaobmGFW1lR+eKSaDWZj5kiLu704LCMt3Xc4=; b=I6x4uTylShE0zgbpMna18iyW3exjKJT++jfqNkLGMcGGtrMbDZlIe9c89MmvqAoPNl i6EBIXgAanOFyamifeU9bKKi5BeK5uJsxrEof9DT9UUFhq7TNaW3scNbUmhQyAwLpOJP gXj1JKDHyT0JW6Qrt5sAvxP8E7G8hnpLm0itlBPsJlz/yY9UZEmCtUENK3eHBpxsWQb6 jO5VOUvbDb9wBqLP4P5VuBd8aS1rz3Rs84/Ku3CKtm+YRXcBBvryCAdPTPlD+1rms2z3 CacIXfxCGKjOXyr0Io4jFPryq9cfT2AEXBWGUQ+bgm3SJvcQK93QRDtS+j0QsjlTzhxl 0Npw== X-Gm-Message-State: AO0yUKWugJTHm0Xv63yCoNCCaDLZwh7sDC/QBop2pVtc9rZWsjDsNkqa ZO7xygJn5qrZYys2PM46jGZ/cNJw8BSBuItE X-Google-Smtp-Source: AK7set9QvfSbow01BVrgJj2aIxonOsZTWw57MP899TCBnpozRmCwdtwh4NSxr4J3XOtYa3x83YrFEw== X-Received: by 2002:a05:600c:3510:b0:3dc:42d2:aeee with SMTP id h16-20020a05600c351000b003dc42d2aeeemr20043513wmq.25.1676313892145; Mon, 13 Feb 2023 10:44:52 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-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=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann Subject: [PATCH v3 13/14] hw/usb/dev-hub: Use QOM USB_HUB() macro instead of casting Date: Mon, 13 Feb 2023 19:43:37 +0100 Message-Id: <20230213184338.46712-14-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=philmd@linaro.org; helo=mail-wm1-x32a.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1676313912113100001 Use the safer USB_HUB() QOM type-checking macro instead of casts. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/usb/dev-hub.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/usb/dev-hub.c b/hw/usb/dev-hub.c index a6b50dbc8d..4734700e3e 100644 --- a/hw/usb/dev-hub.c +++ b/hw/usb/dev-hub.c @@ -350,7 +350,7 @@ static const char *feature_name(int feature) static void usb_hub_handle_control(USBDevice *dev, USBPacket *p, int request, int value, int index, int length, uint8_t *dat= a) { - USBHubState *s =3D (USBHubState *)dev; + USBHubState *s =3D USB_HUB(dev); int ret; =20 trace_usb_hub_control(s->dev.addr, request, value, index, length); @@ -523,7 +523,7 @@ static void usb_hub_handle_control(USBDevice *dev, USBP= acket *p, =20 static void usb_hub_handle_data(USBDevice *dev, USBPacket *p) { - USBHubState *s =3D (USBHubState *)dev; + USBHubState *s =3D USB_HUB(dev); =20 switch(p->pid) { case USB_TOKEN_IN: @@ -568,7 +568,7 @@ static void usb_hub_handle_data(USBDevice *dev, USBPack= et *p) =20 static void usb_hub_unrealize(USBDevice *dev) { - USBHubState *s =3D (USBHubState *)dev; + USBHubState *s =3D USB_HUB(dev); int i; =20 for (i =3D 0; i < s->num_ports; i++) { --=20 2.38.1 From nobody Fri May 17 11:05:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1676314040; cv=none; d=zohomail.com; s=zohoarc; b=kP18KqXpM7uCFxnJOk/t/ocPE4z+Q2B2uNRlRWRQqwWS1gRFlQfYxdBCw9MNK2zGkw6nqbm+It06W878+7jepc5uMCbBt5gYPZChecvUIp+JyqpfQweK06wlTWvYLFDEFncmUR29oFTZjaeqQmFw99aXxuBq7CqI5KcfoU2IJtU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676314040; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=BCofvFRozrpBRIR6kzkyhIQPbWbeiNV/KXSS7SVLec8=; b=C+menYYxZsNupKC/0lJU9/CyYMU+2vxEzH100E5ocF4pwpVYO1DCFr2xG8o6Z9YBIzYsteIt2nF0+eJO07txZQPl6HVqMwKr2xL3LmMrh/W7sb0CDBfzToV+7IjTY/Ahj0rlqucCuea6Ib1uUt1844YANyki1pXokB5IW0RToGE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1676314040844741.4008352937765; Mon, 13 Feb 2023 10:47:20 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRdp0-0002gm-G0; Mon, 13 Feb 2023 13:45:02 -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 1pRdoy-0002al-Qq for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:45:00 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRdow-0000Am-Ty for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:45:00 -0500 Received: by mail-wr1-x42a.google.com with SMTP id co8so9513364wrb.1 for ; Mon, 13 Feb 2023 10:44:58 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id u14-20020adff88e000000b002c56046a3b5sm1165934wrp.53.2023.02.13.10.44.56 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Feb 2023 10:44:57 -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=BCofvFRozrpBRIR6kzkyhIQPbWbeiNV/KXSS7SVLec8=; b=H8Jzcy26pGsu1nLmy1m7SaZmtNpDEoeb1Q+k9YDdSc8habOWsCapzngown3yprPtis Sf0OXtLkXRnZYh+de5+UzPr2MzXDtdzc63AhZFZ5xu7ni0QFww/NN3xBD/E3Xx0L03pA nw4gq0pmkg/66RsJ6HxpzzCjSW3szBEGPCk8D4Ks4B4mugByqXs0OGb5wRe6Yh/ndADb lV7bCubTP8EvZ7+7Vxo5dOOPQcFh2gZFQRf0YGcghLJDVv534BUemr4s/75JPOAsiZwA xUYetQp8R5SDt+Q1yzbhE5YGTqhS52qPLyvjnuROukRWMyMP7KNh05o9cGN9DUmNhtim hlOw== 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=BCofvFRozrpBRIR6kzkyhIQPbWbeiNV/KXSS7SVLec8=; b=EPKPZODjwgeBMbMftHn/Z8ONviFuNh+u3Vs4aMc7XXHiRd3WmAuSL+r6LHhPyu116R eGrQ5QYJ7KVdF0Dw7ueybLZnh8VcvEEzj9YoSyCFxYsIyURVh6cKoS4Jeqw7Sqjs3rh0 KGQ8pZ3USuyjV4xCvm3tV1bJwPv2b/fq7mbusYFW+7QThOSq9w/5dR/O+7mtKXwLjEeJ gMXTAXPybrfQ1WudPcWBVrcUWyW9NBXVGEyXRULfuixEpeM63zbXT3HgDxrQ1Zu0xYF4 ms6KZxid76rn8/mZZRnnF742eT2BU7x4iYndP5LPb/A805+3hUtt5GRPpfEmdOaIT8LF u0+A== X-Gm-Message-State: AO0yUKW0flCkAJVBbfJdlgP9N59D4LjgeT9SgKvH0QLv9y9lTj78JgK7 mZmDOOctLfkaAx+01kHmC9jhAGUw6N+FkXJW X-Google-Smtp-Source: AK7set9iO04TRNbFszaXuMnkby4d2ldMBGfb02J/veA7yT949CLIwZdMnESjOK0n2axtwPhVQLzkFw== X-Received: by 2002:a05:6000:1816:b0:2c5:5a63:ae07 with SMTP id m22-20020a056000181600b002c55a63ae07mr2561832wrh.23.1676313897398; Mon, 13 Feb 2023 10:44:57 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-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=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann Subject: [PATCH v3 14/14] hw/usb: Replace DO_UPCAST(USBBus) by USB_BUS() Date: Mon, 13 Feb 2023 19:43:38 +0100 Message-Id: <20230213184338.46712-15-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=philmd@linaro.org; helo=mail-wr1-x42a.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1676314042734100005 Use the USB_BUS() QOM type-checking macro to avoid DO_UPCAST(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/usb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/hw/usb.h b/include/hw/usb.h index b2111bb1c7..f743a5e945 100644 --- a/include/hw/usb.h +++ b/include/hw/usb.h @@ -520,7 +520,7 @@ void usb_check_attach(USBDevice *dev, Error **errp); =20 static inline USBBus *usb_bus_from_device(USBDevice *d) { - return DO_UPCAST(USBBus, qbus, qdev_get_parent_bus(DEVICE(d))); + return USB_BUS(qdev_get_parent_bus(DEVICE(d))); } =20 extern const VMStateDescription vmstate_usb_device; --=20 2.38.1