Lines Matching refs:mk
558 struct module_kobject *mk, char *buf) in param_attr_show() argument
566 kernel_param_lock(mk->mod); in param_attr_show()
568 kernel_param_unlock(mk->mod); in param_attr_show()
574 struct module_kobject *mk, in param_attr_store() argument
583 kernel_param_lock(mk->mod); in param_attr_store()
588 kernel_param_unlock(mk->mod); in param_attr_store()
625 static __modinit int add_sysfs_param(struct module_kobject *mk, in add_sysfs_param() argument
636 if (!mk->mp) { in add_sysfs_param()
638 mk->mp = kzalloc(sizeof(*mk->mp), GFP_KERNEL); in add_sysfs_param()
639 if (!mk->mp) in add_sysfs_param()
641 mk->mp->grp.name = "parameters"; in add_sysfs_param()
643 mk->mp->grp.attrs = kzalloc(sizeof(mk->mp->grp.attrs[0]), in add_sysfs_param()
646 if (!mk->mp->grp.attrs) in add_sysfs_param()
651 new_mp = krealloc(mk->mp, in add_sysfs_param()
652 sizeof(*mk->mp) + in add_sysfs_param()
653 sizeof(mk->mp->attrs[0]) * (mk->mp->num + 1), in add_sysfs_param()
657 mk->mp = new_mp; in add_sysfs_param()
660 new_attrs = krealloc(mk->mp->grp.attrs, in add_sysfs_param()
661 sizeof(mk->mp->grp.attrs[0]) * (mk->mp->num + 2), in add_sysfs_param()
665 mk->mp->grp.attrs = new_attrs; in add_sysfs_param()
668 memset(&mk->mp->attrs[mk->mp->num], 0, sizeof(mk->mp->attrs[0])); in add_sysfs_param()
669 sysfs_attr_init(&mk->mp->attrs[mk->mp->num].mattr.attr); in add_sysfs_param()
670 mk->mp->attrs[mk->mp->num].param = kp; in add_sysfs_param()
671 mk->mp->attrs[mk->mp->num].mattr.show = param_attr_show; in add_sysfs_param()
674 mk->mp->attrs[mk->mp->num].mattr.store = param_attr_store; in add_sysfs_param()
676 mk->mp->attrs[mk->mp->num].mattr.store = NULL; in add_sysfs_param()
677 mk->mp->attrs[mk->mp->num].mattr.attr.name = (char *)name; in add_sysfs_param()
678 mk->mp->attrs[mk->mp->num].mattr.attr.mode = kp->perm; in add_sysfs_param()
679 mk->mp->num++; in add_sysfs_param()
682 for (i = 0; i < mk->mp->num; i++) in add_sysfs_param()
683 mk->mp->grp.attrs[i] = &mk->mp->attrs[i].mattr.attr; in add_sysfs_param()
684 mk->mp->grp.attrs[mk->mp->num] = NULL; in add_sysfs_param()
689 static void free_module_param_attrs(struct module_kobject *mk) in free_module_param_attrs() argument
691 if (mk->mp) in free_module_param_attrs()
692 kfree(mk->mp->grp.attrs); in free_module_param_attrs()
693 kfree(mk->mp); in free_module_param_attrs()
694 mk->mp = NULL; in free_module_param_attrs()
763 struct module_kobject *mk; in locate_module_kobject() local
769 mk = to_module_kobject(kobj); in locate_module_kobject()
771 mk = kzalloc(sizeof(struct module_kobject), GFP_KERNEL); in locate_module_kobject()
772 BUG_ON(!mk); in locate_module_kobject()
774 mk->mod = THIS_MODULE; in locate_module_kobject()
775 mk->kobj.kset = module_kset; in locate_module_kobject()
776 err = kobject_init_and_add(&mk->kobj, &module_ktype, NULL, in locate_module_kobject()
780 err = sysfs_create_file(&mk->kobj, &module_uevent.attr); in locate_module_kobject()
783 kobject_put(&mk->kobj); in locate_module_kobject()
790 kobject_get(&mk->kobj); in locate_module_kobject()
793 return mk; in locate_module_kobject()
800 struct module_kobject *mk; in kernel_add_sysfs_param() local
803 mk = locate_module_kobject(name); in kernel_add_sysfs_param()
804 if (!mk) in kernel_add_sysfs_param()
808 if (mk->mp) in kernel_add_sysfs_param()
809 sysfs_remove_group(&mk->kobj, &mk->mp->grp); in kernel_add_sysfs_param()
812 err = add_sysfs_param(mk, kparam, kparam->name + name_skip); in kernel_add_sysfs_param()
814 err = sysfs_create_group(&mk->kobj, &mk->mp->grp); in kernel_add_sysfs_param()
816 kobject_uevent(&mk->kobj, KOBJ_ADD); in kernel_add_sysfs_param()
817 kobject_put(&mk->kobj); in kernel_add_sysfs_param()
856 struct module_kobject *mk, char *buf) in __modver_version_show() argument
870 struct module_kobject *mk; in version_sysfs_builtin() local
874 mk = locate_module_kobject(vattr->module_name); in version_sysfs_builtin()
875 if (mk) { in version_sysfs_builtin()
876 err = sysfs_create_file(&mk->kobj, &vattr->mattr.attr); in version_sysfs_builtin()
878 kobject_uevent(&mk->kobj, KOBJ_ADD); in version_sysfs_builtin()
879 kobject_put(&mk->kobj); in version_sysfs_builtin()
891 struct module_kobject *mk; in module_attr_show() local
895 mk = to_module_kobject(kobj); in module_attr_show()
900 ret = attribute->show(attribute, mk, buf); in module_attr_show()
910 struct module_kobject *mk; in module_attr_store() local
914 mk = to_module_kobject(kobj); in module_attr_store()
919 ret = attribute->store(attribute, mk, buf, len); in module_attr_store()
947 struct module_kobject *mk = to_module_kobject(kobj); in module_kobj_release() local
948 complete(mk->kobj_completion); in module_kobj_release()