Commit e6bf6e57 authored by Daniel Vetter's avatar Daniel Vetter

drm/ttm: Remove TTM_HAS_AGP

It tries to do fancy things with excluding agp support if ttm is
built-in, but agp isn't. Instead just express this depency like drm
does and use CONFIG_AGP everywhere.

Also use the neat Makefile magic to make the entire ttm_agp_backend
file optional.

v2: Use IS_ENABLED(CONFIG_AGP) as suggested by Ville

v3: Review from Emil.

v4: Actually get it right as spotted by 0-day.

Cc: Emil Velikov <emil.l.velikov@gmail.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarEmil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1459337046-25882-1-git-send-email-daniel.vetter@ffwll.ch
parent 67535531
...@@ -2,9 +2,10 @@ ...@@ -2,9 +2,10 @@
# Makefile for the drm device driver. This driver provides support for the # Makefile for the drm device driver. This driver provides support for the
ccflags-y := -Iinclude/drm ccflags-y := -Iinclude/drm
ttm-y := ttm_agp_backend.o ttm_memory.o ttm_tt.o ttm_bo.o \ ttm-y := ttm_memory.o ttm_tt.o ttm_bo.o \
ttm_bo_util.o ttm_bo_vm.o ttm_module.o \ ttm_bo_util.o ttm_bo_vm.o ttm_module.o \
ttm_object.o ttm_lock.o ttm_execbuf_util.o ttm_page_alloc.o \ ttm_object.o ttm_lock.o ttm_execbuf_util.o ttm_page_alloc.o \
ttm_bo_manager.o ttm_page_alloc_dma.o ttm_bo_manager.o ttm_page_alloc_dma.o
ttm-$(CONFIG_AGP) += ttm_agp_backend.o
obj-$(CONFIG_DRM_TTM) += ttm.o obj-$(CONFIG_DRM_TTM) += ttm.o
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#include <drm/ttm/ttm_module.h> #include <drm/ttm/ttm_module.h>
#include <drm/ttm/ttm_bo_driver.h> #include <drm/ttm/ttm_bo_driver.h>
#include <drm/ttm/ttm_page_alloc.h> #include <drm/ttm/ttm_page_alloc.h>
#ifdef TTM_HAS_AGP
#include <drm/ttm/ttm_placement.h> #include <drm/ttm/ttm_placement.h>
#include <linux/agp_backend.h> #include <linux/agp_backend.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -148,5 +147,3 @@ void ttm_agp_tt_unpopulate(struct ttm_tt *ttm) ...@@ -148,5 +147,3 @@ void ttm_agp_tt_unpopulate(struct ttm_tt *ttm)
ttm_pool_unpopulate(ttm); ttm_pool_unpopulate(ttm);
} }
EXPORT_SYMBOL(ttm_agp_tt_unpopulate); EXPORT_SYMBOL(ttm_agp_tt_unpopulate);
#endif
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
#include <drm/ttm/ttm_bo_driver.h> #include <drm/ttm/ttm_bo_driver.h>
#include <drm/ttm/ttm_page_alloc.h> #include <drm/ttm/ttm_page_alloc.h>
#ifdef TTM_HAS_AGP #if IS_ENABLED(CONFIG_AGP)
#include <asm/agp.h> #include <asm/agp.h>
#endif #endif
...@@ -219,7 +219,7 @@ static struct ttm_pool_manager *_manager; ...@@ -219,7 +219,7 @@ static struct ttm_pool_manager *_manager;
#ifndef CONFIG_X86 #ifndef CONFIG_X86
static int set_pages_array_wb(struct page **pages, int addrinarray) static int set_pages_array_wb(struct page **pages, int addrinarray)
{ {
#ifdef TTM_HAS_AGP #if IS_ENABLED(CONFIG_AGP)
int i; int i;
for (i = 0; i < addrinarray; i++) for (i = 0; i < addrinarray; i++)
...@@ -230,7 +230,7 @@ static int set_pages_array_wb(struct page **pages, int addrinarray) ...@@ -230,7 +230,7 @@ static int set_pages_array_wb(struct page **pages, int addrinarray)
static int set_pages_array_wc(struct page **pages, int addrinarray) static int set_pages_array_wc(struct page **pages, int addrinarray)
{ {
#ifdef TTM_HAS_AGP #if IS_ENABLED(CONFIG_AGP)
int i; int i;
for (i = 0; i < addrinarray; i++) for (i = 0; i < addrinarray; i++)
...@@ -241,7 +241,7 @@ static int set_pages_array_wc(struct page **pages, int addrinarray) ...@@ -241,7 +241,7 @@ static int set_pages_array_wc(struct page **pages, int addrinarray)
static int set_pages_array_uc(struct page **pages, int addrinarray) static int set_pages_array_uc(struct page **pages, int addrinarray)
{ {
#ifdef TTM_HAS_AGP #if IS_ENABLED(CONFIG_AGP)
int i; int i;
for (i = 0; i < addrinarray; i++) for (i = 0; i < addrinarray; i++)
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
#include <linux/kthread.h> #include <linux/kthread.h>
#include <drm/ttm/ttm_bo_driver.h> #include <drm/ttm/ttm_bo_driver.h>
#include <drm/ttm/ttm_page_alloc.h> #include <drm/ttm/ttm_page_alloc.h>
#ifdef TTM_HAS_AGP #if IS_ENABLED(CONFIG_AGP)
#include <asm/agp.h> #include <asm/agp.h>
#endif #endif
...@@ -271,7 +271,7 @@ static struct kobj_type ttm_pool_kobj_type = { ...@@ -271,7 +271,7 @@ static struct kobj_type ttm_pool_kobj_type = {
#ifndef CONFIG_X86 #ifndef CONFIG_X86
static int set_pages_array_wb(struct page **pages, int addrinarray) static int set_pages_array_wb(struct page **pages, int addrinarray)
{ {
#ifdef TTM_HAS_AGP #if IS_ENABLED(CONFIG_AGP)
int i; int i;
for (i = 0; i < addrinarray; i++) for (i = 0; i < addrinarray; i++)
...@@ -282,7 +282,7 @@ static int set_pages_array_wb(struct page **pages, int addrinarray) ...@@ -282,7 +282,7 @@ static int set_pages_array_wb(struct page **pages, int addrinarray)
static int set_pages_array_wc(struct page **pages, int addrinarray) static int set_pages_array_wc(struct page **pages, int addrinarray)
{ {
#ifdef TTM_HAS_AGP #if IS_ENABLED(CONFIG_AGP)
int i; int i;
for (i = 0; i < addrinarray; i++) for (i = 0; i < addrinarray; i++)
...@@ -293,7 +293,7 @@ static int set_pages_array_wc(struct page **pages, int addrinarray) ...@@ -293,7 +293,7 @@ static int set_pages_array_wc(struct page **pages, int addrinarray)
static int set_pages_array_uc(struct page **pages, int addrinarray) static int set_pages_array_uc(struct page **pages, int addrinarray)
{ {
#ifdef TTM_HAS_AGP #if IS_ENABLED(CONFIG_AGP)
int i; int i;
for (i = 0; i < addrinarray; i++) for (i = 0; i < addrinarray; i++)
......
...@@ -1030,8 +1030,7 @@ extern pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp); ...@@ -1030,8 +1030,7 @@ extern pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp);
extern const struct ttm_mem_type_manager_func ttm_bo_manager_func; extern const struct ttm_mem_type_manager_func ttm_bo_manager_func;
#if (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE))) #if IS_ENABLED(CONFIG_AGP)
#define TTM_HAS_AGP
#include <linux/agp_backend.h> #include <linux/agp_backend.h>
/** /**
......
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