Lines Matching defs:kset
196 /* add the kobject to its kset's list */
199 if (!kobj->kset)
202 kset_get(kobj->kset);
203 spin_lock(&kobj->kset->list_lock);
204 list_add_tail(&kobj->entry, &kobj->kset->list);
205 spin_unlock(&kobj->kset->list_lock);
208 /* remove the kobject from its kset's list */
211 if (!kobj->kset)
214 spin_lock(&kobj->kset->list_lock);
216 spin_unlock(&kobj->kset->list_lock);
217 kset_put(kobj->kset);
250 /* join kset if set, use it as parent if we do not already have one */
251 if (kobj->kset) {
253 parent = kobject_get(&kobj->kset->kobj);
261 kobj->kset ? kobject_name(&kobj->kset->kobj) : "<NULL>");
412 * kobject associated with the kset assigned to this kobject. If no kset
575 if (kobj->kset)
576 new_parent = kobject_get(&kobj->kset->kobj);
833 * kset_init() - Initialize a kset for use.
834 * @k: kset
836 void kset_init(struct kset *k)
875 * kset_register() - Initialize and add a kset.
876 * @k: kset.
878 int kset_register(struct kset *k)
900 * kset_unregister() - Remove a kset.
901 * @k: kset.
903 void kset_unregister(struct kset *k)
913 * kset_find_obj() - Search for object in kset.
914 * @kset: kset we're looking in.
917 * Lock kset via @kset->subsys, and iterate over @kset->list,
921 struct kobject *kset_find_obj(struct kset *kset, const char *name)
926 spin_lock(&kset->list_lock);
928 list_for_each_entry(k, &kset->list, entry) {
935 spin_unlock(&kset->list_lock);
942 struct kset *kset = container_of(kobj, struct kset, kobj);
945 kfree(kset);
961 * kset_create() - Create a struct kset dynamically.
963 * @name: the name for the kset
964 * @uevent_ops: a struct kset_uevent_ops for the kset
965 * @parent_kobj: the parent kobject of this kset, if any.
967 * This function creates a kset structure dynamically. This structure can
973 * If the kset was not able to be created, NULL will be returned.
975 static struct kset *kset_create(const char *name,
979 struct kset *kset;
982 kset = kzalloc(sizeof(*kset), GFP_KERNEL);
983 if (!kset)
985 retval = kobject_set_name(&kset->kobj, "%s", name);
987 kfree(kset);
990 kset->uevent_ops = uevent_ops;
991 kset->kobj.parent = parent_kobj;
994 * The kobject of this kset will have a type of kset_ktype and belong to
995 * no kset itself. That way we can properly free it when it is
998 kset->kobj.ktype = &kset_ktype;
999 kset->kobj.kset = NULL;
1001 return kset;
1005 * kset_create_and_add() - Create a struct kset dynamically and add it to sysfs.
1007 * @name: the name for the kset
1008 * @uevent_ops: a struct kset_uevent_ops for the kset
1009 * @parent_kobj: the parent kobject of this kset, if any.
1011 * This function creates a kset structure dynamically and registers it
1016 * If the kset was not able to be created, NULL will be returned.
1018 struct kset *kset_create_and_add(const char *name,
1022 struct kset *kset;
1025 kset = kset_create(name, uevent_ops, parent_kobj);
1026 if (!kset)
1028 error = kset_register(kset);
1030 kfree(kset);
1033 return kset;