Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755403AbXK3VUN (ORCPT ); Fri, 30 Nov 2007 16:20:13 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752405AbXK3VTy (ORCPT ); Fri, 30 Nov 2007 16:19:54 -0500 Received: from iolanthe.rowland.org ([192.131.102.54]:51319 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1752338AbXK3VTy (ORCPT ); Fri, 30 Nov 2007 16:19:54 -0500 Date: Fri, 30 Nov 2007 16:19:53 -0500 (EST) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Greg KH cc: Cornelia Huck , Kay Sievers , Kernel development list , Jonathan Corbet , Randy Dunlap Subject: Re: [RFC] kobject: add kobject_init_ng and kobject_init_and_add functions In-Reply-To: <20071130210420.GA6097@kroah.com> 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: 1085 Lines: 26 On Fri, 30 Nov 2007, Greg KH wrote: > > My suggestion: Have kobject_init_ng() accept a ktype pointer but not a > > parent or name. Instead, make kobject_add_ng() take the parent and > > name (possibly a kset also). Then when kobject_init_and_add() > > encounters an error, it shouldn't do a _put() -- the caller can either > > do the _put() or just do a kfree(). > > Why not the parent for init()? Isn't it always known at that time? > I'll dig to be sure. Specifying the parent during _add() is more logical, because a kobject doesn't actually _do_ anything to the parent until it is registered in the parent's directory. Or to put it another way, an unregistered kobject can't have a parent in any meaningful sense so there's no point specifying the parent in the _init() call. It's really just a matter of taste. Alan Stern - 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/