summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/i915/selftests/mock_drm.h
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2019-11-07 21:39:29 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2019-11-08 10:17:41 +0000
commita8c9a7f52ec5a4b36ce183efd5fda4e4fd90ec45 (patch)
treedebf727251f993185db786505cec57db652f4e96 /drivers/gpu/drm/i915/selftests/mock_drm.h
parentab11a9270a91c833b9b4e3975443f529d1c7cf17 (diff)
drm/i915/selftests: Complete transition to a real struct file mock
Since drm provided us with a real struct file we can use for our anonymous internal clients (mock_file), complete our transition to using that as the primary interface (and not the mocked up struct drm_file we previous were using). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Matthew Auld <matthew.auld@intel.com> Reviewed-by: Matthew Auld <matthew.auld@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20191107213929.23286-1-chris@chris-wilson.co.uk
Diffstat (limited to 'drivers/gpu/drm/i915/selftests/mock_drm.h')
-rw-r--r--drivers/gpu/drm/i915/selftests/mock_drm.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/gpu/drm/i915/selftests/mock_drm.h b/drivers/gpu/drm/i915/selftests/mock_drm.h
index dc4190bd3f5a..d7f49e149f0c 100644
--- a/drivers/gpu/drm/i915/selftests/mock_drm.h
+++ b/drivers/gpu/drm/i915/selftests/mock_drm.h
@@ -25,13 +25,20 @@
#ifndef __MOCK_DRM_H
#define __MOCK_DRM_H
-struct drm_file;
+#include <drm/drm_file.h>
+
struct drm_i915_private;
+struct drm_file;
+struct file;
+
+static inline struct file *mock_file(struct drm_i915_private *i915)
+{
+ return mock_drm_getfile(i915->drm.primary, O_RDWR);
+}
-struct drm_file *mock_file(struct drm_i915_private *i915);
-static inline void mock_file_put(struct drm_file *file)
+static inline struct drm_file *to_drm_file(struct file *f)
{
- fput(file->filp);
+ return f->private_data;
}
#endif /* !__MOCK_DRM_H */