Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mm/shuffle: convert module_param_call to module_param_cb

module_param_call is now completely consistent with module_param_cb, so
there is no need to keep two macros. Convert module_param_call to
module_param_cb since former is obsolete and latter is more kernel-ish.

Link: https://lkml.kernel.org/r/20220909083947.3595610-1-liushixin2@huawei.com
Signed-off-by: Liu Shixin <liushixin2@huawei.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Liu Shixin <liushixin2@huawei.com>
Cc: Paul Russel <rusty@rustcorp.com.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Liu Shixin and committed by
Andrew Morton
85a34107 f1f3afd5

+10 -11
+10 -11
mm/shuffle.c
··· 12 12 DEFINE_STATIC_KEY_FALSE(page_alloc_shuffle_key); 13 13 14 14 static bool shuffle_param; 15 - static int shuffle_show(char *buffer, const struct kernel_param *kp) 16 - { 17 - return sprintf(buffer, "%c\n", shuffle_param ? 'Y' : 'N'); 18 - } 19 15 20 - static __meminit int shuffle_store(const char *val, 16 + static __meminit int shuffle_param_set(const char *val, 21 17 const struct kernel_param *kp) 22 18 { 23 - int rc = param_set_bool(val, kp); 24 - 25 - if (rc < 0) 26 - return rc; 27 - if (shuffle_param) 19 + if (param_set_bool(val, kp)) 20 + return -EINVAL; 21 + if (*(bool *)kp->arg) 28 22 static_branch_enable(&page_alloc_shuffle_key); 29 23 return 0; 30 24 } 31 - module_param_call(shuffle, shuffle_store, shuffle_show, &shuffle_param, 0400); 25 + 26 + static const struct kernel_param_ops shuffle_param_ops = { 27 + .set = shuffle_param_set, 28 + .get = param_get_bool, 29 + }; 30 + module_param_cb(shuffle, &shuffle_param_ops, &shuffle_param, 0400); 32 31 33 32 /* 34 33 * For two pages to be swapped in the shuffle, they must be free (on a