Commit 82be0d75 authored by Daniel Vetter's avatar Daniel Vetter

drm/i915/selftest: Create mock_destroy_device

Just some prep work before we rework the lifetime handling, which
requires replacing all the drm_dev_put in selftests by something else.

v2: Don't go with a static inline, upsets the header tests and
separation.
Acked-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200918132505.2316382-2-daniel.vetter@ffwll.ch
parent c7b36061
......@@ -1617,7 +1617,7 @@ int i915_gem_huge_page_mock_selftests(void)
out_put:
i915_vm_put(&ppgtt->vm);
out_unlock:
drm_dev_put(&dev_priv->drm);
mock_destroy_device(dev_priv);
return err;
}
......
......@@ -1997,7 +1997,7 @@ int i915_gem_context_mock_selftests(void)
err = i915_subtests(tests, i915);
drm_dev_put(&i915->drm);
mock_destroy_device(i915);
return err;
}
......
......@@ -272,7 +272,7 @@ int i915_gem_dmabuf_mock_selftests(void)
err = i915_subtests(tests, i915);
drm_dev_put(&i915->drm);
mock_destroy_device(i915);
return err;
}
......
......@@ -85,7 +85,7 @@ int i915_gem_object_mock_selftests(void)
err = i915_subtests(tests, i915);
drm_dev_put(&i915->drm);
mock_destroy_device(i915);
return err;
}
......
......@@ -73,6 +73,6 @@ int i915_gem_phys_mock_selftests(void)
err = i915_subtests(tests, i915);
drm_dev_put(&i915->drm);
mock_destroy_device(i915);
return err;
}
......@@ -158,7 +158,7 @@ static int mock_hwsp_freelist(void *arg)
__mock_hwsp_record(&state, na, NULL);
kfree(state.history);
err_put:
drm_dev_put(&i915->drm);
mock_destroy_device(i915);
return err;
}
......
......@@ -536,7 +536,7 @@ int i915_gem_evict_mock_selftests(void)
with_intel_runtime_pm(&i915->runtime_pm, wakeref)
err = i915_subtests(tests, &i915->gt);
drm_dev_put(&i915->drm);
mock_destroy_device(i915);
return err;
}
......
......@@ -1727,7 +1727,7 @@ int i915_gem_gtt_mock_selftests(void)
mock_fini_ggtt(ggtt);
kfree(ggtt);
out_put:
drm_dev_put(&i915->drm);
mock_destroy_device(i915);
return err;
}
......
......@@ -527,7 +527,7 @@ int i915_request_mock_selftests(void)
with_intel_runtime_pm(&i915->runtime_pm, wakeref)
err = i915_subtests(tests, i915);
drm_dev_put(&i915->drm);
mock_destroy_device(i915);
return err;
}
......
......@@ -841,7 +841,7 @@ int i915_vma_mock_selftests(void)
mock_fini_ggtt(ggtt);
kfree(ggtt);
out_put:
drm_dev_put(&i915->drm);
mock_destroy_device(i915);
return err;
}
......
......@@ -791,7 +791,7 @@ int intel_memory_region_mock_selftests(void)
intel_memory_region_put(mem);
out_unref:
drm_dev_put(&i915->drm);
mock_destroy_device(i915);
return err;
}
......
......@@ -224,7 +224,12 @@ struct drm_i915_private *mock_gem_device(void)
intel_gt_driver_late_release(&i915->gt);
intel_memory_regions_driver_release(i915);
drm_mode_config_cleanup(&i915->drm);
drm_dev_put(&i915->drm);
mock_destroy_device(i915);
return NULL;
}
void mock_destroy_device(struct drm_i915_private *i915)
{
drm_dev_put(&i915->drm);
}
......@@ -7,4 +7,6 @@ struct drm_i915_private;
struct drm_i915_private *mock_gem_device(void);
void mock_device_flush(struct drm_i915_private *i915);
void mock_destroy_device(struct drm_i915_private *i915);
#endif /* !__MOCK_GEM_DEVICE_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment