Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754437AbZDRUBA (ORCPT ); Sat, 18 Apr 2009 16:01:00 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753236AbZDRUAv (ORCPT ); Sat, 18 Apr 2009 16:00:51 -0400 Received: from mail-bw0-f160.google.com ([209.85.218.160]:39860 "EHLO mail-bw0-f160.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753111AbZDRUAu convert rfc822-to-8bit (ORCPT ); Sat, 18 Apr 2009 16:00:50 -0400 MIME-Version: 1.0 In-Reply-To: <20090418192314.GA22107@suse.de> References: <20090416172803.GB16618@elte.hu> <20090416235452.GE21405@elte.hu> <20090417131633.GA30578@elte.hu> <49E8FD0B.2050308@zytor.com> <49E96731.1000501@kernel.org> <49EA27B9.3030004@kernel.org> <20090418192314.GA22107@suse.de> From: Kay Sievers Date: Sat, 18 Apr 2009 22:00:33 +0200 Message-ID: Subject: Re: [PATCH] pci: keep pci device resource name pointer right. To: Greg KH Cc: Yinghai Lu , Linus Torvalds , Jesse Barnes , Andrew Morton , "H. Peter Anvin" , Ingo Molnar , Thomas Gleixner , "linux-kernel@vger.kernel.org" , linux-pci@vger.kernel.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1692 Lines: 43 On Sat, Apr 18, 2009 at 21:23, Greg KH wrote: > On Sat, Apr 18, 2009 at 12:19:21PM -0700, Yinghai Lu wrote: >> Linus Torvalds wrote: >> > Can we not make the rule be that the name should just be set before? I guess, that's what they do already, otherwise they could not use dev_name(). >> pci_bus_add_device will call device_add. >> >> actually in device_add >> >>         /* first, register with generic layer. */ >>         error = kobject_add(&dev->kobj, dev->kobj.parent, "%s", dev_name(dev)); >>         if (error) >>                 goto Error; >> >> will get one new name for that kobj, old name is freed. >> >> Will try to make kobject_add more smart to reuse the old one. > > I don't understand the problem here, how are you going to change the > kobject core?  Is this just because you aren't getting a name for the > resource?  If so, why would the driver core care about this? Seems a bit odd what we do when registering a device. Usually one sets the name with dev_set_name() which will name the kobject. When one later registers the device, we reallocate the same name, so the pointer changes. I guess the problem here is that the pci code remembers the name pointer after it was set, but it will not be the same after the device is live. We should probably make device_add() pass a NULL as the name, and kobject_add() in that case use the name that is properly set already. Thanks, Kay -- 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/