diff mbox series

[01/11] kernel/parisc: move soft-power sysctl to its own file

Message ID 20220220060000.13079-1-tangmeng@uniontech.com (mailing list archive)
State Superseded
Headers show
Series [01/11] kernel/parisc: move soft-power sysctl to its own file | expand

Commit Message

Meng Tang Feb. 20, 2022, 6 a.m. UTC
kernel/sysctl.c is a kitchen sink where everyone leaves their dirty
dishes, this makes it very difficult to maintain.

To help with this maintenance let's start by moving sysctls to places
where they actually belong.  The proc sysctl maintainers do not want to
know what sysctl knobs you wish to add for your own piece of code, we
just care about the core logic.

All filesystem syctls now get reviewed by fs folks. This commit
follows the commit of fs, move the soft-power sysctl to its own file,
kernel/parisc/power.c.

Signed-off-by: tangmeng <tangmeng@uniontech.com>
---
 drivers/parisc/power.c | 22 ++++++++++++++++++++++
 include/linux/sysctl.h |  1 -
 kernel/sysctl.c        |  9 ---------
 3 files changed, 22 insertions(+), 10 deletions(-)

Comments

kernel test robot Feb. 21, 2022, 5:26 a.m. UTC | #1
Hi tangmeng,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on hnaz-mm/master]
[also build test ERROR on deller-parisc/for-next rostedt-trace/for-next linus/master v5.17-rc5 next-20220217]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/tangmeng/kernel-parisc-move-soft-power-sysctl-to-its-own-file/20220220-174553
base:   https://github.com/hnaz/linux-mm master
config: parisc-randconfig-s031-20220220 (https://download.01.org/0day-ci/archive/20220221/202202211342.EcgL15uq-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 11.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.4-dirty
        # https://github.com/0day-ci/linux/commit/fc2d0c0a37a34fd9c89e5519f2aea93de690c2ce
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review tangmeng/kernel-parisc-move-soft-power-sysctl-to-its-own-file/20220220-174553
        git checkout fc2d0c0a37a34fd9c89e5519f2aea93de690c2ce
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=parisc SHELL=/bin/bash drivers/parisc/ mm/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> drivers/parisc/power.c:196:12: error: static declaration of 'pwrsw_enabled' follows non-static declaration
     196 | static int pwrsw_enabled;
         |            ^~~~~~~~~~~~~
   drivers/parisc/power.c:112:5: note: previous definition of 'pwrsw_enabled' with type 'int'
     112 | int pwrsw_enabled __read_mostly = 1;
         |     ^~~~~~~~~~~~~


vim +/pwrsw_enabled +196 drivers/parisc/power.c

   195	
 > 196	static int pwrsw_enabled;
   197	#ifdef CONFIG_SYSCTL
   198	static struct ctl_table kern_parisc_power_table[] = {
   199		{
   200			.procname       = "soft-power",
   201			.data           = &pwrsw_enabled,
   202			.maxlen         = sizeof(int),
   203			.mode           = 0644,
   204			.proc_handler   = proc_dointvec,
   205		},
   206		{ }
   207	};
   208	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/drivers/parisc/power.c b/drivers/parisc/power.c
index 456776bd8ee6..24e0ffbe460a 100644
--- a/drivers/parisc/power.c
+++ b/drivers/parisc/power.c
@@ -193,6 +193,26 @@  static struct notifier_block parisc_panic_block = {
 	.priority	= INT_MAX,
 };
 
+static int pwrsw_enabled;
+#ifdef CONFIG_SYSCTL
+static struct ctl_table kern_parisc_power_table[] = {
+	{
+		.procname       = "soft-power",
+		.data           = &pwrsw_enabled,
+		.maxlen         = sizeof(int),
+		.mode           = 0644,
+		.proc_handler   = proc_dointvec,
+	},
+	{ }
+};
+
+static void __init kernel_parisc_power_sysctls_init(void)
+{
+	register_sysctl_init("kernel", kern_parisc_power_table);
+}
+#else
+#define kernel_parisc_power_sysctls_init() do { } while (0)
+#endif /* CONFIG_SYSCTL */
 
 static int __init power_init(void)
 {
@@ -233,6 +253,8 @@  static int __init power_init(void)
 	atomic_notifier_chain_register(&panic_notifier_list,
 			&parisc_panic_block);
 
+	kernel_parisc_power_sysctls_init();
+
 	return 0;
 }
 
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 6353d6db69b2..e00bf436d63b 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -242,7 +242,6 @@  int do_proc_douintvec(struct ctl_table *table, int write,
 				  int write, void *data),
 		      void *data);
 
-extern int pwrsw_enabled;
 extern int unaligned_enabled;
 extern int unaligned_dump_stack;
 extern int no_unaligned_warning;
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 22037f03cd2b..d11390634321 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1737,15 +1737,6 @@  static struct ctl_table kern_table[] = {
 		.proc_handler	= proc_dointvec,
 	},
 #endif
-#ifdef CONFIG_PARISC
-	{
-		.procname	= "soft-power",
-		.data		= &pwrsw_enabled,
-		.maxlen		= sizeof (int),
-		.mode		= 0644,
-		.proc_handler	= proc_dointvec,
-	},
-#endif
 #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
 	{
 		.procname	= "unaligned-trap",