patch-2.4.8 linux/drivers/char/drm/ffb_context.c

Next file: linux/drivers/char/drm/ffb_drv.c
Previous file: linux/drivers/char/drm/ffb.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.7/linux/drivers/char/drm/ffb_context.c linux/drivers/char/drm/ffb_context.c
@@ -10,13 +10,14 @@
 #include <linux/sched.h>
 #include <asm/upa.h>
 
+#include "ffb.h"
 #include "drmP.h"
 
 #include "ffb_drv.h"
 
-static int ffb_alloc_queue(drm_device_t *dev, int is_2d_only)
+static int DRM(alloc_queue)(drm_device_t *dev, int is_2d_only)
 {
-	ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) (dev + 1);
+	ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) dev->dev_private;
 	int i;
 
 	for (i = 0; i < FFB_MAX_CTXS; i++) {
@@ -353,9 +354,9 @@
 	} while (--limit);
 }
 
-int ffb_context_switch(drm_device_t *dev, int old, int new)
+int DRM(context_switch)(drm_device_t *dev, int old, int new)
 {
-	ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) (dev + 1);
+	ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) dev->dev_private;
 
         atomic_inc(&dev->total_ctx);
 
@@ -381,8 +382,8 @@
         return 0;
 }
 
-int ffb_resctx(struct inode *inode, struct file *filp, unsigned int cmd,
-	       unsigned long arg)
+int DRM(resctx)(struct inode *inode, struct file *filp, unsigned int cmd,
+		unsigned long arg)
 {
 	drm_ctx_res_t	res;
 	drm_ctx_t	ctx;
@@ -408,8 +409,8 @@
 }
 
 
-int ffb_addctx(struct inode *inode, struct file *filp, unsigned int cmd,
-	       unsigned long arg)
+int DRM(addctx)(struct inode *inode, struct file *filp, unsigned int cmd,
+		unsigned long arg)
 {
 	drm_file_t	*priv	= filp->private_data;
 	drm_device_t	*dev	= priv->dev;
@@ -418,7 +419,7 @@
 
 	if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx)))
 		return -EFAULT;
-	idx = ffb_alloc_queue(dev, (ctx.flags & _DRM_CONTEXT_2DONLY));
+	idx = DRM(alloc_queue)(dev, (ctx.flags & _DRM_CONTEXT_2DONLY));
 	if (idx < 0)
 		return -ENFILE;
 
@@ -429,12 +430,12 @@
 	return 0;
 }
 
-int ffb_modctx(struct inode *inode, struct file *filp, unsigned int cmd,
-	       unsigned long arg)
+int DRM(modctx)(struct inode *inode, struct file *filp, unsigned int cmd,
+		unsigned long arg)
 {
 	drm_file_t	*priv	= filp->private_data;
 	drm_device_t	*dev	= priv->dev;
-	ffb_dev_priv_t	*fpriv	= (ffb_dev_priv_t *) (dev + 1);
+	ffb_dev_priv_t	*fpriv	= (ffb_dev_priv_t *) dev->dev_private;
 	struct ffb_hw_context *hwctx;
 	drm_ctx_t ctx;
 	int idx;
@@ -458,12 +459,12 @@
 	return 0;
 }
 
-int ffb_getctx(struct inode *inode, struct file *filp, unsigned int cmd,
-	       unsigned long arg)
+int DRM(getctx)(struct inode *inode, struct file *filp, unsigned int cmd,
+		unsigned long arg)
 {
 	drm_file_t	*priv	= filp->private_data;
 	drm_device_t	*dev	= priv->dev;
-	ffb_dev_priv_t	*fpriv	= (ffb_dev_priv_t *) (dev + 1);
+	ffb_dev_priv_t	*fpriv	= (ffb_dev_priv_t *) dev->dev_private;
 	struct ffb_hw_context *hwctx;
 	drm_ctx_t ctx;
 	int idx;
@@ -490,8 +491,8 @@
 	return 0;
 }
 
-int ffb_switchctx(struct inode *inode, struct file *filp, unsigned int cmd,
-		  unsigned long arg)
+int DRM(switchctx)(struct inode *inode, struct file *filp, unsigned int cmd,
+		   unsigned long arg)
 {
 	drm_file_t	*priv	= filp->private_data;
 	drm_device_t	*dev	= priv->dev;
@@ -500,11 +501,11 @@
 	if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx)))
 		return -EFAULT;
 	DRM_DEBUG("%d\n", ctx.handle);
-	return ffb_context_switch(dev, dev->last_context, ctx.handle);
+	return DRM(context_switch)(dev, dev->last_context, ctx.handle);
 }
 
-int ffb_newctx(struct inode *inode, struct file *filp, unsigned int cmd,
-	       unsigned long arg)
+int DRM(newctx)(struct inode *inode, struct file *filp, unsigned int cmd,
+		unsigned long arg)
 {
 	drm_ctx_t	ctx;
 
@@ -515,13 +516,13 @@
 	return 0;
 }
 
-int ffb_rmctx(struct inode *inode, struct file *filp, unsigned int cmd,
+int DRM(rmctx)(struct inode *inode, struct file *filp, unsigned int cmd,
 	       unsigned long arg)
 {
 	drm_ctx_t	ctx;
 	drm_file_t	*priv	= filp->private_data;
 	drm_device_t	*dev	= priv->dev;
-	ffb_dev_priv_t	*fpriv	= (ffb_dev_priv_t *) (dev + 1);
+	ffb_dev_priv_t	*fpriv	= (ffb_dev_priv_t *) dev->dev_private;
 	int idx;
 
 	if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx)))

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)