A patch is attached. It changes both linux/linux-2.6 and linux-core. I
tested that it compiles (linux-2.6 and linux-core) and loads all modules
(except radeon, which failed because I don't have the necessary i2c bits
in my kernel). Any objections to applying this?

Regards,
  Felix

Am Sa, den 30.10.2004 schrieb Felix K�hling um 23:56:
> Currenly in linux-core the driver callback reclaim_buffers is called
> with a single argument "filp". In reclaim_buffers you need OS-specific
> knowledge to extract the device pointer from the filp. In the BSD DRM
> reclaim_buffers takes two arguments, "dev" and "filp". Could we change
> the linux version to use the same API? This would allow implementing an
> OS-agnostic reclaim_buffers function in a driver.
> 
> Regards,
>   Felix
-- 
| Felix K�hling <[EMAIL PROTECTED]>                     http://fxk.de.vu |
| PGP Fingerprint: 6A3C 9566 5B30 DDED 73C3  B152 151C 5CC1 D888 E595 |
Index: linux/drmP.h
===================================================================
RCS file: /cvs/dri/drm/linux/drmP.h,v
retrieving revision 1.123
diff -u -r1.123 drmP.h
--- linux/drmP.h	9 Oct 2004 10:58:19 -0000	1.123
+++ linux/drmP.h	31 Oct 2004 10:20:46 -0000
@@ -528,7 +528,7 @@
 	void (*irq_preinstall)(struct drm_device *dev);
 	void (*irq_postinstall)(struct drm_device *dev);
 	void (*irq_uninstall)(struct drm_device *dev);
-	void (*reclaim_buffers)(struct file *filp);
+	void (*reclaim_buffers)(struct drm_device *dev, struct file *filp);
 	unsigned long (*get_map_ofs)(drm_map_t *map);
 	unsigned long (*get_reg_ofs)(struct drm_device *dev);
 	void (*set_version)(struct drm_device *dev, drm_set_version_t *sv);
@@ -870,7 +870,7 @@
 extern int	     DRM(dma_setup)(drm_device_t *dev);
 extern void	     DRM(dma_takedown)(drm_device_t *dev);
 extern void	     DRM(free_buffer)(drm_device_t *dev, drm_buf_t *buf);
-extern void	     DRM(reclaim_buffers)( struct file *filp );
+extern void	     DRM(core_reclaim_buffers)(drm_device_t *dev, struct file *filp);
 
 				/* IRQ support (drm_irq.h) */
 extern int           DRM(control)( struct inode *inode, struct file *filp,
Index: linux/drm_dma.h
===================================================================
RCS file: /cvs/dri/drm/linux/drm_dma.h,v
retrieving revision 1.34
diff -u -r1.34 drm_dma.h
--- linux/drm_dma.h	5 Sep 2004 10:54:58 -0000	1.34
+++ linux/drm_dma.h	31 Oct 2004 10:20:46 -0000
@@ -154,10 +154,8 @@
  *
  * Frees each buffer associated with \p filp not already on the hardware.
  */
-void DRM(core_reclaim_buffers)( struct file *filp )
+void DRM(core_reclaim_buffers)( drm_device_t *dev, struct file *filp )
 {
-	drm_file_t    *priv   = filp->private_data;
-	drm_device_t  *dev    = priv->dev;
 	drm_device_dma_t *dma = dev->dma;
 	int		 i;
 
Index: linux/drm_drv.h
===================================================================
RCS file: /cvs/dri/drm/linux/drm_drv.h,v
retrieving revision 1.91
diff -u -r1.91 drm_drv.h
--- linux/drm_drv.h	8 Oct 2004 14:31:24 -0000	1.91
+++ linux/drm_drv.h	31 Oct 2004 10:20:56 -0000
@@ -857,7 +857,7 @@
 	
 	if (drm_core_check_feature(dev, DRIVER_HAVE_DMA))
 	{
-		dev->fn_tbl.reclaim_buffers(filp);
+		dev->fn_tbl.reclaim_buffers(dev, filp);
 	}
 
 	DRM(fasync)( -1, filp, 0 );
Index: linux/i810_dma.c
===================================================================
RCS file: /cvs/dri/drm/linux/i810_dma.c,v
retrieving revision 1.68
diff -u -r1.68 i810_dma.c
--- linux/i810_dma.c	23 Sep 2004 05:39:13 -0000	1.68
+++ linux/i810_dma.c	31 Oct 2004 10:20:56 -0000
@@ -996,10 +996,8 @@
 }
 
 /* Must be called with the lock held */
-void i810_reclaim_buffers(struct file *filp)
+void i810_reclaim_buffers(drm_device_t *dev, struct file *filp)
 {
-	drm_file_t    *priv   = filp->private_data;
-	drm_device_t  *dev    = priv->dev;
 	drm_device_dma_t *dma = dev->dma;
 	int		 i;
 
@@ -1395,7 +1393,7 @@
 
 static void i810_driver_release(drm_device_t *dev, struct file *filp)
 {
-	i810_reclaim_buffers(filp);
+	i810_reclaim_buffers(dev, filp);
 }
 
 static int i810_driver_dma_quiescent(drm_device_t *dev)
Index: linux/i810_drv.h
===================================================================
RCS file: /cvs/dri/drm/linux/i810_drv.h,v
retrieving revision 1.21
diff -u -r1.21 i810_drv.h
--- linux/i810_drv.h	17 Aug 2004 13:10:04 -0000	1.21
+++ linux/i810_drv.h	31 Oct 2004 10:20:57 -0000
@@ -99,7 +99,7 @@
 extern int  i810_dma_cleanup(drm_device_t *dev);
 extern int  i810_flush_ioctl(struct inode *inode, struct file *filp,
 			     unsigned int cmd, unsigned long arg);
-extern void i810_reclaim_buffers(struct file *filp);
+extern void i810_reclaim_buffers(drm_device_t *dev, struct file *filp);
 extern int  i810_getage(struct inode *inode, struct file *filp,
 			unsigned int cmd, unsigned long arg);
 extern int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma);
Index: linux/i830_dma.c
===================================================================
RCS file: /cvs/dri/drm/linux/i830_dma.c,v
retrieving revision 1.33
diff -u -r1.33 i830_dma.c
--- linux/i830_dma.c	23 Sep 2004 05:39:14 -0000	1.33
+++ linux/i830_dma.c	31 Oct 2004 10:20:57 -0000
@@ -1285,10 +1285,8 @@
 }
 
 /* Must be called with the lock held */
