diff options
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/drm_fops.c | 15 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_gem.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_object.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_ttm.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 5 |
5 files changed, 13 insertions, 18 deletions
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index d25a61739a7b..5062eec673f1 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c | |||
@@ -140,12 +140,12 @@ int drm_open(struct inode *inode, struct file *filp) | |||
140 | } | 140 | } |
141 | if (!retcode) { | 141 | if (!retcode) { |
142 | mutex_lock(&dev->struct_mutex); | 142 | mutex_lock(&dev->struct_mutex); |
143 | if (minor->type == DRM_MINOR_LEGACY) { | 143 | if (dev->dev_mapping == NULL) |
144 | if (dev->dev_mapping == NULL) | 144 | dev->dev_mapping = &inode->i_data; |
145 | dev->dev_mapping = inode->i_mapping; | 145 | /* ihold ensures nobody can remove inode with our i_data */ |
146 | else if (dev->dev_mapping != inode->i_mapping) | 146 | ihold(container_of(dev->dev_mapping, struct inode, i_data)); |
147 | retcode = -ENODEV; | 147 | inode->i_mapping = dev->dev_mapping; |
148 | } | 148 | filp->f_mapping = dev->dev_mapping; |
149 | mutex_unlock(&dev->struct_mutex); | 149 | mutex_unlock(&dev->struct_mutex); |
150 | } | 150 | } |
151 | 151 | ||
@@ -509,6 +509,9 @@ int drm_release(struct inode *inode, struct file *filp) | |||
509 | } | 509 | } |
510 | } | 510 | } |
511 | 511 | ||
512 | BUG_ON(dev->dev_mapping == NULL); | ||
513 | iput(container_of(dev->dev_mapping, struct inode, i_data)); | ||
514 | |||
512 | /* drop the reference held my the file priv */ | 515 | /* drop the reference held my the file priv */ |
513 | drm_master_put(&file_priv->master); | 516 | drm_master_put(&file_priv->master); |
514 | file_priv->is_master = 0; | 517 | file_priv->is_master = 0; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c index 30f542316944..fe3f5a821b84 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c | |||
@@ -207,8 +207,7 @@ nouveau_gem_ioctl_new(struct drm_device *dev, void *data, | |||
207 | struct nouveau_bo *nvbo = NULL; | 207 | struct nouveau_bo *nvbo = NULL; |
208 | int ret = 0; | 208 | int ret = 0; |
209 | 209 | ||
210 | if (unlikely(dev_priv->ttm.bdev.dev_mapping == NULL)) | 210 | dev_priv->ttm.bdev.dev_mapping = dev->dev_mapping; |
211 | dev_priv->ttm.bdev.dev_mapping = dev_priv->dev->dev_mapping; | ||
212 | 211 | ||
213 | if (!dev_priv->engine.vram.flags_valid(dev, req->info.tile_flags)) { | 212 | if (!dev_priv->engine.vram.flags_valid(dev, req->info.tile_flags)) { |
214 | NV_ERROR(dev, "bad page flags: 0x%08x\n", req->info.tile_flags); | 213 | NV_ERROR(dev, "bad page flags: 0x%08x\n", req->info.tile_flags); |
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index 6ecb2006e27e..1f77a5afc011 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c | |||
@@ -115,9 +115,7 @@ int radeon_bo_create(struct radeon_device *rdev, | |||
115 | 115 | ||
116 | size = ALIGN(size, PAGE_SIZE); | 116 | size = ALIGN(size, PAGE_SIZE); |
117 | 117 | ||
118 | if (unlikely(rdev->mman.bdev.dev_mapping == NULL)) { | 118 | rdev->mman.bdev.dev_mapping = rdev->ddev->dev_mapping; |
119 | rdev->mman.bdev.dev_mapping = rdev->ddev->dev_mapping; | ||
120 | } | ||
121 | if (kernel) { | 119 | if (kernel) { |
122 | type = ttm_bo_type_kernel; | 120 | type = ttm_bo_type_kernel; |
123 | } else if (sg) { | 121 | } else if (sg) { |
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c index 0881131a0388..5b71c716d83f 100644 --- a/drivers/gpu/drm/radeon/radeon_ttm.c +++ b/drivers/gpu/drm/radeon/radeon_ttm.c | |||
@@ -734,9 +734,7 @@ int radeon_ttm_init(struct radeon_device *rdev) | |||
734 | } | 734 | } |
735 | DRM_INFO("radeon: %uM of GTT memory ready.\n", | 735 | DRM_INFO("radeon: %uM of GTT memory ready.\n", |
736 | (unsigned)(rdev->mc.gtt_size / (1024 * 1024))); | 736 | (unsigned)(rdev->mc.gtt_size / (1024 * 1024))); |
737 | if (unlikely(rdev->mman.bdev.dev_mapping == NULL)) { | 737 | rdev->mman.bdev.dev_mapping = rdev->ddev->dev_mapping; |
738 | rdev->mman.bdev.dev_mapping = rdev->ddev->dev_mapping; | ||
739 | } | ||
740 | 738 | ||
741 | r = radeon_ttm_debugfs_init(rdev); | 739 | r = radeon_ttm_debugfs_init(rdev); |
742 | if (r) { | 740 | if (r) { |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index 5d5632f5265b..4d9edead01ac 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | |||
@@ -769,10 +769,7 @@ static int vmw_driver_open(struct drm_device *dev, struct drm_file *file_priv) | |||
769 | goto out_no_tfile; | 769 | goto out_no_tfile; |
770 | 770 | ||
771 | file_priv->driver_priv = vmw_fp; | 771 | file_priv->driver_priv = vmw_fp; |
772 | 772 | dev_priv->bdev.dev_mapping = dev->dev_mapping; | |
773 | if (unlikely(dev_priv->bdev.dev_mapping == NULL)) | ||
774 | dev_priv->bdev.dev_mapping = | ||
775 | file_priv->filp->f_path.dentry->d_inode->i_mapping; | ||
776 | 773 | ||
777 | return 0; | 774 | return 0; |
778 | 775 | ||