From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 DD1A0C07E9D for ; Mon, 26 Sep 2022 09:37:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=SV0qkCPbpKVhnuP8DcdwaW5ZsfOnBwBAP04bMyY5OHQ=; b=vN4eUab+BcEpvnZgQqSaEblbTf vr23bd4wv68GwBm8gq3mMLA9NmmZuorIj8mEseKJtaSJsQmgAqliW2fcXtjH7mkbfIAL1WsQRGXZy 68MbvLCRndZL2GUiENL209g8vkVkpLFQHgpHyvpuMbUPvx2imog+CZPWm1fLsDha/VbmBd/nx1Ghg DqiG5fspm12EoyS600WXqP/larB23yIuVrTOq8YtP+tiXcORxr9VBl26M6snn+I0NYMJDiRJWHOH3 LkE7/G8DO+COcL9ZSQL8sgFLtKCtCno5CYKyVByLifsxkZGZX0u7bdgC/V3KNWx/8zHhwsuZQENaW CKNqO89Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ockXK-003geh-Mm; Mon, 26 Sep 2022 09:36:26 +0000 Received: from wnew3-smtp.messagingengine.com ([64.147.123.17]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ockXG-003gbI-Mm for linux-arm-kernel@lists.infradead.org; Mon, 26 Sep 2022 09:36:24 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.west.internal (Postfix) with ESMTP id A27792B0689B; Mon, 26 Sep 2022 05:36:16 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 26 Sep 2022 05:36:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc: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=1664184976; x=1664192176; bh=iMhV2MQCYE l08x7MCNwj+bMXhT0kipZzBnwNpIfB8gg=; b=nJeRGFALZvB203VwJ3MiqZV0H9 SgOgeQdWX4BuXqw5zho/RS25xCKP8KzdQRqm2mCuyRCuOyNsg99A+lAMh76HqDOD x+eTg6WYdZgrHKS0zSICLvO8j/3SJP13HCCOJDkPl0uPhzva8dlItg1Ao8XIGumK Vbx9nh+ELeMIBIDKskokk2eSRhBBTy+Ebrn/rCkgwq5UieGaMJkByqoK+baIJH2C 5/HTEUfuOUF0Aewimr0CqDc5o4qad0/cuXBZvtQDDPTeP6obnNVGzbrPy1O7EYyt KA2581CvfZVH/CjRitmTgJKzFxhYz6lW5pJezzh6VmVJ0W1Vk1jK/Rf7r3oA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc: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= fm2; t=1664184976; x=1664192176; bh=iMhV2MQCYEl08x7MCNwj+bMXhT0k ipZzBnwNpIfB8gg=; b=SvSPhEi02+Ihox7kOmDVhX4pbeqMyi4CJjvjX99cbEyr +Smb2FJx3Ykc2JdeOsoir0jS89/4SjDKcOp0VS69YroKe5ZScShh/wzbeal++grP T3kz/sLVTtvTxyWcC7amFT8p0IQ7unvvIhjLZMctMR9p2aebfl5O2flACUCM2iCZ 2P5b3wXbgjghbYrR6Kyohv5VMzKI7Yp0WJKOOxliNMEAlU2NYmH7nDfcOatZJmwA R60diWPuTdqMHff6/EjwHJOUIq8bKG5D5uiy2lrUcwW+cHnxd0gbHlloPbAiVSxw 3+0du3C5VZZ06FibJPIilHWQYsr44TrJRhrXkcRR1Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeegvddgudelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesghdtreertddtudenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeejveefheefkeeiffegveelveetgffffeektdefuefhtedtgeejhefggedu ffffudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 26 Sep 2022 05:36:14 -0400 (EDT) Date: Mon, 26 Sep 2022 11:36:12 +0200 From: Maxime Ripard To: Noralf =?utf-8?Q?Tr=C3=B8nnes?= Cc: Jernej Skrabec , Rodrigo Vivi , Ben Skeggs , David Airlie , Joonas Lahtinen , Emma Anholt , Karol Herbst , Samuel Holland , Jani Nikula , Thomas Zimmermann , Daniel Vetter , Lyude Paul , Maarten Lankhorst , Tvrtko Ursulin , Chen-Yu Tsai , Hans de Goede , nouveau@lists.freedesktop.org, Geert Uytterhoeven , Dave Stevenson , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Phil Elwell , intel-gfx@lists.freedesktop.org, Dom Cobley , linux-sunxi@lists.linux.dev, Mateusz Kwiatkowski , dri-devel@lists.freedesktop.org Subject: Re: [PATCH v2 02/33] drm/tests: Add Kunit Helpers Message-ID: <20220926093612.wvbou2srbo3uinar@houat> References: <20220728-rpi-analog-tv-properties-v2-0-f733a0ed9f90@cerno.tech> <20220728-rpi-analog-tv-properties-v2-2-f733a0ed9f90@cerno.tech> <3f7000ab-b845-a7e8-f215-02121da779b7@tronnes.org> MIME-Version: 1.0 In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220926_023623_257593_CA450F7B X-CRM114-Status: GOOD ( 23.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============2619777171901995342==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============2619777171901995342== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="wdbx6g5pylyw5se6" Content-Disposition: inline --wdbx6g5pylyw5se6 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Noralf, On Sat, Sep 24, 2022 at 08:06:17PM +0200, Noralf Tr=F8nnes wrote: > Den 24.09.2022 19.56, skrev Noralf Tr=F8nnes: > >=20 > >=20 > > Den 22.09.2022 16.25, skrev Maxime Ripard: > >> As the number of kunit tests in KMS grows further, we start to have > >> multiple test suites that, for example, need to register a mock DRM > >> driver to interact with the KMS function they are supposed to test. > >> > >> Let's add a file meant to provide those kind of helpers to avoid > >> duplication. > >> > >> Signed-off-by: Maxime Ripard > >> > >> diff --git a/drivers/gpu/drm/tests/Makefile b/drivers/gpu/drm/tests/Ma= kefile > >> index 2d9f49b62ecb..b29ef1085cad 100644 > >> --- a/drivers/gpu/drm/tests/Makefile > >> +++ b/drivers/gpu/drm/tests/Makefile > >> @@ -8,6 +8,7 @@ obj-$(CONFIG_DRM_KUNIT_TEST) +=3D \ > >> drm_format_helper_test.o \ > >> drm_format_test.o \ > >> drm_framebuffer_test.o \ > >> + drm_kunit_helpers.o \ > >> drm_mm_test.o \ > >> drm_plane_helper_test.o \ > >> drm_rect_test.o > >> diff --git a/drivers/gpu/drm/tests/drm_kunit_helpers.c b/drivers/gpu/d= rm/tests/drm_kunit_helpers.c > >> new file mode 100644 > >> index 000000000000..7ebd620481c1 > >> --- /dev/null > >> +++ b/drivers/gpu/drm/tests/drm_kunit_helpers.c > >> @@ -0,0 +1,54 @@ > >> +#include > >> +#include > >> + > >> +#include > >> + > >> +static const struct drm_mode_config_funcs drm_mode_config_funcs =3D { > >> +}; > >> + > >> +static const struct drm_driver drm_mode_driver =3D { > >> +}; > >> + > >> +static void drm_kunit_free_device(struct drm_device *drm, void *ptr) > >> +{ > >> + struct device *dev =3D ptr; > >> + > >> + root_device_unregister(dev); > >> +} > >> + > >> +struct drm_device *drm_kunit_device_init(const char *name) > >> +{ > >> + struct drm_device *drm; > >> + struct device *dev; > >> + int ret; > >> + > >> + dev =3D root_device_register(name); > >> + if (IS_ERR(dev)) > >> + return ERR_CAST(dev); > >> + > >> + drm =3D drm_dev_alloc(&drm_mode_driver, dev); > >=20 > > I can't find drm being freed anywhere? > > Maybe you could assign it to drm->managed.final_kfree. There's a drm_dev_put in the test_exit hook which should free it. > Perhaps a better solution would be to use devm_drm_dev_alloc() and > unregister the root device on exit. That avoids reaching into the drm > managed internals and it looks more like a regular driver. But yeah, this is a good idea, I'll do it. Maxime --wdbx6g5pylyw5se6 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCYzFyjAAKCRDj7w1vZxhR xfL5AP9r8SOCVdiPcnR+tkP1VdDT4xdxvsJmgcz60MJ5iuvezwEAwp/UpYjOSXCb YrQ0Vm/0KNnlKIDIInbF28eMSo1bSw0= =31r4 -----END PGP SIGNATURE----- --wdbx6g5pylyw5se6-- --===============2619777171901995342== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============2619777171901995342==--