Skip to contentSkip to conversation

Update DRM ioctl compatibility to new world order

PATCH New Paul Mackerras 1 participant 1 message Apr 10, 2005 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Update DRM ioctl compatibility to new world order

This patch, against 2.6.12-rc2-mm2, updates the DRM ioctl compatibility code. Now it is implemented via the compat_ioctl method in the file_operations structure, rather than using the old register_ioctl32_conversion thing. I also use compat_alloc_user_space rather than doing set_fs.

For now, I have put a lock_kernel/unlock_kernel in there so the DRM ioctl routines have the same environment (BKL held) as before. We will have to do some careful analysis to work out if the DRM code needs any extra locking to be safe without the BKL, I think, and I'd rather do that as a separate change.

drivers/char/drm/drmP.h +5 -3
diff -urN 2.6.12-rc2-mm2/drivers/char/drm/drmP.h g5-ppc64/drivers/char/drm/drmP.h
@@ -316,6 +316,9 @@
 typedef int drm_ioctl_t( struct inode *inode, struct file *filp,
 			 unsigned int cmd, unsigned long arg );
 
+typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd,
+			       unsigned long arg);
+
 typedef struct drm_ioctl_desc {
 	drm_ioctl_t	     *func;
 	int		     auth_needed;
@@ -775,6 +778,8 @@
 				  unsigned int cmd, unsigned long arg);
 extern int           drm_ioctl(struct inode *inode, struct file *filp,
 				unsigned int cmd, unsigned long arg);
+extern long	     drm_compat_ioctl(struct file *filp,
+				unsigned int cmd, unsigned long arg);
 extern int           drm_takedown(drm_device_t * dev);
 
 				/* Device support (drm_fops.h) */
@@ -1069,8 +1074,5 @@
 extern unsigned long drm_core_get_map_ofs(drm_map_t *map);
 extern unsigned long drm_core_get_reg_ofs(struct drm_device *dev);
 
-extern int drm_register_ioc32(void);
-extern void drm_unregister_ioc32(void);
-
 #endif /* __KERNEL__ */
 #endif
drivers/char/drm/drm_drv.c +0 -7
diff -urN 2.6.12-rc2-mm2/drivers/char/drm/drm_drv.c g5-ppc64/drivers/char/drm/drm_drv.c
@@ -407,10 +407,6 @@
 		goto err_p3;
 	}
 		
-#ifdef CONFIG_COMPAT
-	drm_register_ioc32();
-#endif
-
 	DRM_INFO( "Initialized %s %d.%d.%d %s\n",
 		CORE_NAME, CORE_MAJOR, CORE_MINOR, CORE_PATCHLEVEL,
 		CORE_DATE);
@@ -426,9 +422,6 @@
 
 static void __exit drm_core_exit (void)
 {
-#ifdef CONFIG_COMPAT
-	drm_unregister_ioc32();
-#endif
 	remove_proc_entry("dri", NULL);
 	drm_sysfs_destroy(drm_class);
 
drivers/char/drm/drm_ioc32.c +483 -591

1,485 lines not on this page · raw message

drivers/char/drm/radeon_drv.c +3 -6
diff -urN 2.6.12-rc2-mm2/drivers/char/drm/radeon_drv.c g5-ppc64/drivers/char/drm/radeon_drv.c
@@ -101,6 +101,9 @@
 		.mmap = drm_mmap,
 		.poll = drm_poll,
 		.fasync = drm_fasync,
+#ifdef CONFIG_COMPAT
+		.compat_ioctl = radeon_compat_ioctl,
+#endif
 	},
 	.pci_driver = {
 		.name          = DRIVER_NAME,
@@ -110,9 +113,6 @@
 
 static int __init radeon_init(void)
 {
-#ifdef CONFIG_COMPAT
-	radeon_register_ioc32();
-#endif
 	driver.num_ioctls = radeon_max_ioctl;
 	return drm_init(&driver);
 }
@@ -120,9 +120,6 @@
 static void __exit radeon_exit(void)
 {
 	drm_exit(&driver);
-#ifdef CONFIG_COMPAT
-	radeon_unregister_ioc32();
-#endif
 }
 
 module_init(radeon_init);
drivers/char/drm/radeon_drv.h +2 -2
diff -urN 2.6.12-rc2-mm2/drivers/char/drm/radeon_drv.h g5-ppc64/drivers/char/drm/radeon_drv.h
@@ -317,8 +317,8 @@
 extern int radeon_postinit( struct drm_device *dev, unsigned long flags );
 extern int radeon_postcleanup( struct drm_device *dev );
 
-extern int radeon_register_ioc32(void);
-extern void radeon_unregister_ioc32(void);
+extern long radeon_compat_ioctl(struct file *filp, unsigned int cmd,
+				unsigned long arg);
 
 /* Flags for stats.boxes
  */
drivers/char/drm/radeon_ioc32.c +196 -282

595 lines not on this page · raw message