lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20171126131346.12532-2-peng.fan@nxp.com>
Date:   Sun, 26 Nov 2017 21:13:46 +0800
From:   Peng Fan <peng.fan@....com>
To:     hch@....de, m.szyprowski@...sung.com, robin.murphy@....com,
        gregkh@...uxfoundation.org, robh+dt@...nel.org,
        frowand.list@...il.com
Cc:     iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org,
        devicetree@...r.kernel.org, van.freenix@...il.com,
        Peng Fan <peng.fan@....com>
Subject: [RFC 2/2] drivers: dma-mapping: parse per device reserved mem at probe time

Invoke of_reserved_mem_device_init at dma_configure, then
there is no need to call of_reserved_mem_device_init in device
specific probe function.

Signed-off-by: Peng Fan <peng.fan@....com>
---
 drivers/base/dma-mapping.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/base/dma-mapping.c b/drivers/base/dma-mapping.c
index e584eddef0a7..55dca06a7b55 100644
--- a/drivers/base/dma-mapping.c
+++ b/drivers/base/dma-mapping.c
@@ -12,6 +12,7 @@
 #include <linux/export.h>
 #include <linux/gfp.h>
 #include <linux/of_device.h>
+#include <linux/of_reserved_mem.h>
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
 
@@ -351,7 +352,9 @@ int dma_configure(struct device *dev)
 	}
 
 	if (dma_dev->of_node) {
-		ret = of_dma_configure(dev, dma_dev->of_node);
+		ret = of_reserved_mem_device_init(dev);
+		if (ret)
+			ret = of_dma_configure(dev, dma_dev->of_node);
 	} else if (has_acpi_companion(dma_dev)) {
 		attr = acpi_get_dma_attr(to_acpi_device_node(dma_dev->fwnode));
 		if (attr != DEV_DMA_NOT_SUPPORTED)
@@ -367,5 +370,6 @@ int dma_configure(struct device *dev)
 void dma_deconfigure(struct device *dev)
 {
 	of_dma_deconfigure(dev);
+	of_reserved_mem_device_release(dev);
 	acpi_dma_deconfigure(dev);
 }
-- 
2.14.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