diff mbox series

[3/3] arm64: constify sys64_hook instances

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

Commit Message

Mark Rutland Aug. 13, 2019, 2:16 p.m. UTC
All instances of struct sys64_hook contain compile-time constant data,
and are never inentionally modified, so let's make them all 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/traps.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Dave Martin Aug. 14, 2019, 9:12 a.m. UTC | #1
On Tue, Aug 13, 2019 at 03:16:39PM +0100, Mark Rutland wrote:
> All instances of struct sys64_hook contain compile-time constant data,
> and are never inentionally modified, so let's make them all 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/traps.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
> index 42c8422cdf4a..a5d7ce4297b0 100644
> --- a/arch/arm64/kernel/traps.c
> +++ b/arch/arm64/kernel/traps.c
> @@ -511,7 +511,7 @@ struct sys64_hook {
>  	void (*handler)(unsigned int esr, struct pt_regs *regs);
>  };
>  
> -static struct sys64_hook sys64_hooks[] = {
> +static const struct sys64_hook sys64_hooks[] = {
>  	{
>  		.esr_mask = ESR_ELx_SYS64_ISS_EL0_CACHE_OP_MASK,
>  		.esr_val = ESR_ELx_SYS64_ISS_EL0_CACHE_OP_VAL,
> @@ -636,7 +636,7 @@ static void compat_cntfrq_read_handler(unsigned int esr, struct pt_regs *regs)
>  	arm64_compat_skip_faulting_instruction(regs, 4);
>  }
>  
> -static struct sys64_hook cp15_32_hooks[] = {
> +static const struct sys64_hook cp15_32_hooks[] = {
>  	{
>  		.esr_mask = ESR_ELx_CP15_32_ISS_SYS_MASK,
>  		.esr_val = ESR_ELx_CP15_32_ISS_SYS_CNTFRQ,
> @@ -656,7 +656,7 @@ static void compat_cntvct_read_handler(unsigned int esr, struct pt_regs *regs)
>  	arm64_compat_skip_faulting_instruction(regs, 4);
>  }
>  
> -static struct sys64_hook cp15_64_hooks[] = {
> +static const struct sys64_hook cp15_64_hooks[] = {
>  	{
>  		.esr_mask = ESR_ELx_CP15_64_ISS_SYS_MASK,
>  		.esr_val = ESR_ELx_CP15_64_ISS_SYS_CNTVCT,
> @@ -667,7 +667,7 @@ static struct sys64_hook cp15_64_hooks[] = {
>  
>  asmlinkage void __exception do_cp15instr(unsigned int esr, struct pt_regs *regs)
>  {
> -	struct sys64_hook *hook, *hook_base;
> +	const struct sys64_hook *hook, *hook_base;
>  
>  	if (!cp15_cond_valid(esr, regs)) {
>  		/*
> @@ -707,7 +707,7 @@ asmlinkage void __exception do_cp15instr(unsigned int esr, struct pt_regs *regs)
>  
>  asmlinkage void __exception do_sysinstr(unsigned int esr, struct pt_regs *regs)
>  {
> -	struct sys64_hook *hook;
> +	const struct sys64_hook *hook;
>  
>  	for (hook = sys64_hooks; hook->handler; hook++)
>  		if ((hook->esr_mask & esr) == hook->esr_val) {

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

Cheers
---Dave
diff mbox series

Patch

diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
index 42c8422cdf4a..a5d7ce4297b0 100644
--- a/arch/arm64/kernel/traps.c
+++ b/arch/arm64/kernel/traps.c
@@ -511,7 +511,7 @@  struct sys64_hook {
 	void (*handler)(unsigned int esr, struct pt_regs *regs);
 };
 
-static struct sys64_hook sys64_hooks[] = {
+static const struct sys64_hook sys64_hooks[] = {
 	{
 		.esr_mask = ESR_ELx_SYS64_ISS_EL0_CACHE_OP_MASK,
 		.esr_val = ESR_ELx_SYS64_ISS_EL0_CACHE_OP_VAL,
@@ -636,7 +636,7 @@  static void compat_cntfrq_read_handler(unsigned int esr, struct pt_regs *regs)
 	arm64_compat_skip_faulting_instruction(regs, 4);
 }
 
-static struct sys64_hook cp15_32_hooks[] = {
+static const struct sys64_hook cp15_32_hooks[] = {
 	{
 		.esr_mask = ESR_ELx_CP15_32_ISS_SYS_MASK,
 		.esr_val = ESR_ELx_CP15_32_ISS_SYS_CNTFRQ,
@@ -656,7 +656,7 @@  static void compat_cntvct_read_handler(unsigned int esr, struct pt_regs *regs)
 	arm64_compat_skip_faulting_instruction(regs, 4);
 }
 
-static struct sys64_hook cp15_64_hooks[] = {
+static const struct sys64_hook cp15_64_hooks[] = {
 	{
 		.esr_mask = ESR_ELx_CP15_64_ISS_SYS_MASK,
 		.esr_val = ESR_ELx_CP15_64_ISS_SYS_CNTVCT,
@@ -667,7 +667,7 @@  static struct sys64_hook cp15_64_hooks[] = {
 
 asmlinkage void __exception do_cp15instr(unsigned int esr, struct pt_regs *regs)
 {
-	struct sys64_hook *hook, *hook_base;
+	const struct sys64_hook *hook, *hook_base;
 
 	if (!cp15_cond_valid(esr, regs)) {
 		/*
@@ -707,7 +707,7 @@  asmlinkage void __exception do_cp15instr(unsigned int esr, struct pt_regs *regs)
 
 asmlinkage void __exception do_sysinstr(unsigned int esr, struct pt_regs *regs)
 {
-	struct sys64_hook *hook;
+	const struct sys64_hook *hook;
 
 	for (hook = sys64_hooks; hook->handler; hook++)
 		if ((hook->esr_mask & esr) == hook->esr_val) {