[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20081002010542.GA745@ldl.fc.hp.com>
Date: Wed, 1 Oct 2008 19:05:42 -0600
From: Alex Chiang <achiang@...com>
To: Kenji Kaneshige <kaneshige.kenji@...fujitsu.com>
Cc: linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
jbarnes@...tuousgeek.org, kristen.c.accardi@...el.com,
matthew@....cx
Subject: Re: [PATCH v3 02/14] PCI: prevent duplicate slot names
* Kenji Kaneshige <kaneshige.kenji@...fujitsu.com>:
> Kenji Kaneshige wrote:
>> Hi Alex-san,
>>
>> Here is one comment, though I have not finished reviewing/testing
>> your patches yet (sorry for the delay).
>>
>> Alex Chiang wrote:
>>
>> (snip.)
>>
>>> diff --git a/drivers/pci/hotplug/pci_hotplug_core.c
>>> b/drivers/pci/hotplug/pci_hotplug_core.c
>>> index 3e37d63..46802dc 100644
>>> --- a/drivers/pci/hotplug/pci_hotplug_core.c
>>> +++ b/drivers/pci/hotplug/pci_hotplug_core.c
>>> @@ -570,39 +570,32 @@ int pci_hp_register(struct hotplug_slot *slot,
>>> struct pci_bus *bus, int slot_nr,
>>> return -EINVAL;
>>> }
>>> - /* Check if we have already registered a slot with the same
>>> name. */
>>> - if (get_slot_from_name(name))
>>> - return -EEXIST;
>>> -
>>> /*
>>> - * No problems if we call this interface from both ACPI_PCI_SLOT
>>> - * driver and call it here again. If we've already created the
>>> - * pci_slot, the interface will simply bump the refcount.
>>> + * Look for existing slot. If we find it, and it was created by a
>>> + * slot detection driver (ie, doesn't have a ->hotplug()) then we
>>> + * allow the hotplug driver calling us to rename the slot if
>>> desired.
>>> + *
>>> + * Otherwise, create the slot and carry on with life.
>>> */
>>> - pci_slot = pci_create_slot(bus, slot_nr, name);
>>> - if (IS_ERR(pci_slot))
>>> - return PTR_ERR(pci_slot);
>>> -
>>> - if (pci_slot->hotplug) {
>>> - dbg("%s: already claimed\n", __func__);
>>> - pci_destroy_slot(pci_slot);
>>> - return -EBUSY;
>>> + pci_slot = pci_get_pci_slot(bus, slot_nr);
>>
>> The pci_get_pci_slot() function refers pci_bus->slots list, so it
>> should be called with pci_bus_sem semaphore held as pci_create_slot()
>> does, or pci_bus_sem semaphore should be held by pci_get_pci_slot()
>> itself.
Yes, I've changed pci_get_pci_slot() to acquire the pci_bus_sem
semaphore.
Thank you for pointing this out.
It will be fixed in v4 of this patch series, which I will send
out after I receive the rest of your review comments.
Thanks!
/ac
--
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