[<prev] [next>] [day] [month] [year] [list]
Message-ID: <31351d94-91ba-b0fe-cb20-3dcc8254fb66@redhat.com>
Date: Wed, 30 Nov 2022 11:09:59 +0100
From: Javier Martinez Canillas <javierm@...hat.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: dri-devel@...ts.freedesktop.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
kunit-dev@...glegroups.com, linux-media@...r.kernel.org,
linux-kselftest@...r.kernel.org, linaro-mm-sig@...ts.linaro.org,
Brendan Higgins <brendan.higgins@...ux.dev>,
MaĆra Canal <mairacanal@...eup.net>,
Dave Stevenson <dave.stevenson@...pberrypi.com>,
linux-kernel@...r.kernel.org, David Gow <davidgow@...gle.com>
Subject: Re: [PATCH v2 16/17] drm/vc4: tests: Fail the current test if we
access a register
On 11/28/22 15:53, Maxime Ripard wrote:
> Accessing a register when running under kunit is a bad idea since our
> device is completely mocked.
>
> Fail the current test if we ever access any of our hardware registers.
>
> Signed-off-by: Maxime Ripard <maxime@...no.tech>
> ---
[...]
> -#define CRTC_WRITE(offset, val) writel(val, vc4_crtc->regs + (offset))
> -#define CRTC_READ(offset) readl(vc4_crtc->regs + (offset))
> +#define CRTC_WRITE(offset, val) \
> + do { \
> + kunit_fail_current_test("Accessing a register in a unit test!\n"); \
> + writel(val, vc4_crtc->regs + (offset)); \
> + } while (0)
> +
> +#define CRTC_READ(offset) \
> + ({ \
> + kunit_fail_current_test("Accessing a register in a unit test!\n"); \
> + readl(vc4_crtc->regs + (offset)); \
> + })
>
Should this be made conditional on whether DRM_VC4_KUNIT_TEST is enabled ?
That is, just define the simpler macros when is disabled? The kunit_fail_current_test()
is just a no-op if CONFIG_KUNIT isn't enabled, but I think my question still stands.
Reviewed-by: Javier Martinez Canillas <javierm@...hat.com>
--
Best regards,
Javier Martinez Canillas
Core Platforms
Red Hat
Powered by blists - more mailing lists