LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: dann.frazier@canonical.com
To: ocfs2-devel@oss.oracle.com
Cc: linux-kernel@vger.kernel.org, dann frazier <dann.frazier@canonical.com>
Subject: [PATCH] [ocfs2] Use a kobject instead of a kset
Date: Fri,  4 Feb 2011 09:40:27 -0700	[thread overview]
Message-ID: <1296837627-7416-1-git-send-email-dann.frazier@canonical.com> (raw)

From: dann frazier <dann.frazier@canonical.com>

We currently allocate a kset and add attributes to its internal kobject.
However, Documentation/kobject.txt says only the kset code should manipulate
this internal object, and we can get the same results by just creating our
own kobject and avoiding a kset altogether.

Signed-off-by: dann frazier <dann.frazier@canonical.com>
---
 fs/ocfs2/stackglue.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/ocfs2/stackglue.c b/fs/ocfs2/stackglue.c
index 39abf89..7098101 100644
--- a/fs/ocfs2/stackglue.c
+++ b/fs/ocfs2/stackglue.c
@@ -607,29 +607,29 @@ static struct attribute_group ocfs2_attr_group = {
 	.attrs = ocfs2_attrs,
 };
 
-static struct kset *ocfs2_kset;
+static struct kobject *ocfs2_kobj;
 
 static void ocfs2_sysfs_exit(void)
 {
-	kset_unregister(ocfs2_kset);
+	kobject_put(ocfs2_kobj);
 }
 
 static int ocfs2_sysfs_init(void)
 {
 	int ret;
 
-	ocfs2_kset = kset_create_and_add("ocfs2", NULL, fs_kobj);
-	if (!ocfs2_kset)
+	ocfs2_kobj = kobject_create_and_add("ocfs2", fs_kobj);
+	if (!ocfs2_kobj)
 		return -ENOMEM;
 
-	ret = sysfs_create_group(&ocfs2_kset->kobj, &ocfs2_attr_group);
+	ret = sysfs_create_group(ocfs2_kobj, &ocfs2_attr_group);
 	if (ret)
 		goto error;
 
 	return 0;
 
 error:
-	kset_unregister(ocfs2_kset);
+	kobject_put(ocfs2_kobj);
 	return ret;
 }
 
-- 
1.7.2.3


             reply	other threads:[~2011-02-04 16:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-04 16:40 dann.frazier [this message]
2011-02-04 17:58 ` [Ocfs2-devel] " Joel Becker
2011-02-05 18:45   ` dann frazier

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=1296837627-7416-1-git-send-email-dann.frazier@canonical.com \
    --to=dann.frazier@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ocfs2-devel@oss.oracle.com \
    --subject='Re: [PATCH] [ocfs2] Use a kobject instead of a kset' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).