[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20071129215455.GB5043@kroah.com>
Date: Thu, 29 Nov 2007 13:54:55 -0800
From: Greg KH <greg@...ah.com>
To: Cornelia Huck <cornelia.huck@...ibm.com>
Cc: Kay Sievers <kay.sievers@...y.org>,
Alan Stern <stern@...land.harvard.edu>,
Kernel development list <linux-kernel@...r.kernel.org>,
Jonathan Corbet <corbet@....net>,
Randy Dunlap <randy.dunlap@...cle.com>
Subject: Re: kobject_init rewrite
One minor documentation update:
> /**
> * kobject_init - initialize a kobject structure
> * @kobj: pointer to the kobject to initialize
> * @ktype: pointer to the ktype for this kobject.
> * @fmt: the name of the kobject
> *
> * This function will properly initialize a kobject such that it can then
> * be passed to the kobject_add() call.
> *
> * If the function returns an error, the memory allocated by the kobject
> * can be safely freed, no other functions need to be called.
If the function does not return an error, the only way the kobject's
memory can be properly freed is with a call to kobject_put(). kfree()
should never be called on a kobject after this function has been called,
execept from the ktype's release function.
> */
> int kobject_init(struct kobject *kobj, struct kobj_type *ktype, const char *fmt, ...)
> {
> va_list args;
> int retval;
>
> if (!kobj)
> return -EINVAL;
>
> if (!ktype)
> return -EINVAL;
>
> WARN_ON(atomic_read(&kobj->kref.refcount));
> kref_init(&kobj->kref);
> INIT_LIST_HEAD(&kobj->entry);
> kobj->ktype = ktype;
>
> va_start(args, fmt);
> retval = kobject_set_name_vargs(kobj, fmt, args);
> va_end(args);
>
> return retval;
> }
>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists