Re: [PATCH v5 04/16] PCI: prevent duplicate slot names

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Alex Chiang
Date: Wednesday, October 8, 2008 - 10:56 pm

* Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>:

I'm trying to get into 2.6.28. ;)


Hm... I don't think this is a common scenario but...

int pci_hp_register(...)
{
	...

        pci_slot = pci_create_slot(bus, slot_nr, name, 1);
        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;
        }
	...
}

I could maybe move that check into pci_create_slot() instead.

struct pci_slot *pci_create_slot(...)
{
	...

        /*
         * Get existing slot and rename if desired
         */
        slot = get_slot(parent, slot_nr);
        if (slot && rename) {
		if ((err = slot->hotplug ? -EBUSY : 0)
		     || (err = rename_slot(slot, name))) {
                        kobject_put(&slot->kobj);
                        slot = NULL;
                        goto err;
                } else
                        goto out;
        } else if (slot)
                goto out;
	...
}

Seems a little ugly to me, but maybe it's necessary?

/ac

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH v5 00/16] PCI: let the core manage slot names, Alex Chiang, (Wed Oct 8, 9:46 pm)
[PATCH v5 04/16] PCI: prevent duplicate slot names, Alex Chiang, (Wed Oct 8, 9:46 pm)
[PATCH v5 15/16] PCI: Hotplug core: remove 'name', Alex Chiang, (Wed Oct 8, 9:47 pm)
Re: [PATCH v5 04/16] PCI: prevent duplicate slot names, Kenji Kaneshige, (Wed Oct 8, 10:31 pm)
Re: [PATCH v5 04/16] PCI: prevent duplicate slot names, Alex Chiang, (Wed Oct 8, 10:56 pm)
Re: [PATCH v5 04/16] PCI: prevent duplicate slot names, Kenji Kaneshige, (Thu Oct 9, 5:32 am)
Re: [PATCH v5 04/16] PCI: prevent duplicate slot names, Kenji Kaneshige, (Thu Oct 9, 9:43 pm)
Re: [PATCH v5 04/16] PCI: prevent duplicate slot names, Alex Chiang, (Thu Oct 9, 10:27 pm)
Re: [PATCH v5 04/16] PCI: prevent duplicate slot names, Kenji Kaneshige, (Fri Oct 10, 1:11 am)
Re: [PATCH v5 04/16] PCI: prevent duplicate slot names, Alex Chiang, (Fri Oct 10, 2:29 pm)