Re: [PATCH v3 6/6] panic: sys_info: Factor out read and write handlers

From: Andrew Morton

Date: Thu Oct 30 2025 - 23:16:13 EST


On Thu, 30 Oct 2025 12:44:22 +0100 Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:

> For the sake of the code readability and easier maintenance
> factor out read and write sys_info handlers.
>
> ...
>
> --- a/lib/sys_info.c
> +++ b/lib/sys_info.c
> @@ -43,18 +43,56 @@ unsigned long sys_info_parse_param(char *str)
>
> #ifdef CONFIG_SYSCTL
>
> +static int sys_info_write_handler(struct ctl_table *table,
> + void *buffer, size_t *lenp, loff_t *ppos,
> + unsigned long *si_bits_global)
> +{

checkpatch wanted this:

--- a/lib/sys_info.c~panic-sys_info-factor-out-read-and-write-handlers-checkpatch-fixes
+++ a/lib/sys_info.c
@@ -43,7 +43,7 @@ unsigned long sys_info_parse_param(char

#ifdef CONFIG_SYSCTL

-static int sys_info_write_handler(struct ctl_table *table,
+static int sys_info_write_handler(const struct ctl_table *table,
void *buffer, size_t *lenp, loff_t *ppos,
unsigned long *si_bits_global)
{
@@ -62,7 +62,7 @@ static int sys_info_write_handler(struct
return 0;
}

-static int sys_info_read_handler(struct ctl_table *table,
+static int sys_info_read_handler(const struct ctl_table *table,
void *buffer, size_t *lenp, loff_t *ppos,
unsigned long *si_bits_global)
{
_