drm: Kill ctx_count from struct drm_device
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 4 Oct 2013 11:53:39 +0000 (14:53 +0300)
committerDave Airlie <airlied@redhat.com>
Wed, 9 Oct 2013 05:55:32 +0000 (15:55 +1000)
The only user of ctx_count is the via driver, and we can replace that
use with list_is_singular().

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/drm_context.c
drivers/gpu/drm/drm_fops.c
drivers/gpu/drm/via/via_mm.c
include/drm/drmP.h

index 224ff965bcf7de624c3b62b6db153bda090ea4a9..a4b017b6849efd79686693e0e5cad7b5edf9ae09 100644 (file)
@@ -334,7 +334,6 @@ int drm_addctx(struct drm_device *dev, void *data,
 
        mutex_lock(&dev->ctxlist_mutex);
        list_add(&ctx_entry->head, &dev->ctxlist);
-       ++dev->ctx_count;
        mutex_unlock(&dev->ctxlist_mutex);
 
        return 0;
@@ -432,7 +431,6 @@ int drm_rmctx(struct drm_device *dev, void *data,
                        if (pos->handle == ctx->handle) {
                                list_del(&pos->head);
                                kfree(pos);
-                               --dev->ctx_count;
                        }
                }
        }
index 8bc94eaaf9f5d779417ab17703280b3b43569d0d..621b45e08bd12047ca7e2745ee3e0923dcb58d38 100644 (file)
@@ -524,7 +524,6 @@ int drm_release(struct inode *inode, struct file *filp)
 
                                list_del(&pos->head);
                                kfree(pos);
-                               --dev->ctx_count;
                        }
                }
        }
index 7e3ad87c366c6761e41b38c4fe3226f38925d9e5..9278891054834992ba30c5b9ac2a4f5b09403438 100644 (file)
@@ -79,7 +79,7 @@ int via_final_context(struct drm_device *dev, int context)
 
        /* Linux specific until context tracking code gets ported to BSD */
        /* Last context, perform cleanup */
-       if (dev->ctx_count == 1 && dev->dev_private) {
+       if (list_is_singular(&dev->ctxlist) && dev->dev_private) {
                DRM_DEBUG("Last Context\n");
                drm_irq_uninstall(dev);
                via_cleanup_futex(dev_priv);
index 5b99c0e072efcdba11f8ee0d68dad328e558672f..e26b802367191bff09179c34a45421169d2d2672 100644 (file)
@@ -1132,7 +1132,6 @@ struct drm_device {
        /** \name Context handle management */
        /*@{ */
        struct list_head ctxlist;       /**< Linked list of context handles */
-       int ctx_count;                  /**< Number of context handles */
        struct mutex ctxlist_mutex;     /**< For ctxlist */
 
        struct idr ctx_idr;