lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <0ae37916-ecc1-d97c-6a98-c8008fdd05f6@igalia.com>
Date:   Mon, 28 Nov 2022 17:01:20 -0300
From:   Maíra Canal <mcanal@...lia.com>
To:     Maxime Ripard <maxime@...no.tech>, Daniel Vetter <daniel@...ll.ch>,
        Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
        Maxime Ripard <mripard@...nel.org>,
        David Airlie <airlied@...il.com>,
        Thomas Zimmermann <tzimmermann@...e.de>
Cc:     David Gow <davidgow@...gle.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Dave Stevenson <dave.stevenson@...pberrypi.com>,
        Javier Martinez Canillas <javierm@...hat.com>,
        dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
        linaro-mm-sig@...ts.linaro.org,
        Brendan Higgins <brendan.higgins@...ux.dev>,
        linux-kselftest@...r.kernel.org, kunit-dev@...glegroups.com,
        linux-media@...r.kernel.org
Subject: Re: [PATCH v2 06/17] drm/tests: helpers: Switch to a platform_device

On 11/28/22 11:53, Maxime Ripard wrote:
> 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 <javierm@...hat.com>
> Signed-off-by: Maxime Ripard <maxime@...no.tech>

Reviewed-by: Maíra Canal <mcanal@...lia.com>

Best Regards,
- 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 <kunit/resource.h>
>  
>  #include <linux/device.h>
> +#include <linux/platform_device.h>
>  
>  #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);
>  
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