public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] drm: Add DRM_GEM_FOPS
@ 2022-06-06 19:54 Rob Clark
  2022-06-06 19:54 ` [PATCH v2 2/2] drm/msm: Expose client engine utilization via fdinfo Rob Clark
  2022-06-07  6:56 ` [PATCH v2 1/2] drm: Add DRM_GEM_FOPS Thomas Zimmermann
  0 siblings, 2 replies; 10+ messages in thread
From: Rob Clark @ 2022-06-06 19:54 UTC (permalink / raw)
  To: dri-devel
  Cc: freedreno, linux-arm-msm, Tvrtko Ursulin, Rob Clark,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Daniel Vetter, open list

From: Rob Clark <robdclark@chromium.org>

The DEFINE_DRM_GEM_FOPS() helper is a bit limiting if a driver wants to
provide additional file ops, like show_fdinfo().

Signed-off-by: Rob Clark <robdclark@chromium.org>
---
 include/drm/drm_gem.h | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h
index 9d7c61a122dc..dc88d4a2cdf6 100644
--- a/include/drm/drm_gem.h
+++ b/include/drm/drm_gem.h
@@ -314,6 +314,23 @@ struct drm_gem_object {
 	const struct drm_gem_object_funcs *funcs;
 };
 
+/**
+ * DRM_GEM_FOPS - Default drm GEM file operations
+ *
+ * This macro provides a shorthand for setting the GEM file ops in the
+ * &file_operations structure.
+ */
+#define DRM_GEM_FOPS \
+	.open		= drm_open,\
+	.release	= drm_release,\
+	.unlocked_ioctl	= drm_ioctl,\
+	.compat_ioctl	= drm_compat_ioctl,\
+	.poll		= drm_poll,\
+	.read		= drm_read,\
+	.llseek		= noop_llseek,\
+	.mmap		= drm_gem_mmap
+
+
 /**
  * DEFINE_DRM_GEM_FOPS() - macro to generate file operations for GEM drivers
  * @name: name for the generated structure
@@ -330,14 +347,7 @@ struct drm_gem_object {
 #define DEFINE_DRM_GEM_FOPS(name) \
 	static const struct file_operations name = {\
 		.owner		= THIS_MODULE,\
-		.open		= drm_open,\
-		.release	= drm_release,\
-		.unlocked_ioctl	= drm_ioctl,\
-		.compat_ioctl	= drm_compat_ioctl,\
-		.poll		= drm_poll,\
-		.read		= drm_read,\
-		.llseek		= noop_llseek,\
-		.mmap		= drm_gem_mmap,\
+		DRM_GEM_FOPS,\
 	}
 
 void drm_gem_object_release(struct drm_gem_object *obj);
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-06-08  7:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-06 19:54 [PATCH v2 1/2] drm: Add DRM_GEM_FOPS Rob Clark
2022-06-06 19:54 ` [PATCH v2 2/2] drm/msm: Expose client engine utilization via fdinfo Rob Clark
2022-06-07  6:03   ` kernel test robot
2022-06-07  8:56   ` Tvrtko Ursulin
2022-06-07 16:02     ` Rob Clark
2022-06-07 16:08       ` Rob Clark
2022-06-08  7:19         ` Tvrtko Ursulin
2022-06-07  6:56 ` [PATCH v2 1/2] drm: Add DRM_GEM_FOPS Thomas Zimmermann
2022-06-07 14:58   ` Rob Clark
2022-06-07 17:22     ` Thomas Zimmermann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox