Commit ecb98379 authored by Julia Lawall's avatar Julia Lawall Committed by Paul Burton

MIPS: use resource_size

Use resource_size rather than a verbose computation on
the end and start fields.

The semantic patch that makes these changes is as follows:
(http://coccinelle.lip6.fr/)

<smpl>
@@ struct resource ptr; @@
- (ptr.end - ptr.start + 1)
+ resource_size(&ptr)
</smpl>
Signed-off-by: default avatarJulia Lawall <Julia.Lawall@inria.fr>
Reviewed-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: default avatarPaul Burton <paulburton@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: kernel-janitors@vger.kernel.org
Cc: James Hogan <jhogan@kernel.org>
Cc: linux-mips@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
parent 0ce5ebd2
...@@ -515,8 +515,7 @@ static void __init request_crashkernel(struct resource *res) ...@@ -515,8 +515,7 @@ static void __init request_crashkernel(struct resource *res)
ret = request_resource(res, &crashk_res); ret = request_resource(res, &crashk_res);
if (!ret) if (!ret)
pr_info("Reserving %ldMB of memory at %ldMB for crashkernel\n", pr_info("Reserving %ldMB of memory at %ldMB for crashkernel\n",
(unsigned long)((crashk_res.end - (unsigned long)(resource_size(&crashk_res) >> 20),
crashk_res.start + 1) >> 20),
(unsigned long)(crashk_res.start >> 20)); (unsigned long)(crashk_res.start >> 20));
} }
#else /* !defined(CONFIG_KEXEC) */ #else /* !defined(CONFIG_KEXEC) */
...@@ -698,8 +697,7 @@ static void __init arch_mem_init(char **cmdline_p) ...@@ -698,8 +697,7 @@ static void __init arch_mem_init(char **cmdline_p)
mips_parse_crashkernel(); mips_parse_crashkernel();
#ifdef CONFIG_KEXEC #ifdef CONFIG_KEXEC
if (crashk_res.start != crashk_res.end) if (crashk_res.start != crashk_res.end)
memblock_reserve(crashk_res.start, memblock_reserve(crashk_res.start, resource_size(&crashk_res));
crashk_res.end - crashk_res.start + 1);
#endif #endif
device_tree_init(); device_tree_init();
sparse_init(); sparse_init();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment