summaryrefslogtreecommitdiff
path: root/bsd
diff options
context:
space:
mode:
Diffstat (limited to 'bsd')
-rw-r--r--bsd/drm_bufs.h2
-rw-r--r--bsd/drm_drv.h10
-rw-r--r--bsd/drm_fops.h5
-rw-r--r--bsd/drm_os_freebsd.h2
4 files changed, 12 insertions, 7 deletions
diff --git a/bsd/drm_bufs.h b/bsd/drm_bufs.h
index 0915da84a..15d4a3b17 100644
--- a/bsd/drm_bufs.h
+++ b/bsd/drm_bufs.h
@@ -145,8 +145,8 @@ int DRM(addmap)( DRM_IOCTL_ARGS )
DRM(free)(map, sizeof(*map), DRM_MEM_MAPS);
return DRM_ERR(EBUSY);
}
- DRM_UNLOCK();
dev->lock.hw_lock = map->handle; /* Pointer to lock */
+ DRM_UNLOCK();
}
break;
#if __REALLY_HAVE_AGP
diff --git a/bsd/drm_drv.h b/bsd/drm_drv.h
index 1083f9f98..bf1e2ac4f 100644
--- a/bsd/drm_drv.h
+++ b/bsd/drm_drv.h
@@ -417,11 +417,13 @@ const char *DRM(find_description)(int vendor, int device) {
return NULL;
}
-/* Initialize the DRM on first open. Called with device's lock held */
+/* Initialize the DRM on first open. */
static int DRM(setup)( drm_device_t *dev )
{
int i;
+ DRM_SPINLOCK_ASSERT(&dev->dev_lock);
+
DRIVER_PRESETUP();
dev->buf_use = 0;
@@ -496,9 +498,7 @@ static int DRM(setup)( drm_device_t *dev )
return 0;
}
-/* Free resources associated with the DRM on the last close.
- * Called with the device's lock held.
- */
+/* Free resources associated with the DRM on the last close. */
static int DRM(takedown)( drm_device_t *dev )
{
drm_magic_entry_t *pt, *next;
@@ -506,6 +506,8 @@ static int DRM(takedown)( drm_device_t *dev )
drm_map_list_entry_t *list;
int i;
+ DRM_SPINLOCK_ASSERT(&dev->dev_lock);
+
DRM_DEBUG( "\n" );
DRIVER_PRETAKEDOWN();
diff --git a/bsd/drm_fops.h b/bsd/drm_fops.h
index 55ef8ce0c..e9c5d7a0b 100644
--- a/bsd/drm_fops.h
+++ b/bsd/drm_fops.h
@@ -33,7 +33,6 @@
#include "drmP.h"
-/* Requires device lock held */
drm_file_t *DRM(find_file_by_proc)(drm_device_t *dev, DRM_STRUCTPROC *p)
{
#if __FreeBSD_version >= 500021
@@ -45,6 +44,8 @@ drm_file_t *DRM(find_file_by_proc)(drm_device_t *dev, DRM_STRUCTPROC *p)
#endif
drm_file_t *priv;
+ DRM_SPINLOCK_ASSERT(&dev->dev_lock);
+
TAILQ_FOREACH(priv, &dev->files, link)
if (priv->pid == pid && priv->uid == uid)
return priv;
@@ -65,7 +66,7 @@ int DRM(open_helper)(dev_t kdev, int flags, int fmt, DRM_STRUCTPROC *p,
DRM_DEBUG("pid = %d, minor = %d\n", DRM_CURRENTPID, m);
DRM_LOCK();
- priv = (drm_file_t *) DRM(find_file_by_proc)(dev, p);
+ priv = DRM(find_file_by_proc)(dev, p);
if (priv) {
priv->refs++;
} else {
diff --git a/bsd/drm_os_freebsd.h b/bsd/drm_os_freebsd.h
index 00a44023a..31379b6aa 100644
--- a/bsd/drm_os_freebsd.h
+++ b/bsd/drm_os_freebsd.h
@@ -122,6 +122,7 @@
#define DRM_SPINUNINIT(l) mtx_destroy(&l)
#define DRM_SPINLOCK(l) mtx_lock(l)
#define DRM_SPINUNLOCK(u) mtx_unlock(u);
+#define DRM_SPINLOCK_ASSERT(l) mtx_assert(l, MA_OWNED)
#define DRM_CURRENTPID curthread->td_proc->p_pid
#define DRM_LOCK() mtx_lock(&dev->dev_lock)
#define DRM_UNLOCK() mtx_unlock(&dev->dev_lock)
@@ -137,6 +138,7 @@
#define DRM_SPINUNINIT(l)
#define DRM_SPINLOCK(l)
#define DRM_SPINUNLOCK(u)
+#define DRM_SPINLOCK_ASSERT(l)
#define DRM_CURRENTPID curproc->p_pid
#define DRM_LOCK()
#define DRM_UNLOCK()