Commit 3d914e83 authored by Daniel Vetter's avatar Daniel Vetter Committed by Dave Airlie

drm: hide legacy sg cleanup better from common code

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: default avatarEric Anholt <eric@anholt.net>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 45886af2
...@@ -197,11 +197,7 @@ int drm_lastclose(struct drm_device * dev) ...@@ -197,11 +197,7 @@ int drm_lastclose(struct drm_device * dev)
drm_agp_clear(dev); drm_agp_clear(dev);
if (drm_core_check_feature(dev, DRIVER_SG) && dev->sg && drm_legacy_sg_cleanup(dev);
!drm_core_check_feature(dev, DRIVER_MODESET)) {
drm_sg_cleanup(dev->sg);
dev->sg = NULL;
}
/* Clear vma list (only built for debugging) */ /* Clear vma list (only built for debugging) */
list_for_each_entry_safe(vma, vma_temp, &dev->vmalist, head) { list_for_each_entry_safe(vma, vma_temp, &dev->vmalist, head) {
......
...@@ -46,7 +46,7 @@ static inline void *drm_vmalloc_dma(unsigned long size) ...@@ -46,7 +46,7 @@ static inline void *drm_vmalloc_dma(unsigned long size)
#endif #endif
} }
void drm_sg_cleanup(struct drm_sg_mem * entry) static void drm_sg_cleanup(struct drm_sg_mem * entry)
{ {
struct page *page; struct page *page;
int i; int i;
...@@ -64,6 +64,14 @@ void drm_sg_cleanup(struct drm_sg_mem * entry) ...@@ -64,6 +64,14 @@ void drm_sg_cleanup(struct drm_sg_mem * entry)
kfree(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 #ifdef _LP64
# define ScatterHandle(x) (unsigned int)((x >> 32) + (x & ((1L << 32) - 1))) # define ScatterHandle(x) (unsigned int)((x >> 32) + (x & ((1L << 32) - 1)))
#else #else
......
...@@ -1522,7 +1522,7 @@ extern int drm_vma_info(struct seq_file *m, void *data); ...@@ -1522,7 +1522,7 @@ extern int drm_vma_info(struct seq_file *m, void *data);
#endif #endif
/* Scatter Gather Support (drm_scatter.h) */ /* 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, extern int drm_sg_alloc(struct drm_device *dev, void *data,
struct drm_file *file_priv); struct drm_file *file_priv);
extern int drm_sg_free(struct drm_device *dev, void *data, extern int drm_sg_free(struct drm_device *dev, void *data,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment