|
@@ -312,18 +312,6 @@ static int __init init_acpi(void)
|
|
return retval;
|
|
return retval;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
-/**
|
|
|
|
- * make_slot_name - make a slot name that appears in pcihpfs
|
|
|
|
- * @slot: slot to name
|
|
|
|
- *
|
|
|
|
- */
|
|
|
|
-static void make_slot_name(struct slot *slot)
|
|
|
|
-{
|
|
|
|
- snprintf(slot->hotplug_slot->name, SLOT_NAME_SIZE, "%u",
|
|
|
|
- slot->acpi_slot->sun);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* release_slot - free up the memory used by a slot
|
|
* release_slot - free up the memory used by a slot
|
|
* @hotplug_slot: slot to free
|
|
* @hotplug_slot: slot to free
|
|
@@ -334,8 +322,6 @@ static void release_slot(struct hotplug_slot *hotplug_slot)
|
|
|
|
|
|
dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
|
|
dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
|
|
|
|
|
|
- kfree(slot->hotplug_slot->info);
|
|
|
|
- kfree(slot->hotplug_slot->name);
|
|
|
|
kfree(slot->hotplug_slot);
|
|
kfree(slot->hotplug_slot);
|
|
kfree(slot);
|
|
kfree(slot);
|
|
}
|
|
}
|
|
@@ -344,26 +330,19 @@ static void release_slot(struct hotplug_slot *hotplug_slot)
|
|
int acpiphp_register_hotplug_slot(struct acpiphp_slot *acpiphp_slot)
|
|
int acpiphp_register_hotplug_slot(struct acpiphp_slot *acpiphp_slot)
|
|
{
|
|
{
|
|
struct slot *slot;
|
|
struct slot *slot;
|
|
- struct hotplug_slot *hotplug_slot;
|
|
|
|
- struct hotplug_slot_info *hotplug_slot_info;
|
|
|
|
int retval = -ENOMEM;
|
|
int retval = -ENOMEM;
|
|
|
|
|
|
slot = kzalloc(sizeof(*slot), GFP_KERNEL);
|
|
slot = kzalloc(sizeof(*slot), GFP_KERNEL);
|
|
if (!slot)
|
|
if (!slot)
|
|
goto error;
|
|
goto error;
|
|
|
|
|
|
- slot->hotplug_slot = kzalloc(sizeof(*hotplug_slot), GFP_KERNEL);
|
|
|
|
|
|
+ slot->hotplug_slot = kzalloc(sizeof(*slot->hotplug_slot), GFP_KERNEL);
|
|
if (!slot->hotplug_slot)
|
|
if (!slot->hotplug_slot)
|
|
goto error_slot;
|
|
goto error_slot;
|
|
|
|
|
|
- slot->hotplug_slot->info = kzalloc(sizeof(*hotplug_slot_info),
|
|
|
|
- GFP_KERNEL);
|
|
|
|
- if (!slot->hotplug_slot->info)
|
|
|
|
- goto error_hpslot;
|
|
|
|
|
|
+ slot->hotplug_slot->info = &slot->info;
|
|
|
|
|
|
- slot->hotplug_slot->name = kzalloc(SLOT_NAME_SIZE, GFP_KERNEL);
|
|
|
|
- if (!slot->hotplug_slot->name)
|
|
|
|
- goto error_info;
|
|
|
|
|
|
+ slot->hotplug_slot->name = slot->name;
|
|
|
|
|
|
slot->hotplug_slot->private = slot;
|
|
slot->hotplug_slot->private = slot;
|
|
slot->hotplug_slot->release = &release_slot;
|
|
slot->hotplug_slot->release = &release_slot;
|
|
@@ -378,21 +357,17 @@ int acpiphp_register_hotplug_slot(struct acpiphp_slot *acpiphp_slot)
|
|
slot->hotplug_slot->info->cur_bus_speed = PCI_SPEED_UNKNOWN;
|
|
slot->hotplug_slot->info->cur_bus_speed = PCI_SPEED_UNKNOWN;
|
|
|
|
|
|
acpiphp_slot->slot = slot;
|
|
acpiphp_slot->slot = slot;
|
|
- make_slot_name(slot);
|
|
|
|
|
|
+ snprintf(slot->name, sizeof(slot->name), "%u", slot->acpi_slot->sun);
|
|
|
|
|
|
retval = pci_hp_register(slot->hotplug_slot);
|
|
retval = pci_hp_register(slot->hotplug_slot);
|
|
if (retval) {
|
|
if (retval) {
|
|
err("pci_hp_register failed with error %d\n", retval);
|
|
err("pci_hp_register failed with error %d\n", retval);
|
|
- goto error_name;
|
|
|
|
|
|
+ goto error_hpslot;
|
|
}
|
|
}
|
|
|
|
|
|
info("Slot [%s] registered\n", slot->hotplug_slot->name);
|
|
info("Slot [%s] registered\n", slot->hotplug_slot->name);
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
-error_name:
|
|
|
|
- kfree(slot->hotplug_slot->name);
|
|
|
|
-error_info:
|
|
|
|
- kfree(slot->hotplug_slot->info);
|
|
|
|
error_hpslot:
|
|
error_hpslot:
|
|
kfree(slot->hotplug_slot);
|
|
kfree(slot->hotplug_slot);
|
|
error_slot:
|
|
error_slot:
|