Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Sat, 4 Jan 2003 15:16:23 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Sat, 4 Jan 2003 15:16:23 -0500 Received: from air-2.osdl.org ([65.172.181.6]:16095 "EHLO mail.osdl.org") by vger.kernel.org with ESMTP id ; Sat, 4 Jan 2003 15:16:19 -0500 Date: Sat, 4 Jan 2003 13:45:10 -0600 (CST) From: Patrick Mochel X-X-Sender: To: Matt Domsch cc: Subject: Re: kobject_init() sets kobj->subsys wrong? In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1688 Lines: 41 Hi Matt. On Sat, 4 Jan 2003, Matt Domsch wrote: > > 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. Actually, the objects are always placed on their subsystem's list, never their parent's. An object's parent is only used to determine the location to insert the object. This gives the subsystem the ability to maintain an ordered list of all objects registered with it, even when the objects compose an arbitrarily deep hierarchy. This is docuemented somewhere, but I'll be sure to add a comment to kobject_add() explaining this. > 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. This is correct. Also in kobject_add(), orphan objects are adopted by the subsystem they belong to. -pat - 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/