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
--