@@ -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)
{
@@ -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
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@quicinc.com> --- fs/pstore/ram.c | 26 ++++++++++++++++++-------- include/linux/pstore_ram.h | 2 ++ 2 files changed, 20 insertions(+), 8 deletions(-)