diff options
author | Owain Ainsworth <oga@cvs.openbsd.org> | 2009-03-30 00:17:13 +0000 |
---|---|---|
committer | Owain Ainsworth <oga@cvs.openbsd.org> | 2009-03-30 00:17:13 +0000 |
commit | 1f08dd635f94f957647c32a67d9839fc80df4531 (patch) | |
tree | b36f9f4b64cd0270fdfd677317b88ec90ae88ccf /sys/dev | |
parent | df66b23e0527df77593db1a172df0604ca59e85c (diff) |
Remove the DRM_SPIN lock macros, just expand them to mutex operations.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/drm/drmP.h | 12 | ||||
-rw-r--r-- | sys/dev/pci/drm/drm_irq.c | 28 | ||||
-rw-r--r-- | sys/dev/pci/drm/i915_drv.h | 2 |
3 files changed, 19 insertions, 23 deletions
diff --git a/sys/dev/pci/drm/drmP.h b/sys/dev/pci/drm/drmP.h index a4eb253e0ca..42f7e22e2ff 100644 --- a/sys/dev/pci/drm/drmP.h +++ b/sys/dev/pci/drm/drmP.h @@ -83,10 +83,6 @@ #define __OS_HAS_AGP 1 #define DRM_CURRENTPID curproc->p_pid -#define DRM_SPINTYPE struct mutex -#define DRM_SPININIT(l,name) mtx_init(l,IPL_NONE) -#define DRM_SPINLOCK(l) mtx_enter(l) -#define DRM_SPINUNLOCK(l) mtx_leave(l) #define DRM_LOCK() rw_enter_write(&dev->dev_lock) #define DRM_UNLOCK() rw_exit_write(&dev->dev_lock) #define DRM_MAXUNITS 8 @@ -191,14 +187,14 @@ do { \ } while (0) #define DRM_WAIT_ON( ret, queue, timeout, condition ) \ -DRM_SPINLOCK(&dev->irq_lock); \ +mtx_enter(&dev->irq_lock); \ while ( ret == 0 ) { \ if (condition) \ break; \ ret = msleep((queue), &dev->irq_lock, \ PZERO | PCATCH, "drmwtq", (timeout)); \ } \ -DRM_SPINUNLOCK(&dev->irq_lock) +mtx_leave(&dev->irq_lock) #define DRM_ERROR(fmt, arg...) \ printf("error: [" DRM_NAME ":pid%d:%s] *ERROR* " fmt, \ @@ -440,7 +436,7 @@ struct drm_device { int if_version; /* Highest interface version set */ /* Locks */ - DRM_SPINTYPE irq_lock; /* protects irq condition checks */ + struct mutex irq_lock; /* protects irq condition checks */ struct rwlock dev_lock; /* protects everything else */ /* Usage Counters */ @@ -466,7 +462,7 @@ struct drm_device { /* VBLANK support */ int num_crtcs; /* number of crtcs */ u_int32_t max_vblank_count; /* size of counter reg*/ - DRM_SPINTYPE vbl_lock; /* VBLANK data lock */ + struct mutex vbl_lock; /* VBLANK data lock */ int vblank_disable_allowed; struct timeout vblank_disable_timer; /* timer for disable */ struct drm_vblank *vblank; /* One per ctrc */ diff --git a/sys/dev/pci/drm/drm_irq.c b/sys/dev/pci/drm/drm_irq.c index e6c9423a235..2a0f7cf592c 100644 --- a/sys/dev/pci/drm/drm_irq.c +++ b/sys/dev/pci/drm/drm_irq.c @@ -62,9 +62,9 @@ drm_irq_handler_wrap(DRM_IRQ_ARGS) irqreturn_t ret; struct drm_device *dev = (struct drm_device *)arg; - DRM_SPINLOCK(&dev->irq_lock); + mtx_enter(&dev->irq_lock); ret = dev->driver->irq_handler(arg); - DRM_SPINUNLOCK(&dev->irq_lock); + mtx_leave(&dev->irq_lock); return ret; } @@ -148,7 +148,7 @@ vblank_disable(void *arg) struct drm_device *dev = (struct drm_device*)arg; int i; - DRM_SPINLOCK(&dev->vbl_lock); + mtx_enter(&dev->vbl_lock); if (!dev->vblank_disable_allowed) goto out; @@ -162,7 +162,7 @@ vblank_disable(void *arg) } } out: - DRM_SPINUNLOCK(&dev->vbl_lock); + mtx_leave(&dev->vbl_lock); } void @@ -233,7 +233,7 @@ drm_vblank_get(struct drm_device *dev, int crtc) if (dev->irq_enabled == 0) return (EINVAL); - DRM_SPINLOCK(&dev->vbl_lock); + mtx_enter(&dev->vbl_lock); atomic_add(1, &dev->vblank[crtc].vbl_refcount); if (dev->vblank[crtc].vbl_refcount == 1 && dev->vblank[crtc].vbl_enabled == 0) { @@ -245,7 +245,7 @@ drm_vblank_get(struct drm_device *dev, int crtc) } } - DRM_SPINUNLOCK(&dev->vbl_lock); + mtx_leave(&dev->vbl_lock); return (ret); } @@ -256,12 +256,12 @@ drm_vblank_put(struct drm_device *dev, int crtc) if (dev->irq_enabled == 0) return; - DRM_SPINLOCK(&dev->vbl_lock); + mtx_enter(&dev->vbl_lock); /* Last user schedules interrupt disable */ atomic_dec(&dev->vblank[crtc].vbl_refcount); if (dev->vblank[crtc].vbl_refcount == 0) timeout_add_sec(&dev->vblank_disable_timer, 5); - DRM_SPINUNLOCK(&dev->vbl_lock); + mtx_leave(&dev->vbl_lock); } int @@ -288,18 +288,18 @@ drm_modeset_ctl(struct drm_device *dev, void *data, struct drm_file *file_priv) switch (modeset->cmd) { case _DRM_PRE_MODESET: if (dev->vblank[crtc].vbl_inmodeset == 0) { - DRM_SPINLOCK(&dev->vbl_lock); + mtx_enter(&dev->vbl_lock); dev->vblank[crtc].vbl_inmodeset = 1; - DRM_SPINUNLOCK(&dev->vbl_lock); + mtx_leave(&dev->vbl_lock); drm_vblank_get(dev, crtc); } break; case _DRM_POST_MODESET: if (dev->vblank[crtc].vbl_inmodeset) { - DRM_SPINLOCK(&dev->vbl_lock); + mtx_enter(&dev->vbl_lock); dev->vblank_disable_allowed = 1; dev->vblank[crtc].vbl_inmodeset = 0; - DRM_SPINUNLOCK(&dev->vbl_lock); + mtx_leave(&dev->vbl_lock); drm_vblank_put(dev, crtc); } break; @@ -346,7 +346,7 @@ drm_wait_vblank(struct drm_device *dev, void *data, struct drm_file *file_priv) if (flags & _DRM_VBLANK_SIGNAL) { ret = EINVAL; } else { - DRM_SPINLOCK(&dev->vbl_lock); + mtx_enter(&dev->vbl_lock); while (ret == 0) { if ((drm_vblank_count(dev, crtc) - vblwait->request.sequence) <= (1 << 23)) @@ -355,7 +355,7 @@ drm_wait_vblank(struct drm_device *dev, void *data, struct drm_file *file_priv) &dev->vbl_lock, PZERO | PCATCH, "drmvblq", 3 * DRM_HZ); } - DRM_SPINUNLOCK(&dev->vbl_lock); + mtx_leave(&dev->vbl_lock); if (ret != EINTR) { struct timeval now; diff --git a/sys/dev/pci/drm/i915_drv.h b/sys/dev/pci/drm/i915_drv.h index 518655c41d3..4fab276fd79 100644 --- a/sys/dev/pci/drm/i915_drv.h +++ b/sys/dev/pci/drm/i915_drv.h @@ -97,7 +97,7 @@ typedef struct drm_i915_private { atomic_t irq_received; /* Protects user_irq_refcount and irq_mask reg */ - DRM_SPINTYPE user_irq_lock; + struct mutex user_irq_lock; /* Refcount for user irq, only enabled when needed */ int user_irq_refcount; /* Cached value of IMR to avoid reads in updating the bitfield */ |