Re: kobjects, sysfs and the driver model make my head hurt

Jeff Garzik (jgarzik@pobox.com)
Sun, 06 Jul 2003 12:54:32 -0400


Greg KH wrote:
>>(a) kobj = kobject_get(kobj);
>
>
> This is the way to call kobject_get(), as the object we get after the
> function returns is the one we can then safely use.
[...]
> Think of it as, "now we can use this kobject, not the one before calling
> kobject_get()".

Doesn't matter. There is still absolutely no reason for the additional
pointer storage. I agree with with you "Thinks of it as", but also add
my own: think of it as a spinlock function. It doesn't return any
value, but you can't touch the locked object(s) before you call the
function.

The alloc functions return pointers. The _get functions never need to,
because logically there should always we at least one ref when we are
calling _get. (unless we want _get to notice an OBJ_FREEING flag and
fail, that is...)

Jeff

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/