diff --git a/Documentation/kobject.txt b/Documentation/kobject.txt index c5182bb2c16c3c2142db906e11cfc604a290f564..f87241dfed8765a98c1eaf6b6d3acbaa56d8f25f 100644 --- a/Documentation/kobject.txt +++ b/Documentation/kobject.txt @@ -342,7 +342,10 @@ kset use: When you are finished with the kset, call: void kset_unregister(struct kset *kset); -to destroy it. +to destroy it. This removes the kset from sysfs and decrements its reference +count. When the reference count goes to zero, the kset will be released. +Because other references to the kset may still exist, the release may happen +after kset_unregister() returns. An example of using a kset can be seen in the samples/kobject/kset-example.c file in the kernel tree. diff --git a/lib/kobject.c b/lib/kobject.c index 1d110dc95db544e8757d610faf3f5bbad7f9af20..98b45bb33c8dbcb6dbc520a4b347138258bb7ce0 100644 --- a/lib/kobject.c +++ b/lib/kobject.c @@ -855,6 +855,7 @@ void kset_unregister(struct kset *k) { if (!k) return; + kobject_del(&k->kobj); kobject_put(&k->kobj); }