Lines Matching refs:kp
111 static void param_check_unsafe(const struct kernel_param *kp) in param_check_unsafe() argument
113 if (kp->flags & KERNEL_PARAM_FL_UNSAFE) { in param_check_unsafe()
115 kp->name); in param_check_unsafe()
273 int param_set_##name(const char *val, const struct kernel_param *kp) \
275 return strtolfn(val, 0, (type *)kp->arg); \
277 int param_get_##name(char *buffer, const struct kernel_param *kp) \
280 *((type *)kp->arg)); \
300 int param_set_charp(const char *val, const struct kernel_param *kp) in param_set_charp() argument
303 pr_err("%s: string parameter too long\n", kp->name); in param_set_charp()
307 maybe_kfree_parameter(*(char **)kp->arg); in param_set_charp()
312 *(char **)kp->arg = kmalloc_parameter(strlen(val)+1); in param_set_charp()
313 if (!*(char **)kp->arg) in param_set_charp()
315 strcpy(*(char **)kp->arg, val); in param_set_charp()
317 *(const char **)kp->arg = val; in param_set_charp()
323 int param_get_charp(char *buffer, const struct kernel_param *kp) in param_get_charp() argument
325 return scnprintf(buffer, PAGE_SIZE, "%s", *((char **)kp->arg)); in param_get_charp()
343 int param_set_bool(const char *val, const struct kernel_param *kp) in param_set_bool() argument
349 return strtobool(val, kp->arg); in param_set_bool()
353 int param_get_bool(char *buffer, const struct kernel_param *kp) in param_get_bool() argument
356 return sprintf(buffer, "%c", *(bool *)kp->arg ? 'Y' : 'N'); in param_get_bool()
367 int param_set_bool_enable_only(const char *val, const struct kernel_param *kp) in param_set_bool_enable_only() argument
371 bool orig_value = *(bool *)kp->arg; in param_set_bool_enable_only()
372 struct kernel_param dummy_kp = *kp; in param_set_bool_enable_only()
385 err = param_set_bool(val, kp); in param_set_bool_enable_only()
399 int param_set_invbool(const char *val, const struct kernel_param *kp) in param_set_invbool() argument
408 *(bool *)kp->arg = !boolval; in param_set_invbool()
413 int param_get_invbool(char *buffer, const struct kernel_param *kp) in param_get_invbool() argument
415 return sprintf(buffer, "%c", (*(bool *)kp->arg) ? 'N' : 'Y'); in param_get_invbool()
425 int param_set_bint(const char *val, const struct kernel_param *kp) in param_set_bint() argument
428 struct kernel_param boolkp = *kp; in param_set_bint()
436 *(int *)kp->arg = v; in param_set_bint()
454 int (*set)(const char *, const struct kernel_param *kp), in param_array() argument
459 struct kernel_param kp; in param_array() local
463 kp.name = name; in param_array()
464 kp.arg = elem; in param_array()
465 kp.level = level; in param_array()
482 ret = set(val, &kp); in param_array()
486 kp.arg += elemsize; in param_array()
498 static int param_array_set(const char *val, const struct kernel_param *kp) in param_array_set() argument
500 const struct kparam_array *arr = kp->arr; in param_array_set()
503 return param_array(kp->mod, kp->name, val, 1, arr->max, arr->elem, in param_array_set()
504 arr->elemsize, arr->ops->set, kp->level, in param_array_set()
508 static int param_array_get(char *buffer, const struct kernel_param *kp) in param_array_get() argument
511 const struct kparam_array *arr = kp->arr; in param_array_get()
512 struct kernel_param p = *kp; in param_array_get()
545 int param_set_copystring(const char *val, const struct kernel_param *kp) in param_set_copystring() argument
547 const struct kparam_string *kps = kp->str; in param_set_copystring()
551 kp->name, kps->maxlen-1); in param_set_copystring()
559 int param_get_string(char *buffer, const struct kernel_param *kp) in param_get_string() argument
561 const struct kparam_string *kps = kp->str; in param_get_string()
663 const struct kernel_param *kp, in add_sysfs_param() argument
671 BUG_ON(!kp->perm); in add_sysfs_param()
707 mk->mp->attrs[mk->mp->num].param = kp; in add_sysfs_param()
710 if ((kp->perm & (S_IWUSR | S_IWGRP | S_IWOTH)) != 0) in add_sysfs_param()
715 mk->mp->attrs[mk->mp->num].mattr.attr.mode = kp->perm; in add_sysfs_param()
869 const struct kernel_param *kp; in param_sysfs_builtin() local
873 for (kp = __start___param; kp < __stop___param; kp++) { in param_sysfs_builtin()
876 if (kp->perm == 0) in param_sysfs_builtin()
879 dot = strchr(kp->name, '.'); in param_sysfs_builtin()
885 name_len = dot - kp->name + 1; in param_sysfs_builtin()
886 strlcpy(modname, kp->name, name_len); in param_sysfs_builtin()
888 kernel_add_sysfs_param(modname, kp, name_len); in param_sysfs_builtin()