brcm2708: switch to linux 4.4 and update patches
[openwrt.git] / target / linux / brcm2708 / patches-4.1 / 0120-vchiq_arm-Sort-out-the-vmalloc-case.patch
1 From fc0402a5515d72d27012c931cc405dc860b0e043 Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Tue, 14 Jul 2015 11:11:51 +0100
4 Subject: [PATCH 120/222] vchiq_arm: Sort out the vmalloc case
5
6 See: https://github.com/raspberrypi/linux/issues/1055
7 ---
8  .../misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c    | 10 +++++-----
9  1 file changed, 5 insertions(+), 5 deletions(-)
10
11 --- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
12 +++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
13 @@ -394,21 +394,21 @@ create_pagelist(char __user *buf, size_t
14         if (is_vmalloc_addr(buf)) {
15                 int dir = (type == PAGELIST_WRITE) ?
16                         DMA_TO_DEVICE : DMA_FROM_DEVICE;
17 -               unsigned long length = pagelist->length;
18 -               unsigned int offset = pagelist->offset;
19 +               unsigned long length = count;
20 +               unsigned int off = offset;
21  
22                 for (actual_pages = 0; actual_pages < num_pages;
23                      actual_pages++) {
24                         struct page *pg = vmalloc_to_page(buf + (actual_pages *
25                                                                  PAGE_SIZE));
26 -                       size_t bytes = PAGE_SIZE - offset;
27 +                       size_t bytes = PAGE_SIZE - off;
28  
29                         if (bytes > length)
30                                 bytes = length;
31                         pages[actual_pages] = pg;
32 -                       dmac_map_area(page_address(pg) + offset, bytes, dir);
33 +                       dmac_map_area(page_address(pg) + off, bytes, dir);
34                         length -= bytes;
35 -                       offset = 0;
36 +                       off = 0;
37                 }
38                 *need_release = 0; /* do not try and release vmalloc pages */
39         } else {