[04/27] arm64: Port deprecated instruction emulation to new sysctl interface

Message ID 1502280338-23002-5-git-send-email-Dave.Martin@arm.com
State New, archived
Headers

Commit Message

Dave Martin Aug. 9, 2017, 12:05 p.m. UTC
  Currently, armv8_deprected.c takes charge of the "abi" sysctl
directory, which makes life difficult for other code that wants to
register sysctls in the same directory.

There is a "new" [1] sysctl registration interface that removes the
need to define ctl_tables for parent directories explicitly, which
is ideal here.

This patch ports register_insn_emulation_sysctl() over to the
register_sysctl() interface and removes the redundant ctl_table for
"abi".

Signed-off-by: Dave Martin <Dave.Martin@arm.com>

[1] fea478d4101a (sysctl: Add register_sysctl for normal sysctl
users)
The commit message notes an intent to port users of the
pre-existing interfaces over to register_sysctl(), though the
number of users of the new interface currently appears negligible.
---
 arch/arm64/kernel/armv8_deprecated.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)
  

Comments

Alex Bennée Aug. 18, 2017, 12:09 p.m. UTC | #1
Dave Martin <Dave.Martin@arm.com> writes:

> Currently, armv8_deprected.c takes charge of the "abi" sysctl
> directory, which makes life difficult for other code that wants to
> register sysctls in the same directory.
>
> There is a "new" [1] sysctl registration interface that removes the
> need to define ctl_tables for parent directories explicitly, which
> is ideal here.
>
> This patch ports register_insn_emulation_sysctl() over to the
> register_sysctl() interface and removes the redundant ctl_table for
> "abi".
>
> Signed-off-by: Dave Martin <Dave.Martin@arm.com>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

>
> [1] fea478d4101a (sysctl: Add register_sysctl for normal sysctl
> users)
> The commit message notes an intent to port users of the
> pre-existing interfaces over to register_sysctl(), though the
> number of users of the new interface currently appears negligible.
> ---
>  arch/arm64/kernel/armv8_deprecated.c | 15 +++------------
>  1 file changed, 3 insertions(+), 12 deletions(-)
>
> diff --git a/arch/arm64/kernel/armv8_deprecated.c b/arch/arm64/kernel/armv8_deprecated.c
> index f0e6d71..e15eb2d 100644
> --- a/arch/arm64/kernel/armv8_deprecated.c
> +++ b/arch/arm64/kernel/armv8_deprecated.c
> @@ -228,15 +228,7 @@ static int emulation_proc_handler(struct ctl_table *table, int write,
>  	return ret;
>  }
>
> -static struct ctl_table ctl_abi[] = {
> -	{
> -		.procname = "abi",
> -		.mode = 0555,
> -	},
> -	{ }
> -};
> -
> -static void __init register_insn_emulation_sysctl(struct ctl_table *table)
> +static void __init register_insn_emulation_sysctl(void)
>  {
>  	unsigned long flags;
>  	int i = 0;
> @@ -262,8 +254,7 @@ static void __init register_insn_emulation_sysctl(struct ctl_table *table)
>  	}
>  	raw_spin_unlock_irqrestore(&insn_emulation_lock, flags);
>
> -	table->child = insns_sysctl;
> -	register_sysctl_table(table);
> +	register_sysctl("abi", insns_sysctl);
>  }
>
>  /*
> @@ -644,7 +635,7 @@ static int __init armv8_deprecated_init(void)
>  	cpuhp_setup_state_nocalls(CPUHP_AP_ARM64_ISNDEP_STARTING,
>  				  "arm64/isndep:starting",
>  				  run_all_insn_set_hw_mode, NULL);
> -	register_insn_emulation_sysctl(ctl_abi);
> +	register_insn_emulation_sysctl();
>
>  	return 0;
>  }


--
Alex Bennée
  

Patch

diff --git a/arch/arm64/kernel/armv8_deprecated.c b/arch/arm64/kernel/armv8_deprecated.c
index f0e6d71..e15eb2d 100644
--- a/arch/arm64/kernel/armv8_deprecated.c
+++ b/arch/arm64/kernel/armv8_deprecated.c
@@ -228,15 +228,7 @@  static int emulation_proc_handler(struct ctl_table *table, int write,
 	return ret;
 }
 
-static struct ctl_table ctl_abi[] = {
-	{
-		.procname = "abi",
-		.mode = 0555,
-	},
-	{ }
-};
-
-static void __init register_insn_emulation_sysctl(struct ctl_table *table)
+static void __init register_insn_emulation_sysctl(void)
 {
 	unsigned long flags;
 	int i = 0;
@@ -262,8 +254,7 @@  static void __init register_insn_emulation_sysctl(struct ctl_table *table)
 	}
 	raw_spin_unlock_irqrestore(&insn_emulation_lock, flags);
 
-	table->child = insns_sysctl;
-	register_sysctl_table(table);
+	register_sysctl("abi", insns_sysctl);
 }
 
 /*
@@ -644,7 +635,7 @@  static int __init armv8_deprecated_init(void)
 	cpuhp_setup_state_nocalls(CPUHP_AP_ARM64_ISNDEP_STARTING,
 				  "arm64/isndep:starting",
 				  run_all_insn_set_hw_mode, NULL);
-	register_insn_emulation_sysctl(ctl_abi);
+	register_insn_emulation_sysctl();
 
 	return 0;
 }