Lines Matching refs:kset

173 /* add the kobject to its kset's list */
176 if (!kobj->kset)
179 kset_get(kobj->kset);
180 spin_lock(&kobj->kset->list_lock);
181 list_add_tail(&kobj->entry, &kobj->kset->list);
182 spin_unlock(&kobj->kset->list_lock);
185 /* remove the kobject from its kset's list */
188 if (!kobj->kset)
191 spin_lock(&kobj->kset->list_lock);
193 spin_unlock(&kobj->kset->list_lock);
194 kset_put(kobj->kset);
227 /* join kset if set, use it as parent if we do not already have one */
228 if (kobj->kset) {
230 parent = kobject_get(&kobj->kset->kobj);
238 kobj->kset ? kobject_name(&kobj->kset->kobj) : "<NULL>");
388 * kobject associated with the kset assigned to this kobject. If no kset
551 if (kobj->kset)
552 new_parent = kobject_get(&kobj->kset->kobj);
809 * kset_init() - Initialize a kset for use.
810 * @k: kset
812 void kset_init(struct kset *k)
851 * kset_register() - Initialize and add a kset.
852 * @k: kset.
854 * NOTE: On error, the kset.kobj.name allocated by() kobj_set_name()
857 int kset_register(struct kset *k)
883 * kset_unregister() - Remove a kset.
884 * @k: kset.
886 void kset_unregister(struct kset *k)
896 * kset_find_obj() - Search for object in kset.
897 * @kset: kset we're looking in.
900 * Lock kset via @kset->subsys, and iterate over @kset->list,
904 struct kobject *kset_find_obj(struct kset *kset, const char *name)
909 spin_lock(&kset->list_lock);
911 list_for_each_entry(k, &kset->list, entry) {
918 spin_unlock(&kset->list_lock);
925 struct kset *kset = container_of(kobj, struct kset, kobj);
928 kfree(kset);
944 * kset_create() - Create a struct kset dynamically.
946 * @name: the name for the kset
947 * @uevent_ops: a struct kset_uevent_ops for the kset
948 * @parent_kobj: the parent kobject of this kset, if any.
950 * This function creates a kset structure dynamically. This structure can
956 * If the kset was not able to be created, NULL will be returned.
958 static struct kset *kset_create(const char *name,
962 struct kset *kset;
965 kset = kzalloc(sizeof(*kset), GFP_KERNEL);
966 if (!kset)
968 retval = kobject_set_name(&kset->kobj, "%s", name);
970 kfree(kset);
973 kset->uevent_ops = uevent_ops;
974 kset->kobj.parent = parent_kobj;
977 * The kobject of this kset will have a type of kset_ktype and belong to
978 * no kset itself. That way we can properly free it when it is
981 kset->kobj.ktype = &kset_ktype;
982 kset->kobj.kset = NULL;
984 return kset;
988 * kset_create_and_add() - Create a struct kset dynamically and add it to sysfs.
990 * @name: the name for the kset
991 * @uevent_ops: a struct kset_uevent_ops for the kset
992 * @parent_kobj: the parent kobject of this kset, if any.
994 * This function creates a kset structure dynamically and registers it
999 * If the kset was not able to be created, NULL will be returned.
1001 struct kset *kset_create_and_add(const char *name,
1005 struct kset *kset;
1008 kset = kset_create(name, uevent_ops, parent_kobj);
1009 if (!kset)
1011 error = kset_register(kset);
1013 kfree(kset);
1016 return kset;