• Daniel Vetter's avatar
    drm/i915/selftests: align more to real device lifetimes · cd01269d
    Daniel Vetter authored
    To avoid having to create all the device and driver scaffolding we
    just manually create and destroy a devres_group.
    
    v2: Rebased
    
    v3: use devres_open/release_group so we can use devm without real
    hacks in the driver core or having to create an entire fake bus for
    testing drivers. Might want to extract this into helpers eventually,
    maybe as a mock_drm_dev_alloc or test_drm_dev_alloc.
    
    v4:
    - Fix IS_ERR handling (Matt)
    - Delete surplus put_device() in mock_device_release (intel-gfx-ci)
    
    v5:
    - do not switch to device_add - it breaks runtime pm in the tests and
      with the devres_group_add/release no longer needed for automatic
      cleanup (CI). Update commit message to match.
    - print correct error in pr_err (Matt)
    
    v6: Remove now unused err variable (CI).
    
    v7: More warning fixes ...
    Acked-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
    Cc: Matthew Auld <matthew.william.auld@gmail.com>
    Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> (v3)
    Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
    Reviewed-by: Matthew Auld <matthew.william.auld@gmail.com> (v4)
    Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20200919134032.2488403-1-daniel.vetter@ffwll.ch
    cd01269d
mock_gem_device.c 6 KB