From: Greg KH <greg@kroah.com>
To: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: Alan Stern <stern@rowland.harvard.edu>,
Kay Sievers <kay.sievers@vrfy.org>,
Kernel development list <linux-kernel@vger.kernel.org>,
Jonathan Corbet <corbet@lwn.net>,
Randy Dunlap <randy.dunlap@oracle.com>
Subject: Re: [RFC] kobject: add kobject_init_ng, kobject_add_ng, and kobject_init_and_add functions
Date: Mon, 3 Dec 2007 11:06:26 -0800 [thread overview]
Message-ID: <20071203190626.GB21776@kroah.com> (raw)
In-Reply-To: <20071203130003.06afbf61@gondolin.boeblingen.de.ibm.com>
On Mon, Dec 03, 2007 at 01:00:03PM +0100, Cornelia Huck wrote:
> On Fri, 30 Nov 2007 22:29:39 -0500 (EST),
> Alan Stern <stern@rowland.harvard.edu> wrote:
>
> > On Fri, 30 Nov 2007, Greg KH wrote:
> >
> > > +/**
> > > + * kobject_add_ng - the main kobject add function
> > > + * @kobj: the kobject to add
> > > + * @parent: pointer to the parent of the kobject.
> > > + *
> > > + * The kobject name is set and added to the kobject hierarchy in this
> > > + * function.
> > > + *
> > > + * If @parent is set, then the parent of the @kobj will be set to it.
> > > + * If @parent is NULL, then the parent of the @kobj will be set to the
> > > + * kobject associted with the kset assigned to this kobject. If no kset
> > > + * is assigned to the kobject, then the kobject will be located in the
> > > + * root of the sysfs tree.
> > > + *
> > > + * If this function returns an error, kobject_put() must be called to
> > > + * properly clean up the memory associated with the object.
> > > + *
> > > + * If the function is successful, the only way to properly clean up the
> > > + * memory is with a call to kobject_del().
> >
> > In which case kobject_put() isn't needed?
>
> kobject_del() should only undo what kobject_add() did. So kobject_put()
> will still be needed to clean up the memory. Perhaps the wording should
> be:
>
> If the function is successful, the only way to properly clean up the
> kobject is to call kobject_del() for removing the kobject from the
> hierarchy and to subsequently call kobject_put() to clean up the memory.
But that's not what the code does today in the kobject_del() function.
So for now, let's leave what we have.
thanks,
greg k-h
next prev parent reply other threads:[~2007-12-03 19:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-01 1:00 [RFC] kobject_init changes - take 2 Greg KH
2007-12-01 1:01 ` [RFC] kobject: add kobject_init_ng, kobject_add_ng, and kobject_init_and_add functions Greg KH
2007-12-01 1:02 ` [RFC] kobject: the new functions in use Greg KH
2007-12-01 3:29 ` [RFC] kobject: add kobject_init_ng, kobject_add_ng, and kobject_init_and_add functions Alan Stern
2007-12-03 12:00 ` Cornelia Huck
2007-12-03 19:06 ` Greg KH [this message]
2007-12-04 10:01 ` Cornelia Huck
2007-12-04 15:28 ` Alan Stern
2007-12-03 19:05 ` Greg KH
2007-12-03 20:55 ` Alan Stern
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=20071203190626.GB21776@kroah.com \
--to=greg@kroah.com \
--cc=corbet@lwn.net \
--cc=cornelia.huck@de.ibm.com \
--cc=kay.sievers@vrfy.org \
--cc=linux-kernel@vger.kernel.org \
--cc=randy.dunlap@oracle.com \
--cc=stern@rowland.harvard.edu \
/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