Re: [RFC] New kobject/kset/ktype documentation and example code

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Cornelia Huck <cornelia.huck@...>
Cc: Greg KH <greg@...>, <linux-kernel@...>, Kay Sievers <kay.sievers@...>, Jonathan Corbet <corbet@...>, Randy Dunlap <randy.dunlap@...>
Date: Wednesday, November 28, 2007 - 3:18 pm

On Wed, 28 Nov 2007, Cornelia Huck wrote:


Slightly ambiguous.  Instead just say:

If you have initialized your kobject via kobject_init() or
kobject_register(), you must not deallocate the kobject anywhere other
than its release() method (which is invoked during the final
kobject_put() call).  Otherwise the kernel will leak memory.


In theory modules shouldn't present a problem -- especially if Greg 
merges the "Kobjects: drop child->parent ref at unregistration" patch.

When a module is unloaded, it has to unregister all its kobjects, which 
should force all their children to be unregistered too.  At that time 
the children's drivers should drop all their references to the parent 
kobject, leaving only references held by the module being unloaded.  
Presumably it can arrange to drop its own references before its exit() 
routine returns.

The only problem arises when a child's driver retains a reference to 
the parent kobject.  If things are done properly, this reference should 
involve incrementing the module count -- which would prevent the module 
from being unloaded in the first place.

Alan Stern

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
kobject_init rewrite, Greg KH, (Thu Nov 29, 5:53 pm)
Re: kobject_init rewrite, Alan Stern, (Thu Nov 29, 6:16 pm)
Re: kobject_init rewrite, Greg KH, (Thu Nov 29, 6:24 pm)
Re: kobject_init rewrite, Greg KH, (Thu Nov 29, 5:54 pm)
Re: kobject_init rewrite, Cornelia Huck, (Fri Nov 30, 5:31 am)
Re: [RFC] New kobject/kset/ktype documentation and example c..., Alan Stern, (Wed Nov 28, 3:18 pm)
[RFC] Sample kset/ktype/kobject implementation, Greg KH, (Tue Nov 27, 7:04 pm)
Re: [RFC] Sample kset/ktype/kobject implementation, Cornelia Huck, (Wed Nov 28, 12:35 pm)
Re: [RFC] Sample kset/ktype/kobject implementation, Cornelia Huck, (Thu Nov 29, 5:39 am)
Re: [RFC] Sample kset/ktype/kobject implementation, Alan Stern, (Thu Nov 29, 6:11 pm)
Re: [RFC] Sample kset/ktype/kobject implementation, Dave Young, (Fri Nov 30, 1:07 am)
Re: [RFC] Sample kset/ktype/kobject implementation, Alan Stern, (Fri Nov 30, 10:51 am)
Re: [RFC] Sample kset/ktype/kobject implementation, Dave Young, (Fri Nov 30, 1:57 am)
[RFC] sample kobject implementation, Greg KH, (Tue Nov 27, 7:03 pm)