brcm47xx: fix reading WGT634U CFE variables with 4.1
[openwrt/staging/wigyori.git] / target / linux / brcm47xx / patches-4.1 / 310-no_highpage.patch
1 --- a/arch/mips/include/asm/page.h
2 +++ b/arch/mips/include/asm/page.h
3 @@ -71,6 +71,7 @@ static inline unsigned int page_size_ftl
4 #endif /* CONFIG_MIPS_HUGE_TLB_SUPPORT */
5
6 #include <linux/pfn.h>
7 +#include <asm/cpu-features.h>
8
9 extern void build_clear_page(void);
10 extern void build_copy_page(void);
11 @@ -105,11 +106,16 @@ static inline void clear_user_page(void
12 flush_data_cache_page((unsigned long)addr);
13 }
14
15 -struct vm_area_struct;
16 -extern void copy_user_highpage(struct page *to, struct page *from,
17 - unsigned long vaddr, struct vm_area_struct *vma);
18 +static inline void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
19 + struct page *to)
20 +{
21 + extern void (*flush_data_cache_page)(unsigned long addr);
22
23 -#define __HAVE_ARCH_COPY_USER_HIGHPAGE
24 + copy_page(vto, vfrom);
25 + if (!cpu_has_ic_fills_f_dc ||
26 + pages_do_alias((unsigned long)vto, vaddr & PAGE_MASK))
27 + flush_data_cache_page((unsigned long)vto);
28 +}
29
30 /*
31 * These are used to make use of C type-checking..
32 --- a/arch/mips/mm/init.c
33 +++ b/arch/mips/mm/init.c
34 @@ -154,30 +154,6 @@ void kunmap_coherent(void)
35 pagefault_enable();
36 }
37
38 -void copy_user_highpage(struct page *to, struct page *from,
39 - unsigned long vaddr, struct vm_area_struct *vma)
40 -{
41 - void *vfrom, *vto;
42 -
43 - vto = kmap_atomic(to);
44 - if (cpu_has_dc_aliases && cpu_use_kmap_coherent &&
45 - page_mapped(from) && !Page_dcache_dirty(from)) {
46 - vfrom = kmap_coherent(from, vaddr);
47 - copy_page(vto, vfrom);
48 - kunmap_coherent();
49 - } else {
50 - vfrom = kmap_atomic(from);
51 - copy_page(vto, vfrom);
52 - kunmap_atomic(vfrom);
53 - }
54 - if ((!cpu_has_ic_fills_f_dc) ||
55 - pages_do_alias((unsigned long)vto, vaddr & PAGE_MASK))
56 - flush_data_cache_page((unsigned long)vto);
57 - kunmap_atomic(vto);
58 - /* Make sure this page is cleared on other CPU's too before using it */
59 - smp_wmb();
60 -}
61 -
62 void copy_to_user_page(struct vm_area_struct *vma,
63 struct page *page, unsigned long vaddr, void *dst, const void *src,
64 unsigned long len)