mirror of
https://github.com/torvalds/linux
synced 2024-09-23 21:07:52 +00:00
staging: most: dim2: use device to allocate coherent memory
On several architectures the allocation of coherent memory needs a device that has the dma_ops structure properly initialized. This patch enables the DIM2 platform to be used to allocate this type of memory. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
1fb6089acb
commit
d060bff70e
|
@ -683,12 +683,16 @@ static int poison_channel(struct most_interface *most_iface, int ch_idx)
|
||||||
|
|
||||||
static void *dma_alloc(struct mbo *mbo, u32 size)
|
static void *dma_alloc(struct mbo *mbo, u32 size)
|
||||||
{
|
{
|
||||||
return dma_alloc_coherent(NULL, size, &mbo->bus_address, GFP_KERNEL);
|
struct device *dev = mbo->ifp->driver_dev;
|
||||||
|
|
||||||
|
return dma_alloc_coherent(dev, size, &mbo->bus_address, GFP_KERNEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dma_free(struct mbo *mbo, u32 size)
|
static void dma_free(struct mbo *mbo, u32 size)
|
||||||
{
|
{
|
||||||
dma_free_coherent(NULL, size, mbo->virt_address, mbo->bus_address);
|
struct device *dev = mbo->ifp->driver_dev;
|
||||||
|
|
||||||
|
dma_free_coherent(dev, size, mbo->virt_address, mbo->bus_address);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct of_device_id dim2_of_match[];
|
static const struct of_device_id dim2_of_match[];
|
||||||
|
@ -870,6 +874,7 @@ static int dim2_probe(struct platform_device *pdev)
|
||||||
dev->most_iface.dma_free = dma_free;
|
dev->most_iface.dma_free = dma_free;
|
||||||
dev->most_iface.poison_channel = poison_channel;
|
dev->most_iface.poison_channel = poison_channel;
|
||||||
dev->most_iface.request_netinfo = request_netinfo;
|
dev->most_iface.request_netinfo = request_netinfo;
|
||||||
|
dev->most_iface.driver_dev = &pdev->dev;
|
||||||
dev->dev.init_name = "dim2_state";
|
dev->dev.init_name = "dim2_state";
|
||||||
dev->dev.parent = &dev->most_iface.dev;
|
dev->dev.parent = &dev->most_iface.dev;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue