From patchwork Mon Feb 13 07:08:06 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: 653172 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2266382wrr; Sun, 12 Feb 2023 23:09:52 -0800 (PST) X-Google-Smtp-Source: AK7set/+8Jkx1aBkV6plQyuDYenZDquCFN7FTlsUlRuTMkNG0YowwIoIdvTzy59UJscbcWApG6a6 X-Received: by 2002:ac8:5884:0:b0:3b8:696b:95e8 with SMTP id t4-20020ac85884000000b003b8696b95e8mr40876504qta.1.1676272191866; Sun, 12 Feb 2023 23:09:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676272191; cv=none; d=google.com; s=arc-20160816; b=u/87EofBbF4h0Ili2P1GsJUg37j2wfBMoTo+hmyB+r+u8a9a+b6+cAiGTbPaiaTGqZ Ap52acpalzTQpB2owYl4LkhqcD064Zk5gh2iwFATscUd8z+V0wm1k31GZ/WXU/nhTH9k mPjTFFk+Gg5cXSPDqrYtlj7Cg7YhZL5altiBGgFbOh9HeBymvuXzGminq/oJGNmIP9fM fINWzr8HRmApbIbbBNodacACVEKiIZnNgvoijDBU+jYKMIlHKpEOj2QamYQ1XHBHRSxl YZLFQKmmeS1pbWikE87RvtDghi8h6QANNO+44jQUyoFvdJLxuFKI+Lck+Pw8Qrsh0rhK TXrw== 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=aX4WF//a82DbH/pLyiLT+PR7PTLTSCcfLQ5Uc4rrIPTT9GRBPTkFoVs1nTjeY4OaCA p6tQVbtzu5rTc6H0YpyOfGETzdMBc5+zPw8PDTNfbG1E2EWNvWlZTWDeVM9qGOXJz+CR Ep5hZjaNPq/UavcZubm3cWF3bf4A/zI7kWoQyvj6eIBXtEp4O9ft+9cPxyDRlbAskWfy SzKWwHrY+je+pttNOEFKrVcSU+eHzg1qCFqxVNQCIpmyzHuiJMK/zjnZCpVBKIyLSStR khgIkPZjgAlPXjrTm26LYJXo4b79yHsok1CJ24Edbm07o7VppIRGjricON70tivKbdIv T72Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=L3aKW+Lc; 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 bm25-20020a05620a199900b0071b14ed19f6si9404018qkb.215.2023.02.12.23.09.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 23:09:51 -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=L3aKW+Lc; 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 1pRSxI-0000lW-L4; Mon, 13 Feb 2023 02:08:52 -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 1pRSxH-0000hJ-53 for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:08:51 -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 1pRSxF-0001ny-Hc for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:08:50 -0500 Received: by mail-wr1-x42d.google.com with SMTP id o18so11074366wrj.3 for ; Sun, 12 Feb 2023 23:08:49 -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=L3aKW+LchH1HrxXhm5hLdl6Zq1Y/TuSg7p65IwM8x599O5chOKRo2cUdBzgpL519lq 7o5tG7wWtNV57jlnCgQCq2dvCfjA0/JCaInFDFS9pTx3kZMQa0VVhuBd3mKu4bC33kz5 l4tt4yr4z3i6sXmUpp1OX664e+uBYDiq56J30kLdmtpulGaa/YUZnbSDshHygCMdkoWW Rh7mNiEtbepJX76jMBqcilhlDo2iK3OuSrBlIi6NErF4rXJQJdqf1v1wL0kA0qMFOvkO LagTTyG4rnys7duHzgiIqiEBYPerTzXDDDxdVKoKZk77h/wpGzZxymkxJKTF7ALN7B2U AeUw== 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=TMzTArKuiHH6FxwLdd5pmRlBPOv/H+YztmhG3SCqXZz01x2X8dAKXB18v2nwfxDpiN l6mjMpA5Fv9h+z7FbgEJ3HQ/brYMxG/iLOHGBIPmy8r7YaAx34XI6bN0MclLCODe319s JTlPxhuJNH7XCzksLYnqD8hpblMHyCAPi49kPZn0mYrGNeFAPKagjww9VexBxdxy9n/8 MA6lSRMWF79pgcgy9XHFkYuiOMEkZcskmLk49z8wME6e60J1GYMN2JkO5Zyw06dSDKgz y/gtJLCJDPJwPw6VO+4C3NvqsgZLbowfYits29gbqRqsqUD+9GKpH/15bqPTW+Z/jMes u1LA== X-Gm-Message-State: AO0yUKUV1jy7rhWRBDKt1YCfFEcJhQer83SU/Uu9Igbwi01sO4xlMdXa hAD7FIYeNFj085V17cSCxpFxl9c3wjM+n9Wk X-Received: by 2002:adf:ffc3:0:b0:2c5:4154:9f32 with SMTP id x3-20020adfffc3000000b002c541549f32mr8981840wrs.65.1676272128612; Sun, 12 Feb 2023 23:08:48 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id d7-20020adfe887000000b002c551f7d452sm4453690wrm.98.2023.02.12.23.08.47 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 23:08:48 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Eduardo Habkost Cc: qemu-block@nongnu.org, Thomas Huth , Li Qiang , qemu-s390x@nongnu.org, Hu Tao , Gonglei Arei , Cao jin , xiaoqiang zhao , Paolo Bonzini , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , "Michael S. Tsirkin" , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PATCH v2 05/19] hw/char/serial-pci-multi: Replace DO_UPCAST() by PCI_MULTISERIAL() Date: Mon, 13 Feb 2023 08:08:06 +0100 Message-Id: <20230213070820.76881-6-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230213070820.76881-1-philmd@linaro.org> References: <20230213070820.76881-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=philmd@linaro.org; helo=mail-wr1-x42d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Use the 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);