diff mbox series

[2/3] arm64: constify aarch64_insn_encoding_class[]

Message ID 20190813141639.13476-3-mark.rutland@arm.com (mailing list archive)
State Mainlined
Commit 0da23df2ff043c8d39b389e32ee68af64b5f408e
Headers show
Series arm64: trivial constification patches | expand

Commit Message

Mark Rutland Aug. 13, 2019, 2:16 p.m. UTC
The aarch64_insn_encoding_class[] array contains compile-time constant
data, and is never intentionally modified, so let's mark it as const.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
---
 arch/arm64/kernel/insn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Dave Martin Aug. 14, 2019, 9:10 a.m. UTC | #1
On Tue, Aug 13, 2019 at 03:16:38PM +0100, Mark Rutland wrote:
> The aarch64_insn_encoding_class[] array contains compile-time constant
> data, and is never intentionally modified, so let's mark it as const.
> 
> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> ---
>  arch/arm64/kernel/insn.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/kernel/insn.c b/arch/arm64/kernel/insn.c
> index 84b059ed04fc..d801a7094076 100644
> --- a/arch/arm64/kernel/insn.c
> +++ b/arch/arm64/kernel/insn.c
> @@ -26,7 +26,7 @@
>  #define AARCH64_INSN_N_BIT	BIT(22)
>  #define AARCH64_INSN_LSL_12	BIT(22)
>  
> -static int aarch64_insn_encoding_class[] = {
> +static const int aarch64_insn_encoding_class[] = {
>  	AARCH64_INSN_CLS_UNKNOWN,
>  	AARCH64_INSN_CLS_UNKNOWN,
>  	AARCH64_INSN_CLS_UNKNOWN,

This is an implementation detail of aarch64_get_insn_class(), so it
could be moved inside there, or rewritten as a switch.  It works as-is
though.

Either way,

Reviewed-by: Dave Martin <Dave.Martin@arm.com>

Cheers
---Dave
diff mbox series

Patch

diff --git a/arch/arm64/kernel/insn.c b/arch/arm64/kernel/insn.c
index 84b059ed04fc..d801a7094076 100644
--- a/arch/arm64/kernel/insn.c
+++ b/arch/arm64/kernel/insn.c
@@ -26,7 +26,7 @@ 
 #define AARCH64_INSN_N_BIT	BIT(22)
 #define AARCH64_INSN_LSL_12	BIT(22)
 
-static int aarch64_insn_encoding_class[] = {
+static const int aarch64_insn_encoding_class[] = {
 	AARCH64_INSN_CLS_UNKNOWN,
 	AARCH64_INSN_CLS_UNKNOWN,
 	AARCH64_INSN_CLS_UNKNOWN,