[PATCH trivial] arm64: constify hwcap_str

Catalin Marinas catalin.marinas at arm.com
Thu Nov 7 12:50:11 EST 2013


On Wed, Nov 06, 2013 at 04:32:47PM +0000, Ard Biesheuvel wrote:
> Turn hwcap_str from a 'writable array of pointers to const char[]'
> to a multidimensional const char[][].
> 
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel at linaro.org>
> ---
> 
> This is something I noticed when looking at Steve Capper's hwcaps patch: really
> no point in having a writable array of 8-byte pointers in .data keeping track of
> these hwcap strings.

I don't see a problem (few bytes wasted). If you want to make it
read-only, this would do:

diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index 9cf30f49610d..84a770fd7003 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -308,7 +308,7 @@ static int __init topology_init(void)
 }
 subsys_initcall(topology_init);
 
-static const char *hwcap_str[] = {
+static const char *const hwcap_str[] = {
 	"fp",
 	"asimd",
 	NULL

-- 
Catalin



More information about the linux-arm-kernel mailing list