From patchwork Mon Feb 13 18:43:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 653212 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2581292wrr; Mon, 13 Feb 2023 10:46:03 -0800 (PST) X-Google-Smtp-Source: AK7set8chaeQL5fF3HlUASsGD3V+2cnA/m9wtWVwe+dL8TU7xDSxlGJmpXfehPG72o7oMyknF7Vx X-Received: by 2002:a05:6214:2425:b0:56e:c174:1c88 with SMTP id gy5-20020a056214242500b0056ec1741c88mr1285434qvb.46.1676313962780; Mon, 13 Feb 2023 10:46:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676313962; cv=none; d=google.com; s=arc-20160816; b=FypcngkyScnpLZRXbIiX4Wc2REl7fXr8mtTIn3lSYzTzAoZ4fbBjBAgfw+6lKHmNAE wvADoj0DIde8S9RArBhzLyaIGDv50gVp2YgX5yJdtsyJyBzkXbME18WVEIc4SbE33c0W SCGPzuQWjA7hkwPFlx2OcOs75V6BZzn422zimcmv2DS1dcnd3SrMSb3KWyoHGfn10AFO hrPHPHutktg4RbyxOd78gma4lbcE7AdlEOKQoA6FEH8R/IEtw3cQNXQYA9fXxWW9dChx zylS0WFQJCjFn61riGISQ4uXjT3cYt6RmyrSTGPs6mHOm62z8lClOsYHPYMUjG1a8pt/ mKoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yz6IoxjWNiku5kCSpBghWuT3DdtWubTdcdH43JCupO0=; b=to2cLzvGmwX7Sq3WHrcPa3VQ/+o12LFVfJaF44JxvsD/v02z7vbXsBBgB0I+YEJGcc dt7vYtjxd0kFOtk/8X2YgkcJsvN1L7pWK70QFXBYmpvHfqUF+7zN9wRUm8SAjUTwwRRD UoZyhD+armfg19bOTYrxMJ/6jHUFwSuZknjSmuEKtUgRCB/CrdWHtGEcIXVyp17GTu8+ vVlRLnuBOJpO7K51o3qeZd0xxD/sy5YK5NLKqlIqvhdLdyjNg0fVKoxNHDjDvIh5bSZM 07PPkHpjvlBIpa4JC+ZqDz4eXaF/L3ASv80YQKhiiRrHTwXwSyvCHLLLI02EAz2yVO3x Ydbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="jI1P/tOj"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q22-20020a05620a2a5600b00733f1926964si10198691qkp.723.2023.02.13.10.46.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Feb 2023 10:46:02 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="jI1P/tOj"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRdoE-00014i-OW; Mon, 13 Feb 2023 13:44:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pRdoA-0000zA-FK for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:44:10 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRdo8-0008P1-KE for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:44:10 -0500 Received: by mail-wm1-x331.google.com with SMTP id m20-20020a05600c3b1400b003e1e754657aso3521092wms.2 for ; Mon, 13 Feb 2023 10:44:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yz6IoxjWNiku5kCSpBghWuT3DdtWubTdcdH43JCupO0=; b=jI1P/tOjW9ruO26diB/wqKvoc4LbkvFcbqid/SNBffoSTAE8C5sMngFDii/eXeDXID 8Gg+AOi/4iEjqTyKkMG11hVagnBMxrLKPpVhoQk74yTap6wcWbjZX3D5oMZJACT2RnnV aQOFMecmRpsqqgDCMneXD2h7zJJFeDXCP4nwMVWwxhogdUpG63yIwW+rx/Crgrq0r08p Kdn48Oq5VVJ7BysstFHyujnqIOrP+p57y4ia5GPkxoOkeSn67E1CHt3Ucy5WTq3DA8Ud xb0iPbPDsjdBG6apMN1Ddj0zzYbq80DGcOmgrBVQVOrrdrevY3w7mHc+yXIeOcgstu+H CVtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yz6IoxjWNiku5kCSpBghWuT3DdtWubTdcdH43JCupO0=; b=MigPJRKL7bvGU3gquy7TlVMTbp5TRwIY7Tq0/hshd/UDe7VJ/Cft/4k5P6fuOezqBV CUSE4Pzu5/BLb3hmJQFBDAFaebQGn/LBB4atGg4jJVlBYH4r6mlknNYpUSaPpWkXC/qx yN0dHkkTkS/774/GANZC4Bo7LIct6bFz70ZfCX+PY3/F7uFA0u/cqWYCpYsBGHuCxC5B LPtjqTJzRiwqZgdaErDtjSNiwoqFl/DfykIFR+EeDmLhBWfzRQrV3mOiMQk4/h7DKQav PMIiNn2ZUDMsP5heJTberdCK2FABJNZFFE4Wo+9J6Peb6zSMX68EWVd9C2F2Rvztv3dM rVIg== X-Gm-Message-State: AO0yUKX8e3LzYkyxhVK1/vuKboxtErqLGZQxuXRlgffrw6J4+MlSwgJE xo7NQ/VkUSixDzNytrXG9fXDugeaCF6A1Ila X-Received: by 2002:a05:600c:1895:b0:3dc:4aa6:a8a9 with SMTP id x21-20020a05600c189500b003dc4aa6a8a9mr19187855wmp.7.1676313847532; Mon, 13 Feb 2023 10:44:07 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id v18-20020a05600c445200b003de77597f16sm16157583wmn.21.2023.02.13.10.44.06 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Feb 2023 10:44:07 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Eduardo Habkost Cc: qemu-block@nongnu.org, Hu Tao , Gonglei Arei , Richard Henderson , Li Qiang , Thomas Huth , Cao jin , xiaoqiang zhao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PATCH v3 05/14] hw/char/serial-pci-multi: Replace DO_UPCAST() by PCI_MULTISERIAL() Date: Mon, 13 Feb 2023 19:43:29 +0100 Message-Id: <20230213184338.46712-6-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230213184338.46712-1-philmd@linaro.org> References: <20230213184338.46712-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Use the PCI_MULTISERIAL() QOM type-checking macro to avoid the few DO_UPCAST(PCIMultiSerialState) calls. Signed-off-by: Philippe Mathieu-Daudé --- hw/char/serial-pci-multi.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/hw/char/serial-pci-multi.c b/hw/char/serial-pci-multi.c index 704be5c294..d660b6fa97 100644 --- a/hw/char/serial-pci-multi.c +++ b/hw/char/serial-pci-multi.c @@ -58,7 +58,7 @@ struct PCIMultiSerialState { static void multi_serial_pci_exit(PCIDevice *dev) { - PCIMultiSerialState *pci = DO_UPCAST(PCIMultiSerialState, dev, dev); + PCIMultiSerialState *pci = PCI_MULTISERIAL(dev); SerialState *s; int i; @@ -97,11 +97,10 @@ static size_t multi_serial_get_port_count(PCIDeviceClass *pc) g_assert_not_reached(); } - static void multi_serial_pci_realize(PCIDevice *dev, Error **errp) { PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(dev); - PCIMultiSerialState *pci = DO_UPCAST(PCIMultiSerialState, dev, dev); + PCIMultiSerialState *pci = PCI_MULTISERIAL(dev); SerialState *s; size_t i, nports = multi_serial_get_port_count(pc); @@ -190,9 +189,8 @@ static void multi_4x_serial_pci_class_initfn(ObjectClass *klass, void *data) static void multi_serial_init(Object *o) { - PCIDevice *dev = PCI_DEVICE(o); - PCIMultiSerialState *pms = DO_UPCAST(PCIMultiSerialState, dev, dev); - size_t i, nports = multi_serial_get_port_count(PCI_DEVICE_GET_CLASS(dev)); + PCIMultiSerialState *pms = PCI_MULTISERIAL(o); + size_t i, nports = multi_serial_get_port_count(PCI_DEVICE_GET_CLASS(o)); for (i = 0; i < nports; i++) { object_initialize_child(o, "serial[*]", &pms->state[i], TYPE_SERIAL);