brcm2708: update linux 4.4 patches to latest version
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-4.4 / 0534-brcmvirt_gpio-Pass-device-structure-into-dma_zalloc_.patch
1 From 4b40f23d8afba2fe227e515d0c793e95530350b2 Mon Sep 17 00:00:00 2001
2 From: popcornmix <popcornmix@gmail.com>
3 Date: Mon, 14 Nov 2016 17:46:54 +0000
4 Subject: [PATCH] brcmvirt_gpio: Pass device structure into dma_zalloc_coherent
5
6 ---
7 drivers/gpio/gpio-bcm-virt.c | 9 +++++----
8 1 file changed, 5 insertions(+), 4 deletions(-)
9
10 --- a/drivers/gpio/gpio-bcm-virt.c
11 +++ b/drivers/gpio/gpio-bcm-virt.c
12 @@ -102,7 +102,7 @@ static int brcmvirt_gpio_probe(struct pl
13 goto out;
14 }
15
16 - ucb->ts_base = dma_zalloc_coherent(NULL, PAGE_SIZE, &ucb->bus_addr, GFP_KERNEL);
17 + ucb->ts_base = dma_zalloc_coherent(dev, PAGE_SIZE, &ucb->bus_addr, GFP_KERNEL);
18 if (!ucb->ts_base) {
19 pr_err("[%s]: failed to dma_alloc_coherent(%ld)\n",
20 __func__, PAGE_SIZE);
21 @@ -116,7 +116,7 @@ static int brcmvirt_gpio_probe(struct pl
22
23 if (err || gpiovirtbuf != 0) {
24 dev_warn(dev, "Failed to set gpiovirtbuf, trying to get err:%x\n", err);
25 - dma_free_coherent(NULL, PAGE_SIZE, ucb->ts_base, ucb->bus_addr);
26 + dma_free_coherent(dev, PAGE_SIZE, ucb->ts_base, ucb->bus_addr);
27 ucb->ts_base = 0;
28 ucb->bus_addr = 0;
29 }
30 @@ -168,7 +168,7 @@ static int brcmvirt_gpio_probe(struct pl
31 return 0;
32 out:
33 if (ucb->bus_addr) {
34 - dma_free_coherent(NULL, PAGE_SIZE, ucb->ts_base, ucb->bus_addr);
35 + dma_free_coherent(dev, PAGE_SIZE, ucb->ts_base, ucb->bus_addr);
36 ucb->bus_addr = 0;
37 ucb->ts_base = NULL;
38 } else if (ucb->ts_base) {
39 @@ -180,12 +180,13 @@ out:
40
41 static int brcmvirt_gpio_remove(struct platform_device *pdev)
42 {
43 + struct device *dev = &pdev->dev;
44 int err = 0;
45 struct brcmvirt_gpio *ucb = platform_get_drvdata(pdev);
46
47 gpiochip_remove(&ucb->gc);
48 if (ucb->bus_addr)
49 - dma_free_coherent(NULL, PAGE_SIZE, ucb->ts_base, ucb->bus_addr);
50 + dma_free_coherent(dev, PAGE_SIZE, ucb->ts_base, ucb->bus_addr);
51 else if (ucb->ts_base)
52 iounmap(ucb->ts_base);
53 return err;