[lkml]   [2003]   [Jul]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subjectkobjects, sysfs and the driver model make my head hurt

It's just all too complex. There's just too many levels of indirection
and structures which do almost the same thing and misleading functions.
It needs to be thoroughly simplified. Here's one particularly misleading

* kobject_get - increment refcount for object.
* @kobj: object.

struct kobject * kobject_get(struct kobject * kobj)
struct kobject * ret = kobj;

if (kobj) {
} else
ret = NULL;
return ret;

Why on earth does it return the value of its argument? And why's it
written in such a convoluted way? Here's a simpler form which retains
all the existing semantics:

struct kobject * kobject_get(struct kobject * kobj)
if (kobj) {
return kobj;

or maybe better:

if (!kobj)
return NULL;
return kobj;

But why return anything? Which looks clearer?

(a) kobj = kobject_get(kobj);

(b) kobject_get(kobj);

The first one makes me think that kobject_get might return a different
kobject than the one I passed in. That doesn't make much sense.

There's much more in this vein, but this email is long enough already.

<rmk> "you are in a maze of structures, all alike. There is a kset here."

"It's not Hollywood. War is real, war is primarily not about defeat or
victory, it is about death. I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

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