Skip to content

Commit 4a6d9dd

Browse files
LuBaolujoergroedel
authored andcommitted
amba: Stop sharing platform_dma_configure()
Stop sharing platform_dma_configure() helper as they are about to have their own bus dma_configure callbacks. Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/20220418005000.897664-4-baolu.lu@linux.intel.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 25f3bcf commit 4a6d9dd

3 files changed

Lines changed: 19 additions & 5 deletions

File tree

drivers/amba/bus.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#include <linux/platform_device.h>
2121
#include <linux/reset.h>
2222
#include <linux/of_irq.h>
23+
#include <linux/of_device.h>
24+
#include <linux/acpi.h>
2325

2426
#define to_amba_driver(d) container_of(d, struct amba_driver, drv)
2527

@@ -273,6 +275,21 @@ static void amba_shutdown(struct device *dev)
273275
drv->shutdown(to_amba_device(dev));
274276
}
275277

278+
static int amba_dma_configure(struct device *dev)
279+
{
280+
enum dev_dma_attr attr;
281+
int ret = 0;
282+
283+
if (dev->of_node) {
284+
ret = of_dma_configure(dev, dev->of_node, true);
285+
} else if (has_acpi_companion(dev)) {
286+
attr = acpi_get_dma_attr(to_acpi_device_node(dev->fwnode));
287+
ret = acpi_dma_configure(dev, attr);
288+
}
289+
290+
return ret;
291+
}
292+
276293
#ifdef CONFIG_PM
277294
/*
278295
* Hooks to provide runtime PM of the pclk (bus clock). It is safe to
@@ -341,7 +358,7 @@ struct bus_type amba_bustype = {
341358
.probe = amba_probe,
342359
.remove = amba_remove,
343360
.shutdown = amba_shutdown,
344-
.dma_configure = platform_dma_configure,
361+
.dma_configure = amba_dma_configure,
345362
.pm = &amba_pm,
346363
};
347364
EXPORT_SYMBOL_GPL(amba_bustype);

drivers/base/platform.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,8 +1454,7 @@ static void platform_shutdown(struct device *_dev)
14541454
drv->shutdown(dev);
14551455
}
14561456

1457-
1458-
int platform_dma_configure(struct device *dev)
1457+
static int platform_dma_configure(struct device *dev)
14591458
{
14601459
enum dev_dma_attr attr;
14611460
int ret = 0;

include/linux/platform_device.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,6 @@ extern int platform_pm_restore(struct device *dev);
328328
#define platform_pm_restore NULL
329329
#endif
330330

331-
extern int platform_dma_configure(struct device *dev);
332-
333331
#ifdef CONFIG_PM_SLEEP
334332
#define USE_PLATFORM_PM_SLEEP_OPS \
335333
.suspend = platform_pm_suspend, \

0 commit comments

Comments
 (0)