From: Bjorn Helgaas <bhelgaas@google.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Veaceslav Falico <vfalico@redhat.com>,
Russell King <linux@arm.linux.org.uk>,
Neil Horman <nhorman@tuxdriver.com>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
Zdenek Kabelac <zkabelac@redhat.com>
Subject: [PATCH 1/2] kobject: remove kset from sysfs immediately in kset_unregister()
Date: Tue, 08 Oct 2013 14:20:16 -0600 [thread overview]
Message-ID: <20131008202016.19377.17182.stgit@bhelgaas-glaptop.roam.corp.google.com> (raw)
In-Reply-To: <20131008201915.19377.34185.stgit@bhelgaas-glaptop.roam.corp.google.com>
There's no explicit "unlink from sysfs" interface for ksets, so I think
callers of kset_unregister() expect the kset to be removed from sysfs
immediately, without waiting for the last reference to be released.
This patch makes the sysfs removal happen immediately, so the caller may
create a new kset with the same name as soon as kset_unregister() returns.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
Documentation/kobject.txt | 3 ++-
lib/kobject.c | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/Documentation/kobject.txt b/Documentation/kobject.txt
index c5182bb..8e8b501 100644
--- a/Documentation/kobject.txt
+++ b/Documentation/kobject.txt
@@ -342,7 +342,8 @@ 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, after the kset
+reference count goes to zero, releases it.
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 9621751..9098992 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -753,6 +753,7 @@ void kset_unregister(struct kset *k)
{
if (!k)
return;
+ kobject_del(&k->kobj);
kobject_put(&k->kobj);
}
next prev parent reply other threads:[~2013-10-08 20:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-08 20:20 [PATCH 0/2] Remove ksets from sysfs eagerly Bjorn Helgaas
2013-10-08 20:20 ` Bjorn Helgaas [this message]
2013-12-03 18:04 ` [PATCH 1/2] kobject: remove kset from sysfs immediately in kset_unregister() Greg Kroah-Hartman
2013-12-03 22:41 ` Bjorn Helgaas
2013-12-06 0:01 ` Greg Kroah-Hartman
2013-12-06 0:34 ` Bjorn Helgaas
2013-10-08 20:20 ` [PATCH 2/2] kobject: fix kset sample error path Bjorn Helgaas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131008202016.19377.17182.stgit@bhelgaas-glaptop.roam.corp.google.com \
--to=bhelgaas@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=nhorman@tuxdriver.com \
--cc=vfalico@redhat.com \
--cc=zkabelac@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®