mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
drm/vc4: tests: Switch generation mockup to a switch
Testing whether the VideoCore generation we want to mock is vc5 or vc4 worked so far, but will be difficult to extend to support BCM2712 (VC6). Convert to a switch. Signed-off-by: Maxime Ripard <maxime@cerno.tech>
This commit is contained in:
committed by
Dom Cobley
parent
1722c49312
commit
987f4325b0
@@ -157,13 +157,27 @@ KUNIT_DEFINE_ACTION_WRAPPER(kunit_action_drm_dev_unregister,
|
|||||||
|
|
||||||
static struct vc4_dev *__mock_device(struct kunit *test, enum vc4_gen gen)
|
static struct vc4_dev *__mock_device(struct kunit *test, enum vc4_gen gen)
|
||||||
{
|
{
|
||||||
|
const struct vc4_mock_desc *desc;
|
||||||
|
const struct drm_driver *drv;
|
||||||
struct drm_device *drm;
|
struct drm_device *drm;
|
||||||
const struct drm_driver *drv = (gen == VC4_GEN_5) ? &vc5_drm_driver : &vc4_drm_driver;
|
|
||||||
const struct vc4_mock_desc *desc = (gen == VC4_GEN_5) ? &vc5_mock : &vc4_mock;
|
|
||||||
struct vc4_dev *vc4;
|
struct vc4_dev *vc4;
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
switch (gen) {
|
||||||
|
case VC4_GEN_4:
|
||||||
|
drv = &vc4_drm_driver;
|
||||||
|
desc = &vc4_mock;
|
||||||
|
break;
|
||||||
|
case VC4_GEN_5:
|
||||||
|
drv = &vc5_drm_driver;
|
||||||
|
desc = &vc5_mock;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
dev = drm_kunit_helper_alloc_device(test);
|
dev = drm_kunit_helper_alloc_device(test);
|
||||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dev);
|
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dev);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user