udisks: services: change default.target to multi-user.target
[AGL/meta-agl-demo.git] / recipes-kernel / most / files / 0009-dim2-use-device-for-coherent-memory-allocation.patch
1 From 756f2f1f90524c2620ed7951e436d13bdb929a6b Mon Sep 17 00:00:00 2001
2 From: Andrey Shvetsov <andrey.shvetsov@k2l.de>
3 Date: Mon, 12 Feb 2018 12:25:37 +0100
4 Subject: [PATCH] staging: most: dim2: use device for coherent memory allocation
5
6 On several modern architectures the allocation of coherent memory needs
7 a device that has the dma_ops properly set.  This patch enables use of
8 the DIM2 platform device for the allocation process.
9
10 Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de>
11 ---
12  hdm-dim2/dim2_hdm.c |  9 +++++++--
13  1 file changed, 7 insertions(+), 2 deletions(-)
14
15 diff --git a/hdm-dim2/dim2_hdm.c b/hdm-dim2/dim2_hdm.c
16 index 05e1896..1847091 100644
17 --- a/hdm-dim2/dim2_hdm.c
18 +++ b/hdm-dim2/dim2_hdm.c
19 @@ -688,12 +688,16 @@ static int poison_channel(struct most_interface *most_iface, int ch_idx)
20
21  static void *dma_alloc(struct mbo *mbo, u32 size)
22  {
23 -       return dma_alloc_coherent(NULL, size, &mbo->bus_address, GFP_KERNEL);
24 +       struct device *dev = mbo->ifp->dev;
25 +
26 +       return dma_alloc_coherent(dev, size, &mbo->bus_address, GFP_KERNEL);
27  }
28
29  static void dma_free(struct mbo *mbo, u32 size)
30  {
31 -       dma_free_coherent(NULL, size, mbo->virt_address, mbo->bus_address);
32 +       struct device *dev = mbo->ifp->dev;
33 +
34 +       dma_free_coherent(dev, size, mbo->virt_address, mbo->bus_address);
35  }
36
37  static const struct of_device_id dim2_of_match[];
38 @@ -875,6 +879,7 @@ static int dim2_probe(struct platform_device *pdev)
39         dev->most_iface.poison_channel = poison_channel;
40         dev->most_iface.request_netinfo = request_netinfo;
41         dev->most_iface.extra_attrs = DBR_ATTRS;
42 +       dev->most_iface.dev = &pdev->dev;
43
44         kobj = most_register_interface(&dev->most_iface);
45         if (IS_ERR(kobj)) {
46 --
47 libgit2 0.26.0