lkml.org 
[lkml]   [2007]   [Dec]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC] kobject: add kobject_init_ng, kobject_add_ng, and kobject_init_and_add functions
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


\
 
 \ /
  Last update: 2007-12-03 20:07    [W:1.419 / U:1.388 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site