aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/drm_fops.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/drm/drm_fops.c')
-rw-r--r--drivers/char/drm/drm_fops.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/drivers/char/drm/drm_fops.c b/drivers/char/drm/drm_fops.c
index bf0a740122bf..f57f7d1a281e 100644
--- a/drivers/char/drm/drm_fops.c
+++ b/drivers/char/drm/drm_fops.c
@@ -45,8 +45,8 @@ static int drm_setup(drm_device_t * dev)
45 int i; 45 int i;
46 int ret; 46 int ret;
47 47
48 if (dev->driver->presetup) { 48 if (dev->driver->firstopen) {
49 ret = dev->driver->presetup(dev); 49 ret = dev->driver->firstopen(dev);
50 if (ret != 0) 50 if (ret != 0)
51 return ret; 51 return ret;
52 } 52 }
@@ -109,8 +109,6 @@ static int drm_setup(drm_device_t * dev)
109 * drm_select_queue fails between the time the interrupt is 109 * drm_select_queue fails between the time the interrupt is
110 * initialized and the time the queues are initialized. 110 * initialized and the time the queues are initialized.
111 */ 111 */
112 if (dev->driver->postsetup)
113 dev->driver->postsetup(dev);
114 112
115 return 0; 113 return 0;
116} 114}
@@ -167,7 +165,7 @@ EXPORT_SYMBOL(drm_open);
167 * If the hardware lock is held then free it, and take it again for the kernel 165 * If the hardware lock is held then free it, and take it again for the kernel
168 * context since it's necessary to reclaim buffers. Unlink the file private 166 * context since it's necessary to reclaim buffers. Unlink the file private
169 * data from its list and free it. Decreases the open count and if it reaches 167 * data from its list and free it. Decreases the open count and if it reaches
170 * zero calls takedown(). 168 * zero calls drm_lastclose().
171 */ 169 */
172int drm_release(struct inode *inode, struct file *filp) 170int drm_release(struct inode *inode, struct file *filp)
173{ 171{
@@ -180,8 +178,8 @@ int drm_release(struct inode *inode, struct file *filp)
180 178
181 DRM_DEBUG("open_count = %d\n", dev->open_count); 179 DRM_DEBUG("open_count = %d\n", dev->open_count);
182 180
183 if (dev->driver->prerelease) 181 if (dev->driver->preclose)
184 dev->driver->prerelease(dev, filp); 182 dev->driver->preclose(dev, filp);
185 183
186 /* ======================================================== 184 /* ========================================================
187 * Begin inline drm_release 185 * Begin inline drm_release
@@ -197,8 +195,8 @@ int drm_release(struct inode *inode, struct file *filp)
197 DRM_DEBUG("File %p released, freeing lock for context %d\n", 195 DRM_DEBUG("File %p released, freeing lock for context %d\n",
198 filp, _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)); 196 filp, _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock));
199 197
200 if (dev->driver->release) 198 if (dev->driver->reclaim_buffers_locked)
201 dev->driver->release(dev, filp); 199 dev->driver->reclaim_buffers_locked(dev, filp);
202 200
203 drm_lock_free(dev, &dev->lock.hw_lock->lock, 201 drm_lock_free(dev, &dev->lock.hw_lock->lock,
204 _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)); 202 _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock));
@@ -207,7 +205,7 @@ int drm_release(struct inode *inode, struct file *filp)
207 hardware at this point, possibly 205 hardware at this point, possibly
208 processed via a callback to the X 206 processed via a callback to the X
209 server. */ 207 server. */
210 } else if (dev->driver->release && priv->lock_count 208 } else if (dev->driver->reclaim_buffers_locked && priv->lock_count
211 && dev->lock.hw_lock) { 209 && dev->lock.hw_lock) {
212 /* The lock is required to reclaim buffers */ 210 /* The lock is required to reclaim buffers */
213 DECLARE_WAITQUEUE(entry, current); 211 DECLARE_WAITQUEUE(entry, current);
@@ -237,15 +235,14 @@ int drm_release(struct inode *inode, struct file *filp)
237 __set_current_state(TASK_RUNNING); 235 __set_current_state(TASK_RUNNING);
238 remove_wait_queue(&dev->lock.lock_queue, &entry); 236 remove_wait_queue(&dev->lock.lock_queue, &entry);
239 if (!retcode) { 237 if (!retcode) {
240 if (dev->driver->release) 238 dev->driver->reclaim_buffers_locked(dev, filp);
241 dev->driver->release(dev, filp);
242 drm_lock_free(dev, &dev->lock.hw_lock->lock, 239 drm_lock_free(dev, &dev->lock.hw_lock->lock,
243 DRM_KERNEL_CONTEXT); 240 DRM_KERNEL_CONTEXT);
244 } 241 }
245 } 242 }
246 243
247 if (drm_core_check_feature(dev, DRIVER_HAVE_DMA) 244 if (drm_core_check_feature(dev, DRIVER_HAVE_DMA) &&
248 && !dev->driver->release) { 245 !dev->driver->reclaim_buffers_locked) {
249 dev->driver->reclaim_buffers(dev, filp); 246 dev->driver->reclaim_buffers(dev, filp);
250 } 247 }
251 248
@@ -292,8 +289,8 @@ int drm_release(struct inode *inode, struct file *filp)
292 } 289 }
293 up(&dev->struct_sem); 290 up(&dev->struct_sem);
294 291
295 if (dev->driver->free_filp_priv) 292 if (dev->driver->postclose)
296 dev->driver->free_filp_priv(dev, priv); 293 dev->driver->postclose(dev, priv);
297 294
298 drm_free(priv, sizeof(*priv), DRM_MEM_FILES); 295 drm_free(priv, sizeof(*priv), DRM_MEM_FILES);
299 296
@@ -313,7 +310,7 @@ int drm_release(struct inode *inode, struct file *filp)
313 } 310 }
314 spin_unlock(&dev->count_lock); 311 spin_unlock(&dev->count_lock);
315 unlock_kernel(); 312 unlock_kernel();
316 return drm_takedown(dev); 313 return drm_lastclose(dev);
317 } 314 }
318 spin_unlock(&dev->count_lock); 315 spin_unlock(&dev->count_lock);
319 316
@@ -363,8 +360,8 @@ static int drm_open_helper(struct inode *inode, struct file *filp,
363 priv->authenticated = capable(CAP_SYS_ADMIN); 360 priv->authenticated = capable(CAP_SYS_ADMIN);
364 priv->lock_count = 0; 361 priv->lock_count = 0;
365 362
366 if (dev->driver->open_helper) { 363 if (dev->driver->open) {
367 ret = dev->driver->open_helper(dev, priv); 364 ret = dev->driver->open(dev, priv);
368 if (ret < 0) 365 if (ret < 0)
369 goto out_free; 366 goto out_free;
370 } 367 }