[PATCH 3/6] sysctl: refactor __do_proc_doulongvec_minmax()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Extract the local variables min and max as parameters in
__do_proc_doulongvec_minmax() to facilitate code reuse in subsequent
patches. There are no functional changes.

Signed-off-by: Jinliang Zheng <alexjlzheng@xxxxxxxxxxx>
---
 kernel/sysctl.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 79e6cb1d5c48..05b48b204ed4 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1020,9 +1020,10 @@ static int sysrq_sysctl_handler(const struct ctl_table *table, int write,
 static int __do_proc_doulongvec_minmax(void *data,
 		const struct ctl_table *table, int write,
 		void *buffer, size_t *lenp, loff_t *ppos,
-		unsigned long convmul, unsigned long convdiv)
+		unsigned long convmul, unsigned long convdiv,
+		unsigned long *min, unsigned long *max)
 {
-	unsigned long *i, *min, *max;
+	unsigned long *i;
 	int vleft, first = 1, err = 0;
 	size_t left;
 	char *p;
@@ -1033,8 +1034,6 @@ static int __do_proc_doulongvec_minmax(void *data,
 	}
 
 	i = data;
-	min = table->extra1;
-	max = table->extra2;
 	vleft = table->maxlen / sizeof(unsigned long);
 	left = *lenp;
 
@@ -1095,8 +1094,10 @@ static int do_proc_doulongvec_minmax(const struct ctl_table *table, int write,
 		void *buffer, size_t *lenp, loff_t *ppos, unsigned long convmul,
 		unsigned long convdiv)
 {
+	unsigned long *min = table->extra1;
+	unsigned long *max = table->extra2;
 	return __do_proc_doulongvec_minmax(table->data, table, write,
-			buffer, lenp, ppos, convmul, convdiv);
+			buffer, lenp, ppos, convmul, convdiv, min, max);
 }
 
 /**
-- 
2.41.1





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux