[PATCHv4 06/24] arm64: Move /proc/cpuinfo handling code

Dave Martin Dave.Martin at arm.com
Wed Oct 21 02:00:51 PDT 2015


On Mon, Oct 19, 2015 at 02:24:43PM +0100, Suzuki K. Poulose wrote:
> This patch moves the /proc/cpuinfo handling code:
> 
> arch/arm64/kernel/{setup.c to cpuinfo.c}
> 
> No functional changes
> 
> Signed-off-by: Suzuki K. Poulose <suzuki.poulose at arm.com>

[...]

> diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c
> index 8307b33..0dadb69 100644
> --- a/arch/arm64/kernel/cpuinfo.c
> +++ b/arch/arm64/kernel/cpuinfo.c

[...]

> @@ -45,6 +48,127 @@ static char *icache_policy_str[] = {
>  
>  unsigned long __icache_flags;
>  
> +static const char *hwcap_str[] = {

[...]

> +#ifdef CONFIG_COMPAT
> +static const char *compat_hwcap_str[] = {

[...]

> +static const char *compat_hwcap2_str[] = {

[...]

I still have a random cleanup patch knocking around for constifying
these arrays.

It's probably best kept separate so that your patch just moves code
around, but feel free to add my patch to the series if you want.

Cheers
---Dave

>From ab00f84e4d45e95b4d816961a0160f1d448aa886 Mon Sep 17 00:00:00 2001
From: Dave Martin <Dave.Martin at arm.com>
Date: Thu, 30 Jul 2015 16:36:25 +0100
Subject: [PATCH 1/2] arm64: Constify hwcap name string arrays

The hwcap string arrays used for generating the contents of
/proc/cpuinfo are currently arrays of non-const pointers.

There's no need for these pointers to be mutable, so this patch makes
them const so that they can be moved to .rodata.

Signed-off-by: Dave Martin <Dave.Martin at arm.com>
---
 arch/arm64/kernel/cpuinfo.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c
index 349ebf7..20b7748 100644
--- a/arch/arm64/kernel/cpuinfo.c
+++ b/arch/arm64/kernel/cpuinfo.c
@@ -48,7 +48,7 @@ static char *icache_policy_str[] = {
 
 unsigned long __icache_flags;
 
-static const char *hwcap_str[] = {
+static const char *const hwcap_str[] = {
 	"fp",
 	"asimd",
 	"evtstrm",
@@ -63,7 +63,7 @@ static const char *hwcap_str[] = {
 };
 
 #ifdef CONFIG_COMPAT
-static const char *compat_hwcap_str[] = {
+static const char *const compat_hwcap_str[] = {
 	"swp",
 	"half",
 	"thumb",
@@ -88,7 +88,7 @@ static const char *compat_hwcap_str[] = {
 	"evtstrm"
 };
 
-static const char *compat_hwcap2_str[] = {
+static const char *const compat_hwcap2_str[] = {
 	"aes",
 	"pmull",
 	"sha1",
-- 
1.7.10.4




More information about the linux-arm-kernel mailing list