Re: [PATCH] sysctl: Remove unused ctl_table forward declarations
From: Petr Mladek
Date: Tue Dec 16 2025 - 08:42:30 EST
On Mon 2025-12-15 16:25:19, Joel Granados wrote:
> Remove superfluous forward declarations of ctl_table from header files
> where they are no longer needed. These declarations were left behind
> after sysctl code refactoring and cleanup.
>
> Signed-off-by: Joel Granados <joel.granados@xxxxxxxxxx>
For the printk part:
Reviewed-by: Petr Mladek <pmladek@xxxxxxxx>
That said, I have found one more declaration in kernel/printk/internal.h.
It is there because of devkmsg_sysctl_set_loglvl() declaration.
But I think that a better solution would be:
diff --git a/kernel/printk/internal.h b/kernel/printk/internal.h
index dff97321741a..27169fd33231 100644
--- a/kernel/printk/internal.h
+++ b/kernel/printk/internal.h
@@ -4,9 +4,9 @@
*/
#include <linux/console.h>
#include <linux/types.h>
+#include <linux/sysctl.h>
#if defined(CONFIG_PRINTK) && defined(CONFIG_SYSCTL)
-struct ctl_table;
void __init printk_sysctl_init(void);
int devkmsg_sysctl_set_loglvl(const struct ctl_table *table, int write,
void *buffer, size_t *lenp, loff_t *ppos);
diff --git a/kernel/printk/sysctl.c b/kernel/printk/sysctl.c
index bb8fecb3fb05..512f0c692d6a 100644
--- a/kernel/printk/sysctl.c
+++ b/kernel/printk/sysctl.c
@@ -3,7 +3,6 @@
* sysctl.c: General linux system control interface
*/
-#include <linux/sysctl.h>
#include <linux/printk.h>
#include <linux/capability.h>
#include <linux/ratelimit.h>
Feel free to add this into v2. Or we could do this in a separate patch.
Best Regards,
Petr