From: Lu Baolu <baolu.lu@linux.intel.com>
Date: Mon, 18 Apr 2022 08:49:52 +0800
Subject: amba: Stop sharing platform_dma_configure()
Git-commit: 4a6d9dd564d0e7339fc15ecc5ce66db4ad842be2
Patch-mainline: v5.19-rc1
References: bsc#1205701
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>
---
drivers/amba/bus.c | 19 ++++++++++++++++++-
drivers/base/platform.c | 3 +--
include/linux/platform_device.h | 2 --
3 files changed, 19 insertions(+), 5 deletions(-)
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -19,6 +19,8 @@
#include <linux/clk/clk-conf.h>
#include <linux/platform_device.h>
#include <linux/reset.h>
+#include <linux/of_device.h>
+#include <linux/acpi.h>
#include <asm/irq.h>
@@ -250,6 +252,21 @@ static void amba_shutdown(struct device
drv->shutdown(to_amba_device(dev));
}
+static int amba_dma_configure(struct device *dev)
+{
+ enum dev_dma_attr attr;
+ int ret = 0;
+
+ if (dev->of_node) {
+ ret = of_dma_configure(dev, dev->of_node, true);
+ } else if (has_acpi_companion(dev)) {
+ attr = acpi_get_dma_attr(to_acpi_device_node(dev->fwnode));
+ ret = acpi_dma_configure(dev, attr);
+ }
+
+ return ret;
+}
+
#ifdef CONFIG_PM
/*
* Hooks to provide runtime PM of the pclk (bus clock). It is safe to
@@ -318,7 +335,7 @@ struct bus_type amba_bustype = {
.probe = amba_probe,
.remove = amba_remove,
.shutdown = amba_shutdown,
- .dma_configure = platform_dma_configure,
+ .dma_configure = amba_dma_configure,
.pm = &amba_pm,
};
EXPORT_SYMBOL_GPL(amba_bustype);
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -1465,8 +1465,7 @@ static void platform_shutdown(struct dev
drv->shutdown(dev);
}
-
-int platform_dma_configure(struct device *dev)
+static int platform_dma_configure(struct device *dev)
{
enum dev_dma_attr attr;
int ret = 0;
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -330,8 +330,6 @@ extern int platform_pm_restore(struct de
#define platform_pm_restore NULL
#endif
-extern int platform_dma_configure(struct device *dev);
-
#ifdef CONFIG_PM_SLEEP
#define USE_PLATFORM_PM_SLEEP_OPS \
.suspend = platform_pm_suspend, \