summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2019-03-15 10:14:41 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2019-03-18 09:43:35 +0100
commit08c0102474a3f3a0fc1934e4bb047154bcdfd525 (patch)
treea178302fd8b7c1b9d2b22d2edb05ee086e7e3d1a /fs
parenta327b29adca7fe634d257fb7793b02aada9c88af (diff)
downloadbarebox-08c0102474a3f3a0fc1934e4bb047154bcdfd525.tar.gz
ramoops: use DT reserved-memory bindings
Instead of a ramoops-specific node, use a child node of /reserved-memory. This requires that of_platform_device_create() be explicitly called for the node, though, since "/reserved-memory" does not have its own "compatible" property. Suggested-by: Rob Herring <robh@kernel.org> Signed-off-by: Kees Cook <keescook@chromium.org> Acked-by: Rob Herring <robh@kernel.org> [p.zabel@pengutronix.de: ported to Barebox from Linux commit 529182e204db] Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'fs')
-rw-r--r--fs/pstore/ram.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 98c11e4..8dc583e 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -377,27 +377,19 @@ static int ramoops_parse_dt(struct device_d *dev,
struct ramoops_platform_data *pdata)
{
struct device_node *of_node = dev->device_node;
- struct device_node *mem_region;
- struct resource res;
+ struct resource *res;
u32 value;
int ret;
- mem_region = of_parse_phandle(of_node, "memory-region", 0);
- if (!mem_region) {
- dev_err(dev, "no memory-region phandle\n");
- return -ENODEV;
- }
-
- ret = of_address_to_resource(mem_region, 0, &res);
- if (ret) {
+ res = dev_get_resource(dev, IORESOURCE_MEM, 0);
+ if (!res) {
dev_err(dev,
- "failed to translate memory-region to resource: %d\n",
- ret);
- return ret;
+ "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;
pdata->mem_type = of_property_read_bool(of_node, "unbuffered");
pdata->dump_oops = !of_property_read_bool(of_node, "no-dump-oops");