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);