[PATCH v4 09/21] pstore/ram : Export ramoops_parse_dt() symbol

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It is possible if some driver do not want ramoops region to
be static instead it sets up the mem_address and mem_size
and use everything what this driver has to offer. To offer
this convenience export ramoops_parse_dt() function.

Signed-off-by: Mukesh Ojha <quic_mojha@xxxxxxxxxxx>
---
 fs/pstore/ram.c            | 26 ++++++++++++++++++--------
 include/linux/pstore_ram.h |  2 ++
 2 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index ade66dbe5f39..6bb66d044bef 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -638,7 +638,7 @@ static int ramoops_parse_dt_u32(struct platform_device *pdev,
 	return 0;
 }
 
-static int ramoops_parse_dt(struct platform_device *pdev,
+int ramoops_parse_dt(struct platform_device *pdev,
 			    struct ramoops_platform_data *pdata)
 {
 	struct device_node *of_node = pdev->dev.of_node;
@@ -649,15 +649,24 @@ static int ramoops_parse_dt(struct platform_device *pdev,
 
 	dev_dbg(&pdev->dev, "using Device Tree\n");
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res) {
-		dev_err(&pdev->dev,
-			"failed to locate DT /reserved-memory resource\n");
-		return -EINVAL;
+	/*
+	 * It is possible if some driver do not want ramoops
+	 * region to be static instead it sets up the mem_address
+	 * and mem_size and use everything what this driver has
+	 * to offer.
+	 */
+	if (!pdata->mem_address && !pdata->mem_size) {
+		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+		if (!res) {
+			dev_err(&pdev->dev,
+				"failed to locate DT /reserved-memory resource\n");
+			return -EINVAL;
+		}
+
+		pdata->mem_size = resource_size(res);
+		pdata->mem_address = res->start;
 	}
 
-	pdata->mem_size = resource_size(res);
-	pdata->mem_address = res->start;
 	/*
 	 * Setting "unbuffered" is deprecated and will be ignored if
 	 * "mem_type" is also specified.
@@ -713,6 +722,7 @@ static int ramoops_parse_dt(struct platform_device *pdev,
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(ramoops_parse_dt);
 
 static int ramoops_probe(struct platform_device *pdev)
 {
diff --git a/include/linux/pstore_ram.h b/include/linux/pstore_ram.h
index 9d65ff94e216..55df4e631a25 100644
--- a/include/linux/pstore_ram.h
+++ b/include/linux/pstore_ram.h
@@ -8,6 +8,7 @@
 #ifndef __LINUX_PSTORE_RAM_H__
 #define __LINUX_PSTORE_RAM_H__
 
+#include <linux/platform_device.h>
 #include <linux/pstore.h>
 
 struct persistent_ram_ecc_info {
@@ -39,4 +40,5 @@ struct ramoops_platform_data {
 	struct persistent_ram_ecc_info ecc_info;
 };
 
+int ramoops_parse_dt(struct platform_device *, struct ramoops_platform_data *);
 #endif
-- 
2.7.4




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux