0534-brcmvirt_gpio-Pass-device-structure-into-dma_zalloc_.patch 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. drivers/gpio/gpio-bcm-virt.c | 9 +++++----
  7. 1 file changed, 5 insertions(+), 4 deletions(-)
  8. --- a/drivers/gpio/gpio-bcm-virt.c
  9. +++ b/drivers/gpio/gpio-bcm-virt.c
  10. @@ -102,7 +102,7 @@ static int brcmvirt_gpio_probe(struct pl
  11. goto out;
  12. }
  13. - ucb->ts_base = dma_zalloc_coherent(NULL, PAGE_SIZE, &ucb->bus_addr, GFP_KERNEL);
  14. + ucb->ts_base = dma_zalloc_coherent(dev, PAGE_SIZE, &ucb->bus_addr, GFP_KERNEL);
  15. if (!ucb->ts_base) {
  16. pr_err("[%s]: failed to dma_alloc_coherent(%ld)\n",
  17. __func__, PAGE_SIZE);
  18. @@ -116,7 +116,7 @@ static int brcmvirt_gpio_probe(struct pl
  19. if (err || gpiovirtbuf != 0) {
  20. dev_warn(dev, "Failed to set gpiovirtbuf, trying to get err:%x\n", err);
  21. - dma_free_coherent(NULL, PAGE_SIZE, ucb->ts_base, ucb->bus_addr);
  22. + dma_free_coherent(dev, PAGE_SIZE, ucb->ts_base, ucb->bus_addr);
  23. ucb->ts_base = 0;
  24. ucb->bus_addr = 0;
  25. }
  26. @@ -168,7 +168,7 @@ static int brcmvirt_gpio_probe(struct pl
  27. return 0;
  28. out:
  29. if (ucb->bus_addr) {
  30. - dma_free_coherent(NULL, PAGE_SIZE, ucb->ts_base, ucb->bus_addr);
  31. + dma_free_coherent(dev, PAGE_SIZE, ucb->ts_base, ucb->bus_addr);
  32. ucb->bus_addr = 0;
  33. ucb->ts_base = NULL;
  34. } else if (ucb->ts_base) {
  35. @@ -180,12 +180,13 @@ out:
  36. static int brcmvirt_gpio_remove(struct platform_device *pdev)
  37. {
  38. + struct device *dev = &pdev->dev;
  39. int err = 0;
  40. struct brcmvirt_gpio *ucb = platform_get_drvdata(pdev);
  41. gpiochip_remove(&ucb->gc);
  42. if (ucb->bus_addr)
  43. - dma_free_coherent(NULL, PAGE_SIZE, ucb->ts_base, ucb->bus_addr);
  44. + dma_free_coherent(dev, PAGE_SIZE, ucb->ts_base, ucb->bus_addr);
  45. else if (ucb->ts_base)
  46. iounmap(ucb->ts_base);
  47. return err;