From a9015f0cb152e989483f9aaa5dfef2e6e5f4e334 Mon Sep 17 00:00:00 2001 From: Alexandre Courbot Date: Fri, 18 Dec 2015 15:16:09 +0900 Subject: allow compilation against 3.18 --- drm/nouveau/dispnv04/tvnv17.c | 4 ++++ drm/nouveau/nouveau_connector.c | 7 +++++++ drm/nouveau/nouveau_drm.c | 7 +++++++ drm/nouveau/nouveau_fbcon.c | 17 +++++++++++++++++ drm/nouveau/nouveau_platform.c | 7 +++++++ 5 files changed, 42 insertions(+) diff --git a/drm/nouveau/dispnv04/tvnv17.c b/drm/nouveau/dispnv04/tvnv17.c index 163317d26..4be69bcfa 100644 --- a/drm/nouveau/dispnv04/tvnv17.c +++ b/drm/nouveau/dispnv04/tvnv17.c @@ -24,6 +24,8 @@ * */ +#include + #include #include #include "nouveau_drm.h" @@ -656,7 +658,9 @@ static int nv17_tv_create_resources(struct drm_encoder *encoder, nouveau_tv_norm); } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) drm_mode_create_tv_properties(dev, num_tv_norms, nv17_tv_norm_names); +#endif drm_object_attach_property(&connector->base, conf->tv_select_subconnector_property, diff --git a/drm/nouveau/nouveau_connector.c b/drm/nouveau/nouveau_connector.c index fcebfae5d..f9a5030a0 100644 --- a/drm/nouveau/nouveau_connector.c +++ b/drm/nouveau/nouveau_connector.c @@ -27,6 +27,7 @@ #include #include +#include #include #include @@ -935,7 +936,11 @@ nouveau_connector_funcs_lvds = { .force = nouveau_connector_force }; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) static int +#else +static void +#endif nouveau_connector_dp_dpms(struct drm_connector *connector, int mode) { struct nouveau_encoder *nv_encoder = NULL; @@ -954,7 +959,9 @@ nouveau_connector_dp_dpms(struct drm_connector *connector, int mode) } } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) return drm_helper_connector_dpms(connector, mode); +#endif } static const struct drm_connector_funcs diff --git a/drm/nouveau/nouveau_drm.c b/drm/nouveau/nouveau_drm.c index c75b662c1..c8a80adad 100644 --- a/drm/nouveau/nouveau_drm.c +++ b/drm/nouveau/nouveau_drm.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "drmP.h" #include "drm_crtc_helper.h" @@ -918,6 +919,10 @@ nouveau_driver_fops = { .llseek = noop_llseek, }; +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) +#define DRIVER_KMS_LEGACY_CONTEXT 0 +#endif + static struct drm_driver driver_stub = { .driver_features = @@ -936,7 +941,9 @@ driver_stub = { .debugfs_cleanup = nouveau_drm_debugfs_cleanup, #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) .get_vblank_counter = drm_vblank_no_hw_counter, +#endif .enable_vblank = nouveau_display_vblank_enable, .disable_vblank = nouveau_display_vblank_disable, #ifndef CONFIG_ARCH_TEGRA diff --git a/drm/nouveau/nouveau_fbcon.c b/drm/nouveau/nouveau_fbcon.c index 59f27e774..40d198cca 100644 --- a/drm/nouveau/nouveau_fbcon.c +++ b/drm/nouveau/nouveau_fbcon.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -84,7 +85,9 @@ nouveau_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect) if (ret != -ENODEV) nouveau_fbcon_gpu_lockup(info); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) drm_fb_helper_cfb_fillrect(info, rect); +#endif } static void @@ -116,7 +119,9 @@ nouveau_fbcon_copyarea(struct fb_info *info, const struct fb_copyarea *image) if (ret != -ENODEV) nouveau_fbcon_gpu_lockup(info); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) drm_fb_helper_cfb_copyarea(info, image); +#endif } static void @@ -148,7 +153,9 @@ nouveau_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) if (ret != -ENODEV) nouveau_fbcon_gpu_lockup(info); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) drm_fb_helper_cfb_imageblit(info, image); +#endif } static int @@ -221,9 +228,11 @@ static struct fb_ops nouveau_fbcon_sw_ops = { .fb_release = nouveau_fbcon_release, .fb_check_var = drm_fb_helper_check_var, .fb_set_par = drm_fb_helper_set_par, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) .fb_fillrect = drm_fb_helper_cfb_fillrect, .fb_copyarea = drm_fb_helper_cfb_copyarea, .fb_imageblit = drm_fb_helper_cfb_imageblit, +#endif .fb_pan_display = drm_fb_helper_pan_display, .fb_blank = drm_fb_helper_blank, .fb_setcmap = drm_fb_helper_setcmap, @@ -388,7 +397,11 @@ nouveau_fbcon_create(struct drm_fb_helper *helper, mutex_lock(&dev->struct_mutex); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) info = drm_fb_helper_alloc_fbi(helper); +#else + info = ERR_PTR(-EINVAL); +#endif if (IS_ERR(info)) { ret = PTR_ERR(info); goto out_unlock; @@ -466,8 +479,10 @@ nouveau_fbcon_destroy(struct drm_device *dev, struct nouveau_fbdev *fbcon) { struct nouveau_framebuffer *nouveau_fb = &fbcon->nouveau_fb; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) drm_fb_helper_unregister_fbi(&fbcon->helper); drm_fb_helper_release_fbi(&fbcon->helper); +#endif if (nouveau_fb->nvbo) { nouveau_bo_unmap(nouveau_fb->nvbo); @@ -505,7 +520,9 @@ nouveau_fbcon_set_suspend(struct drm_device *dev, int state) console_lock(); if (state == FBINFO_STATE_RUNNING) nouveau_fbcon_accel_restore(dev); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) drm_fb_helper_set_suspend(&drm->fbcon->helper, state); +#endif if (state != FBINFO_STATE_RUNNING) nouveau_fbcon_accel_save_disable(dev); console_unlock(); diff --git a/drm/nouveau/nouveau_platform.c b/drm/nouveau/nouveau_platform.c index 8a70cec59..0140198c5 100644 --- a/drm/nouveau/nouveau_platform.c +++ b/drm/nouveau/nouveau_platform.c @@ -20,6 +20,7 @@ * DEALINGS IN THE SOFTWARE. */ #include "nouveau_platform.h" +#include static int nouveau_platform_probe(struct platform_device *pdev) { @@ -28,7 +29,13 @@ static int nouveau_platform_probe(struct platform_device *pdev) struct drm_device *drm; int ret; +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) + const struct of_device_id *match; + match = of_match_device(pdev->dev.driver->of_match_table, &pdev->dev); + func = match->data; +#else func = of_device_get_match_data(&pdev->dev); +#endif drm = nouveau_platform_device_create(func, pdev, &device); if (IS_ERR(drm)) -- cgit v1.2.1