blob: 104e2c599d53977954cea2c9d1229e4f43749f15 [file] [log] [blame]
From 54b230e26a1889c08507e791ab043f8a4b4ff771 Mon Sep 17 00:00:00 2001
From: Romain Perier <romain.perier@free-electrons.com>
Date: Thu, 7 Jul 2016 14:40:53 +0200
Subject: [PATCH] Add support for Linux 4.4
It fixes various things like the use of seq_printf because its API
changed. It also replaces the call to mtrr_add and mtrr_del by
arch_phys_wc_add and arch_phys_wc_del because these symbols are
no longer exported for Linux >= 4.3.x.
Signed-off-by: Romain Perier <romain.perier@free-electrons.com>
---
common/lib/modules/fglrx/build_mod/firegl_public.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/common/lib/modules/fglrx/build_mod/firegl_public.c b/common/lib/modules/fglrx/build_mod/firegl_public.c
index bb67bba..b4b2d30 100755
--- a/common/lib/modules/fglrx/build_mod/firegl_public.c
+++ b/common/lib/modules/fglrx/build_mod/firegl_public.c
@@ -636,9 +636,16 @@ static int firegl_major_proc_read(struct seq_file *m, void* data)
len = snprintf(buf, request, "%d\n", major);
#else
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)
+ seq_printf(m, "%d\n", major);
+ len = 0;
+#else
len = seq_printf(m, "%d\n", major);
#endif
+#endif
+
KCL_DEBUG1(FN_FIREGL_PROC, "return len=%i\n",len);
return len;
@@ -3432,7 +3439,11 @@ int ATI_API_CALL KCL_MEM_MTRR_Support(void)
int ATI_API_CALL KCL_MEM_MTRR_AddRegionWc(unsigned long base, unsigned long size)
{
#ifdef CONFIG_MTRR
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)
+ return arch_phys_wc_add(base, size);
+#else
return mtrr_add(base, size, MTRR_TYPE_WRCOMB, 1);
+#endif
#else /* !CONFIG_MTRR */
return -EPERM;
#endif /* !CONFIG_MTRR */
@@ -3441,7 +3452,12 @@ int ATI_API_CALL KCL_MEM_MTRR_AddRegionWc(unsigned long base, unsigned long size
int ATI_API_CALL KCL_MEM_MTRR_DeleteRegion(int reg, unsigned long base, unsigned long size)
{
#ifdef CONFIG_MTRR
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)
+ arch_phys_wc_del(reg);
+ return 0;
+#else
return mtrr_del(reg, base, size);
+#endif
#else /* !CONFIG_MTRR */
return -EPERM;
#endif /* !CONFIG_MTRR */
@@ -6505,8 +6521,13 @@ static int KCL_fpu_save_init(struct task_struct *tsk)
if (!(fpu->state->xsave.xsave_hdr.xstate_bv & XSTATE_FP))
#else
_copy_xregs_to_kernel(&fpu->state.xsave);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,0)
+ if (!(fpu->state.xsave.header.xfeatures & XFEATURE_MASK_FP))
+#else
if (!(fpu->state.xsave.header.xfeatures & XSTATE_FP))
#endif
+
+#endif
return 1;
} else if (static_cpu_has(X86_FEATURE_FXSR)) {
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
--
2.8.1