From patchwork Mon Nov 28 14:53:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13057637 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 32C05C43217 for ; Mon, 28 Nov 2022 14:57:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 310D410E207; Mon, 28 Nov 2022 14:57:17 +0000 (UTC) Received: from wnew1-smtp.messagingengine.com (wnew1-smtp.messagingengine.com [64.147.123.26]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6CF2A10E1FD for ; Mon, 28 Nov 2022 14:57:11 +0000 (UTC) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.west.internal (Postfix) with ESMTP id C33172B04FDA; Mon, 28 Nov 2022 09:57:07 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Mon, 28 Nov 2022 09:57:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1669647427; x= 1669654627; bh=3jM1lFpUvid9dL8xbYzBjvihYXMZQEDhHtBPP0SyarI=; b=d VnpaZfinNiAH/tdfbeKg1gxVVl6mk3HeKH9W+u5ZMKfM1lNFVuJKEOG79mGzdL2k dDxLP27Ua2TBSA5Oz/BnDdbB2FVYEMTR5pYBVkHzMzpuqhmhtcAsVokdQLz8SrsZ gAVy2B1kfBbaufD/RqZw+1A+wyiCbgkhoQPG9HRXsEK2a1ZRDoIrASGZ29a13LIj p5H//H34wOeSSWUADeF9pd15Bc3nMWs5tG0f2ygMPddDNEVSDJu0CkZIoX46FAU6 QzUO1Gh1ChW/wsJ00DgNGiVaVUabr3a64bcX5mc7FR43msRqDukHma5Jo0bazFrI yPAWydFqrja0c09MwW7oA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1669647427; x= 1669654627; bh=3jM1lFpUvid9dL8xbYzBjvihYXMZQEDhHtBPP0SyarI=; b=X j88QF+w6o3q7D/akegJ4mlKIG0E6FJhRmmrAC/wktVBnzMLEUYGmCP6DhZqxBKvZ 1jDzeouSYvgxEXnqNn0Ze4//1J2GkIDIrKQIH8K5Qnc7teEj4Yl7jKr0KSxoQktC NY66dUBM6RsLYA8TO2ktXDkGbJcIq3D1V3ekTfVwtcMbeXkMu2i9erK112vBi4lh DXHnuKrm3TAzlJ820wWaVvYrqt6FSqc4HPAL8atGKlDHUPCKWpSEyvrovIPhj9e8 gsm+i6WsDLKL9Lrh4Y+PCF+FbfaaJmzmsq8JMF+VCbb2RPz2k82APN8aGAn6ykyV wKkRYCMu2wOQApH9Xqm2w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrjedvgdejvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 28 Nov 2022 09:57:06 -0500 (EST) From: Maxime Ripard Date: Mon, 28 Nov 2022 15:53:35 +0100 Subject: [PATCH v2 06/17] drm/tests: helpers: Switch to a platform_device MIME-Version: 1.0 Message-Id: <20221123-rpi-kunit-tests-v2-6-efe5ed518b63@cerno.tech> References: <20221123-rpi-kunit-tests-v2-0-efe5ed518b63@cerno.tech> In-Reply-To: <20221123-rpi-kunit-tests-v2-0-efe5ed518b63@cerno.tech> To: Daniel Vetter , Maarten Lankhorst , Maxime Ripard , David Airlie , Thomas Zimmermann X-Mailer: b4 0.11.0-dev-d416f X-Developer-Signature: v=1; a=openpgp-sha256; l=1696; i=maxime@cerno.tech; h=from:subject:message-id; bh=mqiACPZnDbOIQIFxcYqDVu9/u1XR2zsC5mwvrG+GQrs=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMktp8vSqzU0p7InMRZPvsOw3PHS19+lOWkHrBcGhL56sO// 8WmzO0pZGMS4GGTFFFlihM2XxJ2a9bqTjW8ezBxWJpAhDFycAjCRaQyMDJs4uVpWvPO+8kmUmTVc8P LGxXz750VZ7OXtZt67vVF2/l1GhskW8wWX8t1RS/ww6Zv47YDZWc5snkwt6/Yr1Nfv8Q3qYAIA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?unknown-8bit?q?David_Gow_=3Cdavidgow=40google=2Ecom=3E=2C_Ma=C3=ADra_C?= =?unknown-8bit?q?anal_=3Cmairacanal=40riseup=2Enet=3E=2C_Greg_Kroah-Hartman?= =?unknown-8bit?q?_=3Cgregkh=40linuxfoundation=2Eorg=3E=2C_Dave_Stevenson_?= =?unknown-8bit?q?=3Cdave=2Estevenson=40raspberrypi=2Ecom=3E=2C_Javier_Marti?= =?unknown-8bit?q?nez_Canillas_=3Cjavierm=40redhat=2Ecom=3E=2C_dri-devel=40l?= =?unknown-8bit?q?ists=2Efreedesktop=2Eorg=2C_linux-kernel=40vger=2Ekernel?= =?unknown-8bit?q?=2Eorg=2C_linaro-mm-sig=40lists=2Elinaro=2Eorg=2C_Brendan_?= =?unknown-8bit?q?Higgins_=3Cbrendan=2Ehiggins=40linux=2Edev=3E=2C_Maxime_Ri?= =?unknown-8bit?q?pard_=3Cmaxime=40cerno=2Etech=3E=2C_linux-kselftest=40vger?= =?unknown-8bit?q?=2Ekernel=2Eorg=2C_kunit-dev=40googlegroups=2Ecom=2C_linux?= =?unknown-8bit?q?-media=40vger=2Ekernel=2Eorg?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The device managed resources are ran if the device has bus, which is not the case of a root_device. Let's use a platform_device instead. Reviewed-by: Javier Martinez Canillas Signed-off-by: Maxime Ripard Reviewed-by: MaĆ­ra Canal --- drivers/gpu/drm/tests/drm_kunit_helpers.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/tests/drm_kunit_helpers.c b/drivers/gpu/drm/tests/drm_kunit_helpers.c index 9fb045fa685f..15678ab823b0 100644 --- a/drivers/gpu/drm/tests/drm_kunit_helpers.c +++ b/drivers/gpu/drm/tests/drm_kunit_helpers.c @@ -7,6 +7,7 @@ #include #include +#include #define KUNIT_DEVICE_NAME "drm-kunit-mock-device" @@ -32,7 +33,16 @@ static const struct drm_mode_config_funcs drm_mode_config_funcs = { */ struct device *drm_kunit_helper_alloc_device(struct kunit *test) { - return root_device_register(KUNIT_DEVICE_NAME); + struct platform_device *pdev; + int ret; + + pdev = platform_device_alloc(KUNIT_DEVICE_NAME, PLATFORM_DEVID_NONE); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, pdev); + + ret = platform_device_add(pdev); + KUNIT_ASSERT_EQ(test, ret, 0); + + return &pdev->dev; } EXPORT_SYMBOL(drm_kunit_helper_alloc_device); @@ -45,7 +55,9 @@ EXPORT_SYMBOL(drm_kunit_helper_alloc_device); */ void drm_kunit_helper_free_device(struct kunit *test, struct device *dev) { - root_device_unregister(dev); + struct platform_device *pdev = to_platform_device(dev); + + platform_device_unregister(pdev); } EXPORT_SYMBOL(drm_kunit_helper_free_device);