drm: hide legacy sg cleanup better from common code
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 8 Aug 2013 13:41:17 +0000 (15:41 +0200)
committerDave Airlie <airlied@redhat.com>
Mon, 19 Aug 2013 00:03:49 +0000 (10:03 +1000)
I've decided that some clear markers for what's legacy dri1/non-gem
code is useful. I've opted to use the drm_legacy prefix and then hide
all the checks in that function for better readability in the common
code.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/drm_drv.c
drivers/gpu/drm/drm_scatter.c
include/drm/drmP.h

index dddd79988ffca3cf11d676502dfa64fea8f649cb..743b24d7918ef49830931568d6aa049ead89b5bc 100644 (file)
@@ -197,11 +197,7 @@ int drm_lastclose(struct drm_device * dev)
 
        drm_agp_clear(dev);
 
-       if (drm_core_check_feature(dev, DRIVER_SG) && dev->sg &&
-           !drm_core_check_feature(dev, DRIVER_MODESET)) {
-               drm_sg_cleanup(dev->sg);
-               dev->sg = NULL;
-       }
+       drm_legacy_sg_cleanup(dev);
 
        /* Clear vma list (only built for debugging) */
        list_for_each_entry_safe(vma, vma_temp, &dev->vmalist, head) {
index a4a076ff17573704a3b0ce75104f6f93e9cccf4d..dd8a6480065cb851505185d00826a4187726a03b 100644 (file)
@@ -46,7 +46,7 @@ static inline void *drm_vmalloc_dma(unsigned long size)
 #endif
 }
 
-void drm_sg_cleanup(struct drm_sg_mem * entry)
+static void drm_sg_cleanup(struct drm_sg_mem * entry)
 {
        struct page *page;
        int i;
@@ -64,6 +64,14 @@ void drm_sg_cleanup(struct drm_sg_mem * entry)
        kfree(entry);
 }
 
+void drm_legacy_sg_cleanup(struct drm_device *dev)
+{
+       if (drm_core_check_feature(dev, DRIVER_SG) && dev->sg &&
+           !drm_core_check_feature(dev, DRIVER_MODESET)) {
+               drm_sg_cleanup(dev->sg);
+               dev->sg = NULL;
+       }
+}
 #ifdef _LP64
 # define ScatterHandle(x) (unsigned int)((x >> 32) + (x & ((1L << 32) - 1)))
 #else
index 813ca1d1172821b2106a9797eaaa78ca26273bd8..10d9f83a9df09ea23c4de46d89c4b6277b24dd30 100644 (file)
@@ -1522,7 +1522,7 @@ extern int drm_vma_info(struct seq_file *m, void *data);
 #endif
 
                                /* Scatter Gather Support (drm_scatter.h) */
-extern void drm_sg_cleanup(struct drm_sg_mem * entry);
+extern void drm_legacy_sg_cleanup(struct drm_device *dev);
 extern int drm_sg_alloc(struct drm_device *dev, void *data,
                        struct drm_file *file_priv);
 extern int drm_sg_free(struct drm_device *dev, void *data,