X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=drivers%2Fchar%2Fdrm%2Fdrm_fops.c;h=898f47dafec0b2fc6234e0c7f42ad3a4656e70ef;hb=12cbbd95e12e911b43afae7f6f4850f616223642;hp=403f44a1bf016cebe684f8d35719bf3b8d6dbf06;hpb=0825788ff27c7145e9d558cb2a26f3837d1f9be5;p=powerpc.git diff --git a/drivers/char/drm/drm_fops.c b/drivers/char/drm/drm_fops.c index 403f44a1bf..898f47dafe 100644 --- a/drivers/char/drm/drm_fops.c +++ b/drivers/char/drm/drm_fops.c @@ -53,6 +53,8 @@ static int drm_setup(drm_device_t * dev) return ret; } + dev->magicfree.next = NULL; + /* prebuild the SAREA */ i = drm_addmap(dev, 0, SAREA_MAX, _DRM_SHM, _DRM_CONTAINS_LOCK, &map); if (i != 0) @@ -69,13 +71,11 @@ static int drm_setup(drm_device_t * dev) return i; } - for (i = 0; i < DRM_ARRAY_SIZE(dev->counts); i++) + for (i = 0; i < ARRAY_SIZE(dev->counts); i++) atomic_set(&dev->counts[i], 0); - for (i = 0; i < DRM_HASH_SIZE; i++) { - dev->magiclist[i].head = NULL; - dev->magiclist[i].tail = NULL; - } + drm_ht_create(&dev->magiclist, DRM_MAGIC_HASH_ORDER); + INIT_LIST_HEAD(&dev->magicfree); dev->ctxlist = drm_alloc(sizeof(*dev->ctxlist), DRM_MEM_CTXLIST); if (dev->ctxlist == NULL) @@ -175,7 +175,7 @@ int drm_stub_open(struct inode *inode, struct file *filp) drm_device_t *dev = NULL; int minor = iminor(inode); int err = -ENODEV; - struct file_operations *old_fops; + const struct file_operations *old_fops; DRM_DEBUG("\n"); @@ -262,7 +262,7 @@ static int drm_open_helper(struct inode *inode, struct file *filp, goto out_free; } - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); if (!dev->file_last) { priv->next = NULL; priv->prev = NULL; @@ -276,7 +276,7 @@ static int drm_open_helper(struct inode *inode, struct file *filp, dev->file_last->next = priv; dev->file_last = priv; } - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); #ifdef __alpha__ /* @@ -413,7 +413,7 @@ int drm_release(struct inode *inode, struct file *filp) drm_fasync(-1, filp, 0); - down(&dev->ctxlist_sem); + mutex_lock(&dev->ctxlist_mutex); if (dev->ctxlist && (!list_empty(&dev->ctxlist->head))) { drm_ctx_list_t *pos, *n; @@ -432,9 +432,9 @@ int drm_release(struct inode *inode, struct file *filp) } } } - up(&dev->ctxlist_sem); + mutex_unlock(&dev->ctxlist_mutex); - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); if (priv->remove_auth_on_close == 1) { drm_file_t *temp = dev->file_first; while (temp) { @@ -452,7 +452,7 @@ int drm_release(struct inode *inode, struct file *filp) } else { dev->file_last = priv->prev; } - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); if (dev->driver->postclose) dev->driver->postclose(dev, priv);