Thread (5 messages) 5 messages, 4 authors, 2025-12-17

Re: [PATCH] sysctl: Remove unused ctl_table forward declarations

From: Joel Granados <joel.granados@kernel.org>
Date: 2025-12-17 12:09:15
Also in: linux-fsdevel, linux-hams, linux-mm, lkml

On Tue, Dec 16, 2025 at 01:44:17PM +0100, Petr Mladek wrote:
quoted hunk ↗ jump to hunk
On Mon 2025-12-15 16:25:19, Joel Granados wrote:
quoted
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@kernel.org>
For the printk part:

Reviewed-by: Petr Mladek <pmladek@suse.com>

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
Very nice, thx. 

I believe it fits inside the current commit (no need to make two).
I'll add this and send a V2. You can then add co-developed-by &
Signed-off-by if you want.

Best

-- 

Joel Granados

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help