lkml.org 
[lkml]   [2003]   [Jul]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: kobjects, sysfs and the driver model make my head hurt
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/

\
 
 \ /
  Last update: 2005-03-22 13:46    [W:0.069 / U:0.564 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site