diff options
author | Kees Cook <keescook@chromium.org> | 2016-07-29 18:11:32 -0700 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2016-08-05 11:21:36 -0700 |
commit | 529182e204db083cb7bda832d1c5c6d9278ba1cb (patch) | |
tree | b923eedd4b5a1e2d6cdda1af5c8bfd3b18b17189 /fs | |
parent | f38d2e5313f0af9d9b66c02a5d49c71deb994b85 (diff) |
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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/pstore/ram.c | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index 47516a794011..427eee7570bb 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c @@ -486,30 +486,21 @@ static int ramoops_parse_dt(struct platform_device *pdev, struct ramoops_platform_data *pdata) { struct device_node *of_node = pdev->dev.of_node; - struct device_node *mem_region; - struct resource res; + struct resource *res; u32 value; int ret; dev_dbg(&pdev->dev, "using Device Tree\n"); - mem_region = of_parse_phandle(of_node, "memory-region", 0); - if (!mem_region) { - dev_err(&pdev->dev, "no memory-region phandle\n"); - return -ENODEV; - } - - ret = of_address_to_resource(mem_region, 0, &res); - of_node_put(mem_region); - if (ret) { + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) { dev_err(&pdev->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"); |