vserver 2.0 rc7
[linux-2.6.git] / drivers / char / drm / drm_fops.c
index e967efb..9067942 100644 (file)
@@ -143,8 +143,10 @@ int drm_open( struct inode *inode, struct file *filp )
        if (!((minor >= 0) && (minor < drm_cards_limit)))
                return -ENODEV;
                
-       dev = drm_minors[minor].dev;
-       if (!dev)
+       if (!drm_heads[minor])
+               return -ENODEV;
+
+       if (!(dev = drm_heads[minor]->dev))
                return -ENODEV;
        
        retcode = drm_open_helper( inode, filp, dev );
@@ -181,7 +183,7 @@ int drm_release( struct inode *inode, struct file *filp )
        int retcode = 0;
 
        lock_kernel();
-       dev = priv->dev;
+       dev = priv->head->dev;
 
        DRM_DEBUG( "open_count = %d\n", dev->open_count );
 
@@ -193,7 +195,7 @@ int drm_release( struct inode *inode, struct file *filp )
         */
 
        DRM_DEBUG( "pid = %d, device = 0x%lx, open_count = %d\n",
-                  current->pid, (long)old_encode_dev(dev->device), dev->open_count );
+                  current->pid, (long)old_encode_dev(priv->head->device), dev->open_count );
 
        if ( priv->lock_count && dev->lock.hw_lock &&
             _DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) &&
@@ -358,7 +360,7 @@ int drm_open_helper(struct inode *inode, struct file *filp, drm_device_t *dev)
        priv->uid           = current->euid;
        priv->pid           = current->pid;
        priv->minor         = minor;
-       priv->dev           = dev;
+       priv->head          = drm_heads[minor];
        priv->ioctl_count   = 0;
        priv->authenticated = capable(CAP_SYS_ADMIN);
        priv->lock_count    = 0;
@@ -412,10 +414,10 @@ out_free:
 int drm_flush(struct file *filp)
 {
        drm_file_t    *priv   = filp->private_data;
-       drm_device_t  *dev    = priv->dev;
+       drm_device_t  *dev    = priv->head->dev;
 
        DRM_DEBUG("pid = %d, device = 0x%lx, open_count = %d\n",
-                 current->pid, (long)old_encode_dev(dev->device), dev->open_count);
+                 current->pid, (long)old_encode_dev(priv->head->device), dev->open_count);
        return 0;
 }
 EXPORT_SYMBOL(drm_flush);
@@ -424,10 +426,10 @@ EXPORT_SYMBOL(drm_flush);
 int drm_fasync(int fd, struct file *filp, int on)
 {
        drm_file_t    *priv   = filp->private_data;
-       drm_device_t  *dev    = priv->dev;
+       drm_device_t  *dev    = priv->head->dev;
        int           retcode;
 
-       DRM_DEBUG("fd = %d, device = 0x%lx\n", fd, (long)old_encode_dev(dev->device));
+       DRM_DEBUG("fd = %d, device = 0x%lx\n", fd, (long)old_encode_dev(priv->head->device));
        retcode = fasync_helper(fd, filp, on, &dev->buf_async);
        if (retcode < 0) return retcode;
        return 0;