[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ac3eb2510904181300v2593c36dua6c2420828860706@mail.gmail.com>
Date: Sat, 18 Apr 2009 22:00:33 +0200
From: Kay Sievers <kay.sievers@...y.org>
To: Greg KH <gregkh@...e.de>
Cc: Yinghai Lu <yinghai@...nel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Jesse Barnes <jbarnes@...tuousgeek.org>,
Andrew Morton <akpm@...ux-foundation.org>,
"H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...e.hu>,
Thomas Gleixner <tglx@...utronix.de>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
linux-pci@...r.kernel.org
Subject: Re: [PATCH] pci: keep pci device resource name pointer right.
On Sat, Apr 18, 2009 at 21:23, Greg KH <gregkh@...e.de> 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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists