[lkml]   [2003]   [Jan]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
SubjectRe: kobject_init() sets kobj->subsys wrong?
> Your recent patch creating find_bus("scsi") always returns NULL.  I see
> that's because bus_subsys.list is empty.

In kobject_add(), with kobj->subsys = NULL, this kobject (embedded inside
struct subsystem embedded inside struct bus_type) never gets added to
either it's parent's list, nor to the (NULL) subsystem's list. It appears
that the object can be on either a parent's list or a subsystem's list,
but not both, by virtue of there being only one struct list_head entry in
struct kobject.

You're far more versed in how this should work than I. Some ideas...

1) in bus_register(), don't set bus->subsys.parent = &bus_subsys, instead
set bus->subsys.kobj.subsys = &bus_subsys. I did this, and now find_bus()
works as expected, but now the busses created don't have parents unless
they're specified prior to calling bus_register(), so this doesn't seem
quite right.

===== linux-2.5-edd-work/drivers/base/bus.c 1.26 vs edited =====
--- 1.26/drivers/base/bus.c Sun Dec 1 23:22:04 2002
+++ edited/linux-2.5-edd-work/drivers/base/bus.c Sat Jan 4 13:58:31 2003
@@ -495,7 +520,7 @@

- bus->subsys.parent = &bus_subsys;
+ bus->subsys.kobj.subsys = &bus_subsys;


2) set both bus->subsys.parent and bus->subsys.kobj.subsys, but then fix
the test in kobject_add() to put the object on the subsystem's list if
possible, then fall back to the parent list otherwise. Again, doesn't
seem quite right.

3) Add another struct list_head to kobject to let it reside on both a
parent list and a subsystem list if either exist.

There are probably other options. Please advise.


Matt Domsch
Sr. Software Engineer, Lead Engineer, Architect
Dell Linux Solutions
Linux on Dell mailing lists @

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:32    [W:0.043 / U:10.260 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site