Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Julia Lawall <Julia.Lawall@inria.fr>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Paul 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

authored by

Julia Lawall and committed by
Paul Burton
ecb98379 0ce5ebd2

+2 -4
+2 -4
arch/mips/kernel/setup.c
··· 515 515 ret = request_resource(res, &crashk_res); 516 516 if (!ret) 517 517 pr_info("Reserving %ldMB of memory at %ldMB for crashkernel\n", 518 - (unsigned long)((crashk_res.end - 519 - crashk_res.start + 1) >> 20), 518 + (unsigned long)(resource_size(&crashk_res) >> 20), 520 519 (unsigned long)(crashk_res.start >> 20)); 521 520 } 522 521 #else /* !defined(CONFIG_KEXEC) */ ··· 697 698 mips_parse_crashkernel(); 698 699 #ifdef CONFIG_KEXEC 699 700 if (crashk_res.start != crashk_res.end) 700 - memblock_reserve(crashk_res.start, 701 - crashk_res.end - crashk_res.start + 1); 701 + memblock_reserve(crashk_res.start, resource_size(&crashk_res)); 702 702 #endif 703 703 device_tree_init(); 704 704 sparse_init();