From patchwork Wed Nov 23 15:25:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13053845 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 69374C433FE for ; Wed, 23 Nov 2022 15:29:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AD47910E57B; Wed, 23 Nov 2022 15:29:04 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id D981D10E578 for ; Wed, 23 Nov 2022 15:28:57 +0000 (UTC) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id B8E8E2B069B3; Wed, 23 Nov 2022 10:28:54 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Wed, 23 Nov 2022 10:28:57 -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=1669217334; x= 1669224534; bh=OCPbhljzvk72Vfl4x08gLdtbrlb3aio1+U3w+NiS6bE=; b=i XtpDOspTj/uf3o4H/se2YK2nZmY2JAW/+hAWAefYhQU2dtgGkTg1LAhaGNBFWt5C 9++vUh+iDUW5SrMyI2A/Uh8JPLASviaDAN4WN9Xtml1JJT0xsObrnJDBl8co9NHa tXnkVingUo3bCnF1xPAY1ZO5LCy5gFqbBiJ4BWwYZOuPDKMN2oviqLTML4fvs+ex pKfUYnB2e41zE2UnVfzOmHGE01GZYyfqBN4U0+njcs44rWt35Xmrx+97q8Bd1Fff hstuoL1eXy0ujivkGoJlTRCr7LoHMDYuWd33HKONz1neNgAgPJlQyTIsFDDT78vU 2rxg0Z5mffBDk+ITSdDug== 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=1669217334; x= 1669224534; bh=OCPbhljzvk72Vfl4x08gLdtbrlb3aio1+U3w+NiS6bE=; b=R fSVazmDyRB/twNEsqCPa0kI1RnNpY/8R+EBaANoPTDomjTSiubr2rcMaS0Gv+tUK KCp0EwNZEtRy3KkhCv9Bd3+0A4TmrfUUp30Vl7FxaZssRsaPNQ+tUhcozXsXre9s ejvxlXn6rKH8JrHbk5+4QhgU6i0ft9bgrWh6Dt7sSRMOW0rcJe08X5WVcYGpYjWJ PBcyrhDMJU6O4hSCW9UU2GvWIkTQmCBIRpcXdGPlIJBj18VF9bOlTEpCIPzCQenE 9jFd02QuMd3FdNjyMSdLUG2M0H4MmAclrxeLnxz+sv36pL4oY8pBrZs1ldsh+suU NBs1bYu4Ev9cUx0DhrPIA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedriedugdejgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeduudduhfevjeetfeegvdffvdevvdejudegudekjeehtdelhfffveethfej ledtveenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 23 Nov 2022 10:28:53 -0500 (EST) From: Maxime Ripard Date: Wed, 23 Nov 2022 16:25:46 +0100 Subject: [PATCH 04/24] drm/tests: helpers: Switch to a platform_device MIME-Version: 1.0 Message-Id: <20221123-rpi-kunit-tests-v1-4-051a0bb60a16@cerno.tech> References: <20221123-rpi-kunit-tests-v1-0-051a0bb60a16@cerno.tech> In-Reply-To: <20221123-rpi-kunit-tests-v1-0-051a0bb60a16@cerno.tech> To: Maxime Ripard , Maarten Lankhorst , Daniel Vetter , David Airlie , Thomas Zimmermann X-Mailer: b4 0.11.0-dev-d416f X-Developer-Signature: v=1; a=openpgp-sha256; l=1567; i=maxime@cerno.tech; h=from:subject:message-id; bh=vlL9ByCFVC14kkn7/3YFwUnuXrrOVTtvBOAlA7Jw1mE=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMl11tW7wiZJPtgrY+UbnaanuOgR75KgVFHpCuOKRY/iTlYf nZveUcrCIMbFICumyBIjbL4k7tSs151sfPNg5rAygQxh4OIUgIm8mMvI8C2I0VrjvnPxCZO14d9+rp f2bJeqUmtYcLbL4o3FKf6tPAz/Ax7NvvSCO/HyFFWrCZ+FLZddtErQ3LfLkPHzoVP/n0rYcgEA 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_Brendan_Higg?= =?unknown-8bit?q?ins_=3Cbrendan=2Ehiggins=40linux=2Edev=3E=2C_Greg_Kroah-Ha?= =?unknown-8bit?q?rtman_=3Cgregkh=40linuxfoundation=2Eorg=3E=2C_Dave_Stevens?= =?unknown-8bit?q?on_=3Cdave=2Estevenson=40raspberrypi=2Ecom=3E=2C_Javier_Ma?= =?unknown-8bit?q?rtinez_Canillas_=3Cjavierm=40redhat=2Ecom=3E=2C_dri-devel?= =?unknown-8bit?q?=40lists=2Efreedesktop=2Eorg=2C_linux-kernel=40vger=2Ekern?= =?unknown-8bit?q?el=2Eorg=2C_linaro-mm-sig=40lists=2Elinaro=2Eorg=2C_Ma=C3?= =?unknown-8bit?q?=ADra_Canal_=3Cmairacanal=40riseup=2Enet=3E=2C_Maxime_Ripa?= =?unknown-8bit?q?rd_=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. Signed-off-by: Maxime Ripard Reviewed-by: Javier Martinez Canillas --- drivers/gpu/drm/tests/drm_kunit_helpers.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/tests/drm_kunit_helpers.c b/drivers/gpu/drm/tests/drm_kunit_helpers.c index 2f974f45c5b4..651aa93a98a8 100644 --- a/drivers/gpu/drm/tests/drm_kunit_helpers.c +++ b/drivers/gpu/drm/tests/drm_kunit_helpers.c @@ -6,6 +6,7 @@ #include #include +#include #include "drm_kunit_helpers.h" @@ -20,12 +21,26 @@ 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(FAKE_DEVICE_NAME); + struct platform_device *pdev; + int ret; + + ret = platform_driver_register(&fake_platform_driver); + KUNIT_ASSERT_EQ(test, ret, 0); + + pdev = platform_device_alloc(FAKE_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; } 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); } struct drm_device *