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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B7C6C4167D for ; Mon, 28 Nov 2022 19:49:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232999AbiK1TtU (ORCPT ); Mon, 28 Nov 2022 14:49:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233839AbiK1TtM (ORCPT ); Mon, 28 Nov 2022 14:49:12 -0500 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDC8C27CC0; Mon, 28 Nov 2022 11:49:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=VAmDay8Qe2++NlnJo/s9zmage8EXAfl6yM10J36267M=; b=KlyRebYWJtdIAFWsb7JuDb5P47 eGzD6qfJm+YoSe1Mind9vYfg8c0LAmobj0xdjme1b2dwc4aOVPUoR//F6U3oCLLNlgdN0gy3cCNqK j7DvEjZXnB78iiEHB21IKJMsSN8dbUOSjK/6p4D6N5c4hkhH8ajPdskiiHSr4wsmT+sKBBg8D0Okc f6+/KPwdvZNad7M0lxhyUbfVTFgrGHBR3eLBiI6PyJb2jdyK/rcpFDbom4RMC9ksCaFrfPBHZksUK R00qzvfLiPuSsbx/36a8/LWdceALEWrIStiv2aRmmpMVB9Qsv/Z3XI/O082SchT+1kx1l1XnimewP YIuUzNrQ==; Received: from [177.34.169.227] (helo=[192.168.0.8]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_128_GCM:128) (Exim) id 1ozk7a-00AbVH-Fp; Mon, 28 Nov 2022 20:48:54 +0100 Message-ID: Date: Mon, 28 Nov 2022 16:48:45 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [PATCH v2 05/17] drm/tests: helpers: Create the device in another function Content-Language: en-US To: Maxime Ripard , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , David Airlie , Thomas Zimmermann Cc: David Gow , Greg Kroah-Hartman , Dave Stevenson , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linaro-mm-sig@lists.linaro.org, Brendan Higgins , linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-media@vger.kernel.org References: <20221123-rpi-kunit-tests-v2-0-efe5ed518b63@cerno.tech> <20221123-rpi-kunit-tests-v2-5-efe5ed518b63@cerno.tech> From: =?UTF-8?Q?Ma=c3=adra_Canal?= In-Reply-To: <20221123-rpi-kunit-tests-v2-5-efe5ed518b63@cerno.tech> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/28/22 11:53, Maxime Ripard wrote: > We'll need in some tests to control when the device needs to be added > and removed, so let's split the device creation from the DRM device > creation function. > > Signed-off-by: Maxime Ripard Just a small nit below, Reviewed-by: Maíra Canal > > diff --git a/drivers/gpu/drm/tests/drm_probe_helper_test.c b/drivers/gpu/drm/tests/drm_probe_helper_test.c > index be61a92b79d2..438b1d42b843 100644 > --- a/drivers/gpu/drm/tests/drm_probe_helper_test.c > +++ b/drivers/gpu/drm/tests/drm_probe_helper_test.c > @@ -17,6 +17,7 @@ > > struct drm_probe_helper_test_priv { > struct drm_device *drm; > + struct device *dev; > struct drm_connector connector; > }; > > @@ -39,7 +40,10 @@ static int drm_probe_helper_test_init(struct kunit *test) > KUNIT_ASSERT_NOT_NULL(test, priv); > test->priv = priv; > > - priv->drm = drm_kunit_helper_alloc_drm_device(test, > + priv->dev = drm_kunit_helper_alloc_device(test); > + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv->dev); > + > + priv->drm = drm_kunit_helper_alloc_drm_device(test, priv->dev, > DRIVER_MODESET | DRIVER_ATOMIC); > KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv->drm); > > @@ -55,6 +59,13 @@ static int drm_probe_helper_test_init(struct kunit *test) > return 0; > } > > +static void drm_probe_helper_test_exit(struct kunit *test) > +{ > + struct drm_probe_helper_test_priv *priv = test->priv;; There are two semicolons by the end of this statement. Best Regards, - Maíra Canal > + > + drm_kunit_helper_free_device(test, priv->dev); > +} > + > typedef struct drm_display_mode *(*expected_mode_func_t)(struct drm_device *); > > struct drm_connector_helper_tv_get_modes_test { > @@ -195,6 +206,7 @@ static struct kunit_case drm_test_connector_helper_tv_get_modes_tests[] = { > static struct kunit_suite drm_test_connector_helper_tv_get_modes_suite = { > .name = "drm_connector_helper_tv_get_modes", > .init = drm_probe_helper_test_init, > + .exit = drm_probe_helper_test_exit, > .test_cases = drm_test_connector_helper_tv_get_modes_tests, > }; > > diff --git a/include/drm/drm_kunit_helpers.h b/include/drm/drm_kunit_helpers.h > index 6c12b1426ba0..b4277fe92c38 100644 > --- a/include/drm/drm_kunit_helpers.h > +++ b/include/drm/drm_kunit_helpers.h > @@ -6,8 +6,11 @@ > struct drm_device; > struct kunit; > > +struct device *drm_kunit_helper_alloc_device(struct kunit *test); > +void drm_kunit_helper_free_device(struct kunit *test, struct device *dev); > + > struct drm_device * > -drm_kunit_helper_alloc_drm_device(struct kunit *test, > +drm_kunit_helper_alloc_drm_device(struct kunit *test, struct device *dev, > u32 features); > > #endif // DRM_KUNIT_HELPERS_H_ > 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 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 663D8C4321E for ; Mon, 28 Nov 2022 19:49:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 827DF10E332; Mon, 28 Nov 2022 19:49:10 +0000 (UTC) Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id D331110E331 for ; Mon, 28 Nov 2022 19:49:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=VAmDay8Qe2++NlnJo/s9zmage8EXAfl6yM10J36267M=; b=KlyRebYWJtdIAFWsb7JuDb5P47 eGzD6qfJm+YoSe1Mind9vYfg8c0LAmobj0xdjme1b2dwc4aOVPUoR//F6U3oCLLNlgdN0gy3cCNqK j7DvEjZXnB78iiEHB21IKJMsSN8dbUOSjK/6p4D6N5c4hkhH8ajPdskiiHSr4wsmT+sKBBg8D0Okc f6+/KPwdvZNad7M0lxhyUbfVTFgrGHBR3eLBiI6PyJb2jdyK/rcpFDbom4RMC9ksCaFrfPBHZksUK R00qzvfLiPuSsbx/36a8/LWdceALEWrIStiv2aRmmpMVB9Qsv/Z3XI/O082SchT+1kx1l1XnimewP YIuUzNrQ==; Received: from [177.34.169.227] (helo=[192.168.0.8]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_128_GCM:128) (Exim) id 1ozk7a-00AbVH-Fp; Mon, 28 Nov 2022 20:48:54 +0100 Message-ID: Date: Mon, 28 Nov 2022 16:48:45 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [PATCH v2 05/17] drm/tests: helpers: Create the device in another function Content-Language: en-US To: Maxime Ripard , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , David Airlie , Thomas Zimmermann References: <20221123-rpi-kunit-tests-v2-0-efe5ed518b63@cerno.tech> <20221123-rpi-kunit-tests-v2-5-efe5ed518b63@cerno.tech> From: =?UTF-8?Q?Ma=c3=adra_Canal?= In-Reply-To: <20221123-rpi-kunit-tests-v2-5-efe5ed518b63@cerno.tech> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: linux-kselftest@vger.kernel.org, Dave Stevenson , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Javier Martinez Canillas , linaro-mm-sig@lists.linaro.org, Brendan Higgins , David Gow , linux-media@vger.kernel.org, kunit-dev@googlegroups.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On 11/28/22 11:53, Maxime Ripard wrote: > We'll need in some tests to control when the device needs to be added > and removed, so let's split the device creation from the DRM device > creation function. > > Signed-off-by: Maxime Ripard Just a small nit below, Reviewed-by: Maíra Canal > > diff --git a/drivers/gpu/drm/tests/drm_probe_helper_test.c b/drivers/gpu/drm/tests/drm_probe_helper_test.c > index be61a92b79d2..438b1d42b843 100644 > --- a/drivers/gpu/drm/tests/drm_probe_helper_test.c > +++ b/drivers/gpu/drm/tests/drm_probe_helper_test.c > @@ -17,6 +17,7 @@ > > struct drm_probe_helper_test_priv { > struct drm_device *drm; > + struct device *dev; > struct drm_connector connector; > }; > > @@ -39,7 +40,10 @@ static int drm_probe_helper_test_init(struct kunit *test) > KUNIT_ASSERT_NOT_NULL(test, priv); > test->priv = priv; > > - priv->drm = drm_kunit_helper_alloc_drm_device(test, > + priv->dev = drm_kunit_helper_alloc_device(test); > + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv->dev); > + > + priv->drm = drm_kunit_helper_alloc_drm_device(test, priv->dev, > DRIVER_MODESET | DRIVER_ATOMIC); > KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv->drm); > > @@ -55,6 +59,13 @@ static int drm_probe_helper_test_init(struct kunit *test) > return 0; > } > > +static void drm_probe_helper_test_exit(struct kunit *test) > +{ > + struct drm_probe_helper_test_priv *priv = test->priv;; There are two semicolons by the end of this statement. Best Regards, - Maíra Canal > + > + drm_kunit_helper_free_device(test, priv->dev); > +} > + > typedef struct drm_display_mode *(*expected_mode_func_t)(struct drm_device *); > > struct drm_connector_helper_tv_get_modes_test { > @@ -195,6 +206,7 @@ static struct kunit_case drm_test_connector_helper_tv_get_modes_tests[] = { > static struct kunit_suite drm_test_connector_helper_tv_get_modes_suite = { > .name = "drm_connector_helper_tv_get_modes", > .init = drm_probe_helper_test_init, > + .exit = drm_probe_helper_test_exit, > .test_cases = drm_test_connector_helper_tv_get_modes_tests, > }; > > diff --git a/include/drm/drm_kunit_helpers.h b/include/drm/drm_kunit_helpers.h > index 6c12b1426ba0..b4277fe92c38 100644 > --- a/include/drm/drm_kunit_helpers.h > +++ b/include/drm/drm_kunit_helpers.h > @@ -6,8 +6,11 @@ > struct drm_device; > struct kunit; > > +struct device *drm_kunit_helper_alloc_device(struct kunit *test); > +void drm_kunit_helper_free_device(struct kunit *test, struct device *dev); > + > struct drm_device * > -drm_kunit_helper_alloc_drm_device(struct kunit *test, > +drm_kunit_helper_alloc_drm_device(struct kunit *test, struct device *dev, > u32 features); > > #endif // DRM_KUNIT_HELPERS_H_ >