-void i830_reclaim_buffers( struct file *filp )
+void i830_reclaim_buffers( drm_device_t *dev, struct file *filp )
 {
-	drm_file_t    *priv   = filp->private_data;
-	drm_device_t  *dev    = priv->dev;
 	drm_device_dma_t *dma = dev->dma;
 	int		 i;
 
@@ -1590,7 +1588,7 @@
 
 static void i830_driver_release(drm_device_t *dev, struct file *filp)
 {
-	i830_reclaim_buffers(filp);
+	i830_reclaim_buffers(dev, filp);
 }
 
 static int i830_driver_dma_quiescent(drm_device_t *dev)
Index: linux/i830_drv.h
===================================================================
RCS file: /cvs/dri/drm/linux/i830_drv.h,v
retrieving revision 1.10
diff -u -r1.10 i830_drv.h
--- linux/i830_drv.h	24 Aug 2004 11:15:51 -0000	1.10
+++ linux/i830_drv.h	31 Oct 2004 10:20:57 -0000
@@ -99,7 +99,7 @@
 extern int  i830_dma_cleanup(drm_device_t *dev);
 extern int  i830_flush_ioctl(struct inode *inode, struct file *filp,
 			     unsigned int cmd, unsigned long arg);
-extern void i830_reclaim_buffers(struct file *filp);
+extern void i830_reclaim_buffers(drm_device_t *dev, struct file *filp);
 extern int  i830_getage(struct inode *inode, struct file *filp, unsigned int cmd,
 			unsigned long arg);
 extern int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma);
Index: linux-core/drmP.h
===================================================================
RCS file: /cvs/dri/drm/linux-core/drmP.h,v
retrieving revision 1.136
diff -u -r1.136 drmP.h
--- linux-core/drmP.h	23 Oct 2004 18:12:34 -0000	1.136
+++ linux-core/drmP.h	31 Oct 2004 10:20:59 -0000
@@ -536,7 +536,7 @@
 	void (*irq_preinstall) (struct drm_device * dev);
 	void (*irq_postinstall) (struct drm_device * dev);
 	void (*irq_uninstall) (struct drm_device * dev);
-	void (*reclaim_buffers) (struct file * filp);
+	void (*reclaim_buffers) (struct drm_device *dev, struct file * filp);
 	unsigned long (*get_map_ofs) (drm_map_t * map);
 	unsigned long (*get_reg_ofs) (struct drm_device * dev);
 	void (*set_version) (struct drm_device * dev, drm_set_version_t * sv);
@@ -866,7 +866,7 @@
 extern int drm_dma_setup(drm_device_t * dev);
 extern void drm_dma_takedown(drm_device_t * dev);
 extern void drm_free_buffer(drm_device_t * dev, drm_buf_t * buf);
