From patchwork Mon Feb 13 18:43:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 653215 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2581525wrr; Mon, 13 Feb 2023 10:46:30 -0800 (PST) X-Google-Smtp-Source: AK7set9sViCAIp1NSYCYW2l92mQAB0ujnQjRRs4VAeuOE/2M+daORbEnh99k7nEYQpEIcOzjt1Bh X-Received: by 2002:a05:622a:211:b0:3b9:b2c3:9d2a with SMTP id b17-20020a05622a021100b003b9b2c39d2amr42995478qtx.22.1676313989987; Mon, 13 Feb 2023 10:46:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676313989; cv=none; d=google.com; s=arc-20160816; b=sCoJmzWqSWWG3gSyDQxBWrLJOzseAUkp80Ve4T7O4VG6s2dmQISDH2+xZLy4mSp1+d zb6nxFgzubAFLTQ19nNXPnBbawnA+AwVHzf2CBePPI+YHDulI3QyWMrAmbf9ww4ROdnP 04Wjii3zoQzdJOJjsSI42XCes7M1SJRJjYHfihWJpf/+zbAbnWnzuLmo7g6KXcd5/YEQ HbQWIlk237+o09+HVDdbVjmIeSXxLl1HtAQPZqUxsVcBDUe83vRf7A/b7DifgNOdeDQp 8M6h81x/Ep1BVb66UCiK+qY0q5wWfQJ1sS5FJjfm4aoxSJ8M1XdS4UByIj0ziTti37Yg GbAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Nx8Xgm2tW9Gq4Bio8ruD+Zbqqbx7fjg7obd5raLzp9c=; b=0i7BYGZnPH/gQDeSu7yfSuG7DvJDA6GjfJptKA4SBjOVlDvh2g0uwyC2VPQo2VatmT 6dxAMySzGyukXFPuKLn5jjYahsmGGDD1WkOkkIOTxmY9FFBa6uiPZHWgn5bEYc7912k9 Ykiup2wr+EcBJ/DtGmA3eoxhfR5gT4QVP8lkyH8MBdgATjSXb8MY5QNMEzFQSrgQvUmA 3EcDGQmrsgBZGypbOWsdpwap8urxl8v+Sa+2E62pOWuHwR72aHRZUzpuuCqLsz7bldsu HwPc/9MaGWP8BRm0aqE46Niah9y55KIks9k8KMErqJ7Nwu0P7kwmwsk2gCXgKCMDnY0s bvWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LjekvQ6J; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f7-20020ac87f07000000b003b634217ff8si10100862qtk.774.2023.02.13.10.46.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Feb 2023 10:46:29 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LjekvQ6J; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRdo1-0000tW-VB; Mon, 13 Feb 2023 13:44:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pRdnq-0000r2-2d for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:43:51 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRdnn-0008No-Kv for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:43:49 -0500 Received: by mail-wm1-x333.google.com with SMTP id he5so1531754wmb.3 for ; Mon, 13 Feb 2023 10:43:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Nx8Xgm2tW9Gq4Bio8ruD+Zbqqbx7fjg7obd5raLzp9c=; b=LjekvQ6JXpGK9dEvBMxMKFxxhnOcCFNY+4jwJOIDh0fLNC0AtqqzbU6VQ1lpfEzSSH wlsQsqXnZCz6btSBwVjnYOLogTpKPuHGFiT8IuD07rdmelaZvUrjFbW2yFe4Ubn0PCOl UQWm2tAE90R9PJY0yCVLMMl0IdUR8VB7rhsdKMGMNhl4DMYMhDTadDyLkWWhG9q9PkgO sc+VNF4y0IWpWhaCLxlr9kcuC5u9z8FAvcmtx4Z5J+RkHpZowPapme2Aes2i9wqOjJzK k6EdP16Tj4kEWXDftea8cXGm0x7+Fm2enUun1Csa8T6LIILLHH8k788jfy9ADFqzKrbA 7dew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Nx8Xgm2tW9Gq4Bio8ruD+Zbqqbx7fjg7obd5raLzp9c=; b=T9xoR4dLYjlA9OUem8Z6QV2PUOC3qhfaiIQ+AmHxJLKjRzpYgTCce2w+FlPISXAHDa hHbpDSiAMZTT7B8Tr2q0t3/DrhGYbOY6G+m8JszS7ejtgwfnhWkek8guKfnyw+Fj5V4L mHrY7vL82xVDxpymzVGvd4ich1ZiDsO6G89X0odFDdpjsZT+ebZk11bzyswb9lG60bVw J+AfnYt6rrJ5F5BE7mLozzi4TiUyJ4zeJ8uWR5WYd4n7DrFjHdjBuBhFhFQuvgXWy7oE nHT/e10fZ3W+MDTEd7eJv896XgVGYvkI+NLzQx4S8uluFOw1qeH7KDTbohsXArfSsgY3 3QnA== X-Gm-Message-State: AO0yUKUQKsxSEQ3vj8z1iD1mwOzB/vmnJt5F+4pPWwdO91zw5V0+l9Ok AdjlbdbbZ+3he+moL+P4sO6sBQX9GQ3GrmFI X-Received: by 2002:a05:600c:1608:b0:3df:dc0d:f0b3 with SMTP id m8-20020a05600c160800b003dfdc0df0b3mr19706716wmn.9.1676313825971; Mon, 13 Feb 2023 10:43:45 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id j6-20020a05600c42c600b003df245cd853sm13850313wme.44.2023.02.13.10.43.44 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Feb 2023 10:43:45 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Eduardo Habkost Cc: qemu-block@nongnu.org, Hu Tao , Gonglei Arei , Richard Henderson , Li Qiang , Thomas Huth , Cao jin , xiaoqiang zhao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PATCH v3 01/14] hw/char/serial-pci: Replace DO_UPCAST(PCISerialState) by PCI_SERIAL() Date: Mon, 13 Feb 2023 19:43:25 +0100 Message-Id: <20230213184338.46712-2-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230213184338.46712-1-philmd@linaro.org> References: <20230213184338.46712-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Use the PCI_SERIAL() QOM type-checking macro to avoid DO_UPCAST(). Signed-off-by: Philippe Mathieu-Daudé --- hw/char/serial-pci.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hw/char/serial-pci.c b/hw/char/serial-pci.c index 801b769aba..9689645cac 100644 --- a/hw/char/serial-pci.c +++ b/hw/char/serial-pci.c @@ -36,7 +36,10 @@ #include "qom/object.h" struct PCISerialState { + /*< private >*/ PCIDevice dev; + /*< public >*/ + SerialState state; uint8_t prog_if; }; @@ -46,7 +49,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(PCISerialState, PCI_SERIAL) static void serial_pci_realize(PCIDevice *dev, Error **errp) { - PCISerialState *pci = DO_UPCAST(PCISerialState, dev, dev); + PCISerialState *pci = PCI_SERIAL(dev); SerialState *s = &pci->state; if (!qdev_realize(DEVICE(s), NULL, errp)) { @@ -63,7 +66,7 @@ static void serial_pci_realize(PCIDevice *dev, Error **errp) static void serial_pci_exit(PCIDevice *dev) { - PCISerialState *pci = DO_UPCAST(PCISerialState, dev, dev); + PCISerialState *pci = PCI_SERIAL(dev); SerialState *s = &pci->state; qdev_unrealize(DEVICE(s)); From patchwork Mon Feb 13 18:43:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 653210 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2581018wrr; Mon, 13 Feb 2023 10:45:33 -0800 (PST) X-Google-Smtp-Source: AK7set/RPs7L28b36U8mEgs+SVNoDLdqvwFi4zfmWgtsOorXm3Btf2UDhtEzEAQul6jVWXIlE0D/ X-Received: by 2002:a05:6214:628:b0:56e:b96c:2e03 with SMTP id a8-20020a056214062800b0056eb96c2e03mr4481645qvx.25.1676313933261; Mon, 13 Feb 2023 10:45:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676313933; cv=none; d=google.com; s=arc-20160816; b=WODIraDD9pRw/JL9S+a/YYzK8eb0oujrGbqMPWdJPtK09iXVecqH3JRFNu1HVsTfmf 0m5Ew49qXqNnAGjgJHDZ3gcB3U887RriNYmtbzoXjUG+hXRwURqSbg0PFBvB7MJokTV5 pKPLKSccU5ewtrV7YzGiQ7BZlhdcHM6HVx0rblWMu9XHT3pLrfQ267diKq6qL2nG5ih6 BNQW4yGfhZkEABpySjpBTtm9/LGuZDf8bEVORgwrIi6JK36FCO3DQZDKmHlxZk/SVffT +HSkOtXik2/8PQV76cNUfEZWEM3/bmjFlPX6Vl80ed9W0N0jI1yaAHWu8dQsXjwXNbsf Gcpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iJ+QRHFZYIqXqYbl7DIdWxHc+GN5ZGRCj3hAlbpC3f0=; b=ulscqISeuXFVKhRvIQFcVCrQtq+6Qiugdy4IK8EnRpwFOLjNwTV4+Q/AH0ZwEaErDH UZR57olMRFqy/5E/cy7OanFV13PHIqo4AvIo4inMmzhOfh/hRwY03joxM1ZMLHVfyJiM lr/0q/V21wr0wHVTh1YbxsHrf0yufgDaRi5jM8WGZy3Xjm2UX0VWOeTx5rRJKLfx5d5M EzW8DEwgFqLUxK2o3LoaCmuFzTP50tU7IJJWLXN4sUdj/KFXtRfGQOwHiOzj6uPz5Tf/ Arv2EiDFLke/jiDSWrv3Wh/sCX8hTMYrw8vahLGldOf8OfLmBwprLwrYJNo9M4r3QICC 7eHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="hxWM/Hal"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b20-20020a0cc994000000b0056eb58eedb6si2015493qvk.499.2023.02.13.10.45.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Feb 2023 10:45:33 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="hxWM/Hal"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Eduardo Habkost Cc: qemu-block@nongnu.org, Hu Tao , Gonglei Arei , Richard Henderson , Li Qiang , Thomas Huth , Cao jin , xiaoqiang zhao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PATCH v3 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org See rationale in commit 38b5d79b2e ("qom: add helper macro DEFINE_TYPES()"). Signed-off-by: Philippe Mathieu-Daudé --- 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) } } -static const TypeInfo multi_2x_serial_pci_info = { - .name = "pci-serial-2x", - .parent = TYPE_PCI_DEVICE, - .instance_size = sizeof(PCIMultiSerialState), - .instance_init = multi_serial_init, - .class_init = multi_2x_serial_pci_class_initfn, - .interfaces = (InterfaceInfo[]) { - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { }, - }, +static const TypeInfo multi_serial_pci_types[] = { + { + .name = "pci-serial-2x", + .parent = TYPE_PCI_DEVICE, + .instance_size = sizeof(PCIMultiSerialState), + .instance_init = multi_serial_init, + .class_init = multi_2x_serial_pci_class_initfn, + .interfaces = (InterfaceInfo[]) { + { INTERFACE_CONVENTIONAL_PCI_DEVICE }, + { }, + }, + }, { + .name = "pci-serial-4x", + .parent = TYPE_PCI_DEVICE, + .instance_size = sizeof(PCIMultiSerialState), + .instance_init = multi_serial_init, + .class_init = multi_4x_serial_pci_class_initfn, + .interfaces = (InterfaceInfo[]) { + { INTERFACE_CONVENTIONAL_PCI_DEVICE }, + { }, + }, + } }; -static const TypeInfo multi_4x_serial_pci_info = { - .name = "pci-serial-4x", - .parent = TYPE_PCI_DEVICE, - .instance_size = sizeof(PCIMultiSerialState), - .instance_init = multi_serial_init, - .class_init = multi_4x_serial_pci_class_initfn, - .interfaces = (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) From patchwork Mon Feb 13 18:43:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 653207 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2580607wrr; Mon, 13 Feb 2023 10:44:47 -0800 (PST) X-Google-Smtp-Source: AK7set+O6uWaEcT/jy03yVN4N8fLZmpfP2Xoa+jOEL+4+hfB4W2jwOrVwrGhNTpAy15BdK9Bpxdc X-Received: by 2002:a05:622a:1804:b0:3b1:4a8:4665 with SMTP id t4-20020a05622a180400b003b104a84665mr44255469qtc.62.1676313887438; Mon, 13 Feb 2023 10:44:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676313887; cv=none; d=google.com; s=arc-20160816; b=naAcbGKiUOoiqfy32O3UigghdpN1CvG1D7AZ8OE+hoRFOpWdYHSaVY9s2YCoI/THQA WsIBFvY3WgOwjFKVvozGjBkf4WIzukFro7r+B6vJssoo/y5zNheJ5hxnZ0hzqwn47M7e QB3ov5nzmCxiyRMwYLv38sOFmGDCseR8t7hnseWUx7UmlwJnHW3dkPVIRPlKwN2S7fUY K3i6mux6a5EYJL6sy+9XIAcOBazFl3jLWwBIGazTlhOX1890GG24tbIgj5xE15zQMmxl 8Q41CwYdvDT96nHiUwAcfR4h46/P3UHm9uXMmGKnyL9z9Qc4vV34M2bGHAFpp3CnOjn7 EaZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xzELhgE3er5tMNQ9I7jJncHCuwtWilKXAa2ONw84yPk=; b=BMECKd4DwKN//vrGVSqeWpRHXo8jACKo5E00emTyNNxb8OPgvh08pPjtI3sOd+RrNM jNsq0NxiXFTov+xHFnMcbnLiPYZbvPaVhwKu8eZVIhN61YZKrRVV4Aubic+a24c+sxSp 61rBUybNShi5vXRz4dzTyeUlP9t3It4NfTPjUlNDfLOwpCoxtNspnyQs3CZV61tZwK3O Qmpr2PsOAqlEb/9DjCT4dqYbvWbNTUwhxX7SafuveA4dit5Toi8tzQRzK/MPFfy97CWv oKt1/4IczCF51bMevtXgRqyAsnLxVgFy7cryGuTBodvuJwgRXDc7vDY7e6PD+zFrTbGj ss5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=M21viOpH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b4-20020ac87fc4000000b003ba75817499si10502857qtk.242.2023.02.13.10.44.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Feb 2023 10:44:47 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=M21viOpH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Eduardo Habkost Cc: qemu-block@nongnu.org, Hu Tao , Gonglei Arei , Richard Henderson , Li Qiang , Thomas Huth , Cao jin , xiaoqiang zhao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PATCH v3 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Introduce PCI_MULTISERIAL ("pci-serial"), QOM abstract parent of "pci-serial-2x" and "pci-serial-4x". Signed-off-by: Philippe Mathieu-Daudé --- 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 @@ #define PCI_SERIAL_MAX_PORTS 4 -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; +}; static void multi_serial_pci_exit(PCIDevice *dev) { @@ -191,25 +198,23 @@ static void multi_serial_init(Object *o) static const TypeInfo multi_serial_pci_types[] = { { - .name = "pci-serial-2x", - .parent = TYPE_PCI_DEVICE, - .instance_size = sizeof(PCIMultiSerialState), - .instance_init = multi_serial_init, - .class_init = multi_2x_serial_pci_class_initfn, - .interfaces = (InterfaceInfo[]) { + .name = TYPE_PCI_MULTISERIAL, + .parent = TYPE_PCI_DEVICE, + .instance_size = sizeof(PCIMultiSerialState), + .instance_init = multi_serial_init, + .abstract = true, + .interfaces = (InterfaceInfo[]) { { INTERFACE_CONVENTIONAL_PCI_DEVICE }, { }, }, + }, { + .name = "pci-serial-2x", + .parent = TYPE_PCI_MULTISERIAL, + .class_init = multi_2x_serial_pci_class_initfn, }, { .name = "pci-serial-4x", - .parent = TYPE_PCI_DEVICE, - .instance_size = sizeof(PCIMultiSerialState), - .instance_init = multi_serial_init, + .parent = TYPE_PCI_MULTISERIAL, .class_init = multi_4x_serial_pci_class_initfn, - .interfaces = (InterfaceInfo[]) { - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { }, - }, } }; From patchwork Mon Feb 13 18:43:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 653208 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2580656wrr; Mon, 13 Feb 2023 10:44:55 -0800 (PST) X-Google-Smtp-Source: AK7set+6te6cphUM7cUX3gs975LcW76YPv9FU6kPrvFBQyFeoe0V3jfHJlanpkTnwx7RW+HbwbaB X-Received: by 2002:a05:6214:f23:b0:56e:7bc1:69f2 with SMTP id iw3-20020a0562140f2300b0056e7bc169f2mr32049641qvb.5.1676313895293; Mon, 13 Feb 2023 10:44:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676313895; cv=none; d=google.com; s=arc-20160816; b=EmUICcJfHapOnswFVpihvXzPzZ4W+q/VI+vCZaWYVAaCjMsd7DtGnwjsAI2J8F//Ku sWwzGfHKA7BuvE2umESQvcMaFcKT8bemHwT1CxN3TfHrPlHoAUbVeUKtTEwFQF5IylGR DE8zSLGBNiOPhJ66yKjhnd5xv9uru0rrd/GtouEBgMzsZ0fYs5UVqN5ca+1DEWX1MYzG ZWdsSOabnXmoYXxhkwfidQp6D40K6zOZFGLwXh70dTa1hW/gG0gx3tJ0kIe/xrLwaHPC XeT4su4SxGAKzg8bl4Svf/Er7zbb+Im+vYpcExM//oPK83lZDGgm+X13Hus/GztRGvp2 8qpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fmzU+qV6CluU3J1xGV1AbokblN6ppa6B541b+KpiIv4=; b=YhJk1eZawpkd7xW+YMB5JlE5N6ftDp0b8hcAkC9NE1cLH6BDjgnOFifpfHr0thases 8i1uV23XBpVK6Q4z3awAJKSc5xQAXAW+ZJz1AyFSA9TOIuOrneqV5yQgJ6UF198cgszj bNfMVLDcUb+NXjMAzRCxHLG8na7OHKxAW7HDYQJENPmKKbvAvT4KdZYoOX9Fv+AC4gMM /2uukdHpndA9IWZSQNZZ2M9IG4YdzfHCDFexCWBz60/CruqLu3QVns+wrGYeRpQdkdtL NFVatf70iLQ89wkAR+qMebJE4IJb7qap86AtBpWoRg7i30oNI6R7ju8triwz+o0i/7DX TuaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hhFsKwfl; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bs39-20020a05620a472700b00721407a4a86si11060460qkb.509.2023.02.13.10.44.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Feb 2023 10:44:55 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hhFsKwfl; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Eduardo Habkost Cc: qemu-block@nongnu.org, Hu Tao , Gonglei Arei , Richard Henderson , Li Qiang , Thomas Huth , Cao jin , xiaoqiang zhao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PATCH v3 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é --- 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[] = { DEFINE_PROP_END_OF_LIST(), }; -static void multi_2x_serial_pci_class_initfn(ObjectClass *klass, void *data) +static void multi_serial_class_initfn(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *pc = PCI_DEVICE_CLASS(klass); + pc->realize = multi_serial_pci_realize; pc->exit = multi_serial_pci_exit; pc->vendor_id = PCI_VENDOR_ID_REDHAT; - pc->device_id = PCI_DEVICE_ID_REDHAT_SERIAL2; pc->revision = 1; pc->class_id = PCI_CLASS_COMMUNICATION_SERIAL; dc->vmsd = &vmstate_pci_multi_serial; @@ -170,19 +170,22 @@ static void multi_2x_serial_pci_class_initfn(ObjectClass *klass, void *data) set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } +static void multi_2x_serial_pci_class_initfn(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + PCIDeviceClass *pc = PCI_DEVICE_CLASS(klass); + + pc->device_id = 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 *data) { DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *pc = PCI_DEVICE_CLASS(klass); - pc->realize = multi_serial_pci_realize; - pc->exit = multi_serial_pci_exit; - pc->vendor_id = PCI_VENDOR_ID_REDHAT; + pc->device_id = PCI_DEVICE_ID_REDHAT_SERIAL4; - pc->revision = 1; - pc->class_id = PCI_CLASS_COMMUNICATION_SERIAL; - dc->vmsd = &vmstate_pci_multi_serial; device_class_set_props(dc, multi_4x_serial_pci_properties); - set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } static void multi_serial_init(Object *o) @@ -202,6 +205,7 @@ static const TypeInfo multi_serial_pci_types[] = { .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(PCIMultiSerialState), .instance_init = multi_serial_init, + .class_init = multi_serial_class_initfn, .abstract = true, .interfaces = (InterfaceInfo[]) { { INTERFACE_CONVENTIONAL_PCI_DEVICE }, From patchwork Mon Feb 13 18:43:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 653212 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2581292wrr; Mon, 13 Feb 2023 10:46:03 -0800 (PST) X-Google-Smtp-Source: AK7set8chaeQL5fF3HlUASsGD3V+2cnA/m9wtWVwe+dL8TU7xDSxlGJmpXfehPG72o7oMyknF7Vx X-Received: by 2002:a05:6214:2425:b0:56e:c174:1c88 with SMTP id gy5-20020a056214242500b0056ec1741c88mr1285434qvb.46.1676313962780; Mon, 13 Feb 2023 10:46:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676313962; cv=none; d=google.com; s=arc-20160816; b=FypcngkyScnpLZRXbIiX4Wc2REl7fXr8mtTIn3lSYzTzAoZ4fbBjBAgfw+6lKHmNAE wvADoj0DIde8S9RArBhzLyaIGDv50gVp2YgX5yJdtsyJyBzkXbME18WVEIc4SbE33c0W SCGPzuQWjA7hkwPFlx2OcOs75V6BZzn422zimcmv2DS1dcnd3SrMSb3KWyoHGfn10AFO hrPHPHutktg4RbyxOd78gma4lbcE7AdlEOKQoA6FEH8R/IEtw3cQNXQYA9fXxWW9dChx zylS0WFQJCjFn61riGISQ4uXjT3cYt6RmyrSTGPs6mHOm62z8lClOsYHPYMUjG1a8pt/ mKoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yz6IoxjWNiku5kCSpBghWuT3DdtWubTdcdH43JCupO0=; b=to2cLzvGmwX7Sq3WHrcPa3VQ/+o12LFVfJaF44JxvsD/v02z7vbXsBBgB0I+YEJGcc dt7vYtjxd0kFOtk/8X2YgkcJsvN1L7pWK70QFXBYmpvHfqUF+7zN9wRUm8SAjUTwwRRD UoZyhD+armfg19bOTYrxMJ/6jHUFwSuZknjSmuEKtUgRCB/CrdWHtGEcIXVyp17GTu8+ vVlRLnuBOJpO7K51o3qeZd0xxD/sy5YK5NLKqlIqvhdLdyjNg0fVKoxNHDjDvIh5bSZM 07PPkHpjvlBIpa4JC+ZqDz4eXaF/L3ASv80YQKhiiRrHTwXwSyvCHLLLI02EAz2yVO3x Ydbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="jI1P/tOj"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q22-20020a05620a2a5600b00733f1926964si10198691qkp.723.2023.02.13.10.46.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Feb 2023 10:46:02 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="jI1P/tOj"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Eduardo Habkost Cc: qemu-block@nongnu.org, Hu Tao , Gonglei Arei , Richard Henderson , Li Qiang , Thomas Huth , Cao jin , xiaoqiang zhao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PATCH v3 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Use the PCI_MULTISERIAL() QOM type-checking macro to avoid the few DO_UPCAST(PCIMultiSerialState) calls. Signed-off-by: Philippe Mathieu-Daudé --- 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 { static void multi_serial_pci_exit(PCIDevice *dev) { - PCIMultiSerialState *pci = DO_UPCAST(PCIMultiSerialState, dev, dev); + PCIMultiSerialState *pci = PCI_MULTISERIAL(dev); SerialState *s; int i; @@ -97,11 +97,10 @@ static size_t multi_serial_get_port_count(PCIDeviceClass *pc) g_assert_not_reached(); } - static void multi_serial_pci_realize(PCIDevice *dev, Error **errp) { PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(dev); - PCIMultiSerialState *pci = DO_UPCAST(PCIMultiSerialState, dev, dev); + PCIMultiSerialState *pci = PCI_MULTISERIAL(dev); SerialState *s; size_t i, nports = multi_serial_get_port_count(pc); @@ -190,9 +189,8 @@ static void multi_4x_serial_pci_class_initfn(ObjectClass *klass, void *data) static void multi_serial_init(Object *o) { - PCIDevice *dev = PCI_DEVICE(o); - PCIMultiSerialState *pms = DO_UPCAST(PCIMultiSerialState, dev, dev); - size_t i, nports = multi_serial_get_port_count(PCI_DEVICE_GET_CLASS(dev)); + PCIMultiSerialState *pms = PCI_MULTISERIAL(o); + size_t i, nports = multi_serial_get_port_count(PCI_DEVICE_GET_CLASS(o)); for (i = 0; i < nports; i++) { object_initialize_child(o, "serial[*]", &pms->state[i], TYPE_SERIAL); From patchwork Mon Feb 13 18:43:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 653213 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2581316wrr; Mon, 13 Feb 2023 10:46:04 -0800 (PST) X-Google-Smtp-Source: AK7set8/HwZEyiR35xxvpPTFgvAT7t6Ch5IDRiFed9h8p3OXefOpsj0yax5FA2ZsIH7rZzKWmSvD X-Received: by 2002:ad4:5be8:0:b0:56e:a658:84e4 with SMTP id k8-20020ad45be8000000b0056ea65884e4mr11182789qvc.36.1676313964438; Mon, 13 Feb 2023 10:46:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676313964; cv=none; d=google.com; s=arc-20160816; b=q3tFDiylwaOt86TFWSG4btNBTbA0AZoigDvsdy1Oz69bgWwVHTGX+hhvKxrB1E6wXV d3I25d4tJQdHGdweTYlYpRiTiKFEgwBhWqLDyiXFSfN28LBesnyUNFEVrBaQpXZFAFZh zkweGJFatUeWXefOFGtZ7qLkQF481jGq5RO6dX9EhcREYdXxQ67g6ha3eoCh+lWHdLKq DWQeBbum7IcOjRo5tv9sgvVbsRu78PyOAJNO5wj8DgsKDgmiPyHsYDTbT8ijAaT24CoH lMq6OjbBMdhpOwXw2B9NM1BCA6Ff6KlI755Q8q1DPz0JOaZfrx8MVHWl+QNlH76rbql9 SHVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JeDWNjpVkKdLbShBUyGUp3JADBIyaux21T6WZ6Gmeuk=; b=KO4fDkVZFVW2kiZB36YuPcxtc36jGLbdpGNLkTGtKy169hVoWhvh8CMJuw/VMo2Qhd ynZTFjYODLChAawQhyGL89zc7X42tiBsYUq1MGI2/8Qi5jMQNTM78Krir4jtyWylZYgs h1cGK30ULsjapQ2KmuQ3PdAD5G6wwz5gIl4FOtoIlBN+EUGAuOp6gHeiaerXmx4R0j6i G6SqcVZjEyEjjqR9Lo9zwkzSSwa155ELqx3d8D6Wn5p4137rnuWXB2iY6gKfnIBxt+O8 Df6fZEUZAS3YITreub9CAEinvCTrxfXzZAyQGXS2Sj8ZZTQUcbdFoX0UJKvuzUStuLCd ioTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wyGNJ1e9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q28-20020a05620a025c00b0073b203efd8bsi5249111qkn.533.2023.02.13.10.46.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Feb 2023 10:46:04 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wyGNJ1e9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Eduardo Habkost Cc: qemu-block@nongnu.org, Hu Tao , Gonglei Arei , Richard Henderson , Li Qiang , Thomas Huth , Cao jin , xiaoqiang zhao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , 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 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=philmd@linaro.org; helo=mail-wr1-x42b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Use the IDE_DEVICE() QOM type-checking macro to avoid DO_UPCAST(). Signed-off-by: Philippe Mathieu-Daudé --- 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, DriveInfo *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); } int ide_get_geometry(BusState *bus, int unit, From patchwork Mon Feb 13 18:43:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 653217 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2581829wrr; Mon, 13 Feb 2023 10:47:09 -0800 (PST) X-Google-Smtp-Source: AK7set+YU69l84NnIhM+UvGi5v3A5G1oEUivVoQGEgj0E3YG8E3b8mvkqJX8i2qz90qfL2jHPvj4 X-Received: by 2002:ac8:58c5:0:b0:3b8:6bc1:1570 with SMTP id u5-20020ac858c5000000b003b86bc11570mr33193661qta.23.1676314029628; Mon, 13 Feb 2023 10:47:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676314029; cv=none; d=google.com; s=arc-20160816; b=i1/G9lu2INLmDhW1wbMacvVzWESlzcJ0qR66QiFTKRV6pyNs101Fpcynb0X+DHzF/d azjiW9XPBYRiHv8Jc9pdrcLvluXwxBYhWVzCxIMKWZWewtX1OL//+7u897eGjcjfmkkX 2DyZbbEOs+OMoUrCm46vISAIhmQMieESbF5cggnYVf+U6cDt1e1HvYvYvttb06a9mePm Uj46NQmod2BtKxLkp1YJePoJLCykQ5WJAIshhclXn82B3r18LqeKxo6XWHIksXouCI9i vCw612LF4QItZI2MyWwdClMtiM7+aj10GnYZ4Qr6SZc0YkNePYMSwnvwWsSAbjZ0N6uk Is/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/hnCzjPfxFE+jbV/pOTQTvC2sGuBuierxSlf21esNXo=; b=rd+6FPIT6HVJGbPZKi2XYWSbww4/pXi7UlIGtnSnPwXPQ3O50lk1Ce3XVi4HJ27uR1 7Lg2tN2hCnN1lOtYbCP9EZrTk+FwemwP4HRjSWCIfu86VFLjpgzLuU5p0lPa21fdLot6 3ss9bc6pKtGUQXo1y3dMANqwWMGS3tkPq9rCT6CRaHrfHevl4Kf9mowrDB3PMkpQTGfw f7xT2qwJuiHjYWCjotSr9zqJejvJQrebvZ+wVq7kQ3loA2RnO9ss7rXCJIa3ujoffntp g0Od0IR/BB3kRYTiroAcBmGxFFkJCgw0r4oDZ7CCiHAAUKQG602LJG2iaDTCLeItZUrD 6YDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IX9uVrlK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h22-20020ac85856000000b003b1ad716005si10319596qth.577.2023.02.13.10.47.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Feb 2023 10:47:09 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IX9uVrlK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Eduardo Habkost Cc: qemu-block@nongnu.org, Hu Tao , Gonglei Arei , Richard Henderson , Li Qiang , Thomas Huth , Cao jin , xiaoqiang zhao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Use the IDE_BUS() QOM type-checking macro to avoid DO_UPCAST(). Signed-off-by: Philippe Mathieu-Daudé --- 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 **errp) { IDEDevice *dev = IDE_DEVICE(qdev); IDEDeviceClass *dc = IDE_DEVICE_GET_CLASS(dev); - IDEBus *bus = DO_UPCAST(IDEBus, qbus, qdev_get_parent_bus(qdev)); + IDEBus *bus = IDE_BUS(qdev_get_parent_bus(qdev)); if (dev->unit == -1) { dev->unit = bus->master ? 1 : 0; @@ -139,7 +139,7 @@ IDEDevice *ide_create_drive(IDEBus *bus, int unit, DriveInfo *drive) int ide_get_geometry(BusState *bus, int unit, int16_t *cyls, int8_t *heads, int8_t *secs) { - IDEState *s = &DO_UPCAST(IDEBus, qbus, bus)->ifs[unit]; + IDEState *s = &IDE_BUS(bus)->ifs[unit]; if (s->drive_kind != IDE_HD || !s->blk) { return -1; @@ -153,7 +153,7 @@ int ide_get_geometry(BusState *bus, int unit, 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; } /* --------------------------------- */ @@ -164,7 +164,7 @@ typedef struct IDEDrive { static void ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind, Error **errp) { - IDEBus *bus = DO_UPCAST(IDEBus, qbus, qdev_get_parent_bus(DEVICE(dev))); + IDEBus *bus = IDE_BUS(qdev_get_parent_bus(DEVICE(dev))); IDEState *s = bus->ifs + dev->unit; int ret; From patchwork Mon Feb 13 18:43:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 653221 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2581921wrr; Mon, 13 Feb 2023 10:47:22 -0800 (PST) X-Google-Smtp-Source: AK7set8N9QrbjNMRh+hRuSWe4Mtzbwlh9RLHjPBUNj1F1cb7Xj8fZKbipgmNh6dLxPuBzaakE7bR X-Received: by 2002:a05:622a:1209:b0:3b8:6cb0:8d18 with SMTP id y9-20020a05622a120900b003b86cb08d18mr42268142qtx.5.1676314042615; Mon, 13 Feb 2023 10:47:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676314042; cv=none; d=google.com; s=arc-20160816; b=LWB4OJYBODlLdKkB07A3aHJFOb0x7CmCtLJpRbME6TMfnATU5M51aWRO08Me9tBVy1 CZRkatp3eSQQSnQn3blLofanQH9D+lFcwtb2hUAFcOkL992INqC1hfB+HB83+55PFLJH Rcq/I+eBHtnil5NiGXt3pmT/KHqh2ntvdDN+7iQQkQDIBo8sVtf2c4PRQ58/IY8yz0mX x9xsfg9MkbusYIEQjVmyBlJRPN/RRACDyfP3SkhJskiRwD0t3bhPUVbxkWcvrbT1eBCT ArosscXj63X4yCDYVzmYJsU81XgZHgNzHxmsDk2vSEciTvF2X12WvIVww/zgUZLhteVH sTaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VotmsYo6EZx1VvqMFkr1+QDMy3wRb1XAiA9w0UCQyq8=; b=hdJsaSVVYFMD5ce5bQarDPbk/yfXAqiITeMkaxTmNmuerWrQBvTWIqZaBk7K/LcEwU cgU33lhUdcplCHZmpSM9Zmns2O4D5HWC2W1FSohVKrAyaaa2zhE6extDrbJs9BmII7gD 28aFJFuup68leDxNtQW3ZIdiyVK4QxIRx3zyWmiO2LCOXIKLmZVwF72O2JUfOtE4rZ99 6hjHDTLlaJ3FDELEOnrAbPe38T2TM18y10l5ZGh16X5h7sdsn/k2eX6LfbySHom44atu npvwPs/rQ1cnDVMCvhRO9k6beLZhH33mT9ZjdJx0TrGxto5/yS0xUv8M7el2Oh4yW+fu TwxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gP9ewFH4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b6-20020ac87fc6000000b003b69fac5696si10307602qtk.695.2023.02.13.10.47.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Feb 2023 10:47:22 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gP9ewFH4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRdoV-0001Nh-LM; Mon, 13 Feb 2023 13:44:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pRdoR-0001Hj-SC for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:44:27 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRdoP-0008Tc-Jn for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:44:27 -0500 Received: by mail-wm1-x334.google.com with SMTP id f47-20020a05600c492f00b003dc584a7b7eso11954767wmp.3 for ; Mon, 13 Feb 2023 10:44:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VotmsYo6EZx1VvqMFkr1+QDMy3wRb1XAiA9w0UCQyq8=; b=gP9ewFH4awNxF2vi0b8jkzWKJ0I8idDoCPVWlFgHGp/VCPiDRsWJZEo/czC6DNh9wv iAZnHPe7ZusDLdDCCjbTBoUhmqMmzfGNK/m6/KPRttR6zVV7zbcqSUlq+674DTqlzQsr uTW6xLj/x220CydgFWuPc/YqthaVbmaQMIa7lMg6z1opRP86nPA7zDXhZ7pXc+sSdnLa FiLFiFUG1gm+rlqYjtxGHI+305ZxxY6CSGN1hTmGCgrYT5h7nMo0S1zmzjTa8MOrKUN2 ClSOO+Ly2qWes3kWcTbRUoUg70BZs7WWeR0X+fzE3vaJ1qEJN+pLBi/3mYhT6i8JiH2S 26yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VotmsYo6EZx1VvqMFkr1+QDMy3wRb1XAiA9w0UCQyq8=; b=2oKIaAx8GyuikKGHzkzr5nOmR5ykhI24OaxDnU+UTCXn78sTQUpbhTzxDJ62D3spJL /o+l29FCVfKglbnFE1ue10hZ4I46kwAmunvWTk60VQo6lTwNVItRMyfXqgV/AH3Qb+oG iRF1zDNge+IuEnJ+HMjfWjlWBzf8nqEF7jRsUOpmxKPH7qWVBF2liOP/MfGVnEd5pMXR acBVHn62CZnFRIDeFM3rng9/s9rgkRthmqKwHDeQHEhnJpj1WKo5MXEaApymnVm8x3rf ewYdRlhqyYSAKE1Hy6ZccpmgMaE4cD7E6OH+VHtMyZsFOr9Z4HnCvsf5kascPnDXheK9 pwhQ== X-Gm-Message-State: AO0yUKWAkCZ/enuGqAaujqw9PlAW15IurQf9i5oGzyCoM1TUTU/t153n OYKJPjkSvScQ6bdHQ49lrNIQhXoQFp1aI5S8 X-Received: by 2002:a05:600c:491d:b0:3da:2a78:d7a4 with SMTP id f29-20020a05600c491d00b003da2a78d7a4mr19705810wmp.21.1676313863858; Mon, 13 Feb 2023 10:44:23 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id d5-20020a1c7305000000b003dc4baaedd3sm17223550wmb.37.2023.02.13.10.44.22 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Feb 2023 10:44:23 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Eduardo Habkost Cc: qemu-block@nongnu.org, Hu Tao , Gonglei Arei , Richard Henderson , Li Qiang , Thomas Huth , Cao jin , xiaoqiang zhao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Jason Wang Subject: [PATCH v3 08/14] hw/net/ne2000-pci: Replace DO_UPCAST(PCINE2000State) by PCI_NE2000() Date: Mon, 13 Feb 2023 19:43:32 +0100 Message-Id: <20230213184338.46712-9-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230213184338.46712-1-philmd@linaro.org> References: <20230213184338.46712-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Define TYPE_PCI_NE2000 and the QOM PCI_NE2000() macro. Use PCI_NE2000() instead of DO_UPCAST(). Signed-off-by: Philippe Mathieu-Daudé --- hw/net/ne2000-pci.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/hw/net/ne2000-pci.c b/hw/net/ne2000-pci.c index edc6689d33..0332e7f616 100644 --- a/hw/net/ne2000-pci.c +++ b/hw/net/ne2000-pci.c @@ -30,10 +30,16 @@ #include "ne2000.h" #include "sysemu/sysemu.h" -typedef struct PCINE2000State { +#define TYPE_PCI_NE2000 "ne2k_pci" +OBJECT_DECLARE_SIMPLE_TYPE(PCINE2000State, PCI_NE2000) + +struct PCINE2000State { + /*< private >*/ PCIDevice dev; + /*< public >*/ + NE2000State ne2000; -} PCINE2000State; +}; static const VMStateDescription vmstate_pci_ne2000 = { .name = "ne2000", @@ -54,7 +60,7 @@ static NetClientInfo net_ne2000_info = { static void pci_ne2000_realize(PCIDevice *pci_dev, Error **errp) { - PCINE2000State *d = DO_UPCAST(PCINE2000State, dev, pci_dev); + PCINE2000State *d = PCI_NE2000(pci_dev); NE2000State *s; uint8_t *pci_conf; @@ -77,7 +83,7 @@ static void pci_ne2000_realize(PCIDevice *pci_dev, Error **errp) static void pci_ne2000_exit(PCIDevice *pci_dev) { - PCINE2000State *d = DO_UPCAST(PCINE2000State, dev, pci_dev); + PCINE2000State *d = PCI_NE2000(pci_dev); NE2000State *s = &d->ne2000; qemu_del_nic(s->nic); @@ -87,7 +93,7 @@ static void pci_ne2000_exit(PCIDevice *pci_dev) static void ne2000_instance_init(Object *obj) { PCIDevice *pci_dev = PCI_DEVICE(obj); - PCINE2000State *d = DO_UPCAST(PCINE2000State, dev, pci_dev); + PCINE2000State *d = PCI_NE2000(pci_dev); NE2000State *s = &d->ne2000; device_add_bootindex_property(obj, &s->c.bootindex, @@ -117,7 +123,7 @@ static void ne2000_class_init(ObjectClass *klass, void *data) } static const TypeInfo ne2000_info = { - .name = "ne2k_pci", + .name = TYPE_PCI_NE2000, .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(PCINE2000State), .class_init = ne2000_class_init, From patchwork Mon Feb 13 18:43:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 653214 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2581495wrr; Mon, 13 Feb 2023 10:46:27 -0800 (PST) X-Google-Smtp-Source: AK7set8oi8SBe5dM8L0g8I+6jberE3TJeYcePw++GOqyxtKj7RTPMQVjyyBC3jJRvAplqIB/2Gd/ X-Received: by 2002:ac8:4e88:0:b0:3b8:8756:6de8 with SMTP id 8-20020ac84e88000000b003b887566de8mr42568965qtp.67.1676313986903; Mon, 13 Feb 2023 10:46:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676313986; cv=none; d=google.com; s=arc-20160816; b=L/qMlHJqFRnzFwShxrTvSTQCkhhaD7iigLdF6f09K343rrLdv1qcshsJ992LEy3CU3 QtoI3RHnBxjW0PL2oOgMrLR5kPKezz01eEaL4XZPd7AWTxGKXtEimeKO4WVnip+a53Nj eHjxbKe3MOmF7vgElzT8UYaE5okEICGjwoEcHJhT/DX3M4vEQhOiZW8XWy3OiDMuUre5 EjqZ9KQRrMiDlbRwwHERN4np6sm6BS9w3WEMnAqPBPXmZxbpatEiPm0Sve4wllOLOinw IROVeFGFXAGpmJDwVr+rbTncakS48mlkXQf26J80aRXF8JzRTbrnp3yb1vCNlKXaRpFk MvGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fD8XsrjHaA7eijBs8OwmQ3XFemQ30TcP+DXj6h7knEg=; b=XsDI23IblddGe2vuk/NWNbErXf2fkJmkTt3QdNlIRwqZKMC6UCzXZ1rO2WIBxLTCqW 0B4PxNmfL+Xd7/SRcX89mOPGw4+tBR2UtjY8XXnKvaizUHBSIuo7gILmfGAwuzGPdLRp G5TKfxifte3ZCyeI4gBp2gWKgwFstJ24CozDtN+In6fMxdOtJh4s8Z1WK6hmoZNSOu+0 tvXjH8JmTMnbAgJCNxZiqFQ1WlAc1b+vTCPAc3yT2Ee1CNxu/cQtcP9NQ7AGp3rt0KCi IfVOw0b+iGT4++OTlRmx4h5CSnvNNOVlY5TvsRbGhkzkGuVWI6EuVFlFUEiPEP2LdrPA F9Jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="JclyZ9/U"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w8-20020ac87e88000000b003b62ebf878dsi10379784qtj.347.2023.02.13.10.46.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Feb 2023 10:46:26 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="JclyZ9/U"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRdoW-0001Sd-WF; Mon, 13 Feb 2023 13:44:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pRdoW-0001Nx-2N for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:44:32 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRdoU-0008S7-JE for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:44:31 -0500 Received: by mail-wr1-x42b.google.com with SMTP id bu23so13251067wrb.8 for ; Mon, 13 Feb 2023 10:44:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fD8XsrjHaA7eijBs8OwmQ3XFemQ30TcP+DXj6h7knEg=; b=JclyZ9/UqBA9BGGqA55SoSo+LpL1ZYdxe3PslvYu0+Yxk9KVvZ9IAaUZaDBkNXcQGO Iir74BDi18LUqcAmsy0C6cWDzj1wTIhCbQt6E1iZG7JN2uoyRDBlh4FG7cdGXPGQNgwe qQSkeYZeigYr4Wq+SCC6Wmb8hzuTPSFS+B0toflyI8TiFIYuTQ5OJS4t9q02HFVEVpW1 vZ16spJxrCwlh6KhD5iGgrir1VcX3GE+/e5FXFIA6j7zecRrS4froZyBhb01JANmQCci AhmEqrixRAzaIeb3/kjzNuMfHJ7VHo38IYbBkWyBk0rKgusieKEatRh0wDn2yw03EFpW f4bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fD8XsrjHaA7eijBs8OwmQ3XFemQ30TcP+DXj6h7knEg=; b=k+Rv//Ub0ixjtp5q1oWbrdazRhMFirlhLjyHcmhg54Z1XcPqW5A5wAGImNUggICISE oLgHIOxHFRb11Fmv3c96J8/kno6KeRtzGjQ9rjz+rbU1ZW+6y0E8jAes04jLQh+Xp8MD X9GhitLxBTMcN4GtULOzN1uAjr1EF1EWux3mcY4n4W81gZeEuFxhua5qpMH+phdkrnCs OqZHE4UzGWAjIlmqThtL0vAGARWwazEV66cyklh39ntoe7Z2bYhkqKIwAHQcX7PX/qNL 1ghIxP1K9BpTUkq7d1O2oarUUFUeFZwVfDeHNniN8Fi/t50AV5+rRJRfawf4hBjULdo+ BrGg== X-Gm-Message-State: AO0yUKV+kveJsITDY7S3Bd8ejwGS+XbUtYomiyF1w5QKn1nDN+JY8a0K vUkE3Adzat4oBp+fGng9V5ct1AVqTuLQWz4x X-Received: by 2002:a5d:4577:0:b0:2c5:4ec7:a466 with SMTP id a23-20020a5d4577000000b002c54ec7a466mr6889035wrc.31.1676313869723; Mon, 13 Feb 2023 10:44:29 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id z6-20020a1c4c06000000b003d1d5a83b2esm17393991wmf.35.2023.02.13.10.44.28 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Feb 2023 10:44:29 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Eduardo Habkost Cc: qemu-block@nongnu.org, Hu Tao , Gonglei Arei , Richard Henderson , Li Qiang , Thomas Huth , Cao jin , xiaoqiang zhao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Sven Schnelle , Jason Wang Subject: [PATCH v3 09/14] hw/net/tulip: Finish QOM conversion Date: Mon, 13 Feb 2023 19:43:33 +0100 Message-Id: <20230213184338.46712-10-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230213184338.46712-1-philmd@linaro.org> References: <20230213184338.46712-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=philmd@linaro.org; helo=mail-wr1-x42b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Use the TULIP() and DEVICE() QOM type-checking macros. Remove uses of DO_UPCAST(). Signed-off-by: Philippe Mathieu-Daudé Acked-by: Jason Wang --- hw/net/tulip.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/hw/net/tulip.c b/hw/net/tulip.c index 915e5fb595..990507859d 100644 --- a/hw/net/tulip.c +++ b/hw/net/tulip.c @@ -19,7 +19,10 @@ #include "net/eth.h" struct TULIPState { + /*< private >*/ PCIDevice dev; + /*< public >*/ + MemoryRegion io; MemoryRegion memory; NICConf c; @@ -959,7 +962,7 @@ static void tulip_fill_eeprom(TULIPState *s) static void pci_tulip_realize(PCIDevice *pci_dev, Error **errp) { - TULIPState *s = DO_UPCAST(TULIPState, dev, pci_dev); + TULIPState *s = TULIP(pci_dev); uint8_t *pci_conf; pci_conf = s->dev.config; @@ -967,7 +970,7 @@ static void pci_tulip_realize(PCIDevice *pci_dev, Error **errp) qemu_macaddr_default_if_unset(&s->c.macaddr); - s->eeprom = eeprom93xx_new(&pci_dev->qdev, 64); + s->eeprom = eeprom93xx_new(DEVICE(pci_dev), 64); tulip_fill_eeprom(s); memory_region_init_io(&s->io, OBJECT(&s->dev), &tulip_ops, s, @@ -983,27 +986,26 @@ static void pci_tulip_realize(PCIDevice *pci_dev, Error **errp) s->nic = qemu_new_nic(&net_tulip_info, &s->c, object_get_typename(OBJECT(pci_dev)), - pci_dev->qdev.id, s); + DEVICE(pci_dev)->id, s); qemu_format_nic_info_str(qemu_get_queue(s->nic), s->c.macaddr.a); } static void pci_tulip_exit(PCIDevice *pci_dev) { - TULIPState *s = DO_UPCAST(TULIPState, dev, pci_dev); + TULIPState *s = TULIP(pci_dev); qemu_del_nic(s->nic); qemu_free_irq(s->irq); - eeprom93xx_free(&pci_dev->qdev, s->eeprom); + eeprom93xx_free(DEVICE(s), s->eeprom); } static void tulip_instance_init(Object *obj) { - PCIDevice *pci_dev = PCI_DEVICE(obj); - TULIPState *d = DO_UPCAST(TULIPState, dev, pci_dev); + TULIPState *s = TULIP(obj); - device_add_bootindex_property(obj, &d->c.bootindex, + device_add_bootindex_property(obj, &s->c.bootindex, "bootindex", "/ethernet-phy@0", - &pci_dev->qdev); + DEVICE(obj)); } static Property tulip_properties[] = { From patchwork Mon Feb 13 18:43:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 653211 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2581290wrr; Mon, 13 Feb 2023 10:46:03 -0800 (PST) X-Google-Smtp-Source: AK7set9MQ7uTRt2c9mnjtYF+F88TTWi645N5IBc5eixoaHcS6rIdZClDi5mrHrLaBHKRSooiFLbJ X-Received: by 2002:a05:622a:81:b0:3b9:a641:aa66 with SMTP id o1-20020a05622a008100b003b9a641aa66mr48040277qtw.15.1676313962840; Mon, 13 Feb 2023 10:46:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676313962; cv=none; d=google.com; s=arc-20160816; b=CPRNdmD73m6KQeiT8/v4BzzyPFHDeI8WjaqPXNgiWtT5DrSQcjFc8fRTgG+bDzCsh9 fl6T4HPqsF1QvpCPGPOPJZSf+nKD1hILihme/OTQgUnijO4dQpbNEiUYKpW9NcniaNBH I+GxQ+dUBZC58BrYBihLs+tshf/fkoRe+A9Pj7S+wJVQLg+hXwwQeQV3zL01YOeCmz5N 7nK3mthD8ulB+a7SsnYGhfK0kMr7AHtcImT2SCkurvwPOSr0jWYeT25ryc86qFiTMXbD e11tUWtGylLLVMrTCwqg95ud2AyPpQTwj/lyXVyVWOVCCwzekYCsIz/EqbNdP+GaGpHF HR/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3YnlWYrFQuWXt1rppNJud8kwI6R078rMYORIY8x9Pr4=; b=cpnhqaYoQViQ8BBHk4oHPA2ANsMSgJm6Pi05yBLAuXpnPfghdJOuzN7zmLHL2uIA0k cJA7lZfGaN6wr4bKykeArjsnVF5nQjCHo7FWkj+S73TdCGE0k8Wjig5HEW1NGlmWEtMu 6apOGztKc+s25jVKMVPi7Yyc27v8E98be7pSk8uo2eOBy8rfEjByUgVJyOvbUwCWwcYu nh97eVO0yjj/DaWmCnPygcvOtknyhEckGwofNqnpoyFhE6l+93doMi+bavM0P76IphyH oBMlWefhyypmQWICDRvtp2Fnkusa+cMwN3KQ2sTbhTDzUs+MlJ7jee7OGQERIBFXSh8k tswg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="BfsZ/BP4"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 3-20020ac85903000000b003b63791e5f8si10671233qty.623.2023.02.13.10.46.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Feb 2023 10:46:02 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="BfsZ/BP4"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Eduardo Habkost Cc: qemu-block@nongnu.org, Hu Tao , Gonglei Arei , Richard Henderson , Li Qiang , Thomas Huth , Cao jin , xiaoqiang zhao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Use the PCI_BUS() QOM type-checking macro to avoid DO_UPCAST(). Signed-off-by: Philippe Mathieu-Daudé --- 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 = DO_UPCAST(PCIBus, qbus, qbus); + PCIBus *bus = PCI_BUS(qbus); int i; for (i = 0; i < ARRAY_SIZE(bus->devices); ++i) { From patchwork Mon Feb 13 18:43:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 653218 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2581894wrr; Mon, 13 Feb 2023 10:47:19 -0800 (PST) X-Google-Smtp-Source: AK7set/3bITCeIDO0wjbVg4ktVDeW/GEKurLhIsNN5RXfuaSyMLO8uEA733C6Oo177lOhlaHSoNy X-Received: by 2002:ad4:5d6c:0:b0:56e:af4a:11f8 with SMTP id fn12-20020ad45d6c000000b0056eaf4a11f8mr10030687qvb.4.1676314039488; Mon, 13 Feb 2023 10:47:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676314039; cv=none; d=google.com; s=arc-20160816; b=QvV/9EqXPmVSt8QoM1aJ+MpiEQoP+SKkZH6e1Xc/1DUk8dsMcOdaTLt0tzAm4zV8C/ 9O7FJ1OPKPRjzN+93SUIUqjccpgBOzVo4sr/XULTK990YA8YVu9GeKGz548JghPm5kHY uK3kqXuWDlJWsEPCNJk9kzf5HEFAIcMVBsVYNaoBVoP6RZVpwz/W8sARkUh+5zvswJ8j nlCIpxjFiFU4OeUC+soASp/GmkE/m0R5ia26QJaba8QUEfwcjJtPI+oKGgsHjq8cjR/G xwWaoYZmQygFpHaZ8pL3Xzo7lUGmHJgUpql1S8+lu4GBUzhWRWakhlpEaYZcGDBwGxn+ MYhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lbFFSEwuPaiVjYWiGHnO40wk80nlXCVErHPDaxFN7V8=; b=YBOqTEJadNHgVEASiaKR0eqsPYuHhmNY/Y4X/p9RB57pb9LCrRr6dy+N7UPLUWEJrf uUfzBiQDe5TX/pd1sXqlNB2Xsdvh8aUNYHfy2mcBMT/lzW/T4aCjsig0U8heWmajTOyq YjZ2LO+2SyleCkrQHwpID0BZynpc3td11tmzqkgewsoWaEAbQf0a7YqMbB8kNJ0JVcBW suzKPBvhWizugYPM/3LqRADhOPsZzw0dbIUsKKRvI70uzG9Zw6VqPn+U1QLjGqmQYiPD pMXsyHWAdL3Eg0FdVZ3JwwPXBSQdAfxCORN0IF2keFgP2+AGROhRWr8rLkodl9F1Ubrh e4SA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IrXHoLjJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m15-20020a05620a13af00b00708084c79f3si9093978qki.610.2023.02.13.10.47.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Feb 2023 10:47:19 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IrXHoLjJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Eduardo Habkost Cc: qemu-block@nongnu.org, Hu Tao , Gonglei Arei , Richard Henderson , Li Qiang , Thomas Huth , Cao jin , xiaoqiang zhao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Use the SCSI_BUS() QOM type-checking macro to avoid DO_UPCAST(). Signed-off-by: Philippe Mathieu-Daudé --- 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 = DO_UPCAST(SCSIBus, qbus, qdev_get_parent_bus(DEVICE(dev))); + SCSIBus *bus = SCSI_BUS(qdev_get_parent_bus(DEVICE(dev))); int rc; assert(cmd->len == 0); @@ -250,7 +250,7 @@ static bool scsi_bus_check_address(BusState *qbus, DeviceState *qdev, Error **er static void scsi_qdev_realize(DeviceState *qdev, Error **errp) { SCSIDevice *dev = SCSI_DEVICE(qdev); - SCSIBus *bus = DO_UPCAST(SCSIBus, qbus, qdev_get_parent_bus(DEVICE(dev))); + SCSIBus *bus = SCSI_BUS(qdev_get_parent_bus(qdev)); bool is_free; Error *local_err = NULL; @@ -705,7 +705,7 @@ SCSIRequest *scsi_req_alloc(const SCSIReqOps *reqops, SCSIDevice *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 = DO_UPCAST(SCSIBus, qbus, qdev_get_parent_bus(DEVICE(d))); + SCSIBus *bus = SCSI_BUS(qdev_get_parent_bus(DEVICE(d))); const SCSIReqOps *ops; SCSIDeviceClass *sc = SCSI_DEVICE_GET_CLASS(d); SCSIRequest *req; @@ -1353,7 +1353,7 @@ int scsi_req_parse_cdb(SCSIDevice *dev, SCSICommand *cmd, uint8_t *buf, void scsi_device_report_change(SCSIDevice *dev, SCSISense sense) { - SCSIBus *bus = DO_UPCAST(SCSIBus, qbus, qdev_get_parent_bus(DEVICE(dev))); + SCSIBus *bus = SCSI_BUS(qdev_get_parent_bus(DEVICE(dev))); scsi_device_set_ua(dev, sense); if (bus->info->change) { @@ -1698,7 +1698,7 @@ static int put_scsi_requests(QEMUFile *f, void *pv, size_t size, const VMStateField *field, JSONWriter *vmdesc) { SCSIDevice *s = pv; - SCSIBus *bus = DO_UPCAST(SCSIBus, qbus, qdev_get_parent_bus(DEVICE(s))); + SCSIBus *bus = SCSI_BUS(qdev_get_parent_bus(DEVICE(s))); SCSIRequest *req; QTAILQ_FOREACH(req, &s->requests, next) { @@ -1726,7 +1726,7 @@ static int get_scsi_requests(QEMUFile *f, void *pv, size_t size, const VMStateField *field) { SCSIDevice *s = pv; - SCSIBus *bus = DO_UPCAST(SCSIBus, qbus, qdev_get_parent_bus(DEVICE(s))); + SCSIBus *bus = SCSI_BUS(qdev_get_parent_bus(DEVICE(s))); int8_t sbyte; while ((sbyte = 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 bus_size, 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))); } SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockBackend *blk, From patchwork Mon Feb 13 18:43:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 653216 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2581719wrr; Mon, 13 Feb 2023 10:46:56 -0800 (PST) X-Google-Smtp-Source: AK7set/c0dQZL2TXC3srWO6Jx1HBVOgxKvCygGeVcHIOocItJjkO8XNV5Q2mALvVydax5b4dVe1G X-Received: by 2002:a05:622a:1752:b0:3b9:a965:7af2 with SMTP id l18-20020a05622a175200b003b9a9657af2mr44102739qtk.45.1676314015918; Mon, 13 Feb 2023 10:46:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676314015; cv=none; d=google.com; s=arc-20160816; b=LkfN5Pkh1+KgRdR4D841n1D8TnyeJXV296NJi7PF5jRzIqVeSvRUs35dr6BkF7NjV8 aEeyMpK47gLfU36jnM4wzhsVGn6EXTP2IUlHfL09AnF1UJls6Nw8Jm2sJyef55/Azukt BG3ReodO/flClo3k3bhRhit5YHM9Su0IMZzzD9/R5vJGibjLBR3la8s/nRdroMSjxAye iXaPLFapg8x+ka+jMH16vX8xOMyETtIp7s7O2fFVs+1IxUkj0+mPzQG4DsepqlVRAT4E Sbbk1fX4tKFvsRYACXhiNjjoK0VucEHRjyVAs4Zr2CohrzUuKIHw2jJpV5Cs3pDB2brF x2yQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tUBrGbpKKV7VXqQbLaZwgKrboQidPjnhwuwd1SCLF+8=; b=W0ExyRr2cRckNpRbCBqZg4+EPQxcnVabFeyzljp0AGInR/HFbGHDslpqKo0BgPAPTg LHsvUi4H7XwzVNHC6g5F7++KUUj7oBnBT0TvD/3NrzAEF4rJSTR+//O8oQo4HGuuIruI PQQ+XakKf09/1Mx8e2n8oqnyCMVXDwACLfZVcrRWcbB82OmllvgiApzJXk9mhukxT2Zb cT9G5DCDYxKwS4JAgEPMBJIpHC7WC7rYEEts6PesQYtgJFeOetW/HZSSjpFPkyFKwx0g PHx8Ux+yl0rxlH8yVMRV3cw9ZFboTSp5X/mM1ttt0MplrvRkPInLIAzQnAKBurYtbFox DUHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y8Ti4Nsi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q17-20020a05622a04d100b003b8559f2a3fsi8577948qtx.365.2023.02.13.10.46.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Feb 2023 10:46:55 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y8Ti4Nsi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Eduardo Habkost Cc: qemu-block@nongnu.org, Hu Tao , Gonglei Arei , Richard Henderson , Li Qiang , Thomas Huth , Cao jin , xiaoqiang zhao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé 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 = CCW_DEVICE(vfio_ccw_dev); tmp_dt = CCW_DEVTYPE_VFIO; } else { - SCSIDevice *sd = (SCSIDevice *) - object_dynamic_cast(OBJECT(dev_st), - TYPE_SCSI_DEVICE); - if (sd) { - SCSIBus *sbus = scsi_bus_from_device(sd); + if (object_dynamic_cast(OBJECT(dev_st), TYPE_SCSI_DEVICE)) { + SCSIBus *sbus = SCSI_BUS(qdev_get_parent_bus(dev_st)); VirtIODevice *vdev = (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, SCSIDevice *d, uint32_t tag, uint32_t lun, void *hba_private) { SCSIRequest *req; - SCSIBus *bus = scsi_bus_from_device(d); + SCSIBus *bus = SCSI_BUS(qdev_get_parent_bus(DEVICE(d))); BusState *qbus = BUS(bus); const int memset_off = 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); } -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 bootindex, bool share_rw, From patchwork Mon Feb 13 18:43:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 653209 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2580808wrr; Mon, 13 Feb 2023 10:45:09 -0800 (PST) X-Google-Smtp-Source: AK7set8mXu7LpDot48DnF9JwhnhigQQRj0ao0ySL/rJrFL3lHiY4HjXAf9Kv2HROkh5a3bOzhkBS X-Received: by 2002:ac8:590b:0:b0:3b9:e735:96e7 with SMTP id 11-20020ac8590b000000b003b9e73596e7mr44184105qty.63.1676313909755; Mon, 13 Feb 2023 10:45:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676313909; cv=none; d=google.com; s=arc-20160816; b=xZ3bZ99Wzhib4oDTwzMWPr6SVlyQpr33dVXMmdjRj01+VZ1kYBX3XGMjmTKoCensB0 cq1mV+YOtqcGyTbQ59AyQk6Un4zeEaQC+yNbmlPcopVTmbCTKQjiifzgw8/7I8Hq9x87 EUjvNgT8jG1t8otnHHW7qK0cgJd0x9S1caW9OeseLkkqrlKnE5aoql0GAQEg0R6QCleh wbCQh8kBama1zxdxFYjBlr889AQfgSRD6fqBt3/gu6FndYLaHBH8wWMe8oVz4uF2lQlQ 4CBEPNqGjAN6bebidRVocJbvkGcZItKHQ4nyKZel13X6zqeMb1k2j3rl9mu70TFA7HJm vB/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yI1y6XZsaobmGFW1lR+eKSaDWZj5kiLu704LCMt3Xc4=; b=Q1cMUaEaRjvGcT91iASAx1yB5Sl992uC3br001/MV5V1cgrgDtc1rrZSp80/CPh9qX 30a3x1C9vBvRPwkcji7fdwL+uijMnItQgYofLqclWxY5fa8YKuvZVtRvIEMUNUxT4PKv 1YRgqQEpn79wJOVEQ/gSYn+o3zwQGZ0dRs48RALBJJb8DRBRQiZZsv7PFJ/BGwyqNmOq Q0+2+x0EUZXxISB1kCCg6xJEtkgxm+PmCFfkJKUFiXb1WwQNpf3RS/5q88WEuRBL9eKH F6HWmnTIsMEyiQB/f/TuTx8xIp8NoWjaoa6APBnx69b8j19iusT3qw5FU8WKzUW78RSq yBCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ao75rupK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bp32-20020a05622a1ba000b0039abe2daf39si10331046qtb.180.2023.02.13.10.45.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Feb 2023 10:45:09 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ao75rupK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRdow-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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Eduardo Habkost Cc: qemu-block@nongnu.org, Hu Tao , Gonglei Arei , Richard Henderson , Li Qiang , Thomas Huth , Cao jin , xiaoqiang zhao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Use the safer USB_HUB() QOM type-checking macro instead of casts. Signed-off-by: Philippe Mathieu-Daudé --- 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 *data) { - USBHubState *s = (USBHubState *)dev; + USBHubState *s = USB_HUB(dev); int ret; trace_usb_hub_control(s->dev.addr, request, value, index, length); @@ -523,7 +523,7 @@ static void usb_hub_handle_control(USBDevice *dev, USBPacket *p, static void usb_hub_handle_data(USBDevice *dev, USBPacket *p) { - USBHubState *s = (USBHubState *)dev; + USBHubState *s = USB_HUB(dev); switch(p->pid) { case USB_TOKEN_IN: @@ -568,7 +568,7 @@ static void usb_hub_handle_data(USBDevice *dev, USBPacket *p) static void usb_hub_unrealize(USBDevice *dev) { - USBHubState *s = (USBHubState *)dev; + USBHubState *s = USB_HUB(dev); int i; for (i = 0; i < s->num_ports; i++) { From patchwork Mon Feb 13 18:43:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 653219 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2581901wrr; Mon, 13 Feb 2023 10:47:20 -0800 (PST) X-Google-Smtp-Source: AK7set9Qwxk8ePHLWA7PcgwIr9dxbg1k9z4M1bvCK1Jg+s1b3e3cixXaXphbJKAS0O6X91po+3Ch X-Received: by 2002:ac8:5c48:0:b0:3b6:a1c2:f63c with SMTP id j8-20020ac85c48000000b003b6a1c2f63cmr45256468qtj.33.1676314040485; Mon, 13 Feb 2023 10:47:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676314040; cv=none; d=google.com; s=arc-20160816; b=NGYepzO/fuJUs+/y5ms9O80EwnewLZGQ8rtyv2RGBfrWgvxPF9GqMpRhre83Xlpc2Y 8w/J4VqERPJMhBamiFFknACO0+oBz6xFGaH4rjiaJ6sJdK6cqIVtQ6CtnVv08QTAmZtP PO7c+BCegtA/Jc3+nXwqpQbz5d5rfqPLf6LFbXtNN9KA2o0dCy2Fy5w4rWoaTisP7aC6 lcGf7ztjll1LB7d3ehVo6MDocZUtEV8LD0qNIK1d+xl//jl+hhw/wDqSA13AF+d1HdYb oO6Bbwups4hWvBmlEkzCtfOY3xwRfpM4EewjnMHcIap7yz/w7s0BmM4YEQgm+f2T4A75 ZM4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BCofvFRozrpBRIR6kzkyhIQPbWbeiNV/KXSS7SVLec8=; b=zFI181ijfA4p/hJIP9JKx2JxhBRynuqynQ1I6tAF8tipCYUWKalYQn0rn5DfK+vEmR oTBzgbimytOvNz0aeukcKAoVbn0bCbEvy4A21hRoJhtohpI+UNe3QI2DC6w6UyerX9rd QWK3yzT5B77floHjg79x4D7FTIoY7dQkeeqOdpksBVdj0cv6/bWIB5FoR94g00kBdiIs AW1M3+LNQJ/RVuIqVS9n91BaJCh1j3fBzF9us6tSbR5knBDS/gnIjvlSt4GrIZ8cw/ZI K1MWO2mjpco8+PoKHWdgqlzynqPqSNBnI7GTJG9XQYadr0IerOs+B2z1aUAkEGJfRtSP kOgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H8Jzcy26; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d130-20020ae9ef88000000b0070d118530c8si9600698qkg.304.2023.02.13.10.47.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Feb 2023 10:47:20 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H8Jzcy26; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Eduardo Habkost Cc: qemu-block@nongnu.org, Hu Tao , Gonglei Arei , Richard Henderson , Li Qiang , Thomas Huth , Cao jin , xiaoqiang zhao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Use the USB_BUS() QOM type-checking macro to avoid DO_UPCAST(). Signed-off-by: Philippe Mathieu-Daudé --- 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); 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))); } extern const VMStateDescription vmstate_usb_device;