diff options
author | Alan Hourihane <alanh@tungstengraphics.com> | 2007-10-23 15:34:12 +0100 |
---|---|---|
committer | Alan Hourihane <alanh@tungstengraphics.com> | 2007-10-23 15:34:12 +0100 |
commit | d5f2b4b411c5ca95d6f66a33d213ece387ac4fc5 (patch) | |
tree | c6f723b2c02e7a6e7cbcd4e7fe8f64b6c5b9e002 /bsd-core | |
parent | 198170ab97bbf2ca6362bb7100e9ed86d90aa51f (diff) | |
parent | a294aa724a1e932fb6017383e08532bfcc914df0 (diff) |
Merge branch 'master' of git+ssh://git.freedesktop.org/git/mesa/drm into modesetting-101
Diffstat (limited to 'bsd-core')
-rw-r--r-- | bsd-core/drm_drv.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/bsd-core/drm_drv.c b/bsd-core/drm_drv.c index c36b78aa..d6868b9c 100644 --- a/bsd-core/drm_drv.c +++ b/bsd-core/drm_drv.c @@ -538,6 +538,7 @@ static int drm_load(drm_device_t *dev) if (dev->driver.load != NULL) { DRM_LOCK(); + /* Shared code returns -errno. */ retcode = -dev->driver.load(dev, dev->id_entry->driver_private); DRM_UNLOCK(); @@ -720,6 +721,9 @@ int drm_close(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p) return EINVAL; } + if (--file_priv->refs != 0) + goto done; + if (dev->driver.preclose != NULL) dev->driver.preclose(dev, file_priv); @@ -795,17 +799,16 @@ int drm_close(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p) dev->buf_pgid = 0; #endif /* __NetBSD__ || __OpenBSD__ */ - if (--file_priv->refs == 0) { - if (dev->driver.postclose != NULL) - dev->driver.postclose(dev, file_priv); - TAILQ_REMOVE(&dev->files, file_priv, link); - free(file_priv, M_DRM); - } + if (dev->driver.postclose != NULL) + dev->driver.postclose(dev, file_priv); + TAILQ_REMOVE(&dev->files, file_priv, link); + free(file_priv, M_DRM); /* ======================================================== * End inline drm_release */ +done: atomic_inc( &dev->counts[_DRM_STAT_CLOSES] ); #ifdef __FreeBSD__ device_unbusy(dev->device); |