Lines Matching refs:kp
100 static bool param_check_unsafe(const struct kernel_param *kp) in param_check_unsafe() argument
102 if (kp->flags & KERNEL_PARAM_FL_HWPARAM && in param_check_unsafe()
106 if (kp->flags & KERNEL_PARAM_FL_UNSAFE) { in param_check_unsafe()
108 kp->name); in param_check_unsafe()
218 int param_set_##name(const char *val, const struct kernel_param *kp) \
220 return strtolfn(val, 0, (type *)kp->arg); \
222 int param_get_##name(char *buffer, const struct kernel_param *kp) \
225 *((type *)kp->arg)); \
246 int param_set_uint_minmax(const char *val, const struct kernel_param *kp, in param_set_uint_minmax() argument
259 *((unsigned int *)kp->arg) = num; in param_set_uint_minmax()
264 int param_set_charp(const char *val, const struct kernel_param *kp) in param_set_charp() argument
267 pr_err("%s: string parameter too long\n", kp->name); in param_set_charp()
271 maybe_kfree_parameter(*(char **)kp->arg); in param_set_charp()
276 *(char **)kp->arg = kmalloc_parameter(strlen(val)+1); in param_set_charp()
277 if (!*(char **)kp->arg) in param_set_charp()
279 strcpy(*(char **)kp->arg, val); in param_set_charp()
281 *(const char **)kp->arg = val; in param_set_charp()
287 int param_get_charp(char *buffer, const struct kernel_param *kp) in param_get_charp() argument
289 return scnprintf(buffer, PAGE_SIZE, "%s\n", *((char **)kp->arg)); in param_get_charp()
307 int param_set_bool(const char *val, const struct kernel_param *kp) in param_set_bool() argument
313 return strtobool(val, kp->arg); in param_set_bool()
317 int param_get_bool(char *buffer, const struct kernel_param *kp) in param_get_bool() argument
320 return sprintf(buffer, "%c\n", *(bool *)kp->arg ? 'Y' : 'N'); in param_get_bool()
331 int param_set_bool_enable_only(const char *val, const struct kernel_param *kp) in param_set_bool_enable_only() argument
335 bool orig_value = *(bool *)kp->arg; in param_set_bool_enable_only()
336 struct kernel_param dummy_kp = *kp; in param_set_bool_enable_only()
349 err = param_set_bool(val, kp); in param_set_bool_enable_only()
363 int param_set_invbool(const char *val, const struct kernel_param *kp) in param_set_invbool() argument
372 *(bool *)kp->arg = !boolval; in param_set_invbool()
377 int param_get_invbool(char *buffer, const struct kernel_param *kp) in param_get_invbool() argument
379 return sprintf(buffer, "%c\n", (*(bool *)kp->arg) ? 'N' : 'Y'); in param_get_invbool()
389 int param_set_bint(const char *val, const struct kernel_param *kp) in param_set_bint() argument
392 struct kernel_param boolkp = *kp; in param_set_bint()
400 *(int *)kp->arg = v; in param_set_bint()
418 int (*set)(const char *, const struct kernel_param *kp), in param_array() argument
423 struct kernel_param kp; in param_array() local
427 kp.name = name; in param_array()
428 kp.arg = elem; in param_array()
429 kp.level = level; in param_array()
446 ret = set(val, &kp); in param_array()
450 kp.arg += elemsize; in param_array()
462 static int param_array_set(const char *val, const struct kernel_param *kp) in param_array_set() argument
464 const struct kparam_array *arr = kp->arr; in param_array_set()
467 return param_array(kp->mod, kp->name, val, 1, arr->max, arr->elem, in param_array_set()
468 arr->elemsize, arr->ops->set, kp->level, in param_array_set()
472 static int param_array_get(char *buffer, const struct kernel_param *kp) in param_array_get() argument
475 const struct kparam_array *arr = kp->arr; in param_array_get()
476 struct kernel_param p = *kp; in param_array_get()
510 int param_set_copystring(const char *val, const struct kernel_param *kp) in param_set_copystring() argument
512 const struct kparam_string *kps = kp->str; in param_set_copystring()
516 kp->name, kps->maxlen-1); in param_set_copystring()
524 int param_get_string(char *buffer, const struct kernel_param *kp) in param_get_string() argument
526 const struct kparam_string *kps = kp->str; in param_get_string()
626 const struct kernel_param *kp, in add_sysfs_param() argument
634 BUG_ON(!kp->perm); in add_sysfs_param()
670 mk->mp->attrs[mk->mp->num].param = kp; in add_sysfs_param()
673 if ((kp->perm & (S_IWUSR | S_IWGRP | S_IWOTH)) != 0) in add_sysfs_param()
678 mk->mp->attrs[mk->mp->num].mattr.attr.mode = kp->perm; in add_sysfs_param()
832 const struct kernel_param *kp; in param_sysfs_builtin() local
836 for (kp = __start___param; kp < __stop___param; kp++) { in param_sysfs_builtin()
839 if (kp->perm == 0) in param_sysfs_builtin()
842 dot = strchr(kp->name, '.'); in param_sysfs_builtin()
848 name_len = dot - kp->name + 1; in param_sysfs_builtin()
849 strlcpy(modname, kp->name, name_len); in param_sysfs_builtin()
851 kernel_add_sysfs_param(modname, kp, name_len); in param_sysfs_builtin()