Re: [RFC] kobject: add kobject_init_ng and kobject_init_and_add functions
- From: Greg KH <greg@xxxxxxxxx>
- Date: Fri, 30 Nov 2007 14:33:04 -0800
On Fri, Nov 30, 2007 at 05:10:33PM -0500, Alan Stern wrote:
On Fri, 30 Nov 2007, Greg KH wrote:
Ok, how about this:
void kobject_init(struct kobject *kobj, struct ktype *ktype);
and then:
int kobject_add(struct kobject *kobj, struct kobject *parent, const char *fmt, ...);
After we call kobject_init() we HAVE to call kobject_put() to clean up
properly. So, if kobject_add() fails, we still need to clean up with
kobject_put();
You could put that a little less strongly. After kobject_init() you
SHOULD call kobject_put() to clean up properly, and after kobject_add()
you MUST call kobject_del() and kobject_put().
No, in looking at the code, you only need to call kobject_del() to clean
everything up properly, if kobject_add() succeeds. No need to call
kobject_put() yet again.
Can someone else verify that this really is correct?
thanks,
greg k-h
p.s. I think it's time to start a "travel to .nz and kick a certain
ex-kernel-developer around a bit" fund...
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
- References:
- Prev by Date: Re: capabilities-introduce-per-process-capability-bounding-set.patch breaks FC6 Avahi
- Next by Date: Re: [bug] SLOB, tipc_init(), WARNING: at arch/x86/mm/highmem_32.c:52 kmap_atomic_prot()
- Previous by thread: Re: [RFC] kobject: add kobject_init_ng and kobject_init_and_add functions
- Next by thread: /sys/class/graphics/fbcon/cursor_blink contains 0 after boot
- Index(es):
Relevant Pages
|