drm: compile drm_vm.c only when needed
authorBenjamin Gaignard <benjamin.gaignard@linaro.org>
Wed, 4 Jan 2017 09:12:56 +0000 (10:12 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 6 Jan 2017 10:03:07 +0000 (11:03 +0100)
drm_vm.c functions are only need for DRM_LEGACY and DRM_NOUVEAU.
Use a new DRM_VM to define when drm_vm.c in needed.

stub drm_legacy_vma_flush() to avoid compilation issues

version 4:
- a "config DRM_VM" in Kconfig

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
[danvet: Fix conflict.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/Kconfig
drivers/gpu/drm/Makefile
drivers/gpu/drm/drm_legacy.h
drivers/gpu/drm/nouveau/Kconfig

index 29146fa..d56b85c 100644 (file)
@@ -136,6 +136,10 @@ config DRM_KMS_CMA_HELPER
        help
          Choose this if you need the KMS CMA helper functions
 
+config DRM_VM
+       bool
+       depends on DRM
+
 source "drivers/gpu/drm/i2c/Kconfig"
 
 source "drivers/gpu/drm/arm/Kconfig"
@@ -264,6 +268,7 @@ source "drivers/gpu/drm/meson/Kconfig"
 menuconfig DRM_LEGACY
        bool "Enable legacy drivers (DANGEROUS)"
        depends on DRM
+       select DRM_VM
        help
          Enable legacy DRI1 drivers. Those drivers expose unsafe and dangerous
          APIs to user-space, which can be used to circumvent access
index d00c389..92de399 100644 (file)
@@ -5,7 +5,7 @@
 drm-y       := drm_auth.o drm_bufs.o drm_cache.o \
                drm_context.o drm_dma.o \
                drm_fops.o drm_gem.o drm_ioctl.o drm_irq.o \
-               drm_lock.o drm_memory.o drm_drv.o drm_vm.o \
+               drm_lock.o drm_memory.o drm_drv.o \
                drm_scatter.o drm_pci.o \
                drm_platform.o drm_sysfs.o drm_hashtab.o drm_mm.o \
                drm_crtc.o drm_fourcc.o drm_modes.o drm_edid.o \
@@ -19,6 +19,7 @@ drm-y       :=        drm_auth.o drm_bufs.o drm_cache.o \
                drm_dumb_buffers.o drm_mode_config.o
 
 drm-$(CONFIG_DRM_LIB_RANDOM) += lib/drm_random.o
+drm-$(CONFIG_DRM_VM) += drm_vm.o
 drm-$(CONFIG_COMPAT) += drm_ioc32.o
 drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o
 drm-$(CONFIG_PCI) += ati_pcigart.o
index c6f422e..e4bb5ad 100644 (file)
@@ -74,7 +74,14 @@ int drm_legacy_freebufs(struct drm_device *d, void *v, struct drm_file *f);
 int drm_legacy_mapbufs(struct drm_device *d, void *v, struct drm_file *f);
 int drm_legacy_dma_ioctl(struct drm_device *d, void *v, struct drm_file *f);
 
+#ifdef CONFIG_DRM_VM
 void drm_legacy_vma_flush(struct drm_device *d);
+#else
+static inline void drm_legacy_vma_flush(struct drm_device *d)
+{
+       /* do nothing */
+}
+#endif
 
 /*
  * AGP Support
index 2922a82..0f2f0af 100644 (file)
@@ -16,6 +16,7 @@ config DRM_NOUVEAU
        select INPUT if ACPI && X86
        select THERMAL if ACPI && X86
        select ACPI_VIDEO if ACPI && X86
+       select DRM_VM
        help
          Choose this option for open-source NVIDIA support.