From patchwork Tue May 23 06:12:05 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: 684884 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1548998wrt; Mon, 22 May 2023 23:13:24 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5mNV1M+jLusLCs3dLJ2b8vJce1saGg4X5jMVQH56QrWynjP9qIipbCq4qFHi+Mx+jHbjcE X-Received: by 2002:a05:620a:8fcc:b0:75b:23a1:3638 with SMTP id rj12-20020a05620a8fcc00b0075b23a13638mr2957583qkn.73.1684822404544; Mon, 22 May 2023 23:13:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684822404; cv=none; d=google.com; s=arc-20160816; b=rFrKNsxFvs8NBjhqvCkfxT4oj9UyMOgFKWfupOynKYWO2XZ1aTz/DjIq65n//BIyyo +itUE7iB/aVSeMXntCi5/2auHjCAAKoQ8zdDIhVSQnoc7IJj37HW+mhqwVf02g96lqVB Og1lMJlbo42/kCo/KCKAQzXdhzATy6Q3iDB5gZs4tlOB/d/d+7kam1a1Thk0wVsFGlLA Sm9H1zmqMDwGmDhGcnIvFSHMtMKvbKliHgR9B8WD+13R1OHam1GjG3sQBK1G9poTMCzI k2eNJI93ryzjlATCn/T8NXc/+E/m7Pw6DuuG536fnixjHPJytngGkkwCwxxwdeZRB/tp cLGw== 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=rQwCIhldMwC77ntdeaeg6sH3aScyUcbooXBZJsXEYow=; b=guqRKkm4dKZA9UrJB1nrwWL/sKO7GLLndITJTDisfejeZ3lUai8t1hQlLpJOg/+lgT /nU7rVzPhDHawjzP/MEXNwuTZrK0AdUldYpEfNyec/cIxW0XLsqpOTVkWgmXBEi/uN9h x/32yc4ePzm7hYlShLMUWtxG2JKYpAnnw1geFtkRSQ+LOijcqmVu77/IFaSNDbTUVwkT uGM1phgr85zwSPtOmSCYt8Inn4aTUZqAODoQloWhu3anSoCD/7RIRqiF7MsTdP/42avB Uq1ycSBxUyfYP0RqIw6Wia3r9jQQOxRLeUHNj+cJEE+22EXCK4wHaP4FgMPC39xmQcrh sI/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Yeb5fJ89; 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 v1-20020ae9e301000000b0075947ef3253si1743325qkf.166.2023.05.22.23.13.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 May 2023 23:13:24 -0700 (PDT) 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=Yeb5fJ89; 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 1q1LGA-00009j-Ur; Tue, 23 May 2023 02:12:44 -0400 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 1q1LFx-000054-2B for qemu-devel@nongnu.org; Tue, 23 May 2023 02:12:28 -0400 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 1q1LFv-0005H4-JE for qemu-devel@nongnu.org; Tue, 23 May 2023 02:12:24 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-3f423521b10so44793435e9.0 for ; Mon, 22 May 2023 23:12:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684822341; x=1687414341; 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=rQwCIhldMwC77ntdeaeg6sH3aScyUcbooXBZJsXEYow=; b=Yeb5fJ899eSOVzWUQqQyU1B7T8QMepA6aHQyF0ZqFxmvauCEok2oxk7EnRoPf4eW63 ewHT8q/aPGmJM01UU54a5byzgyodo1ERoDAl6wn4WKTmB2L3nFSo6aLlFS08AcHXpWu8 ZRFfHVTj7whIlD2+v/Abh7+bW9DJr9zV01nxlLtUWViDo5YzYBV30uC6j0aLh837X4F3 xzTZAjyur9422cT00+ama/ZqWVJ5dOjbI2xaKzEbdqCl+OVHtAuYZuvqcWeF1YT1iesb Yqbi4fXITwtnVKnFI1DM34dBtrTE/dCh6AJx8rrcRwMkB2xapEyApiEYnBGaVhwwJlvD rMjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684822341; x=1687414341; 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=rQwCIhldMwC77ntdeaeg6sH3aScyUcbooXBZJsXEYow=; b=Xq3+Ge8Hj3uyuHPxl6Ix9Y0EDafSVY3rNR4dR3suX4D8QD4li/wyof1fqlwQ6Xhj1n 7T8orNaxnSFzrygTeOb1lDFt9v1dEJD7uiXE4oF+iTMzIx55lOt7WnrobymTi9Ss3xwW J/sMrNCim+Oe5mXYEpuVqpowm7/S1W5I79FyJer5fP4xbbbx8lqsU/fcejmS3/urF/m+ eR2Rdl2tD2ZzN0tScpWXippme5DD0vvLMqJM6glI2wTc9+N5uIXpyoESRf3xsnhPLylr w/g9hmkZRp/ktFKCCk+tNDFR3/9lOySgpPBL3H349BajcBZJpbfODy5z3U4/jxdru6I/ 3R4A== X-Gm-Message-State: AC+VfDxVislYWG2TrjP8PK4kcaTTsgxBmRfnxMc605Gw82b3S197C7+8 MUZ2xq0X/n177zFhPALcvtf5PLnayCb3pJSbynM= X-Received: by 2002:a7b:c8cb:0:b0:3f6:2d8:4823 with SMTP id f11-20020a7bc8cb000000b003f602d84823mr5043528wml.3.1684822341801; Mon, 22 May 2023 23:12:21 -0700 (PDT) Received: from localhost.localdomain (vil69-h02-176-184-48-94.dsl.sta.abo.bbox.fr. [176.184.48.94]) by smtp.gmail.com with ESMTPSA id n16-20020a1c7210000000b003f6042d6d92sm5888628wmc.46.2023.05.22.23.12.20 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 22 May 2023 23:12:21 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Sergio Lopez , "Michael S. Tsirkin" , Eduardo Habkost , qemu-trivial@nongnu.org, Richard Henderson , Gerd Hoffmann , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?q?aud=C3=A9?= Subject: [PATCH 2/4] hw/i386/microvm: Simplify using object_dynamic_cast() Date: Tue, 23 May 2023 08:12:05 +0200 Message-Id: <20230523061207.48818-3-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230523061207.48818-1-philmd@linaro.org> References: <20230523061207.48818-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, T_SCC_BODY_TEXT_LINE=-0.01 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 object_dynamic_cast() to determine if 'dev' is a TYPE_VIRTIO_MMIO. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Sergio Lopez --- hw/i386/microvm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c index 3d606a20b4..7227a2156c 100644 --- a/hw/i386/microvm.c +++ b/hw/i386/microvm.c @@ -389,9 +389,8 @@ static void microvm_fix_kernel_cmdline(MachineState *machine) bus = sysbus_get_default(); QTAILQ_FOREACH(kid, &bus->children, sibling) { DeviceState *dev = kid->child; - ObjectClass *class = object_get_class(OBJECT(dev)); - if (class == object_class_by_name(TYPE_VIRTIO_MMIO)) { + if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_MMIO)) { VirtIOMMIOProxy *mmio = VIRTIO_MMIO(OBJECT(dev)); VirtioBusState *mmio_virtio_bus = &mmio->bus; BusState *mmio_bus = &mmio_virtio_bus->parent_obj;