From patchwork Sun Feb 12 22:51: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: 652834 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2124275wrr; Sun, 12 Feb 2023 14:52:39 -0800 (PST) X-Google-Smtp-Source: AK7set/6GcZW1zmYPZaL4qKC3YGTDAxRNFukdEScKyloZk/7pNtGaEDO/37FTAJx/LxDIa69JG18 X-Received: by 2002:a05:622a:104e:b0:3b9:a4ac:9109 with SMTP id f14-20020a05622a104e00b003b9a4ac9109mr36690286qte.64.1676242359779; Sun, 12 Feb 2023 14:52:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676242359; cv=none; d=google.com; s=arc-20160816; b=f03TNU5hbqBAi6c9dHcC4IRikCO234paFKmZqmptTNXaG+xOuf1fqEi5ToC4lh+hHt tcwM2vADWTZB/Y5soVLf0olugQEN6+YDH6lTnu8+lT/Id+9h5gzK//eMzx5OiOSHtTii Chv4vcN+43qHvWBoRp804rihxl0igmJyyAbHPSLXPJ+acPgjEi5RsVjxOOP05qIY+98Y M0kT56LmE59Do6vYif1EOwgd1H7T2mnsOMoB8smo8M22cl5CM+jDoy1Wquri251B9SR4 BZJMBgXTTj8phl1CSwSLcSD9SIE3BLKyq7pfePCzLAgTbn8GBvYowa6orhLlgprrJzYr XxwA== 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=XVQsRljc+e2WS75HzG39Xi03zc5w5tCS/q97BGvWLOpZjT86ofMWQXINeCLFa3NK/0 qXkee+qHa6c6gfvfrbZRnNiiFp2XOIqdnvT2OCJbRfmSUVbPue+LgZUid0hF7yhuLQPj 9TMROjL4BuSSXB8sL2JLtqtiKZ+kQHXpTmkvhMzPkWnUhJLT6H7jUNGfsEvgN4durfE4 s4JvHwwIxerNa1OVvt0lW9L9+gGQFNx4jpwv5L3UgQFg9mWrB+jfhHIZVC2AcHGnW/H6 g5RuMnaV9QJZqjroqNIaczzQVhgio8zwWZlHdTsSGT2W5ZADOy1RyUhXITdbNsY+wk3S UKoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=avhXU9U3; 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-20020ac85b0f000000b003b9b71027a6si8734697qtw.640.2023.02.12.14.52.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 14:52:39 -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=avhXU9U3; 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 1pRLCQ-00059I-Rw; Sun, 12 Feb 2023 17:51: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 1pRLCO-00058Y-W7 for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:51:57 -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 1pRLCM-0003yQ-ST for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:51:56 -0500 Received: by mail-wm1-x334.google.com with SMTP id f47-20020a05600c492f00b003dc584a7b7eso10046802wmp.3 for ; Sun, 12 Feb 2023 14:51:54 -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=avhXU9U3jL6yfb4yRhx0FXLgj6JO0KS8G870YCY8NmHWseTItMhGyl75Zcp5v6wGCm d9rcFnYrwQrcFF6h5C6g4OKlQHCCFfnVkCOKgnlMSckRS5K3i76mm+7jufCt4B2Itfdj i6klB2bRbz3rT3Iauhw2H2PPdOKVGPONifdeEZIMV5pY5YmQzx/IcmrpWLG9eimAqsIh RwLjZKlU0oJrHx5xCBCNuh7gVRAsMrZsLuizP3oi7HSanposQmDvUrVPEnBjg1g6eERf y5fX6LAt9ueySB/zGeA/MsZmaRRwsgcSB/4XdZ9rtcRNF0UfIJz8DW0rPznXp1IQqQdy Vivg== 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=KE4UKJyQB8uD0h3QMKli79APlakn7Nwd/i6Xh57trEA0Cwtt9XF/CUGHGC9hUze9iS X3Ymtw4+Bs4QYIodhT5+R+Uq2RIMbIH6nqkvOkJjTbShLfolaoPtddQxjxf1rw1f9/+J xCtkO2zE/OOeSAmUdka9CoiPwsN2PU6eBhpnv9r0kbx8OQh3v/Pp5klPQC2ZGS9lHfSw kWmSjXwonbv3OBwcPrWjqfOlVPYyrBUkJkIGS1Fth/6tL8xjdvJKtgyjRWMYn07bzzDO Z/TP6akUMLd7FEQKsTZxaR2XYLYJr88FaJEWeTTWYkfKdDPpVm0kPgXsAsStI2E97E/M a5ig== X-Gm-Message-State: AO0yUKWpx5q4ORdtnVp/bSGF1yC4+0K/F7JFSiBcfSAoovWa4YT2oq51 tmrm0doft8hvRKqR3LmY7oP1EA== X-Received: by 2002:a05:600c:4a8a:b0:3dc:40a0:3853 with SMTP id b10-20020a05600c4a8a00b003dc40a03853mr3202268wmp.11.1676242313682; Sun, 12 Feb 2023 14:51:53 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id m17-20020a05600c3b1100b003df5be8987esm16218119wms.20.2023.02.12.14.51.51 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 14:51:52 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Eduardo Habkost , qemu-devel@nongnu.org Cc: Richard Henderson , xiaoqiang zhao , Hu Tao , Thomas Huth , qemu-block@nongnu.org, qemu-s390x@nongnu.org, Gonglei Arei , Cao jin , Li Qiang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PATCH 01/19] hw/char/serial-pci: Replace DO_UPCAST(PCISerialState) by PCI_SERIAL() Date: Sun, 12 Feb 2023 23:51:26 +0100 Message-Id: <20230212225144.58660-2-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230212225144.58660-1-philmd@linaro.org> References: <20230212225144.58660-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::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 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 Sun Feb 12 22:51: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: 652833 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2124232wrr; Sun, 12 Feb 2023 14:52:26 -0800 (PST) X-Google-Smtp-Source: AK7set8UUsaXCfjt9yqSZPF87zkoZEymo/dha6mnhqdG4gVYwmiZCha3xo4zhU7/HW0fGfILPIAm X-Received: by 2002:a05:622a:13c7:b0:3b9:bf83:d5de with SMTP id p7-20020a05622a13c700b003b9bf83d5demr38611527qtk.26.1676242346480; Sun, 12 Feb 2023 14:52:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676242346; cv=none; d=google.com; s=arc-20160816; b=Vv8dqlqJe8yT78AJVlRnBHDJMVkbx0CNUqXN7qWXQOr3ju91jSSXrKoN/rRaJ55ogX UrAW+JaeEAVD3fag1H/VR8viqh3vgzrOCJmZjy6UzHBPUcaToEZC4Y3d38Gtob4j/r4Y 0NWZUrnKPGB58icm41ou0nVYvWQF83ov52wgIKJw9bV4C0+eTUflS5/wCgQOwX+11kqu tdsxNcplqKWCVZHdpsggmLcpQg8DXOuTYQwW37V5Ctj72Kli2oYg8WVgqPzmh60OJ5Zf hlrscPcrf2ssCJMs/DhYM3Sbx5wEi1kmpqpgMfhzMUpfMGFtAt3KDZX9S3E9+tJs5it8 AIpQ== 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=bCKsG+zAhxcHVZqRjxu5bX66tFE5AAPeqF+8xmSD/dgn0fnTTlWlb/Cc81RL3n0wuj RDLiwDr081reeV+ctkVSBge3DBeYKqSKT1W3dIVXUvJtakiWOB3WeDiosDy1tp6G3jzo XsnW35PCDMLGSVluq76oX7wSmh/O9PSrduacFieKPIOhJ8wiaw5mnRACdc57gbsv4BYy EWn9VgDPoiqt6jOL0R4ZPvG3uM0XSXMzHdprAMketzw1xbLZKXDgj7oVDyHr0KYHWdVZ hx768R0d/8048fXIjlTZfa0rlYla5Yqb3eW1qb/Mp/kccMZo9VtK8S4G06yLFlZisRAt x3cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BlBwTqLx; 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 h6-20020ac85e06000000b003b86032fd35si7759952qtx.729.2023.02.12.14.52.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 14:52: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=BlBwTqLx; 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 1pRLCV-0005Ex-Pj; Sun, 12 Feb 2023 17:52:03 -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 1pRLCU-0005Cb-01 for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:52:02 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRLCS-0003zc-7V for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:52:01 -0500 Received: by mail-wm1-x32d.google.com with SMTP id n33so1533050wms.0 for ; Sun, 12 Feb 2023 14:51:59 -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=BlBwTqLx9F4kMNcRo/5xW0t5FTChw/vNb1Xn1+VeP2/EDIkMbxpndLDQw+znGM1/Jx A1fCjgjvlUm/caIA9/ZiuxCdgzea5HgPbcmbFCI3dyEO/BwSLaA3GzByzcVaa9yHzPCs H32gCrbrCi+6yhggpfnHNNj41J3TafwTp5b8yf9Z5Z2CjUMkvN93ArYx6oN62OIhccr6 QzoTHDesj/Sdm9lZZvKxSNX0xpOz52m44NHh4m3X8LESCu8zbrkD91K9KtWmJ+H30NXi 5hYIzPQKPQZbiQ7rI4ae/bS90QT1b7ugNRY+8muEzrthZm/OIjTOjXkV0MjNyEx40IRy R/Ew== 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=Fu1WHgo/3x1Zc5NGL3en7/JMxNSs0un2ewoJHFvGxoAYk8ROzu8hwCyXQFFkQNdenf zrI1124NDzutlt809TPGEZA21pGGAEW6QrO4xHWBeg+2f5e6+PwlAP5d22zgA91GASag iBsHlvM42tAGQH5d5MVOUhk41D2R/OOZlsqFdqf56GWi6OZrcExkvu7k0nn3Ey1tGxDj /8FJfFNY+Dnt41hIGFbjxd8SFQvqD/VzJTl0omdcLfTvd/xMVyUAJ3Sp4QKVp6LZ/U5I HXiahZcPbUhQFqQaaA44dJCNeOPDW5DyOQwPBU8IiYPDag2yI33JnedvqEsfpRMkymxD jOxQ== X-Gm-Message-State: AO0yUKXlXoG950pzGIhVSbbdVZZPbt9ErFaRfmhoMwZpgTAEMO+5odDF SM3czPXR3v0NPFbwnGP3yvusMQ== X-Received: by 2002:a05:600c:180f:b0:3dc:557f:6126 with SMTP id n15-20020a05600c180f00b003dc557f6126mr21436610wmp.4.1676242319052; Sun, 12 Feb 2023 14:51:59 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id p6-20020a05600c468600b003dc36981727sm16613013wmo.14.2023.02.12.14.51.57 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 14:51:58 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Eduardo Habkost , qemu-devel@nongnu.org Cc: Richard Henderson , xiaoqiang zhao , Hu Tao , Thomas Huth , qemu-block@nongnu.org, qemu-s390x@nongnu.org, Gonglei Arei , Cao jin , Li Qiang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PATCH 02/19] hw/char/serial-pci-multi: Batch register types using DEFINE_TYPES macro Date: Sun, 12 Feb 2023 23:51:27 +0100 Message-Id: <20230212225144.58660-3-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230212225144.58660-1-philmd@linaro.org> References: <20230212225144.58660-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.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 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 Sun Feb 12 22:51: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: 652839 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2124474wrr; Sun, 12 Feb 2023 14:53:25 -0800 (PST) X-Google-Smtp-Source: AK7set8APXUyMEhbkbDYVysuKk/a5JX5FYEMkeSNSP1diYhepw+veexN/i1wklSLj3jHKt2VUHMW X-Received: by 2002:a05:622a:493:b0:3b6:35cc:a5c1 with SMTP id p19-20020a05622a049300b003b635cca5c1mr40806641qtx.20.1676242404911; Sun, 12 Feb 2023 14:53:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676242404; cv=none; d=google.com; s=arc-20160816; b=nqNFvQzT1mId7NJzDKdxKYby04m2RIx/7kg0+5sFRQkog/+x3rCEcOe4hjthtOO/TT tYk957R1QePYgcFrqFUtr+cw9h77h5sh1uaf13T1wBS5/nTuhxXs1EuVIFWNBhN5K8nW x37L/j2Yd/9LrM58ksmTYFUrV++WbYI4x+pO3EOuxvm/6Vn0CgANYfbm0uydQ+Ogr0Cf eQr9fic156BrqB6KvrG7IYSm1QdEXXVhH+15nHr+nhVFKcw2bcOUUhXjxD3I7yEPfXyw ZnV7GWhaw2W4CxYMTYCuNFHEedOqtuaaSJLKy8qj85Dj0KPu8gfhYAm5d2F2zOeyzDpF CDKw== 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=HT2d2u/vjaA1vHLklOaaqzhfI86GF9Vdz9cSYHww3bI=; b=rb35qX1bS5VbN/9Clb2l+o7/f9zqdz580moRsk3P30wLw7SduQclwIHBRXS8+V7ByD x3JtKJ8fIciRQAjoiQiVFVMPHDh5aCDgPQP03Moe2WR217ZOPNKpFZZVoSpePwJIZjq/ Sy0ntzPHtTm/zyYttZbE7En6sE6cUS4wLLBCRukTTgD+dimwARqMfLTDawTjo0WHQAf3 WYTuplD3SuQhNQdXrG2putxP8kMKY9loSfQFqJOD/H7e8/GtZR4h4cXVDnacR37kxK9I x9dXEZUQSdI9rYj7vadxDaDCXRbrHi7BnTskmGw9ZyYdDA496HxfGcNKIQUBc7pno9fk tl1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=To7i0maS; 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 b66-20020a379945000000b0073b331639a8si1670063qke.540.2023.02.12.14.53.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 14:53:24 -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=To7i0maS; 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 1pRLCb-0005I5-Cc; Sun, 12 Feb 2023 17:52: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 1pRLCZ-0005HL-UR for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:52:07 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRLCX-00040S-J7 for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:52:07 -0500 Received: by mail-wm1-x32f.google.com with SMTP id s13-20020a05600c45cd00b003ddca7a2bcbso2388904wmo.3 for ; Sun, 12 Feb 2023 14:52:05 -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=HT2d2u/vjaA1vHLklOaaqzhfI86GF9Vdz9cSYHww3bI=; b=To7i0maSdQHkF9uXA6HVlCbWk4Zx6HP/BVK+JNVFJPBpP4rsJ6kbPH9JjgpSW9xsEU HDxRLPss8I2t9X6cMdoieOtbg6j3r2tPHPAXkrkavLY+uM84mvu3Kdx6x+ICMfaQetYY jHtjCWNLi6Zmcjv8+wMDL9l9NALBt3Wxg8M5xMDeV2k6f+SnKQufnAp3FexcMiIKyvYG cr8Mae14lJdWxW/rWsVw49lO5v7uPuwpzJCCio0D/apmMCD8AJ1IQEufl+Divo7zB8mc NnWo2PziOg+TpbYw9Vbz7cvzsXcVQ5UD24+dDFI/IDLG7XkF0pPDrxDIL+5PVlcFbXY9 Dd7g== 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=HT2d2u/vjaA1vHLklOaaqzhfI86GF9Vdz9cSYHww3bI=; b=LczvMPJxnjuq4Sus3pMB5v/uCJWHZkLrN/IyKjK8ATUo3mi6OArtbUIa+ac/IvHd/F RSZVuoNj/tfAdiR++YYQbqj3yV0gs9RqErR0ten0Qgq/9qO5bqAnTYwEu33FUsKsXobp MxKzLCXxu2UcNwdILJHIeomXyIMieOjjxwHaU271CzUwx9KYdWwwdM0KT+pkYgNbE6O/ x/CWlWMFIty/GGDRHBeP2kcSMsIyUVyWTRdn5hVvEJOYSBK+XbHGcyh/N8pcq1GYomSs fj7S7LLWX603gY6ghCGaWuEEnzSyGPJFbJqxGJPyhYm+SMbUO9/Jh7IHPptcqKKg35TD gdrA== X-Gm-Message-State: AO0yUKUCiUfIx7RTRUjMt46JHkw19UEEybljQZXz3Bfzl7xw3m393+Tw 0q909uEr3wzm2rB27WVJR54KOVspi0o3F2M/ X-Received: by 2002:a05:600c:4d20:b0:3e0:9fe:34dd with SMTP id u32-20020a05600c4d2000b003e009fe34ddmr17582988wmp.4.1676242324374; Sun, 12 Feb 2023 14:52:04 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id p24-20020a05600c1d9800b003dd1bd0b915sm15019053wms.22.2023.02.12.14.52.03 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 14:52:04 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Eduardo Habkost , qemu-devel@nongnu.org Cc: Richard Henderson , xiaoqiang zhao , Hu Tao , Thomas Huth , qemu-block@nongnu.org, qemu-s390x@nongnu.org, Gonglei Arei , Cao jin , Li Qiang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PATCH 03/19] hw/char/serial-pci-multi: Introduce PCI_MULTISERIAL QOM abstract parent Date: Sun, 12 Feb 2023 23:51:28 +0100 Message-Id: <20230212225144.58660-4-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230212225144.58660-1-philmd@linaro.org> References: <20230212225144.58660-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.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..faeb0a9476 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" + +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 Sun Feb 12 22:51: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: 652835 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2124286wrr; Sun, 12 Feb 2023 14:52:41 -0800 (PST) X-Google-Smtp-Source: AK7set8RVwYfmyVR6ya3L5w5WxaGEdXo8fG2LrZNhcwz3o87dJUxQ43bEcOYsjIl2m3SCCpnpL8P X-Received: by 2002:a05:622a:1982:b0:3b6:8b52:1359 with SMTP id u2-20020a05622a198200b003b68b521359mr26360938qtc.0.1676242361436; Sun, 12 Feb 2023 14:52:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676242361; cv=none; d=google.com; s=arc-20160816; b=SRSAfZetK9cba+T4pDV4L3d1RTfDJ11Biu7mEtKDValnaNBaqEAM5FwrSwvWIUYte3 bbZdBXmFqs/I3idd13iAcmHkC36Vwa0qpk9x5PKH50NFcy5cPR1phABlWFwCfGRZ2J7i /d6QN7cGjdyyHxQ06o1DlXQPXTr+ExAGd1+Sb2xRRMK4QL7MgYRHUhnisWIf45nGLM9t 98Q/lDw4aqK7bmlLdJlWlitFI9SkaVxeIMSRd6V7B1ab8UzbL9dyJKTJidErUSq6KlKz KncRlB7rtFGE6hlcATwPrQzd1UTtSugdPuQWkXKxXRM7w7QgTFQkgmz1cm7VQcxmCZzF aC1A== 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=kdvTBIlDDxD/zp1XWppgssK6e1Eedl76M1G0yZJNLN8=; b=bgzjPeC2TdTtbEFFckQ/MBRCiIz5sMcUQ0OT8ShoOHATYyf6Psmkgdo1Q0lAfoQbgh yuNCCO7EtEhJMISQxeUr1ZHknNxic7OQlBUS2QTlJo1d5I8mcXBn7QnvmZt9PNPX+tgA 7FE5Uc9w4S1Rt/ZCBqig5lkVaUWtQskz9npjpYhbo+xBMIUVkK5sj3oq+2p0m3KiIcbE uZKqCJH0iMmrxCZEp78RX1qavnOo6zSWc0GgVgpDSf5FMTLJU+ZKhnKZkp86NXEttAJN 5AjNHDinBuRalxd5opIAh+E4l9hhQ0fGCUHmkf4inESgu/NDlNYnF4sjGSqITGwSQRpw pchw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EJRxRY3h; 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 n7-20020a05622a040700b003ba1149aa28si8538777qtx.211.2023.02.12.14.52.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 14:52:41 -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=EJRxRY3h; 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 1pRLCg-0005K3-Ez; Sun, 12 Feb 2023 17:52: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 1pRLCe-0005Io-Qq for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:52:12 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRLCd-00041D-1b for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:52:12 -0500 Received: by mail-wr1-x430.google.com with SMTP id co8so6695713wrb.1 for ; Sun, 12 Feb 2023 14:52:10 -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=kdvTBIlDDxD/zp1XWppgssK6e1Eedl76M1G0yZJNLN8=; b=EJRxRY3hKHa/rfUJGZCoJCOVgu23RJ/r3/Y057Zb8/O4CMg83atUO9tLTnLclreGV9 ZRR0kPasfIFz86dStzCOuzartlgwXN/FmIUGsSvMKKGymnNzQWuEunrSW5NtNgrjXWfu eR+/mZHBiZ7pnZ+BmMnlnHCKnmyKkoRZuSCBwHyJR58o+6UGG3MZkmVC+IkYkvb+gITj BS6gDQ/8He8DskDgAkoT1/xiPo0uKqs4iUo7gTE3Iz5kaIjoGdp+veoIK+jjUITTS9cO 7fVD+YQRYc8cDSox1VVgKUMz2Baot4mL4FV390r9ADoQp+ozENWRfkW0v+xdebgct8Es OM2g== 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=kdvTBIlDDxD/zp1XWppgssK6e1Eedl76M1G0yZJNLN8=; b=2DxsInK2ohvE8Nv2dyTCo+MoeFzzGCMB8IC5xv4J7DahjMAE4n2P27HMVnZXxguNaU 5dZcH+7D29rWOAYRNGa3FmvC4SXlPbVwSxsH8tSEBsq7zK9H8DAL7OHccquDwrZ3H4nf Qh2SEGXsvrGmr1ZLj6LbR3uvqow4gy3DbjZyFnH8wOd4ld2Ce7cN/McnCVjDawXj5WcC AJ2/aH/Oo4QfnkS/HPiVdc1NwfaAJrnIY3c6J++p64aImf1KnEeyx5gNxktRDHdRX897 89JiG6+4Nc44aUdDNQAlZZmLZE0v4J+JqT9ieIkatOfaeWtF9+VCKmeXvdP3540ZLeRn C21Q== X-Gm-Message-State: AO0yUKUCY3iQH7R7AHTaK7jnyxSSfcp2CS4L1Na4coz04wndxR3IM43j X2reQ1wc3icdgld3umy6Z85kzw== X-Received: by 2002:a5d:6108:0:b0:2c4:3d5:46dc with SMTP id v8-20020a5d6108000000b002c403d546dcmr13444357wrt.37.1676242329773; Sun, 12 Feb 2023 14:52:09 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id f15-20020adff98f000000b002c5583ab017sm1630002wrr.15.2023.02.12.14.52.08 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 14:52:09 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Eduardo Habkost , qemu-devel@nongnu.org Cc: Richard Henderson , xiaoqiang zhao , Hu Tao , Thomas Huth , qemu-block@nongnu.org, qemu-s390x@nongnu.org, Gonglei Arei , Cao jin , Li Qiang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PATCH 04/19] hw/char/serial-pci-multi: Factor multi_serial_class_initfn() out Date: Sun, 12 Feb 2023 23:51:29 +0100 Message-Id: <20230212225144.58660-5-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230212225144.58660-1-philmd@linaro.org> References: <20230212225144.58660-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=philmd@linaro.org; helo=mail-wr1-x430.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 faeb0a9476..cd5af24bd2 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 Sun Feb 12 22:51: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: 652837 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2124426wrr; Sun, 12 Feb 2023 14:53:12 -0800 (PST) X-Google-Smtp-Source: AK7set8NFfruYZQ4nn4d0qTYZI0C2Zw3GL+SRUDxIsKnHAuqRBIh5Lv/VEANvcly+KoyifU5QNgS X-Received: by 2002:a05:6214:5298:b0:53c:8d39:53e6 with SMTP id kj24-20020a056214529800b0053c8d3953e6mr35016611qvb.28.1676242391988; Sun, 12 Feb 2023 14:53:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676242391; cv=none; d=google.com; s=arc-20160816; b=ce4phPCg8oYKusVV3gHTMzt+h8pnCJdQZQlWuRxDWNXEC5neLH7AtTK5l6hx3Z3t0Q couwWZtsyfcAkuVFzA6lxcLVmwQi6C5hV37xtYCdoSvt7H7RCnxKAgBPO0RsahIFImfs yhDyWeXeU/RJ1LAM6XlCK3/ZnVp0RYdg+L5xvnJMlPka2MFoUf4v7dxbM7yd8V3Dl8Lm E1mLa97IsQJ5DlvQn+ZQD2AFEIsqtt/ePYmdrOgHA8xHIHyvt6JTfLFYDFqIexAJHtQl N52SK+DJPSwIF3fdcXsm7h/gD3bBD/PSOAfQb4nmAN9UIDKSlkflgxZOzMK7Gv788Mag iOCg== 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=t/FK4XDdiJG7RHelAiRbUeIilzHxima3ZnBYQtTcGTM=; b=f1JN0Hutn1A4JRmAKwOrxErkeyojmDyVNrO8xthxfYjig/CAu4W0Y3e238UBA+J8O9 TCZBljyYfk17yhaZquxhobC0f0qH3F5dC3lsgI3O8ks+jS0RAKyn6ed+J68ql9Llfsbj uWSndoi960LQMex53S4+gcGTmB+jm2o7WNINjFNN1fkmjbGSQa92x3dBzcKBOCT/UCns BeXjatXsBM1GvXaxtDyUBZnUCZTIiGH06ddPSMpeRTM+YUh0XibPbtM+KZUznOxZMpTj SYCjHiNw8kVIoDWQlEgZBxS9OYdnqaOmE/NqwHe/RuP7yOmra7QaGKyQrQ4F9WxN9lg/ gQvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Pl/YOU5s"; 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 v5-20020a37dc05000000b0071e48ce96fbsi8174968qki.482.2023.02.12.14.53.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 14:53:11 -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="Pl/YOU5s"; 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 1pRLCl-0005Sj-83; Sun, 12 Feb 2023 17:52:19 -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 1pRLCk-0005Rp-1X for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:52:18 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRLCi-00041p-Cz for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:52:17 -0500 Received: by mail-wm1-x329.google.com with SMTP id o36so7556816wms.1 for ; Sun, 12 Feb 2023 14:52:16 -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=t/FK4XDdiJG7RHelAiRbUeIilzHxima3ZnBYQtTcGTM=; b=Pl/YOU5sCUDXy9RjtOx6r+bcOaYy7Iq7XoPUh++c3bxi6GFvxkiI0uneFr4HwxhXIc j7hvJ9WGwjmKNCDDBlaMygLGHtV4fSsSn0vu+bxdX9eMt685+ZOmvxbKAGpSA7ZXJrEI FciKrPg8YFGoIJYzvEP6H5mZBqyvi8CWQMxLr0YGCMRHfdxSaxQSuPB5xWd2oDE0ZYD0 auakyNFUI6tprd8HjA2iDXpLJHwz+O67dIhA1cMU52bwq+3O/mzvkk1SJC91wuyO8sq0 CR1BiKKCp2zZtLOstX22i4da227YJ6BmWPz2WPU7LMNyWJIIA1hDnV2CcLd7S5KEt57f J0ng== 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=t/FK4XDdiJG7RHelAiRbUeIilzHxima3ZnBYQtTcGTM=; b=LyS2WvKQo2KXKohJHALMQlW+1FwoFzkjkEeeb8j5slJKi6qkEaSasjqcz57ZsOSKRT NFGXMOMgT1zKtXsiih+IZJsWQyIWskjMQj6V1R/JuS6jBQ56yL4wJWt5637IICFze06T OBaNH3DlaXiun+9/vKNjudXuk0v90o3LKOf74fJxNws7juI3Ofyb3vdr9dAUhDezz25q RghJNv5+rH3oVXfyU2zlYnu8MWV+BVl83OnBjoGVv41OmZA7xYM0FgjJQ/dZGfTBHUey 1k1TJtT/5hdu6j1JnD1Kk5mGnGVuLpIJqI7Bm30JShVghrC3Hi7Ji8kHHl75APPab5KM ci2A== X-Gm-Message-State: AO0yUKW8tka9Iz2vHgnDvpcWj9+R2AevSzNMdmesfNIQwZlGUSRd6eHV fSvgG8iaK/cHTycj9jNeLNBg8Q== X-Received: by 2002:a05:600c:2b46:b0:3dc:557f:6123 with SMTP id e6-20020a05600c2b4600b003dc557f6123mr17732128wmf.1.1676242335157; Sun, 12 Feb 2023 14:52:15 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id o7-20020a05600c4fc700b003db0ad636d1sm16780161wmq.28.2023.02.12.14.52.13 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 14:52:14 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Eduardo Habkost , qemu-devel@nongnu.org Cc: Richard Henderson , xiaoqiang zhao , Hu Tao , Thomas Huth , qemu-block@nongnu.org, qemu-s390x@nongnu.org, Gonglei Arei , Cao jin , Li Qiang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PATCH 05/19] hw/char/serial-pci-multi: Replace DO_UPCAST() by PCI_MULTISERIAL() Date: Sun, 12 Feb 2023 23:51:30 +0100 Message-Id: <20230212225144.58660-6-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230212225144.58660-1-philmd@linaro.org> References: <20230212225144.58660-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.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 cd5af24bd2..6f4491210d 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 Sun Feb 12 22:51: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: 652849 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2124990wrr; Sun, 12 Feb 2023 14:55:25 -0800 (PST) X-Google-Smtp-Source: AK7set8WKyYQ4lfMMFIAjiXX+JyGdNp4+uhQa3qNhwMYqTab+KdOHnlq5QwavcmfNvBkg1sb3uM8 X-Received: by 2002:a05:6214:d8e:b0:56c:24dc:17a1 with SMTP id e14-20020a0562140d8e00b0056c24dc17a1mr22480654qve.48.1676242525335; Sun, 12 Feb 2023 14:55:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676242525; cv=none; d=google.com; s=arc-20160816; b=uVYDWlvv2UKXgO1i4heKY+gQOGVfZyTUwkFgTcGCV6dCd6kQmnNdIx/mrOFnqtkFgh M/vyC1jP1+t3Hp5XR6/WDiHdZNVJCAHAQBTg1mvxggNsMdBDmEiOZxTOPGW+4HkLikCL v1iiKKJy6uJU0w9RYJciHUDlULJRLjsRN6aoBjb/esHHh5P1gO/6Lnoud3FoNW9PbB6b RFCh0T6DOo262Qu18AzHEtneVyjAnVOR9P8iuU0qKQ09JONTy8xs2Az/1vV5Pdrw7fU+ 8nFt60hcF4i5lUyOeqM/rQKwc9QdZTz6ng8xT0SVBowOodC6GvNspfQbXVf5i3g3/7LX vJaA== 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=e2VknmEn3fmBwvpwvDl4brQssg/rA4ds5kYNPCQi2wo=; b=zF3en5P/KcLqCukdyfTJTXLBPVHKXdcVJaqaqIC+xwRy9jKnxBs8f6n1Cae9aoamY2 mzFK1jlMXTFVALhIXQRV9/GPHmx093PRbaYpnPp7W4uKrC7p5F4jg9uuMVoQF2c1ryiI UZ2eNeEC/NNwb3tGsL3x4eY63HdXA+NBrr68jkzInIKwe6+hSVXQxcvHnPlgL5Yuk+6L 7NBh6DZm4BcMzjIUGf7i/UazOl2BDoj886bFfYSZlR6o7APSwEFc79+tyWj86DEwLlSK R45xgvLjsj7NhWORKSlljbD+0ire3flIgHChdD1LHjIS+QpV9W5OZF10I3qqeI0C+/Se 9lug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NAnShSrG; 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 a14-20020a0ce38e000000b0056eb4526031si266091qvl.91.2023.02.12.14.55.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 14:55:25 -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=NAnShSrG; 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 1pRLCq-0005Yd-71; Sun, 12 Feb 2023 17:52: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 1pRLCp-0005Xf-1g for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:52:23 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRLCn-00042O-Hw for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:52:22 -0500 Received: by mail-wr1-x436.google.com with SMTP id o15so7139061wrc.9 for ; Sun, 12 Feb 2023 14:52:21 -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=e2VknmEn3fmBwvpwvDl4brQssg/rA4ds5kYNPCQi2wo=; b=NAnShSrG3bvpsgcAUn3PIfOzm8ENnXSVBU4aWjYnslxrwPjlGIKeGiXegkBTAKj1XF 9ZpaqBPCq2zv+spNAHgtevK70pSJKDuLsyyDSelFP6ZovIfeUD6uZLukPIUFwhg6yMFe FlETZpGB6Ab8Fdu0106HERa+dCV7fkk8cra8eEz/ddo4SUKwBQEO8MxXMDI11XgKHZ3K CP4CT+0R41GqI0XhAghF343ab/U1uDirpZp3z+vaK3+xcuwGAiPnWv6pIZHNYoBNG9+3 suqPsne/z+2cvy0Z7HPELLHE/M9++sVsvPKqfcyAufMRZzE9ARhAFfhIjk1Bb4dDUBJ0 yS+Q== 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=e2VknmEn3fmBwvpwvDl4brQssg/rA4ds5kYNPCQi2wo=; b=DPnVRHAuEXg3jKBwU4ptw99hQ/fee5yt0YxNilM7ZhWd9SOaICgS+Btd+LawiXJlbf hJdRni0c7rdILrS7pcJGrd/fBQMMDfssxTCp0+1Y45h8tcGr9jC3oCFsDBUqwSyi9zya N0vMIcLT6lJGJfUT512/1/zQd1DYIyIFuqiZpMd7615/IiWmMArPnuBfPDWJQaBcUjCs rIfCEQBQ3soRQJY5B3cQkcDNYOvZsrSKy7nulfNllILc0IVOxy6Ni3l3qzkbNyhT8522 c28wWmWUnfsxNBPFKtbYQ2ieB/hsmRjA/d4O2Mtp/Qnt7QZ9jiFuAZp9zoysche+g8QD z5uQ== X-Gm-Message-State: AO0yUKUjEbY7tm301GgtVQwX03/lXRd2JCWPy8ozGbLaNCacazkptsqG Gg/dRJJpZj2xCKEGcMHsYltrdg== X-Received: by 2002:a5d:6188:0:b0:2c5:49e1:b2cb with SMTP id j8-20020a5d6188000000b002c549e1b2cbmr7664822wru.37.1676242340343; Sun, 12 Feb 2023 14:52:20 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id z9-20020a5d6549000000b002bfd524255esm2483149wrv.43.2023.02.12.14.52.19 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 14:52:20 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Eduardo Habkost , qemu-devel@nongnu.org Cc: Richard Henderson , xiaoqiang zhao , Hu Tao , Thomas Huth , qemu-block@nongnu.org, qemu-s390x@nongnu.org, Gonglei Arei , Cao jin , Li Qiang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow Subject: [PATCH 06/19] hw/ide/qdev: Replace DO_UPCAST(IDEDevice) by IDE_DEVICE() Date: Sun, 12 Feb 2023 23:51:31 +0100 Message-Id: <20230212225144.58660-7-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230212225144.58660-1-philmd@linaro.org> References: <20230212225144.58660-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=philmd@linaro.org; helo=mail-wr1-x436.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 96582ce49b..c96a25e955 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 Sun Feb 12 22:51: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: 652838 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2124450wrr; Sun, 12 Feb 2023 14:53:20 -0800 (PST) X-Google-Smtp-Source: AK7set90yf5AuJox+WcbRZg7Jh2KySREThKsGhSAH8tpG16yLmqgLIJHDX7yaURB5vzodjzUvZ++ X-Received: by 2002:a05:6214:c82:b0:56e:b13f:fea0 with SMTP id r2-20020a0562140c8200b0056eb13ffea0mr3153017qvr.46.1676242400716; Sun, 12 Feb 2023 14:53:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676242400; cv=none; d=google.com; s=arc-20160816; b=NBMPAmfetbrEs9M+ZSwhbwGbGHQ+tBGTTjxJfybaM9LsdxyjimowV+2FtFZ5/RkRpR aXjL+FfFK140OZGqw9CJlitw9oDny3ZK6NAM6Ip2R9fyme5idrm2pRC99IBWQlKA6Uxb cXv/ZIjb2OFHDcSfG1MhLz5Jscs1ls/RU2KuoUJqyWgVIw6AJ9A8YVe45qr8Of9Fk8wX mRQwHtCFHjncWdK6mnWhmlmUSspVzIIwLS9h41lJ0cIkwFBPhBqSINHypz6DvB4Ypam/ uBef2MLqDqHrTPmYmsDOHkKylYHsnZ12QeHboi2j0hHm3bpyZbU6tD+lURNENDc46O0N /Njw== 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=mmW3+j4CxzNplehiqaRULW7t0qame5JDIOTexmpxrH0=; b=Zbsh2wyd3IO8GXfqHMZbYeWDEETYjAhdzFkZc5vowpQih/qZ6BkGxPH6tukqgI9Pti uuBfiLKB2sx4LQ7UVXDOxveaDmDo9dAvBSv/t9iRwk65pVc8UYu/Jm4xoKenfL6U/pFf rDJ7ywBgcC25AvN0zP4VgoRsaDey3pgifHvczv04vfukVL+puD8dGnSMy7Ii2jD3Bg5r +oDyWVEI2UO8gwfTFMHJlZzODXRFJGxU8FbLc0NpOxw0tfS/FWpTY+h+pbKJ1Jm6/Qpk lQctq4d1JH6+gMwr78ij9Y2B2qH1kWyi1rAl4KOJHgLAxGHBAMZzsGEFJiA506QrrEXi pz4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bz0ChdXw; 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 k10-20020a0cabca000000b00568c5e3a0cfsi7952109qvb.125.2023.02.12.14.53.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 14:53: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=bz0ChdXw; 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 1pRLCw-0005lj-3l; Sun, 12 Feb 2023 17:52:30 -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 1pRLCu-0005fx-Li for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:52:28 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRLCt-000437-0O for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:52:28 -0500 Received: by mail-wr1-x430.google.com with SMTP id k3so2816855wrv.5 for ; Sun, 12 Feb 2023 14:52:26 -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=mmW3+j4CxzNplehiqaRULW7t0qame5JDIOTexmpxrH0=; b=bz0ChdXwolRU0I6j2tBywUYDzVv/7C1zU/gwIncr4FPc+dK61rSwCtD87lVZYPmZnq c6SJZAdkcpaIwBSraLgfwZie0C13RYKINpaj7/B7/tFkMPqNnwlYNqDhLJdKSZMTI7wQ 3u3aJPEyv8OenL/Kv9SBAZT9W1MeCtOCHeG4ij7aNqP2UbpgIrqGy0RRW3R0ZcgMzsZk xIm1Q1npoCfhdsRa4ZwN4YJ5KLNGTUzJDA5jYP4AvWgEN3Tn5q1szOnu6JF4R6RLivxK DjPiFf/roN2VEfkOENHvpNwgA+VMCPW2H8ljKIO5Eq4cxq3vXIMEAuV+uiuIkKLJ1qgC I+bg== 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=mmW3+j4CxzNplehiqaRULW7t0qame5JDIOTexmpxrH0=; b=KFlaOi0/aPVqRqCv49SoFd5ktqgWlq2nu3bptEaDqrQc0FjFqLqrEX/fGb9xFoeZjw pgi5Vq+TbUCRNG/xckd1Gk0tLWZUKwG20MauyD84GwjxHGIjPW86Bj8ijaJD6x+NHQbJ CBw/sZ+hwBnCEECb4dNnYq0ui6bkY26xl1bUvBOcnwjNJ3xWANS/fzs7Nwnf5EaogJme WHUHUjv2CbLllQItM+ZZOojpPsC1DtDbUT28Dwfa6K2H0Ra8xjWP/AHZF3FESaYLEQK5 aNqOzZnQ9a4j2V4/o8S1izxrgtp/7j/Pmvj6TpNKcSaaXG6PiBqaJTfAnCZdDmaA5CJx HXjA== X-Gm-Message-State: AO0yUKUoP2ghGjAGOswtOwoz8+UxMRuxmAaprKrc8Rhhf2E/+sGksS2L rc3lhoGQpD3u/SJdjn70+fb6rA== X-Received: by 2002:adf:decf:0:b0:2c3:f250:f202 with SMTP id i15-20020adfdecf000000b002c3f250f202mr21023961wrn.22.1676242345839; Sun, 12 Feb 2023 14:52:25 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id f26-20020a5d58fa000000b002c5526680cbsm3478694wrd.92.2023.02.12.14.52.24 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 14:52:25 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Eduardo Habkost , qemu-devel@nongnu.org Cc: Richard Henderson , xiaoqiang zhao , Hu Tao , Thomas Huth , qemu-block@nongnu.org, qemu-s390x@nongnu.org, Gonglei Arei , Cao jin , Li Qiang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow Subject: [PATCH 07/19] hw/ide/qdev: Replace DO_UPCAST(IDEBus) by IDE_BUS() Date: Sun, 12 Feb 2023 23:51:32 +0100 Message-Id: <20230212225144.58660-8-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230212225144.58660-1-philmd@linaro.org> References: <20230212225144.58660-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=philmd@linaro.org; helo=mail-wr1-x430.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 Replace accesses to qdev->parent_bus by qdev_get_parent_bus(qdev). 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 c96a25e955..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, dev->qdev.parent_bus); + IDEBus *bus = IDE_BUS(qdev_get_parent_bus(DEVICE(dev))); IDEState *s = bus->ifs + dev->unit; int ret; From patchwork Sun Feb 12 22:51: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: 652836 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2124319wrr; Sun, 12 Feb 2023 14:52:46 -0800 (PST) X-Google-Smtp-Source: AK7set+Bw/jCF6mAD2v0EJWCfXYvBmBB0FSDqVLayk61uk0ZXUQKIqiSCy9tnAnPfGNcTvpViaRF X-Received: by 2002:a05:622a:413:b0:3b6:3406:81cb with SMTP id n19-20020a05622a041300b003b6340681cbmr41237650qtx.14.1676242366546; Sun, 12 Feb 2023 14:52:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676242366; cv=none; d=google.com; s=arc-20160816; b=pYrVyl4Is+vOLrPbXUixoK9CTXQ4gRxNnSaXC6m3iBU69CrCHdyzFwO8XAIJ0NUjBo S7QSw+vQxYKIGVEKzzIg5DrJ+RCZO4ylpoKrDK2O3iA8usnTw8fjK3ob63fUCifWFwUu j4ap4sQ4Z0a5XXmgFKc1JYJGImp7iBLNyGGKeKUm+y8sQiXClSRDPtnVYkX60WtVr+we eEGVCEpr+pw1+XcFQA9gAYJd3TQYmT6b4mo9hgXQ2Kd2siZAPS6iKMYuX4QddpdhMO9i zov4mGtD8ESZo8PqNYqQPAapzeQXSrMUXybGZGURdxXdzvzswXeXmlABs6hkVsA/Mefm VOyA== 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=XrL23td/SqJ6TLHwH0jeBHZYA8cTqwvHD0D623uYOIU=; b=V8xbUiDtgI6IZXVuU21A5eBF6RPhdDvvaSgUSBjR7d7WBD8yKz3wnYQ04ea5/OuLAS 2PfwsKl/0l1B1ycFDM4UgXNHY5kAXnxLhAWzWPFfHLWx4IwP0pV3BPa26iqfk9IT93bI AcKC1vcWmDlS3aV/Vdash+Ji2tueiBdosrRR7jaG/VJ9i4smylb1vRqyH4nMawL/813K ee/cvZDh2pvbaGyUz+oScN3w8NJvT9iGLIoPL1uMJcdULQKl9sutwzNR9Z3UIozdBn5R PryRlwHLuTIWYnXEb4AKj75lDYfLd16m1v+4IayHRBbDZmXonVaBaZ6G/lGEUZREqSBb 940g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MNgJspn5; 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 i3-20020ac85c03000000b003b694b01031si8112011qti.447.2023.02.12.14.52.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 14:52:46 -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=MNgJspn5; 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 1pRLD3-0006Gc-Jg; Sun, 12 Feb 2023 17:52:38 -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 1pRLD1-00067V-IE for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:52:35 -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 1pRLCy-00043x-JK for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:52:35 -0500 Received: by mail-wm1-x333.google.com with SMTP id c4-20020a1c3504000000b003d9e2f72093so10070099wma.1 for ; Sun, 12 Feb 2023 14:52:31 -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=XrL23td/SqJ6TLHwH0jeBHZYA8cTqwvHD0D623uYOIU=; b=MNgJspn57gMkvwsch+RFDPlSuN/JfbQ/fdnXWXUbOuptJdsT9VswvTqLOFlRV+rr1L woNcXV9rvE2RZOl8bPdMAsMXRVF0+SqFK49IzS7wKRNNHfw15cxspRH7GpewLxAtjXir tJK8xRu63cwKJdsO1WjDpHUVY4I1ApVA9vS31B4Gu/3jw4GQkl1mbzHMgwLcmqNheMqj uF2XPDiDNwcd7TK0QEsrB5ZvOdlkOhwEKB45Sb6gUYATBeO6w6VkK3gMv4qF3VAA8KXP 7RfPLARRj+HFWfW70+sIa715wY711/tTmmbfOQrJrm9I1AgaqxxfDPcqc21VTTaEOcvp oqKA== 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=XrL23td/SqJ6TLHwH0jeBHZYA8cTqwvHD0D623uYOIU=; b=s+MUgGSZvN9t8fPWGwDBO7XNLEq6RtHFhs0uTk9BN9U+p5Ff+TeLROSwK9HyBhTgXX 7nQH1ANYIKgNBQhrhTTAf3qmDLXLhCm7V87V0BDYn3O+FN1A7Aov2ZpIH5JpjWpPpEFH pnw61LmbD0CWb3R1rbvZhmp5Vn6GnbUshMEPiDmIcK5nhojbBpIpm2yyYL0t7p33sY+w iMx42t5MasrdK6z7Y0Mk5OO5MWWmhEP4rOiyEgnCsRkqcXNcL8RZY6Yths5fIulb4PcQ FGdIZgxLAObkhr2TUBeF+nVrWFwYO6vr9mR1kLL0LsI/ot97DsTmNbH/RKToK9gkprKg viUg== X-Gm-Message-State: AO0yUKXw89ezQrLTzmU9M/V8dp1G7m+1iCKDK1r66V4PmziQN9C846/M GF5qdmkwupgGXeO28y1ZiYnJaUhyNJ0pmYgr X-Received: by 2002:a05:600c:4b28:b0:3df:eecc:de2b with SMTP id i40-20020a05600c4b2800b003dfeeccde2bmr21474402wmp.11.1676242351109; Sun, 12 Feb 2023 14:52:31 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id c129-20020a1c3587000000b003dc1a525f22sm12635748wma.25.2023.02.12.14.52.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 14:52:30 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Eduardo Habkost , qemu-devel@nongnu.org Cc: Richard Henderson , xiaoqiang zhao , Hu Tao , Thomas Huth , qemu-block@nongnu.org, qemu-s390x@nongnu.org, Gonglei Arei , Cao jin , Li Qiang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefan Weil , Jason Wang Subject: [PATCH 08/19] hw/net/eepro100: Introduce TYPE_EEPRO100 QOM abstract parent Date: Sun, 12 Feb 2023 23:51:33 +0100 Message-Id: <20230212225144.58660-9-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230212225144.58660-1-philmd@linaro.org> References: <20230212225144.58660-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::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 Have all the EEPRO100-based devices share a common (abstract) QOM parent. Signed-off-by: Philippe Mathieu-Daudé --- hw/net/eepro100.c | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c index dc07984ae9..dac42ba17b 100644 --- a/hw/net/eepro100.c +++ b/hw/net/eepro100.c @@ -235,8 +235,14 @@ typedef enum { ru_ready = 4 } ru_state_t; -typedef struct { +#define TYPE_EEPRO100 "eepro100" +OBJECT_DECLARE_SIMPLE_TYPE(EEPRO100State, EEPRO100) + +struct EEPRO100State { + /*< private >*/ PCIDevice dev; + /*< public >*/ + /* Hash register (multicast mask array, multiple individual addresses). */ uint8_t mult[8]; MemoryRegion mmio_bar; @@ -279,7 +285,7 @@ typedef struct { /* Quasi static device properties (no need to save them). */ uint16_t stats_size; bool has_extended_tcb_support; -} EEPRO100State; +}; /* Word indices in EEPROM. */ typedef enum { @@ -2082,21 +2088,27 @@ static void eepro100_class_init(ObjectClass *klass, void *data) k->subsystem_id = info->subsystem_id; } +static const TypeInfo eepro100_info = { + .name = TYPE_EEPRO100, + .parent = TYPE_PCI_DEVICE, + .class_init = eepro100_class_init, + .abstract = true, + .instance_size = sizeof(EEPRO100State), + .instance_init = eepro100_instance_init, + .interfaces = (InterfaceInfo[]) { + { INTERFACE_CONVENTIONAL_PCI_DEVICE }, + { }, + }, +}; + static void eepro100_register_types(void) { - size_t i; - for (i = 0; i < ARRAY_SIZE(e100_devices); i++) { - TypeInfo type_info = {}; - E100PCIDeviceInfo *info = &e100_devices[i]; + type_register_static(&eepro100_info); - type_info.name = info->name; - type_info.parent = TYPE_PCI_DEVICE; - type_info.class_init = eepro100_class_init; - type_info.instance_size = sizeof(EEPRO100State); - type_info.instance_init = eepro100_instance_init; - type_info.interfaces = (InterfaceInfo[]) { - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { }, + for (size_t i = 0; i < ARRAY_SIZE(e100_devices); i++) { + TypeInfo type_info = { + .name = e100_devices[i].name, + .parent = TYPE_EEPRO100, }; type_register(&type_info); From patchwork Sun Feb 12 22:51: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: 652846 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2124811wrr; Sun, 12 Feb 2023 14:54:36 -0800 (PST) X-Google-Smtp-Source: AK7set9UEeEKAFbPKg52ClVYjJjZHE7gaZ+OPuoUqzIVLNmv+bjMp6g6THMji/EDYg8tv3p8gmyW X-Received: by 2002:ad4:5ecf:0:b0:56e:a96a:2bdc with SMTP id jm15-20020ad45ecf000000b0056ea96a2bdcmr6029866qvb.40.1676242476596; Sun, 12 Feb 2023 14:54:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676242476; cv=none; d=google.com; s=arc-20160816; b=xI4yiqUct+XKYns+idbWV+b64a0YGZsxiVPz8xSNXk8wIlrP+wwWzigEa6FXTiChsL s+gw3QyEr4dYjjTqu7lW5ncDaERVb7ZJAWUn5GPUATpyk2xH5dgwoW+6wFWZwXmLMClK 6HEZe49c7Few5IfZ5Dx505zs37OVkQmqvvgSRoZxCltPv4HNvkPH+9mBNH4YcpMdkNJo sdCN/ghLLPwOglOOi8fjrU2Gxv0TmwYfu+retxDYmmiI+ImA8smfitS3DOmTJ9tKdGWW rfuFO406elhM1iulFdTY5yzspzZ2O/ebDKhBoyBKxgqlqEQ5NeNvHGqB1q9IHIOfOlN2 kF6A== 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=3aGr4pdXOmnCeHpCx27ssdrfJ2Facg5vKvJw+VkmOyc=; b=CQg16rXWmsM4F44CNvViWtN4KmVIPmfiMJuvnU1lgWV3Ixqf2uqJFBepzbZaPOs0/T YTT75+cXjqRyrUewTDfN9m7vNcCIa4uwhwpypU4QiEz2JE33iiXQQoWFoRiDeJO1uRJr nd2arDrflSNISZPA3EKnloY7R3z21Fz/wnOwvSNPP/y/xNzlOoeGv0H1x2Fu/QB6cnOY lp7PYiTi+yIJJ846Rl338yzMJyDrl5ojAlIpHSrs7KSAYCKRhObHAVKdoV1KtvUmW3w4 /u671y8/TyK35h9mm4NtGnqiOQiTRcAX+SOaEAnuMmIA0xKtBd24YJWYcZ+Lu6/4XvnG jZ6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=keHLgu8I; 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 q19-20020a0ce213000000b0056ea0fb9d6bsi3169732qvl.397.2023.02.12.14.54.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 14:54:36 -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=keHLgu8I; 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 1pRLDA-0006eX-ER; Sun, 12 Feb 2023 17:52:44 -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 1pRLD5-0006Op-O4 for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:52:40 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRLD3-00043y-Lk for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:52:39 -0500 Received: by mail-wm1-x336.google.com with SMTP id j32-20020a05600c1c2000b003dc4fd6e61dso10054391wms.5 for ; Sun, 12 Feb 2023 14:52:36 -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=3aGr4pdXOmnCeHpCx27ssdrfJ2Facg5vKvJw+VkmOyc=; b=keHLgu8IICaJPgJFolVy95Sxf8QzQL8gMNfJTkr76P7op339ycvDldO9C96kqEtLxy 1A26IwRZTMiROjyHOKE4cwU6YYazWZaz2PQln30P3gR+RaZH73S97rMTyiRWZL/v7wcF CPlK4GMLdX2CellFt4gri6xTAwKJ22nYACBZyReHrXYU3AVh/yGTA2PbOZgAJrUFj2KJ 4ekIUjYZjWcbi92emoqCA7Ql/7u1YIMN/16A3XyAUOHY2j38xpuUP9Jj5hZM0fDejhzh V7Rl+MeurhFU9P3uepAmiO9I2sjK1ZxrKKAyYR3pbqjYAO9cuLi9dppK+N9OhG7lVt2G JN0Q== 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=3aGr4pdXOmnCeHpCx27ssdrfJ2Facg5vKvJw+VkmOyc=; b=6F4AdW0girvMxQUnOdRYdSSv9AUVogOpTInxDmiMaXBEeua/QXTI+XD4qUO8bHuCON c0Bj0DJctG03jEUPftvQJj1/u4cDn7TrJpfycViI87c1URDk2dShBp+b3ZhGoUwQsWus /aruU/82ngxI1iCFu/AVB+0Fi1/0rOYCg37+hBwAGEO1t15DcbazrXKNwTeCZdz5A0v1 Z5q/eD1S4PVlgTexCxdw+J21lHQwDrZUWMekdZCnjyp2cSxRbJt/hGA29HnooknUedrd rCkSOFWZdZO6inUK4A1sONqI56krOGqiPC0ETRm6lZmsqeoexdwQdXajsZ7Hm8lcMh/a BHZQ== X-Gm-Message-State: AO0yUKVUnGE8FWWPyGwqiv2q0hQ63stGVRRF9WYGUKMRYgCs4/HIWfyF zClfj4g9+gga8MX5bwiraJgayw== X-Received: by 2002:a05:600c:1898:b0:3df:f7ba:14e1 with SMTP id x24-20020a05600c189800b003dff7ba14e1mr20043703wmp.8.1676242356380; Sun, 12 Feb 2023 14:52:36 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id e14-20020adfe7ce000000b002c54f367fe4sm4403098wrn.100.2023.02.12.14.52.35 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 14:52:36 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Eduardo Habkost , qemu-devel@nongnu.org Cc: Richard Henderson , xiaoqiang zhao , Hu Tao , Thomas Huth , qemu-block@nongnu.org, qemu-s390x@nongnu.org, Gonglei Arei , Cao jin , Li Qiang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefan Weil , Jason Wang Subject: [PATCH 09/19] hw/net/eepro100: Replace DO_UPCAST(EEPRO100State) by EEPRO100() Date: Sun, 12 Feb 2023 23:51:34 +0100 Message-Id: <20230212225144.58660-10-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230212225144.58660-1-philmd@linaro.org> References: <20230212225144.58660-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=philmd@linaro.org; helo=mail-wm1-x336.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 EEPRO100() QOM type-checking macro to avoid DO_UPCAST(). Signed-off-by: Philippe Mathieu-Daudé --- hw/net/eepro100.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c index dac42ba17b..915935a818 100644 --- a/hw/net/eepro100.c +++ b/hw/net/eepro100.c @@ -1828,7 +1828,7 @@ static const VMStateDescription vmstate_eepro100 = { static void pci_nic_uninit(PCIDevice *pci_dev) { - EEPRO100State *s = DO_UPCAST(EEPRO100State, dev, pci_dev); + EEPRO100State *s = EEPRO100(pci_dev); vmstate_unregister(VMSTATE_IF(&pci_dev->qdev), s->vmstate, s); g_free(s->vmstate); @@ -1844,7 +1844,7 @@ static NetClientInfo net_eepro100_info = { static void e100_nic_realize(PCIDevice *pci_dev, Error **errp) { - EEPRO100State *s = DO_UPCAST(EEPRO100State, dev, pci_dev); + EEPRO100State *s = EEPRO100(pci_dev); E100PCIDeviceInfo *info = eepro100_get_class(s); Error *local_err = NULL; @@ -1895,7 +1895,7 @@ static void e100_nic_realize(PCIDevice *pci_dev, Error **errp) static void eepro100_instance_init(Object *obj) { - EEPRO100State *s = DO_UPCAST(EEPRO100State, dev, PCI_DEVICE(obj)); + EEPRO100State *s = EEPRO100(obj); device_add_bootindex_property(obj, &s->conf.bootindex, "bootindex", "/ethernet-phy@0", DEVICE(s)); From patchwork Sun Feb 12 22:51:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 652842 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2124623wrr; Sun, 12 Feb 2023 14:53:54 -0800 (PST) X-Google-Smtp-Source: AK7set9Tt8cEk/dIW1eSiQYmKzn9Bg2+LU4tg6PleDLJ96WSNAK8wZjWoR/XnrbbXZsk+hQAgHl9 X-Received: by 2002:a05:6214:dcd:b0:53a:5812:1434 with SMTP id 13-20020a0562140dcd00b0053a58121434mr43831860qvt.16.1676242434569; Sun, 12 Feb 2023 14:53:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676242434; cv=none; d=google.com; s=arc-20160816; b=B7xAulBspCsryM8pOrK3q567jlCMtfEQWfgJfAzPK4Vv2J+Jp366jDV9aw+KtXgtWR y7LqMJZOo70fNAjmMF/fqfnRkUi71hvMUXFGoW71IyOATqRll1LJ4oInSWrMfXJSuUh8 MCy8IAIGVixeQkYSivDjkKUxOWKW2WXJP6NOrUoogNRDV552CaQfyz09XpghWU82tpV6 m0uLIccCFPpTCXHjmnsRT9XBUMFtFDJFlCzbVuO+uUtI600tmHiHcwPFXjIH87P3fYny plgmCjabx8avgIGV3yyrb9fN56pYeS+8hw+3OXLeOQgHJH86ZddUIwIXzx0CK9WbfYs6 HAaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VotmsYo6EZx1VvqMFkr1+QDMy3wRb1XAiA9w0UCQyq8=; b=TtfTpH4MEEWs7KywSD+Yvmf62gOYjFUXcNK7MIpj52yqfGtrQWBeML6RBbRQ6zKBVl hCAo63j8WQOLTN3CACK923R4EU3pV+kXv9xqktbVp47MWdxalAK1x0WWUtDtYCLmw9g0 fNI9CsiT/PTTJhLcd5wPLBUSb/rWwp+AieNF4A1LnbvCwJn+g/O3W1RX0F0wK1wPVXYG kGYVNuXRPmh/RExjHety7acOlZ75s9cvKjvLhKOmu76XK05hrRcsKOnI58v37Rxz4MtV MSnWm3ObAyBcLT6aIGk2IQBFD0IEaFNkFnYRbYRZrbeCNVJv74CfA3BqypeGwCh/iaFK +n6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Ywlz/uy9"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e15-20020a0cb44f000000b0056bf04b6a81si7962566qvf.580.2023.02.12.14.53.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 14:53:54 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Ywlz/uy9"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRLDE-0006rJ-F9; Sun, 12 Feb 2023 17:52:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pRLDA-0006hK-Lt for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:52:44 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRLD8-00046u-VD for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:52:44 -0500 Received: by mail-wm1-x32b.google.com with SMTP id u10so7536732wmj.3 for ; Sun, 12 Feb 2023 14:52:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VotmsYo6EZx1VvqMFkr1+QDMy3wRb1XAiA9w0UCQyq8=; b=Ywlz/uy9Jxzl38ShTUU5KnBeIep9MrDy9Q2HGidtumag+9jQvq+5/fe3Yk6paa7HEP 4qkuGAr3GMkfEjTjfqankAwmcMsCumxRjumc0e7qrOGS2OzuRDv1Laik5MtWf5kkTB+J 9HmTTfVFfzhPQmnxiMh3ydpbbqOQrvxj3Fpq6GxC3q3IsSdDsBvgzGU7qsd/2TDFDYvG q+X0pQUvlhul+Fy5x3IYIAXKPS7JGU7vVynI+QIoyf1HnmH9cncbk8IsEY35GBb38KHU qbEK286zA53KkRWJcHPr1S/jzAbddbIaKH1hokAF/ZDDBON9oqTC2+kB7IdBnkBc2xzt JycA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VotmsYo6EZx1VvqMFkr1+QDMy3wRb1XAiA9w0UCQyq8=; b=e98+OUU8/826FAjcsiS+b8n7GfpJ7Ins+cjNHChmevT8L6IYZQl58yhoEWslDPHz+Y KRLtEwXHESZUgXXKVOaL7xXaMLVsHpQtD5f5sNv4wyJtk/3ATun8NIBP3h6IEdtQCARm g4lFdIjAmrdGe1Cftm5GRFFHHrpcC+q340xK1jL9arcmts2rRQycEoaC8c/zu7N/8ffN bC15jK/rMFqU5SlKPd6YkXah61u5rDHqIsYQuiVEUplLmk8Wa4SMP3qCbr5xA2y+HW5M b3IueUVfhVt85MBb6ptFrHcAQtPsdVZWgSMHPKqZo+Glp3JfQ4FrxULl71xafLTI/kPu YLuw== X-Gm-Message-State: AO0yUKVDmt4wfwbo/AqNWSXYvt4ZSXPM37LamLl8tsOhvc4180OOtItD oXqW7YtT1z6MVQwi5FRIvoIJcA== X-Received: by 2002:a05:600c:a290:b0:3dc:5a9f:1c7a with SMTP id hu16-20020a05600ca29000b003dc5a9f1c7amr17931410wmb.30.1676242361653; Sun, 12 Feb 2023 14:52:41 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id i14-20020adff30e000000b00241fab5a296sm9102845wro.40.2023.02.12.14.52.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 14:52:41 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Eduardo Habkost , qemu-devel@nongnu.org Cc: Richard Henderson , xiaoqiang zhao , Hu Tao , Thomas Huth , qemu-block@nongnu.org, qemu-s390x@nongnu.org, Gonglei Arei , Cao jin , Li Qiang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Jason Wang Subject: [PATCH 10/19] hw/net/ne2000-pci: Replace DO_UPCAST(PCINE2000State) by PCI_NE2000() Date: Sun, 12 Feb 2023 23:51:35 +0100 Message-Id: <20230212225144.58660-11-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230212225144.58660-1-philmd@linaro.org> References: <20230212225144.58660-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Define TYPE_PCI_NE2000 and the QOM PCI_NE2000() macro. Use PCI_NE2000() instead of DO_UPCAST(). Signed-off-by: Philippe Mathieu-Daudé --- hw/net/ne2000-pci.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/hw/net/ne2000-pci.c b/hw/net/ne2000-pci.c index edc6689d33..0332e7f616 100644 --- a/hw/net/ne2000-pci.c +++ b/hw/net/ne2000-pci.c @@ -30,10 +30,16 @@ #include "ne2000.h" #include "sysemu/sysemu.h" -typedef struct PCINE2000State { +#define TYPE_PCI_NE2000 "ne2k_pci" +OBJECT_DECLARE_SIMPLE_TYPE(PCINE2000State, PCI_NE2000) + +struct PCINE2000State { + /*< private >*/ PCIDevice dev; + /*< public >*/ + NE2000State ne2000; -} PCINE2000State; +}; static const VMStateDescription vmstate_pci_ne2000 = { .name = "ne2000", @@ -54,7 +60,7 @@ static NetClientInfo net_ne2000_info = { static void pci_ne2000_realize(PCIDevice *pci_dev, Error **errp) { - PCINE2000State *d = DO_UPCAST(PCINE2000State, dev, pci_dev); + PCINE2000State *d = PCI_NE2000(pci_dev); NE2000State *s; uint8_t *pci_conf; @@ -77,7 +83,7 @@ static void pci_ne2000_realize(PCIDevice *pci_dev, Error **errp) static void pci_ne2000_exit(PCIDevice *pci_dev) { - PCINE2000State *d = DO_UPCAST(PCINE2000State, dev, pci_dev); + PCINE2000State *d = PCI_NE2000(pci_dev); NE2000State *s = &d->ne2000; qemu_del_nic(s->nic); @@ -87,7 +93,7 @@ static void pci_ne2000_exit(PCIDevice *pci_dev) static void ne2000_instance_init(Object *obj) { PCIDevice *pci_dev = PCI_DEVICE(obj); - PCINE2000State *d = DO_UPCAST(PCINE2000State, dev, pci_dev); + PCINE2000State *d = PCI_NE2000(pci_dev); NE2000State *s = &d->ne2000; device_add_bootindex_property(obj, &s->c.bootindex, @@ -117,7 +123,7 @@ static void ne2000_class_init(ObjectClass *klass, void *data) } static const TypeInfo ne2000_info = { - .name = "ne2k_pci", + .name = TYPE_PCI_NE2000, .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(PCINE2000State), .class_init = ne2000_class_init, From patchwork Sun Feb 12 22:51: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: 652844 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2124689wrr; Sun, 12 Feb 2023 14:54:11 -0800 (PST) X-Google-Smtp-Source: AK7set8LNl1bTKNqe3nGfaU+O3Nf5ZfvUFSTiXht77WWV9DkxpHolj1+JiGO9T5PfLIq7+AcS3y5 X-Received: by 2002:ac8:5e4c:0:b0:3b6:3acb:7f70 with SMTP id i12-20020ac85e4c000000b003b63acb7f70mr42420004qtx.61.1676242451348; Sun, 12 Feb 2023 14:54:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676242451; cv=none; d=google.com; s=arc-20160816; b=R3wYvEEcbbjuPBzqlST76H0GCQo9E8Cp/DLYRNpF1ROGAbk8+vgRNItbf8NOtESc/8 q/Rli3PgTJasEm/o7SdHi17GerMPkGYJXO1itce3JYs9LEuA5k6yhXymNuc/+Q+K3EoX pHC4sLmwg6/P5kGvRDV62ss0Y3V1E6LDrddjyeoNpx8SpHiaskxNQEPeCWtsdoImLf5g eyyKU+MhG7AuPhOw2l4p+rbEUtK0GaGcppOFGR/qrTv8q4fBS2thl9T8xwpuowuwC6/G 35JJPTBfAN1eeVlOFTnM+/zexPfHQ5XBqFWSn16CzSa2kQ+PGX3y5anoGDt3dWmG3yBe C10w== 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=p2ha08UXTJSi1lMTFByfKnlvnDuYpYlq2JhiidY6fbVGPvhV8+Eb5N3o4TM67TkaKG I0/bPryg6K9ygDPq7+dgBsk9LHcDrXIHYsKnq2dlNvFIJXw/o0dKE/ADEaXqIvnP/Kg5 +IWtarpijVGCwqSrUgGdQC2ck+xeaBVDt0IlkVNHSto9HVh5DkbtO5ZJKktnefA8dmb8 r6VWD+lDHsUJjDPZW48qvH7MEqZ0RC1B8eoJYJrqcGWtwDCVD8G3pPd9uLcIpF5Amkg7 M/Ijqdm9C/osyMZjvlWye03L4M89cAvrRgHKM8r71M7sybB5qNlx6+fnod/OdKcxGtB8 lKCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=q0W+X9xb; 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 c14-20020a05622a058e00b003bb8704f3d5si7505212qtb.298.2023.02.12.14.54.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 14:54:11 -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=q0W+X9xb; 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 1pRLDV-0007EY-UM; Sun, 12 Feb 2023 17:53:06 -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 1pRLDF-0006yK-Dd for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:52:51 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRLDD-00040T-Lx for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:52:49 -0500 Received: by mail-wm1-x332.google.com with SMTP id az4-20020a05600c600400b003dff767a1f1so7765007wmb.2 for ; Sun, 12 Feb 2023 14:52: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=fD8XsrjHaA7eijBs8OwmQ3XFemQ30TcP+DXj6h7knEg=; b=q0W+X9xbRaw7fVi7Mdp/WWatdkTm+Q+44jmjN9sFJ1HWn89XJMmxLzr/HnzMjIWwTv u54H1gvj5F/GHcG3oKpbV93tNUT8XOMxhtwqON8UMuYX+D0T3BbAuKvuRfXHVCAD55Xf cq3CCLbGSdyRCdaH+YCxKRzxU+TjXX4BZeVzskhVQbQ/XuyXbgJKz1QHeW6MnZM+MUkN e+afSxlsEhxzQBtMmauUEZ925IWr0liNzlqa+13cH7lVxlRfHZOyYYVlCyHhpgIJXawC ogeZd9AQNu5BwkdVmVulYWZRHIXZBEC5EGYVhOjLUVkHHZErVTPkXB+at+Q2FlgheGea 6ZVg== 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/jHmBh32hWDgmJIYsN2CHsQp3VMqeOdX6whTzkyeUvjNSagBIoc53kR7qRBCQgm49 d8dIssHAjNwNlXn29kfqZKfPhyi0m0gZaSuD980bZ2DuKfDh1k3oyjXO5pIpbTrs3J60 iD/uTSysQW5+aE01XyJ+82Q3ckziHq0vJ31UGyH3FtgSa7IVoLO174Ayido/kexOaCeU 7lOkRpNSUVvr2FzmwB6EDCNuPtEuAhrJJKp6uXeypdMJswm3DxupcW4tXo0LiWqIjIIi p1mOp7vMrF01pJAOCy87iaG99kXeilOKYCLU5SCHYwmgZp6U723c5yjNE8kUk+YXnDgK KPvw== X-Gm-Message-State: AO0yUKV8+R6JzA4ACqlzpakBGotFePb59AU7rNgWcbaHIERcNI/pyID1 KIy+4I3BpVbxPN50DFpN3oKKLA== X-Received: by 2002:a05:600c:30d2:b0:3dc:4fd7:31f7 with SMTP id h18-20020a05600c30d200b003dc4fd731f7mr16490756wmn.41.1676242366923; Sun, 12 Feb 2023 14:52:46 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id v15-20020adfebcf000000b002c3f81c51b6sm9089746wrn.90.2023.02.12.14.52.45 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 14:52:46 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Eduardo Habkost , qemu-devel@nongnu.org Cc: Richard Henderson , xiaoqiang zhao , Hu Tao , Thomas Huth , qemu-block@nongnu.org, qemu-s390x@nongnu.org, Gonglei Arei , Cao jin , Li Qiang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Sven Schnelle , Jason Wang Subject: [PATCH 11/19] hw/net/tulip: Finish QOM conversion Date: Sun, 12 Feb 2023 23:51:36 +0100 Message-Id: <20230212225144.58660-12-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230212225144.58660-1-philmd@linaro.org> References: <20230212225144.58660-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=philmd@linaro.org; helo=mail-wm1-x332.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é --- 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 Sun Feb 12 22:51: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: 652845 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2124778wrr; Sun, 12 Feb 2023 14:54:30 -0800 (PST) X-Google-Smtp-Source: AK7set9VFc54g3Yd7Phm4TI6wtajlPLlFzgQlmXG/QWyu8o78TK0ZdZlWNPu5VknGGWqEN83G00L X-Received: by 2002:ad4:5d6b:0:b0:56e:9eb2:5e84 with SMTP id fn11-20020ad45d6b000000b0056e9eb25e84mr13038789qvb.6.1676242470231; Sun, 12 Feb 2023 14:54:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676242470; cv=none; d=google.com; s=arc-20160816; b=MdZ/i2+AwHddF9jvbhJHifKE9ii8m73++mUdHa6iG0ijYie5Pti1qi1T/hAMY4sJFW 3cGeEbN+M6fREKkpW6tZH7qhbtnG2UTRE1B4Ckggxb+CCCM1oStKngjWqMAevQiIdVKm zKVzTJNk7NF7WFH8belHMn3A6etxbNN6xJcFoG5VLGTGAdIevBrrYsdu977SHBavIX1S 5VjW5A2+YV9ScQXWzoBG76g7vX3hERQotxBO2387vFZRisR8tWqG0+mYXyBkXWZHcY4T NyhDJlFH1cX4fhsgI7UB8JBQ5XrWgrLcsWXqAXJw/kNYt+EAiozrDWz4g6sl/2x+HtVc ydeg== 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=F40ps4LvOj7p6wRqv35U+9cJu6i3lY+IrGdYXPIEaFx0XD5dRIBTr3aWGDHqT5h49W aR2WHQgT16kd/BFhtAcH5Xi95Nl0MN5bbL1vt2+uFkctuOCgIlXmf8k44e7UHeV7B41K JowhQuIUryu7qtEG7D6F9MV0cVd6AlmZno55uPsiXL6fAX+Veg0DvpmHIpgFW2xe7myF CQGvsSgIuXs8KKNtstqUIV48kbGzQbtXLR6X8evzN5vAv15UQIU7w/wQvg0fvx+zt2Kv C1yD6bg54AgzxiDZNkuF0/8T2s+RkFVDKBFfcWf9cvsA1z1XWZRmiVDW9F5dbLGU6pNH z6cA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="LW4lyb/s"; 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 d15-20020a0ce44f000000b005542726b064si7828680qvm.434.2023.02.12.14.54.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 14:54:30 -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="LW4lyb/s"; 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 1pRLDV-0007En-VP; Sun, 12 Feb 2023 17:53:06 -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 1pRLDL-000754-Fb for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:52:56 -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 1pRLDJ-00049i-Ph for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:52:55 -0500 Received: by mail-wr1-x42d.google.com with SMTP id a2so10446543wrd.6 for ; Sun, 12 Feb 2023 14:52: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=3YnlWYrFQuWXt1rppNJud8kwI6R078rMYORIY8x9Pr4=; b=LW4lyb/sy8EE9i2fRD6VtwV+RBA2vgAB56vsAPYxb/2SaNwrv7+qhrb2xUWvswm96h ZNO6XfAY6l842ROdmxk4rJgtw0pEl2fmYq7bJZOE+Q4hatAfN6Zmjcr5HCduFemk8Let 7PGfJBTzJsjd0V0CU1A3e4ZTxh13C+G/sbyiVzFxnne9pyXhcvVTTwD5CbpJG1mEoc24 UvEGK1Q5MsYqL+WW/+KPvDJjOXiGqDj+OZakyAO/1u6+kgTYfXya/gPG2BFAS+jjZu+c e36BrIN/K1mQPgaUPmgTxicWgk5zAWAl/g6EZPFdKhUddv9Y3yipNVtsHUUJGRbRDSJe qsuA== 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=NwKCPEBGTX8+7d5/Fr6e0e74P7NlcSu4fj/CuqTJjxD62UVATRAEpni5VaB1McUeTt pWdjyp0xTm8ayGue6pgL9yUdaUe3PQnFfcCs4RnTzDBpogNB4VsnDCjOYpqsRVZaGFbe TncIqgxfPdU5UnFBNHJM2zennSb/Ot2CT4OOBUhwQBD8IgmbKDnMpzPB3xrFlbQGD+Nv OU8QnKYXjmzujSa7+mYd4B5ce1IxUtSp8wrj1jERvVYVlzYd/5W+dx9MK/p6nR041d2l NKZiyfIjIDtE1Ln+h2HOxZZ1golmmaSAlOi8dHLc1jXUSaYZk5fj95C5UQ1GwDiCJhJr 4UFQ== X-Gm-Message-State: AO0yUKUflW/LLMQeJDNNB1rwn9cU/7OQ9aeKJ1JRGVAkTUqMsDNpPWih WiX5n7+qhjzMJkZnEoZSeCHw1w== X-Received: by 2002:a5d:5150:0:b0:2c3:f971:ae1 with SMTP id u16-20020a5d5150000000b002c3f9710ae1mr16057077wrt.29.1676242372161; Sun, 12 Feb 2023 14:52:52 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id h8-20020a5d5048000000b002c54d97b1ecsm4929144wrt.72.2023.02.12.14.52.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 14:52:51 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Eduardo Habkost , qemu-devel@nongnu.org Cc: Richard Henderson , xiaoqiang zhao , Hu Tao , Thomas Huth , qemu-block@nongnu.org, qemu-s390x@nongnu.org, Gonglei Arei , Cao jin , Li Qiang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Marcel Apfelbaum Subject: [PATCH 12/19] hw/pci/pci: Replace DO_UPCAST(PCIBus) by PCI_BUS() Date: Sun, 12 Feb 2023 23:51:37 +0100 Message-Id: <20230212225144.58660-13-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230212225144.58660-1-philmd@linaro.org> References: <20230212225144.58660-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::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 Sun Feb 12 22:51: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: 652847 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2124887wrr; Sun, 12 Feb 2023 14:54:59 -0800 (PST) X-Google-Smtp-Source: AK7set8wonqoTwLRFPyDV4FUOba1h7sJdTdnCSj6Vw/vpHG9fmb7JmYBcSnxxHGqMmo5MapgIv9w X-Received: by 2002:a05:622a:2c7:b0:3b8:6c4d:488a with SMTP id a7-20020a05622a02c700b003b86c4d488amr40493463qtx.37.1676242499428; Sun, 12 Feb 2023 14:54:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676242499; cv=none; d=google.com; s=arc-20160816; b=LuE6txqZLSWjDrRzGo7Craxqw8daUoMvR2wYYPfTARWwgdSPhrWdIfSvffc3J0cQhD fO1lk+SqL8cV3fLSQAf5YHfMRj/DQ/t7hj4kGqlO8+o+ucF9R335Z8DXC96SUgGEn0UI 4IjrGr5nPCNc/lQ3ETwZB8Aa06AOz1r6zCGoMG3lFl5Mpj7hG0dD5emPEhKDkhXSvhNz /TmmjklbmPYFstHuXEwntYFA4PtkKKkUx2Ejrc4OCUq24T+KimDfdI4OhZqCyYT8qwPQ iyzGCUR5FQ0D1I0qVscCorgEKhzwHvfzYxy+WxCJySQbzxEDBXT1P3livD5aSBttHkUj nvTw== 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=fFJZ77WSAVqad3LkANpNigYGzQiA4H6qXd/MoajMgS8=; b=acT8nqrKO7KKgoPqIoYitla5FHaHeYTi91J/MLnvZYZcX3aTJaAYyUI0RBLTLSbnaj xWG4crhedl+ZxKAaMhgqXcA1EWH7KRVgw8cijvvMlXPtdWmmB8+XX1c5JKXwGO0fvooY j6FClQ9OSFOVJBol/LGBA2D4BPjutMs07akOHViSeiex2PtuPsUyJfKR2uuJvgTWUNnh 5mJWSimJiFLCt4kqVCHzJEtlpFAKYMP9VMbx9O/BqcyL4WoBPlCUwGEcgptM8L7d3wY3 m0NCCPpJXjU2/A7j12o74B4y2rreRvcq6+3Ec/Aj/69m//rO0tH+ZS5L8t0WYSFzqTQY FZBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sjFwxDe7; 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 j12-20020a05622a038c00b003b69d412591si7882239qtx.292.2023.02.12.14.54.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 14:54:59 -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=sjFwxDe7; 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 1pRLDa-0007Wh-Ix; Sun, 12 Feb 2023 17:53:10 -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 1pRLDP-00077x-UJ for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:53:00 -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 1pRLDO-00042R-7n for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:52:59 -0500 Received: by mail-wr1-x42b.google.com with SMTP id r2so10433742wrv.7 for ; Sun, 12 Feb 2023 14:52: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=fFJZ77WSAVqad3LkANpNigYGzQiA4H6qXd/MoajMgS8=; b=sjFwxDe7UqfbeNZWTLvlmLb43ESJ/3mpJNv9oESocdgYm+N9vI4H+XrjZYePxbIt8Z /4lbXmez1wWo/0QK928kLQgqbG4kIeQ5ykN81kFY8zglZJlxzug8Lqqui5GRGZQEMqQl tJ210DI8Oy6j4vsv6oacLMZMhxSguB5PTFv8iHHajE2P74G295F56xwOp35+bvvZ5Ko1 otg4dwJRWKIt9i2GthTubQNrcsgsRjbGbJzaamvay9/SMxgILe5830Re+xydvEGfo9bG 8c8mOKlQF08q83sr4Ue4gIev0U3fDMuu72wsKEQTR1ynU3/m2EljkVttoXzcn2Hs5Z4g HGVA== 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=fFJZ77WSAVqad3LkANpNigYGzQiA4H6qXd/MoajMgS8=; b=PhFTxyK+s7Lgs1UgBTVAvWPXZq3cl9Th+z/3R4/UnbAz6S4buAh6ONBpGwNJ/QE0uK fH1hOIFFIg4euNxkWpoSb3P4oLjrHCOgSPQl7JFPpL7BdTxe6FzqdVcIK+sx2KUI8LlP sQB7F+8yl5KTyAfw1B7QKjjGG2nrOFw80UoHuAlVcn7raM8Uq4pKXxo3lUmW6og32rlI VyK2oLaJyTkrp5OFjf0xpiNoiRGVUw1tpfCuerE2SYUTnaGTbFUj5Ax9947RA0LCDJXE cuMHYNgVAMdDiHaQEBuxTGhDvGDr7ivcUKb6wCk4YVqZ99gMAQvVJkZY6eAO7INLlqGw /jnA== X-Gm-Message-State: AO0yUKWobor9zjU+waLQ/i6ELDh+x59C1zNJN7C/sv9t5ZoNclPCOU6+ ogVJte9G1eVmx/+dvvbaXoflOQ== X-Received: by 2002:a5d:4ed0:0:b0:2c5:55a1:4b2 with SMTP id s16-20020a5d4ed0000000b002c555a104b2mr1945358wrv.49.1676242377498; Sun, 12 Feb 2023 14:52:57 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id a1-20020adff7c1000000b002c54a2037d1sm6918724wrq.75.2023.02.12.14.52.56 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 14:52:57 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Eduardo Habkost , qemu-devel@nongnu.org Cc: Richard Henderson , xiaoqiang zhao , Hu Tao , Thomas Huth , qemu-block@nongnu.org, qemu-s390x@nongnu.org, Gonglei Arei , Cao jin , Li Qiang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Paolo Bonzini , Fam Zheng Subject: [PATCH 13/19] hw/scsi/scsi-bus: Replace DO_UPCAST(SCSIBus) by SCSI_BUS() Date: Sun, 12 Feb 2023 23:51:38 +0100 Message-Id: <20230212225144.58660-14-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230212225144.58660-1-philmd@linaro.org> References: <20230212225144.58660-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::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=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 Replace accesses to qdev->parent_bus by qdev_get_parent_bus(qdev). 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 3127cd7273..29b65a9b54 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, dev->qdev.parent_bus); + 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, dev->qdev.parent_bus); + 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, d->qdev.parent_bus); + 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, dev->qdev.parent_bus); + 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, s->qdev.parent_bus); + 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, s->qdev.parent_bus); + 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 6ea4b64fe7..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, d->qdev.parent_bus); + return SCSI_BUS(qdev_get_parent_bus(DEVICE(d))); } SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockBackend *blk, From patchwork Sun Feb 12 22:51:39 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: 652851 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2125035wrr; Sun, 12 Feb 2023 14:55:33 -0800 (PST) X-Google-Smtp-Source: AK7set8S9CTrRTCOz8PD9WCg5lM5NwTBciGY5cEgO6yC8Y3HwAYe40DmBZBabY++q8Wnc0Wl8aLh X-Received: by 2002:ad4:5b87:0:b0:56b:fe7d:4a5e with SMTP id 7-20020ad45b87000000b0056bfe7d4a5emr35424839qvp.44.1676242532971; Sun, 12 Feb 2023 14:55:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676242532; cv=none; d=google.com; s=arc-20160816; b=v1aviTM9JUDoIoUP5vJeWELAmIqAlAensa1zkVuG+ayWZxxMoQAQM0sTlxOnYLiY9Q eeC65aX+EKrW5yO8KgWnU6UwF6aSS3DOgpI+EZZAr6kbq5ukR+KpVRSntHnLciBLAbIc 5KzIp3/t6QOap+kB9CHjBqp29mUqVwCpkAAcB5NjBlWehqmuXVhR11CE1D6eVZvaday7 Y1ybtYt0W3bqkvAuCYfvoM9lmM0rZ41kzGmowFNhzWjJmkBa/x+k8+E+EoeBgbA8pZSW pKABHUFQepWmGgMNhlp57VzKGOCU0yzhI6lSWOCLlhZcnHKEHj36S0+GYU/Ja8BE+Xfy mt1Q== 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=LKsXht54rDUTkJKqHQqtb4Pds5COe3w7PRc1ZjYr30M=; b=sKOzfDSwOb/O10dV4QqpRoYnQUp41fitOE3xVC0TbPDdgL48bkQ9gUihiBgL3vhZWi BayY4XnfKk3oji/lcGE0AHgWOWxAN9mtCb24MbwYlOXmWFZwHPd1uPYM4Y1EEWIdwt79 7HsLgAT12OSxV8b/D0bKkqp/Se9KnhR0cUNp2jkM3LUu2U8Dfj3HBzOZaBhMTC+dDciu RZnJIAwoxhmkD1TrQLaf6Qev8fwAkg75yOiMBxBX3s03Tt+utHStZvQ10NsHN/OtnHU5 dlGWKAGOOn3/c7mYHfHHSnhZkzr+Cdusfkt/IYUkR2l/e48uDvqj1x1iuJYRAth31KdM ynEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sfrz6HR9; 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 t65-20020a37aa44000000b00706741aa9a8si8026747qke.202.2023.02.12.14.55.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 14:55:32 -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=sfrz6HR9; 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 1pRLDa-0007WV-Ic; Sun, 12 Feb 2023 17:53:10 -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 1pRLDX-0007Io-2L for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:53:07 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRLDV-0004Bq-6M for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:53:06 -0500 Received: by mail-wr1-x42c.google.com with SMTP id k3so2817491wrv.5 for ; Sun, 12 Feb 2023 14:53:04 -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=LKsXht54rDUTkJKqHQqtb4Pds5COe3w7PRc1ZjYr30M=; b=sfrz6HR9V2dqOypvsdhdHvLfc1g4znf+bLlv6r7ACKtPm236EXKEpPVNVoSHdYsiGk PHn90E0rROR90hXNbH5aKujTa7NKutEn5lrjA/35ay6TZEhZaE8FOK+QUpXyBoqI4Ey7 eUQv0jrs1sl5CIrtHS4rtFdP7hlh2o/3/n7LcXbKl7Lf8AJrvsOk3kbHtv9IwSAOAqZR JsjuCbApn7tJ4+GD7rF6KSJuHEYqW6vnFMFngA+z4FTDYxyyV+f+AuDua4qn1A+HA3Z9 XVtakH61+4cH4onDjryiUUqAzI6svjNro4OAFSBJ64nw3nRG92vcZ+puyyuKx/oYp2S4 dtnQ== 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=LKsXht54rDUTkJKqHQqtb4Pds5COe3w7PRc1ZjYr30M=; b=1vB0ZY7BJCPJCw1SUWnn4x7FrqDyF638P1gdtCoQi39r3c5Md9nic9nwEn5e6HAITd MXwyVyAQ4wtGAbSTEOWIrh9wXI/lrJji7nqGeQHHQGAjaBr5TVORu17PpQiPSEASwkOM F6hpXoZ7hnmkVPft6yGStlIqE27n6thjcvkTuMDNjLtB98ayJOek5FLq5XfQ7pu2ZkyH GI/QKN0v1M24sp1HciiRP5LQyQmS3tR5pEHnfUlNnbUWrFVqThcU1NRStFxT3xJ9LG9H d/AiARo0APgNCE302VK85rH5AT2NLyInD28SjnoA6dL8teTzebBKTY9z34ZBrnOL98Ug vIQw== X-Gm-Message-State: AO0yUKXiUCheaJWjVlp2knojRowvWISLDIX2E4BKJG5CMhFQ0ayFRaml z6ralPAgjoZzrKk8jMnyEMjWPA== X-Received: by 2002:adf:d08a:0:b0:236:695b:82d4 with SMTP id y10-20020adfd08a000000b00236695b82d4mr20256109wrh.30.1676242383050; Sun, 12 Feb 2023 14:53:03 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id q4-20020a05600000c400b002c54737e908sm7356335wrx.91.2023.02.12.14.53.01 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 14:53:02 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Eduardo Habkost , qemu-devel@nongnu.org Cc: Richard Henderson , xiaoqiang zhao , Hu Tao , Thomas Huth , qemu-block@nongnu.org, qemu-s390x@nongnu.org, Gonglei Arei , Cao jin , Li Qiang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Christian Borntraeger , David Hildenbrand , Ilya Leoshkevich , Halil Pasic , Eric Farman , Paolo Bonzini , Fam Zheng Subject: [PATCH 14/19] hw/scsi/scsi-bus: Inline two uses of scsi_bus_from_device() Date: Sun, 12 Feb 2023 23:51:39 +0100 Message-Id: <20230212225144.58660-15-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230212225144.58660-1-philmd@linaro.org> References: <20230212225144.58660-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=philmd@linaro.org; helo=mail-wr1-x42c.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é --- 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 29b65a9b54..802bed2abc 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 Sun Feb 12 22:51:40 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: 652850 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2125034wrr; Sun, 12 Feb 2023 14:55:33 -0800 (PST) X-Google-Smtp-Source: AK7set94TpQwe9/tx3GdTIKm9E4DlJv5Fbz4gyLjDK3Nsj904A6zHlMbJdM/IpP0VQ98IeWr7FUU X-Received: by 2002:a05:6214:e6d:b0:56e:ac19:a879 with SMTP id jz13-20020a0562140e6d00b0056eac19a879mr4993864qvb.8.1676242532971; Sun, 12 Feb 2023 14:55:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676242532; cv=none; d=google.com; s=arc-20160816; b=bSk+ZdF/Y8GazTZ0rAGSlcTqA9VYKKHDOhQ0kllYvp5FLWjs2wVF+LG14/VuckK8cT yF5bOkhSVEr+up/vrTOskyNzD8pltZX9LuORzFJqdW64chXsdlc37rhaIcsvqPD+wS2x EXqIaFrJjXnaOWaDadPmbCQ4C/mG4snXSuKfh3iCw+4YOKZ4gh7C+FBMQKm2M+yb5xVG ClNN5uycWrJNg/JlT8/kfnfjlCyvrFeqCSVtc16A4Tjo1z9oqRQH4+chpA5RjVVk2HXi ISJlwMfvxDF8W2R4BN1UKYL1OtI1sYreVxML+ny3HDG3tN/K5C1u986l5HbkPc7B7JR6 DcqA== 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=3lPcQ4RHMZ3h7WGdkWu74gz5pDiRQhZMKvDRNLxsYVM=; b=NDV/3MOvf1E0slojI02q5Z6LE0W6eO3YzsSDsS/V3pFR43YJhAtIoaHHY/3b03BuJb FpqINR19q3BrB0sgG7iVHFvS1RbOtNuFFbgc+Fe4oEnsot2Uzfe8B1EIffNYtS/UVSHN R+RnOTd7YtBD+yluYB2AmtGQ+2iHrvCp3ts4mmv2Qna3/LHJXIZTzYNL7g7Su71yEPuc FpX3aTV9YDqi9JiSFOM7zR4cOEFizZQUUkBWCha7tOs4CuS219ncU73GxzVUr42j578R SZukl04qtvq11wjQVj2M8E78I2ShCVLAgujRribKb40R+mq6kO1JZbvRMY5lthj0HEY5 NsUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wMDTkDiE; 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 g8-20020a0cf088000000b0056ea9a9a806si1822857qvk.13.2023.02.12.14.55.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 14:55:32 -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=wMDTkDiE; 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 1pRLDd-0007uv-6u; Sun, 12 Feb 2023 17:53: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 1pRLDb-0007hL-Jq for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:53:11 -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 1pRLDa-0004Cn-06 for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:53:11 -0500 Received: by mail-wr1-x42b.google.com with SMTP id y1so10461152wru.2 for ; Sun, 12 Feb 2023 14:53:09 -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=3lPcQ4RHMZ3h7WGdkWu74gz5pDiRQhZMKvDRNLxsYVM=; b=wMDTkDiE9P74ywGvFhQ8WOjahnH9rnBpW2LAzzfsMR25ZWbj1gyYQeKrQzbC+xVZrW T6ovfMnC7LP+4Nioz582q6mNxxftnq/eHonkgQIT6TLDFlk1Ha0a/7BgjxaTlt6060/N fQR2Y/7XKNNHO2nwK+Qj54F3L/RNPMh5LBhIpp7LI3/iNRI2pNrbgQSp5yqgNRebDgTR wgR8d+Wd2peOcc83wpAcsGs48hQY/XSvWKw/cF1asz1RrGzGysRM99JD//DMORzFkcxx 6L/mrD0VSjXHqeMeiQbwwf4wLbG+il9OGCdoAP+GsWmscnrl2Rg5bx/sEdMJGsjBKBXr FP9g== 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=3lPcQ4RHMZ3h7WGdkWu74gz5pDiRQhZMKvDRNLxsYVM=; b=i/YhocKCOgY2HlyxEu91q8AETY/jajnvCYWIMJos77jjbIu9FodR3wzJLAnq06u7Dw cf3gt6ll6W7qJKhGTasgx6O5El6zHxEhrMimEbHYXdQMzpbhSMCu0WeViGaZ7DTi2waR g7XBy9EHb+XYsIBZHYxF5i2ySnoPjWBie7+GI4J2LwQcNmjgJ8P95uXVri22Pj+4tSjz orQdUChOdmyy+gG5+lg5kqW9+WQa5MMD41N0WplwL6bmIlZ8QAB2ZPX96qNz5upqsyMI CsJHI8ScdyyppCXRVs0mGnPtY63BoxCIGEFwjptZh4NcPrMXsta1lfJaUR+vkzQqSN9T n9aw== X-Gm-Message-State: AO0yUKUyN7/YEQvgf5QJADzL5B6AksNDdW2QostwbNRwwLPFUcq9KSWr 6/wlpZvIR1Ege+zLwjLwYNzpVg== X-Received: by 2002:a5d:6149:0:b0:2c5:5bc0:e7b1 with SMTP id y9-20020a5d6149000000b002c55bc0e7b1mr306213wrt.1.1676242388744; Sun, 12 Feb 2023 14:53:08 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id u6-20020adfed46000000b002bf95500254sm9111258wro.64.2023.02.12.14.53.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 14:53:08 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Eduardo Habkost , qemu-devel@nongnu.org Cc: Richard Henderson , xiaoqiang zhao , Hu Tao , Thomas Huth , qemu-block@nongnu.org, qemu-s390x@nongnu.org, Gonglei Arei , Cao jin , Li Qiang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Halil Pasic , Christian Borntraeger , Eric Farman , David Hildenbrand , Ilya Leoshkevich Subject: [PATCH 15/19] hw/s390x/event-facility: Replace DO_UPCAST(SCLPEvent) by SCLP_EVENT() Date: Sun, 12 Feb 2023 23:51:40 +0100 Message-Id: <20230212225144.58660-16-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230212225144.58660-1-philmd@linaro.org> References: <20230212225144.58660-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::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 SCLP_EVENT() QOM type-checking macro to avoid DO_UPCAST(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth --- hw/s390x/event-facility.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/s390x/event-facility.c b/hw/s390x/event-facility.c index faa51aa4c7..6891e3cd73 100644 --- a/hw/s390x/event-facility.c +++ b/hw/s390x/event-facility.c @@ -64,8 +64,7 @@ static bool event_pending(SCLPEventFacility *ef) SCLPEventClass *event_class; QTAILQ_FOREACH(kid, &ef->sbus.qbus.children, sibling) { - DeviceState *qdev = kid->child; - event = DO_UPCAST(SCLPEvent, qdev, qdev); + event = SCLP_EVENT(kid->child); event_class = SCLP_EVENT_GET_CLASS(event); if (event->event_pending && event_class->get_send_mask() & ef->receive_mask) { From patchwork Sun Feb 12 22:51:41 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: 652840 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2124522wrr; Sun, 12 Feb 2023 14:53:34 -0800 (PST) X-Google-Smtp-Source: AK7set84tb+GehrOKxfNjrnoZtMaLwIyZReLTUCoPctTdVi/pLAiqFF6jPT9jA3YSxUvFunTvJYY X-Received: by 2002:a05:6214:226c:b0:56e:957f:dd5f with SMTP id gs12-20020a056214226c00b0056e957fdd5fmr19677709qvb.50.1676242414824; Sun, 12 Feb 2023 14:53:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676242414; cv=none; d=google.com; s=arc-20160816; b=mkitf2UWbhKawQqnIwmosb0iJoG+gwhmVBF2Rq10IHvyuz14LCa3YZ7c0IdksOd5Lf Gboi1oszTpKI/430n7ZgRzTVjM97wSaEE+Sia2iek5WCZWlQ5PfkBRzfFv7pA8q14wtn fDBhelXQ34yuB3yVJtHfFCTg2W0C/cu0BS7foDo0AX17CFmJ74jdNteu6+CULf5JbszX 4XzT4dualiiJuGs2GZZdlW1lCvsa+LZfZe8LCJMxk+dxu61HWoqsy2m8L3jqyB5EQT5R z+cxi8XUVEC4h5rOqiz6b/bvMalAmw6gzboCzyN2NlnUaE2E0nIOXgJ61EZDN7O7OFtz oYtg== 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=bInkmnburNvSek0igY2MOEI+V86XMbjL1VMr60EEqDs=; b=tBzqbaIkmoHjwywwf0nKpFhOqqMP3yrm/P2nUdHXChUm5e1qarRfIzJ6KdmRSioUz6 dlskjsaFmDrdJEMprsfAkBvamYUi2/YUPNsPQlry+lHhR4p0HA5XTwvKNwDOsIcO/WaI Y4Zin7lAeSZUDncByJT45AQVjtY8pFucAGLqSRJUi8dJOqRE5D2ro+B2TeiJcwofd5qU SRWNateXXi/NHh3hBadYLWQnRJtA3DxV5uJG7KV9yCA3XathNtsF9G2f2D6+W+t9qnhl qol82J2bzxwEBvSLBQRC0PJtI5Tq0iATeG7asdyJESFsAl1qPnDif1Q+GH4cE823TBAJ bIGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PIPz4h9n; 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 130-20020a370888000000b007210a2509c3si7588543qki.4.2023.02.12.14.53.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 14:53:34 -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=PIPz4h9n; 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 1pRLDk-0000VZ-5w; Sun, 12 Feb 2023 17:53:20 -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 1pRLDh-0000Av-Tj for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:53:17 -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 1pRLDf-0004E5-EA for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:53:17 -0500 Received: by mail-wr1-x42a.google.com with SMTP id o15so7139962wrc.9 for ; Sun, 12 Feb 2023 14:53: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=bInkmnburNvSek0igY2MOEI+V86XMbjL1VMr60EEqDs=; b=PIPz4h9nVzMpq0K0QXkfSdkiowb2j9KoMZgK4fTp134cbISKYHaIKeIloJJvxx+SaS cqq4/akoOyk9gTB/06GK4mGoFZ6B9FaDm+Bt97SikdaVe2DlufGag0dCmSoqW2BeMz5v WR2r+cCHW8ZA1yy1Z64ZDC5NlOONbpnVngLeN3+lvA3zG+qtCafhB1gyfhVA7FRCJJ+e SLBaECuQEBjpvmas752ZN65HxLNLUEHKUHVFjnD/oR7NYLbaqnqg13YBYRn3zoH4y0Dh BTesLDiiBne2oIKOP41MnlV5RutExIIejauooP5pgowk07+/gk41U8B8L1xkdI1+BMYa kn9Q== 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=bInkmnburNvSek0igY2MOEI+V86XMbjL1VMr60EEqDs=; b=tOn/JttDGIpsVcbFePuyCR/6TmxFgM/ISOLO63DIks5mjsHlbObejHqspno+R2LT+B bWuxyS1p9OZFMLxEzuh+UXmZxZoyICx02p3mxlOJ0/9d9FOiKCWu/F93STd5xLQRY83V DG6hNzBqyPMdyI8qRmJRrcQCy3UYtx5KbXuJXbsI9xQWOQBNEYnC81P3rQr5GFtImnSN oloPQOEHmKVbI9xFMjsHlLUI/+SlbcwyK5XiI77vADsa3/URC26ktzwXALVlFhFnMEtU SlkVAqzqtzYB8HNKt71omBOMhMrgH4ppnr4J5Vn2TLeYgTVJjLF224sMIyNoZh8opNr8 qWLw== X-Gm-Message-State: AO0yUKWkSc0fRMMpXykVF6a7dowjmmZ2VKgjR2lQUvGQEDUxrjpTAUTy oVrGg5+zybg2glKrjY9YyELCysCYb8BlRG/T X-Received: by 2002:adf:dcca:0:b0:2c5:56f7:51ec with SMTP id x10-20020adfdcca000000b002c556f751ecmr1809873wrm.1.1676242393989; Sun, 12 Feb 2023 14:53:13 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id h5-20020a5d5045000000b002c54d9fbea5sm4904176wrt.73.2023.02.12.14.53.12 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 14:53:13 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Eduardo Habkost , qemu-devel@nongnu.org Cc: Richard Henderson , xiaoqiang zhao , Hu Tao , Thomas Huth , qemu-block@nongnu.org, qemu-s390x@nongnu.org, Gonglei Arei , Cao jin , Li Qiang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eric Farman , Matthew Rosato , Alex Williamson Subject: [PATCH 16/19] hw/vfio/ccw: Replace DO_UPCAST(VFIOCCWDevice) by VFIO_CCW() Date: Sun, 12 Feb 2023 23:51:41 +0100 Message-Id: <20230212225144.58660-17-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230212225144.58660-1-philmd@linaro.org> References: <20230212225144.58660-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::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 VFIO_CCW() QOM type-checking macro to avoid DO_UPCAST(). Signed-off-by: Philippe Mathieu-Daudé --- hw/vfio/ccw.c | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c index 0354737666..a8aa5b48c4 100644 --- a/hw/vfio/ccw.c +++ b/hw/vfio/ccw.c @@ -76,8 +76,7 @@ struct VFIODeviceOps vfio_ccw_ops = { static IOInstEnding vfio_ccw_handle_request(SubchDev *sch) { - S390CCWDevice *cdev = sch->driver_data; - VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev); + VFIOCCWDevice *vcdev = VFIO_CCW(sch->driver_data); struct ccw_io_region *region = vcdev->io_region; int ret; @@ -125,8 +124,7 @@ again: static IOInstEnding vfio_ccw_handle_store(SubchDev *sch) { - S390CCWDevice *cdev = sch->driver_data; - VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev); + VFIOCCWDevice *vcdev = VFIO_CCW(sch->driver_data); SCHIB *schib = &sch->curr_status; struct ccw_schib_region *region = vcdev->schib_region; SCHIB *s; @@ -170,8 +168,7 @@ static IOInstEnding vfio_ccw_handle_store(SubchDev *sch) static int vfio_ccw_handle_clear(SubchDev *sch) { - S390CCWDevice *cdev = sch->driver_data; - VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev); + VFIOCCWDevice *vcdev = VFIO_CCW(sch->driver_data); struct ccw_cmd_region *region = vcdev->async_cmd_region; int ret; @@ -210,8 +207,7 @@ again: static int vfio_ccw_handle_halt(SubchDev *sch) { - S390CCWDevice *cdev = sch->driver_data; - VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev); + VFIOCCWDevice *vcdev = VFIO_CCW(sch->driver_data); struct ccw_cmd_region *region = vcdev->async_cmd_region; int ret; @@ -252,8 +248,8 @@ again: static void vfio_ccw_reset(DeviceState *dev) { CcwDevice *ccw_dev = DO_UPCAST(CcwDevice, parent_obj, dev); - S390CCWDevice *cdev = DO_UPCAST(S390CCWDevice, parent_obj, ccw_dev); - VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev); + S390CCWDevice *cdev = S390_CCW_DEVICE(ccw_dev); + VFIOCCWDevice *vcdev = VFIO_CCW(cdev); ioctl(vcdev->vdev.fd, VFIO_DEVICE_RESET); } @@ -588,9 +584,10 @@ static void vfio_ccw_put_device(VFIOCCWDevice *vcdev) static void vfio_ccw_get_device(VFIOGroup *group, VFIOCCWDevice *vcdev, Error **errp) { - char *name = g_strdup_printf("%x.%x.%04x", vcdev->cdev.hostid.cssid, - vcdev->cdev.hostid.ssid, - vcdev->cdev.hostid.devid); + S390CCWDevice *cdev = S390_CCW_DEVICE(vcdev); + char *name = g_strdup_printf("%x.%x.%04x", cdev->hostid.cssid, + cdev->hostid.ssid, + cdev->hostid.devid); VFIODevice *vbasedev; QLIST_FOREACH(vbasedev, &group->device_list, next) { @@ -611,14 +608,14 @@ static void vfio_ccw_get_device(VFIOGroup *group, VFIOCCWDevice *vcdev, */ vcdev->vdev.ram_block_discard_allowed = true; - if (vfio_get_device(group, vcdev->cdev.mdevid, &vcdev->vdev, errp)) { + if (vfio_get_device(group, cdev->mdevid, &vcdev->vdev, errp)) { goto out_err; } vcdev->vdev.ops = &vfio_ccw_ops; vcdev->vdev.type = VFIO_DEVICE_TYPE_CCW; vcdev->vdev.name = name; - vcdev->vdev.dev = &vcdev->cdev.parent_obj.parent_obj; + vcdev->vdev.dev = &cdev->parent_obj.parent_obj; return; @@ -657,9 +654,9 @@ static void vfio_ccw_realize(DeviceState *dev, Error **errp) { VFIOGroup *group; CcwDevice *ccw_dev = DO_UPCAST(CcwDevice, parent_obj, dev); - S390CCWDevice *cdev = DO_UPCAST(S390CCWDevice, parent_obj, ccw_dev); - VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev); + S390CCWDevice *cdev = S390_CCW_DEVICE(ccw_dev); S390CCWDeviceClass *cdc = S390_CCW_DEVICE_GET_CLASS(cdev); + VFIOCCWDevice *vcdev = VFIO_CCW(cdev); Error *err = NULL; /* Call the class init function for subchannel. */ @@ -729,9 +726,9 @@ out_err_propagate: static void vfio_ccw_unrealize(DeviceState *dev) { CcwDevice *ccw_dev = DO_UPCAST(CcwDevice, parent_obj, dev); - S390CCWDevice *cdev = DO_UPCAST(S390CCWDevice, parent_obj, ccw_dev); - VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev); + S390CCWDevice *cdev = S390_CCW_DEVICE(ccw_dev); S390CCWDeviceClass *cdc = S390_CCW_DEVICE_GET_CLASS(cdev); + VFIOCCWDevice *vcdev = VFIO_CCW(cdev); VFIOGroup *group = vcdev->vdev.group; vfio_ccw_unregister_irq_notifier(vcdev, VFIO_CCW_REQ_IRQ_INDEX); From patchwork Sun Feb 12 22:51:42 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: 652841 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2124620wrr; Sun, 12 Feb 2023 14:53:54 -0800 (PST) X-Google-Smtp-Source: AK7set8UX9dd8snm4epNgE18wuMjrqjr8AF8psgql89OYR97YwL3VU7hnMoMFEwgEFK8NDMM30YX X-Received: by 2002:ad4:5763:0:b0:56e:b30a:142f with SMTP id r3-20020ad45763000000b0056eb30a142fmr1823468qvx.14.1676242434351; Sun, 12 Feb 2023 14:53:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676242434; cv=none; d=google.com; s=arc-20160816; b=u4Dk9MLrEorTwXd38nOCJw/4IeD/7z278FXBegODvqfCM8OLMeNm8MVwe8TZyogA+l 96Qi8k1i2YqppXNGiHDxluRJtdFpHU1c4b9uizt3OQ7qUKgFDX/EyX786XiPGBXV9UUW gpszgUdM6FbyiOFxvq2usgVtIlTZOZDJbRPAAn8Gt5wug7CoFvpC7/aoDz98hr00BnkT YWgz4121zwVY9fxRtw8aNhnXNj+nFGXgMEuntZEKSSdVuQGazjkt7XIGHzU8hq7fGJtc FkSR+Nzc+raLSrxJtXktWwUSb9NjeY4/noUKmCCIq1t3LP6foh6VmuaZQLmiDWVcNw/E npEw== 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=btOdTJ6LNlLqOTPKM7TI6zR9Zc67AAs+T+MWA6u4cEcOlKAzzXkg+XI08VhDLZslKs KQvup6HckAzi1MNp25FMZBDZbUyahdz/hqfSm5Gc3oftZvndUdhatws6rmLOdtCxmT+w N/dRGRu4zERk4/aeP9FoDsGDtiBk4Jz9YIPY71t68Ql9OfF2eWJ8M4YJVY/HrFrlKf3h GDma0O/4RLMXk/YQH6q3yHneyHH6eI54Czy/oEkpAb3NODkGH80r428JcsX9i7Pjjb7P qnJQD7VaHDEHDL1Be83yfhK+H/8Gcbbh682gprqQN1TTz7kVoDtPYMzAbUIC3sVgTkrz wQLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OWPqsAb0; 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 x17-20020a0cb211000000b0056bf9633d57si8158156qvd.7.2023.02.12.14.53.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 14:53:54 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OWPqsAb0; 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 1pRLDo-0000pV-Bs; Sun, 12 Feb 2023 17:53: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 1pRLDn-0000mI-8u for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:53:23 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRLDk-0004Ai-Hn for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:53:22 -0500 Received: by mail-wr1-x431.google.com with SMTP id h16so10418122wrz.12 for ; Sun, 12 Feb 2023 14:53:20 -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=OWPqsAb0SuWg82E34DR/JsqG0wasmdZB/YM1XLoRpg6AGc/kJOUtWaoaWg4Xx/VMNk 3tLkJbJa8XeISnO2rI6xZIPfPslQS7Ym8WxI78EwlsAIumsuMtFWBNumhOSv3rIJqnFR BXHNCULiwpzCb8QzmcWKgij02Lm721vz+PiWM6m50YPWgPPiw57whsM4aVFUWbvahMlD TQV+W3222datHAf+6D+bt5LPesgVuV5ra4M3t7WCzKxmtE6iVNWapQKpERfHtY1qlR6N X72fgsVIbpbeX3tUjjhhnIGl/dk4UloS0uMhM3v91MAP9IJv6JhYW+rDYK49MaGuJ1ns WVnw== 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=ISTNXN/Ea9eXVYyVjIREigdG/vf1tnXS+Snu6NXRDAT/Ewn9kzg753ogTX0W4rZR1r p3wZxweFdKfghDSYSacBuyJmS3y+X/LwL4NkK2zS9962RWroshjezZKX/q84DCshirY/ yfpHQn4M7BDAquehJWl3engi3EG1Og9I2/SP7nxy/iZGhmv+FfMwOTONaBQbksw9hBhf rjGZO6pUJDXQlvdzR3z/rvoXBLauPzINgMHkSVvxxqBScicABhontAqkH5J3oFOe/szd AI2aApHxutK6wi13QIn07FRyFr5pbwDUpio63DOxuW2GAwsL1bEwINSfbSHIBZXpzIAi xGoQ== X-Gm-Message-State: AO0yUKXtCcgLAaMbhBg4JHP5azHMDhm9xWJfKECIkS5cssx+xKQHf2cn 8/SsxqPgNieNGhNHv2BVN9DeQg== X-Received: by 2002:a05:6000:1b88:b0:2c3:ea8b:2724 with SMTP id r8-20020a0560001b8800b002c3ea8b2724mr17542808wru.21.1676242399794; Sun, 12 Feb 2023 14:53:19 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id k1-20020adff5c1000000b002bff574a250sm9202140wrp.2.2023.02.12.14.53.18 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 14:53:19 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Eduardo Habkost , qemu-devel@nongnu.org Cc: Richard Henderson , xiaoqiang zhao , Hu Tao , Thomas Huth , qemu-block@nongnu.org, qemu-s390x@nongnu.org, Gonglei Arei , Cao jin , Li Qiang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Gerd Hoffmann Subject: [PATCH 17/19] hw/usb/dev-hub: Use QOM USB_HUB() macro instead of casting Date: Sun, 12 Feb 2023 23:51:42 +0100 Message-Id: <20230212225144.58660-18-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230212225144.58660-1-philmd@linaro.org> References: <20230212225144.58660-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=philmd@linaro.org; helo=mail-wr1-x431.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 Sun Feb 12 22:51:43 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: 652843 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2124683wrr; Sun, 12 Feb 2023 14:54:09 -0800 (PST) X-Google-Smtp-Source: AK7set9P2lxBfuJxe2KtTqt5gD3dTyHY07Rk6DC8G/QisFoJNo5YMWt3S+eW25lDNLtjVjL5rxWZ X-Received: by 2002:a05:6214:f07:b0:56e:abf3:91bb with SMTP id gw7-20020a0562140f0700b0056eabf391bbmr5149450qvb.12.1676242449401; Sun, 12 Feb 2023 14:54:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676242449; cv=none; d=google.com; s=arc-20160816; b=oqfMUoiz5YHKp7M2okmh+jP8G8p78cWh/2HpP267AGo2hSsLiJYAHoeOTllppclYrv B83eY60o7psqhz+jNlyfEajFqjx5D2W+X0MDXy62eOKfJViHO5NJ/KuqfKEBjBfD7sbZ PeC9/CmrTAKovMSthypT2BWScTHX8qY+Hc/xtuNHukXzS/JNyE3O+E840dqGdiRrIu5I shEmeudOcABPGa+gFP7qV00NjdRdBOohlps0ak4AaJaYXF2eNu96WZ2WVqLTks3nsWYz dl5fDn0pCyU4TGymRl1u+iaNxZ3GbAHwyYqkcBpr54kW5jCIitF5Y21nta8FkOMmHXlF nzwg== 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=pQvt0NVqKQRnGWvOIKjTRBY46uNvNG89/oXED2HfaRM=; b=vYl59grs6gL+LDnFrJmhNxFRtI737K5jVqdr+RukvJyzRAAHowOEX15tLpqd24LhV4 zZSd2affDA9mGKLXTurYshLYTVXL0w4X67ETUz7gg0jYiJ0MQr3dW20pOWUJCXlWS9Au t21F8yJUWIsooz1OW2gELqh/BGQuab+D+qL+sobxJecPLCPCb//X65yHQBqCtMKEGSvj afhINRXAoyZjI4t7jzIRrdsFFJM/UKdqf7NfRxGkXtZjNtrFA1AGMzt6qyoBZFQtfwEC 3DIXMIUPF/mTUpTFJjRTMQkZPjOMvgJOn+Ktw/bqA1dbwHe0gjp0VZfY1z1tJRdOXYPZ xSsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BheFvmqQ; 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 m9-20020a05620a24c900b00725375894b5si9176729qkn.519.2023.02.12.14.54.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 14:54: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=BheFvmqQ; 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 1pRLDu-0001Ki-7b; Sun, 12 Feb 2023 17:53:30 -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 1pRLDs-0001E8-FF for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:53:28 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRLDp-0004E7-Qz for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:53:28 -0500 Received: by mail-wr1-x433.google.com with SMTP id bu23so10432791wrb.8 for ; Sun, 12 Feb 2023 14:53: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=pQvt0NVqKQRnGWvOIKjTRBY46uNvNG89/oXED2HfaRM=; b=BheFvmqQeN4YY4MY9Iok1QofNVvjoYfVCmL3wRsf/3VwDQDPIyhhqhCanffPUqIWm3 Ye5TiNdL2tv7gxLvyQZD7dp6SdxmXgiq3ZTuVlae+zEl57f0mf2b1epkvBESDKF8/sX9 g5NqdBXPUeGmjukfGReg9HE0LJUbCiKvdShr2ehqrECWBRk65DCJomIIlGvdEzKUnNhz q0fbydOjP76o6rr/bdvWrIfablZThSFWYjxcdrSlRqZgA7a7jHX/d2Upd4tjcptswd99 INKvGIuV1dS+dLlIswLkcHApoXUbW0uWGq+zPTWd3w2bCS5Fl+6maSkFuq36l1akqdpq qwNQ== 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=pQvt0NVqKQRnGWvOIKjTRBY46uNvNG89/oXED2HfaRM=; b=Qv84Nan8wvIUZ4GKgTzztd5PZA0iogQjRHwAiHqL87MtUSYhf5r48YxTaZURfrNg/8 eTZ9uDh23rJlB2/6cIdmkycf6RBWEYT8FEk20O8cyG2xeTfFbBirA+JDYFGACsCpfs8Y HJtnOHMPnsjuphtr6mwa+J6+DAlOsAIBIb634ZTbM9XAy9dSVO6+gEADujgqTgnEi6ur TEOJjn4Xo4WylsIbdUZSuBrTVq2RPjuCXWdoZbl5fPcREzeJ3ssvPfWJkuZjEibk/4Wg j6myKP4i8nGaiAFST55GBZ7hpjUGRazObFAnwdSoLCUM1IMIFRUaT0Z1MPnDRSnEdSoW fZiw== X-Gm-Message-State: AO0yUKXBsRR8+6X1IaRII6XcHjRfqqdNzV8LkM6yIZxfY0bfC30X4d/6 0oKQ6jnSGLDUS1slT8Yh47ICFg== X-Received: by 2002:adf:f301:0:b0:2c5:52b7:8436 with SMTP id i1-20020adff301000000b002c552b78436mr3518656wro.21.1676242405168; Sun, 12 Feb 2023 14:53:25 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id u13-20020a5d514d000000b002c3f50228afsm8940260wrt.3.2023.02.12.14.53.23 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 14:53:24 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Eduardo Habkost , qemu-devel@nongnu.org Cc: Richard Henderson , xiaoqiang zhao , Hu Tao , Thomas Huth , qemu-block@nongnu.org, qemu-s390x@nongnu.org, Gonglei Arei , Cao jin , Li Qiang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Gerd Hoffmann Subject: [PATCH 18/19] hw/usb: Replace DO_UPCAST(USBBus) by USB_BUS() Date: Sun, 12 Feb 2023 23:51:43 +0100 Message-Id: <20230212225144.58660-19-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230212225144.58660-1-philmd@linaro.org> References: <20230212225144.58660-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=philmd@linaro.org; helo=mail-wr1-x433.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 Replace accesses to qdev->parent_bus by qdev_get_parent_bus(qdev). 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 32c23a5ca2..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, d->qdev.parent_bus); + return USB_BUS(qdev_get_parent_bus(DEVICE(d))); } extern const VMStateDescription vmstate_usb_device; From patchwork Sun Feb 12 22:51:44 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: 652848 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2124930wrr; Sun, 12 Feb 2023 14:55:08 -0800 (PST) X-Google-Smtp-Source: AK7set+Toifp7qtLQdLWXbjOt9fD75y2IvJCVQhGmJnpu5zbkeDY11KkTNry3okKc5S2Q0JrYntn X-Received: by 2002:a05:6214:20a8:b0:53c:97fb:3595 with SMTP id 8-20020a05621420a800b0053c97fb3595mr42445223qvd.32.1676242508622; Sun, 12 Feb 2023 14:55:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676242508; cv=none; d=google.com; s=arc-20160816; b=cXP2UWHq5yWp0wfnjdlXMNtN1L2kKUTgI6APxoyTzD+GVIjqoWW1C/ppcz8n3Ie9P+ SG1m43q9JTFzRlHOwWHkYLZELhAXllwYMFn5RfaGmdSz/CJwmz+zNu98NWFJM7Oc7tBx hd+qmjM9Nsvu5kccpuC7fJkQn7f6gyqKHYpBwygshSV9ARAFDC4EqEJkztmLF0vmMeZa YdItG1JzG6SxvqPDz0qP/QClRKK374TNZlJCIKDWiKxDoJRc1YJ5su4tKucgFnc4Oy1p QoBFT97u5UIO2+CcE3IhqeWHl8lzYqjipv7+268Kkh/3qoOiv+sWHSQJudw1JemevrBO hz9g== 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=Y7MPn97FcL/7BFhSjHMb1CUqDm78YK7bxAD/KSpYvWc=; b=lIafeigJ105tLYDTZxmKSQM4H6Uoi7UKBhR+3PJA1qjrKweMWOsEZJcKwNUyd6jMiu kEQmytYIONZA2XVDWXgvkO+YHfpaW68jCkk/FxJuzm40nECXmKbAKOiT3z60Is46+5i7 WmsGAue2/ojqE3qt5EfU3X9bFBy1tJP4QCo7QDBUExGq/FghVQBxHiQoYixxQ66KcCZV uGDeZH7wESlwbfxoqH+dSC8T+VEijPQEla7h1LoXq294BUBXA5hHBReRFkjz6U9NHf3R LDrn187cO55vnoPe7U5COJlDf9KrltdtsA592KwkO9ntinoIsFEJHkvHQc1BBO+kudZh hyKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=K5kR2iIA; 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 j22-20020a05620a289600b007389c641884si7409439qkp.396.2023.02.12.14.55.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 14:55:08 -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=K5kR2iIA; 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 1pRLE6-00025z-9k; Sun, 12 Feb 2023 17:53:42 -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 1pRLE4-0001v9-Ux for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:53:40 -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 1pRLE2-0004Hn-Sw for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:53:40 -0500 Received: by mail-wm1-x32a.google.com with SMTP id z13so7552017wmp.2 for ; Sun, 12 Feb 2023 14:53:38 -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=Y7MPn97FcL/7BFhSjHMb1CUqDm78YK7bxAD/KSpYvWc=; b=K5kR2iIAlG/tgEloMhNQllCw7HWJqgY/l2CMffXFBlhZK70onVOm5WRQkBPMYna3mN fcDkLZISPcEdzsFhbEVQ+ZYsqbfT0TATIhpGDpfnXLQQkArLkwR3ar1ER5li+nx7stNn 6r7xKcHvxIeWzdQ+cTnGZR2PKK+xXkPXgku8N9f+FI0ZrUgeEWV3kraWlUWieCaOh/qK ATxXz2paOpGfrRQpBKhNGp2LnkglodiQYHeNtsIKcBx6XTJtn8S7+s8UdgFI1XZxkK64 gcy/xM3KCG+VphBitmP949kJdom9DqpkBakjy/b/iF2hDHnL6BIWqOMroQBb9Ou8khoz Qshg== 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=Y7MPn97FcL/7BFhSjHMb1CUqDm78YK7bxAD/KSpYvWc=; b=RQ1gFaUbRTg3URgYMSseBKzn4ay8awBryfIMkNCTTHP7TlfBZ7nuNd13ncHZRhSJn2 Oal3s6r3InPE2q+Uv2E/Z4KX/P0CfNs2HI7sljuV119xuu6fMUp8KlYsj0ji4B4V3MR4 pjoMkkqTag+caArkr27RyMLGyhYHfH+Z/N420APJMvNq8qTugIfoENuS8DuSg7nldyVB ztPb/XjhwTEK6LxW7UWrGzGa38XIyDEceusfKXd21Jxlw6E/DG9bWctsulbsdBPemh+Y IeoPU5zThcIF3TgN/zAWvLxnGUBNmIANsUa5dc/iKYZJRTjV1cq9eT54aFykEe3t+gjS TPvg== X-Gm-Message-State: AO0yUKUxeUQjkkpCQDR+yVwHbgaDaT0IGfh9oRMznSBTEttu8aF8FK01 xWwZUhU0XByQPXASVK2e147Qjg== X-Received: by 2002:a05:600c:4b1b:b0:3df:fbc7:5b10 with SMTP id i27-20020a05600c4b1b00b003dffbc75b10mr17047531wmp.0.1676242417442; Sun, 12 Feb 2023 14:53:37 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id p5-20020a1c5445000000b003dc492e4430sm12040317wmi.28.2023.02.12.14.53.36 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 14:53:37 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Eduardo Habkost , qemu-devel@nongnu.org Cc: Richard Henderson , xiaoqiang zhao , Hu Tao , Thomas Huth , qemu-block@nongnu.org, qemu-s390x@nongnu.org, Gonglei Arei , Cao jin , Li Qiang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Samuel Thibault Subject: [RFC PATCH 19/19] hw/usb: Inline usb_bus_from_device() Date: Sun, 12 Feb 2023 23:51:44 +0100 Message-Id: <20230212225144.58660-20-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230212225144.58660-1-philmd@linaro.org> References: <20230212225144.58660-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::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=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 Signed-off-by: Philippe Mathieu-Daudé --- RFC Other devices don't use such helper. Maybe it should be the other way around, introduce more bus_from_device() helpers? --- hw/usb/bus.c | 10 +++++----- hw/usb/core.c | 6 +++--- hw/usb/dev-hub.c | 4 ++-- hw/usb/dev-serial.c | 10 +++++----- hw/usb/hcd-xhci.c | 2 +- include/hw/usb.h | 5 ----- 6 files changed, 16 insertions(+), 21 deletions(-) diff --git a/hw/usb/bus.c b/hw/usb/bus.c index d7c3c71435..4a1b67761c 100644 --- a/hw/usb/bus.c +++ b/hw/usb/bus.c @@ -427,7 +427,7 @@ void usb_unregister_port(USBBus *bus, USBPort *port) void usb_claim_port(USBDevice *dev, Error **errp) { - USBBus *bus = usb_bus_from_device(dev); + USBBus *bus = USB_BUS(qdev_get_parent_bus(DEVICE(dev))); USBPort *port; USBDevice *hub; @@ -473,7 +473,7 @@ void usb_claim_port(USBDevice *dev, Error **errp) void usb_release_port(USBDevice *dev) { - USBBus *bus = usb_bus_from_device(dev); + USBBus *bus = USB_BUS(qdev_get_parent_bus(DEVICE(dev))); USBPort *port = dev->port; assert(port != NULL); @@ -517,7 +517,7 @@ static void usb_mask_to_str(char *dest, size_t size, void usb_check_attach(USBDevice *dev, Error **errp) { - USBBus *bus = usb_bus_from_device(dev); + USBBus *bus = USB_BUS(qdev_get_parent_bus(DEVICE(dev))); USBPort *port = dev->port; char devspeed[32], portspeed[32]; @@ -555,7 +555,7 @@ void usb_device_attach(USBDevice *dev, Error **errp) int usb_device_detach(USBDevice *dev) { - USBBus *bus = usb_bus_from_device(dev); + USBBus *bus = USB_BUS(qdev_get_parent_bus(DEVICE(dev))); USBPort *port = dev->port; assert(port != NULL); @@ -583,7 +583,7 @@ static const char *usb_speed(unsigned int speed) static void usb_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent) { USBDevice *dev = USB_DEVICE(qdev); - USBBus *bus = usb_bus_from_device(dev); + USBBus *bus = USB_BUS(qdev_get_parent_bus(qdev)); monitor_printf(mon, "%*saddr %d.%d, port %s, speed %s, name %s%s\n", indent, "", bus->busnr, dev->addr, diff --git a/hw/usb/core.c b/hw/usb/core.c index 975f76250a..f358f0313a 100644 --- a/hw/usb/core.c +++ b/hw/usb/core.c @@ -95,7 +95,7 @@ void usb_device_reset(USBDevice *dev) void usb_wakeup(USBEndpoint *ep, unsigned int stream) { USBDevice *dev = ep->dev; - USBBus *bus = usb_bus_from_device(dev); + USBBus *bus = USB_BUS(qdev_get_parent_bus(DEVICE(dev))); if (!phase_check(PHASE_MACHINE_READY)) { /* @@ -556,7 +556,7 @@ void usb_packet_check_state(USBPacket *p, USBPacketState expected) return; } dev = p->ep->dev; - bus = usb_bus_from_device(dev); + bus = USB_BUS(qdev_get_parent_bus(DEVICE(dev))); trace_usb_packet_state_fault(bus->busnr, dev->port->path, p->ep->nr, p, usb_packet_state_name(p->state), usb_packet_state_name(expected)); @@ -567,7 +567,7 @@ void usb_packet_set_state(USBPacket *p, USBPacketState state) { if (p->ep) { USBDevice *dev = p->ep->dev; - USBBus *bus = usb_bus_from_device(dev); + USBBus *bus = USB_BUS(qdev_get_parent_bus(DEVICE(dev))); trace_usb_packet_state_change(bus->busnr, dev->port->path, p->ep->nr, p, usb_packet_state_name(p->state), usb_packet_state_name(state)); diff --git a/hw/usb/dev-hub.c b/hw/usb/dev-hub.c index 4734700e3e..4a0bcc4093 100644 --- a/hw/usb/dev-hub.c +++ b/hw/usb/dev-hub.c @@ -572,7 +572,7 @@ static void usb_hub_unrealize(USBDevice *dev) int i; for (i = 0; i < s->num_ports; i++) { - usb_unregister_port(usb_bus_from_device(dev), + usb_unregister_port(USB_BUS(qdev_get_parent_bus(DEVICE(dev))), &s->ports[i].port); } @@ -611,7 +611,7 @@ static void usb_hub_realize(USBDevice *dev, Error **errp) s->intr = usb_ep_get(dev, USB_TOKEN_IN, 1); for (i = 0; i < s->num_ports; i++) { port = &s->ports[i]; - usb_register_port(usb_bus_from_device(dev), + usb_register_port(USB_BUS(qdev_get_parent_bus(DEVICE(dev))), &port->port, s, i, &usb_hub_port_ops, USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL); usb_port_location(&port->port, dev->port, i+1); diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c index 63047d79cf..0194bb541b 100644 --- a/hw/usb/dev-serial.c +++ b/hw/usb/dev-serial.c @@ -190,7 +190,7 @@ static void usb_serial_set_flow_control(USBSerialState *s, uint8_t flow_control) { USBDevice *dev = USB_DEVICE(s); - USBBus *bus = usb_bus_from_device(dev); + USBBus *bus = USB_BUS(qdev_get_parent_bus(DEVICE(dev))); /* TODO: ioctl */ s->flow_control = flow_control; @@ -200,7 +200,7 @@ static void usb_serial_set_flow_control(USBSerialState *s, static void usb_serial_set_xonxoff(USBSerialState *s, int xonxoff) { USBDevice *dev = USB_DEVICE(s); - USBBus *bus = usb_bus_from_device(dev); + USBBus *bus = USB_BUS(qdev_get_parent_bus(DEVICE(dev))); s->xon = xonxoff & 0xff; s->xoff = (xonxoff >> 8) & 0xff; @@ -221,7 +221,7 @@ static void usb_serial_reset(USBSerialState *s) static void usb_serial_handle_reset(USBDevice *dev) { USBSerialState *s = USB_SERIAL(dev); - USBBus *bus = usb_bus_from_device(dev); + USBBus *bus = USB_BUS(qdev_get_parent_bus(DEVICE(dev))); trace_usb_serial_reset(bus->busnr, dev->addr); @@ -261,7 +261,7 @@ static void usb_serial_handle_control(USBDevice *dev, USBPacket *p, int length, uint8_t *data) { USBSerialState *s = USB_SERIAL(dev); - USBBus *bus = usb_bus_from_device(dev); + USBBus *bus = USB_BUS(qdev_get_parent_bus(DEVICE(dev))); int ret; trace_usb_serial_handle_control(bus->busnr, dev->addr, request, value); @@ -479,7 +479,7 @@ static void usb_serial_token_in(USBSerialState *s, USBPacket *p) static void usb_serial_handle_data(USBDevice *dev, USBPacket *p) { USBSerialState *s = USB_SERIAL(dev); - USBBus *bus = usb_bus_from_device(dev); + USBBus *bus = USB_BUS(qdev_get_parent_bus(DEVICE(dev))); uint8_t devep = p->ep->nr; struct iovec *iov; int i; diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index b89b618ec2..94c2e58aaf 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -3268,7 +3268,7 @@ static void xhci_complete(USBPort *port, USBPacket *packet) static void xhci_child_detach(USBPort *uport, USBDevice *child) { - USBBus *bus = usb_bus_from_device(child); + USBBus *bus = USB_BUS(qdev_get_parent_bus(DEVICE(child))); XHCIState *xhci = container_of(bus, XHCIState, bus); xhci_detach_slot(xhci, child->port); diff --git a/include/hw/usb.h b/include/hw/usb.h index f743a5e945..4a2987c477 100644 --- a/include/hw/usb.h +++ b/include/hw/usb.h @@ -518,11 +518,6 @@ void usb_device_attach(USBDevice *dev, Error **errp); int usb_device_detach(USBDevice *dev); void usb_check_attach(USBDevice *dev, Error **errp); -static inline USBBus *usb_bus_from_device(USBDevice *d) -{ - return USB_BUS(qdev_get_parent_bus(DEVICE(d))); -} - extern const VMStateDescription vmstate_usb_device; #define VMSTATE_USB_DEVICE(_field, _state) { \