-extern void drm_core_reclaim_buffers(struct file *filp);
+extern void drm_core_reclaim_buffers(drm_device_t *dev, struct file *filp);
 
 				/* IRQ support (drm_irq.h) */
 extern int drm_control(struct inode *inode, struct file *filp,
Index: linux-core/drm_dma.c
===================================================================
RCS file: /cvs/dri/drm/linux-core/drm_dma.c,v
retrieving revision 1.38
diff -u -r1.38 drm_dma.c
--- linux-core/drm_dma.c	18 Oct 2004 14:16:41 -0000	1.38
+++ linux-core/drm_dma.c	31 Oct 2004 10:20:59 -0000
@@ -154,10 +154,8 @@
  *
  * Frees each buffer associated with \p filp not already on the hardware.
  */
-void drm_core_reclaim_buffers(struct file *filp)
+void drm_core_reclaim_buffers(drm_device_t *dev, struct file *filp)
 {
-	drm_file_t *priv = filp->private_data;
-	drm_device_t *dev = priv->head->dev;
 	drm_device_dma_t *dma = dev->dma;
 	int i;
 
Index: linux-core/drm_fops.c
===================================================================
RCS file: /cvs/dri/drm/linux-core/drm_fops.c,v
retrieving revision 1.29
diff -u -r1.29 drm_fops.c
--- linux-core/drm_fops.c	18 Oct 2004 14:16:41 -0000	1.29
+++ linux-core/drm_fops.c	31 Oct 2004 10:21:01 -0000
@@ -393,7 +393,7 @@
 	}
 
 	if (drm_core_check_feature(dev, DRIVER_HAVE_DMA)) {
-		dev->driver->reclaim_buffers(filp);
+		dev->driver->reclaim_buffers(dev, filp);
 	}
 
 	drm_fasync(-1, filp, 0);
Index: linux-core/i810_dma.c
===================================================================
RCS file: /cvs/dri/drm/linux-core/i810_dma.c,v
retrieving revision 1.74
diff -u -r1.74 i810_dma.c
--- linux-core/i810_dma.c	23 Oct 2004 06:59:15 -0000	1.74
+++ linux-core/i810_dma.c	31 Oct 2004 10:21:05 -0000
@@ -972,10 +972,8 @@
 }
 
 /* Must be called with the lock held */
-void i810_reclaim_buffers(struct file *filp)
+void i810_reclaim_buffers(drm_device_t *dev, struct file *filp)
 {
-	drm_file_t *priv = filp->private_data;
-	drm_device_t *dev = priv->head->dev;
 	drm_device_dma_t *dma = dev->dma;
 	int i;
 
@@ -1366,7 +1364,7 @@
 
 void i810_driver_release(drm_device_t * dev, struct file *filp)
 {
-	i810_reclaim_buffers(filp);
+	i810_reclaim_buffers(dev, filp);
 }
 
 int i810_driver_dma_quiescent(drm_device_t * dev)
Index: linux-core/i810_drv.h
===================================================================
RCS file: /cvs/dri/drm/linux-core/i810_drv.h,v
retrieving revision 1.23
diff -u -r1.23 i810_drv.h
--- linux-core/i810_drv.h	30 Sep 2004 21:12:05 -0000	1.23
+++ linux-core/i810_drv.h	31 Oct 2004 10:21:05 -0000
@@ -121,7 +121,7 @@
 extern int i810_dma_cleanup(drm_device_t * dev);
 extern int i810_flush_ioctl(struct inode *inode, struct file *filp,
 			    unsigned int cmd, unsigned long arg);
-extern void i810_reclaim_buffers(struct file *filp);
+extern void i810_reclaim_buffers(drm_device_t *dev, struct file *filp);
 extern int i810_getage(struct inode *inode, struct file *filp,
 		       unsigned int cmd, unsigned long arg);
 extern int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma);
Index: linux-core/i830_dma.c
===================================================================
RCS file: /cvs/dri/drm/linux-core/i830_dma.c,v
retrieving revision 1.39
diff -u -r1.39 i830_dma.c
--- linux-core/i830_dma.c	23 Oct 2004 06:59:15 -0000	1.39
+++ linux-core/i830_dma.c	31 Oct 2004 10:21:06 -0000
@@ -1252,10 +1252,8 @@
 }
 
 /* Must be called with the lock held */
-void i830_reclaim_buffers(struct file *filp)
+void i830_reclaim_buffers(drm_device_t *dev, struct file *filp)
 {
-	drm_file_t *priv = filp->private_data;
-	drm_device_t *dev = priv->head->dev;
 	drm_device_dma_t *dma = dev->dma;
 	int i;
 
@@ -1556,7 +1554,7 @@
 
 void i830_driver_release(drm_device_t * dev, struct file *filp)
 {
-	i830_reclaim_buffers(filp);
+	i830_reclaim_buffers(dev, filp);
 }
 
 int i830_driver_dma_quiescent(drm_device_t * dev)
Index: linux-core/i830_drv.h
===================================================================
RCS file: /cvs/dri/drm/linux-core/i830_drv.h,v
retrieving revision 1.12
diff -u -r1.12 i830_drv.h
--- linux-core/i830_drv.h	30 Sep 2004 21:12:05 -0000	1.12
+++ linux-core/i830_drv.h	31 Oct 2004 10:21:13 -0000
@@ -129,7 +129,7 @@
 extern int i830_dma_cleanup(drm_device_t * dev);
 extern int i830_flush_ioctl(struct inode *inode, struct file *filp,
 			    unsigned int cmd, unsigned long arg);
-extern void i830_reclaim_buffers(struct file *filp);
+extern void i830_reclaim_buffers(drm_device_t *dev, struct file *filp);
 extern int i830_getage(struct inode *inode, struct file *filp, unsigned int cmd,
 		       unsigned long arg);
 extern int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma);

Reply via email to