Skip to contentSkip to conversation

drm/tinydrm: Fix drm_driver.fops.owner

PATCH Applied Noralf Trønnes 2 participants 2 messages Mar 26, 2017 – Mar 27, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/tinydrm: Fix drm_driver.fops.owner

drm_driver.fops can't be shared since the owner then becomes tinydrm.ko. Move the fops declaration to the driver.

v2: Use DEFINE_DRM_GEM_CMA_FOPS

---
 drivers/gpu/drm/tinydrm/core/tinydrm-core.c | 15 ---------------
 drivers/gpu/drm/tinydrm/mi0283qt.c          |  3 +++
 include/drm/tinydrm/tinydrm.h               |  4 +---
 3 files changed, 4 insertions(+), 18 deletions(-)
drivers/gpu/drm/tinydrm/core/tinydrm-core.c +0 -15
index 6a257dd..fd25c7e5 100644
@@ -122,21 +122,6 @@ void tinydrm_gem_cma_free_object(struct drm_gem_object *gem_obj)
 }
 EXPORT_SYMBOL_GPL(tinydrm_gem_cma_free_object);
 
-const struct file_operations tinydrm_fops = {
-	.owner		= THIS_MODULE,
-	.open		= drm_open,
-	.release	= drm_release,
-	.unlocked_ioctl	= drm_ioctl,
-#ifdef CONFIG_COMPAT
-	.compat_ioctl	= drm_compat_ioctl,
-#endif
-	.poll		= drm_poll,
-	.read		= drm_read,
-	.llseek		= no_llseek,
-	.mmap		= drm_gem_cma_mmap,
-};
-EXPORT_SYMBOL(tinydrm_fops);
-
 static struct drm_framebuffer *
 tinydrm_fb_create(struct drm_device *drm, struct drm_file *file_priv,
 		  const struct drm_mode_fb_cmd2 *mode_cmd)
drivers/gpu/drm/tinydrm/mi0283qt.c +3 -0
index b29fe86..482ff1c3 100644
@@ -132,9 +132,12 @@ static const struct drm_display_mode mi0283qt_mode = {
 	TINYDRM_MODE(320, 240, 58, 43),
 };
 
+DEFINE_DRM_GEM_CMA_FOPS(mi0283qt_fops);
+
 static struct drm_driver mi0283qt_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME |
 				  DRIVER_ATOMIC,
+	.fops			= &mi0283qt_fops,
 	TINYDRM_GEM_DRIVER_OPS,
 	.lastclose		= tinydrm_lastclose,
 	.debugfs_init		= mipi_dbi_debugfs_init,
include/drm/tinydrm/tinydrm.h +1 -3
index cf9ca20..00b800d 100644
@@ -58,8 +58,7 @@ pipe_to_tinydrm(struct drm_simple_display_pipe *pipe)
 	.gem_prime_mmap		= drm_gem_cma_prime_mmap, \
 	.dumb_create		= drm_gem_cma_dumb_create, \
 	.dumb_map_offset	= drm_gem_cma_dumb_map_offset, \
-	.dumb_destroy		= drm_gem_dumb_destroy, \
-	.fops			= &tinydrm_fops
+	.dumb_destroy		= drm_gem_dumb_destroy
 
 /**
  * TINYDRM_MODE - tinydrm display mode
@@ -84,7 +83,6 @@ pipe_to_tinydrm(struct drm_simple_display_pipe *pipe)
 	.type = DRM_MODE_TYPE_DRIVER, \
 	.clock = 1 /* pass validation */
 
-extern const struct file_operations tinydrm_fops;
 void tinydrm_lastclose(struct drm_device *drm);
 void tinydrm_gem_cma_free_object(struct drm_gem_object *gem_obj);
 struct drm_gem_object *
Signature · 6 lines
2.10.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 7 lines · Noralf Trønnes

drm_driver.fops can't be shared since the owner then becomes tinydrm.ko. Move the fops declaration to the driver.

v2: Use DEFINE_DRM_GEM_CMA_FOPS

Applied, thanks.
-Daniel

Quoted 78 lines
---
 drivers/gpu/drm/tinydrm/core/tinydrm-core.c | 15 ---------------
 drivers/gpu/drm/tinydrm/mi0283qt.c          |  3 +++
 include/drm/tinydrm/tinydrm.h               |  4 +---
 3 files changed, 4 insertions(+), 18 deletions(-)
drivers/gpu/drm/tinydrm/core/tinydrm-core.c +0 -15
index 6a257dd..fd25c7e5 100644
@@ -122,21 +122,6 @@ void tinydrm_gem_cma_free_object(struct drm_gem_object *gem_obj)
 }
 EXPORT_SYMBOL_GPL(tinydrm_gem_cma_free_object);
 
-const struct file_operations tinydrm_fops = {
-	.owner		= THIS_MODULE,
-	.open		= drm_open,
-	.release	= drm_release,
-	.unlocked_ioctl	= drm_ioctl,
-#ifdef CONFIG_COMPAT
-	.compat_ioctl	= drm_compat_ioctl,
-#endif
-	.poll		= drm_poll,
-	.read		= drm_read,
-	.llseek		= no_llseek,
-	.mmap		= drm_gem_cma_mmap,
-};
-EXPORT_SYMBOL(tinydrm_fops);
-
 static struct drm_framebuffer *
 tinydrm_fb_create(struct drm_device *drm, struct drm_file *file_priv,
 		  const struct drm_mode_fb_cmd2 *mode_cmd)
drivers/gpu/drm/tinydrm/mi0283qt.c +3 -0
index b29fe86..482ff1c3 100644
@@ -132,9 +132,12 @@ static const struct drm_display_mode mi0283qt_mode = {
 	TINYDRM_MODE(320, 240, 58, 43),
 };
 
+DEFINE_DRM_GEM_CMA_FOPS(mi0283qt_fops);
+
 static struct drm_driver mi0283qt_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME |
 				  DRIVER_ATOMIC,
+	.fops			= &mi0283qt_fops,
 	TINYDRM_GEM_DRIVER_OPS,
 	.lastclose		= tinydrm_lastclose,
 	.debugfs_init		= mipi_dbi_debugfs_init,
include/drm/tinydrm/tinydrm.h +1 -3
index cf9ca20..00b800d 100644
@@ -58,8 +58,7 @@ pipe_to_tinydrm(struct drm_simple_display_pipe *pipe)
 	.gem_prime_mmap		= drm_gem_cma_prime_mmap, \
 	.dumb_create		= drm_gem_cma_dumb_create, \
 	.dumb_map_offset	= drm_gem_cma_dumb_map_offset, \
-	.dumb_destroy		= drm_gem_dumb_destroy, \
-	.fops			= &tinydrm_fops
+	.dumb_destroy		= drm_gem_dumb_destroy
 
 /**
  * TINYDRM_MODE - tinydrm display mode
@@ -84,7 +83,6 @@ pipe_to_tinydrm(struct drm_simple_display_pipe *pipe)
 	.type = DRM_MODE_TYPE_DRIVER, \
 	.clock = 1 /* pass validation */
 
-extern const struct file_operations tinydrm_fops;
 void tinydrm_lastclose(struct drm_device *drm);
 void tinydrm_gem_cma_free_object(struct drm_gem_object *gem_obj);
 struct drm_gem_object *
Signature · 6 lines
2.10.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel