summaryrefslogtreecommitdiff
path: root/drm_context.c
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2014-06-09 11:42:53 +0200
committerThomas Hellstrom <thellstrom@vmware.com>2014-06-10 09:45:49 +0200
commit197e2934c348c26d708cecc853d59ffc04c3efe2 (patch)
tree0ef507fd55ecc2d1c7bf886654d318d0f132d5ae /drm_context.c
parent52139713dd99052be562fb70c04a200f6bdc7954 (diff)
vmwgfx: Adapt to new idr interface
As of Linux 3.9, the idr interface has changed slightly, and as of Linux 3.15 some of the deprecated functions were removed. Adjust the code accordingly, fixing compile breakage on 3.15 Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Diffstat (limited to 'drm_context.c')
-rw-r--r--drm_context.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drm_context.c b/drm_context.c
index 2607753..376aac6 100644
--- a/drm_context.c
+++ b/drm_context.c
@@ -72,6 +72,7 @@ void drm_ctxbitmap_free(struct drm_device * dev, int ctx_handle)
* Allocate a new idr from drm_device::ctx_idr while holding the
* drm_device::struct_mutex lock.
*/
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0))
static int drm_ctxbitmap_next(struct drm_device * dev)
{
int new_id;
@@ -92,6 +93,18 @@ again:
mutex_unlock(&dev->struct_mutex);
return new_id;
}
+#else
+static int drm_ctxbitmap_next(struct drm_device *dev)
+{
+ int ret;
+
+ mutex_lock(&dev->struct_mutex);
+ ret = idr_alloc(&dev->ctx_idr, NULL, DRM_RESERVED_CONTEXTS, 0,
+ GFP_KERNEL);
+ mutex_unlock(&dev->struct_mutex);
+ return ret;
+}
+#endif
/**
* Context bitmap initialization.
@@ -117,7 +130,10 @@ int drm_ctxbitmap_init(struct drm_device * dev)
void drm_ctxbitmap_cleanup(struct drm_device * dev)
{
mutex_lock(&dev->struct_mutex);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0))
idr_remove_all(&dev->ctx_idr);
+#endif
+ idr_destroy(&dev->ctx_idr);
mutex_unlock(&dev->struct_mutex);
}