Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 41228
b: refs/heads/master
c: ac9e989
h: refs/heads/master
v: v3
  • Loading branch information
Rolf Eike Beer authored and Greg Kroah-Hartman committed Dec 1, 2006
1 parent 3a4e9db commit 8e454f8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 33 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: adbc2a102252994c36102008293b52760613d6c3
refs/heads/master: ac9e98918776d8fa6dc38bfa6d298a7dbcbac2cb
4 changes: 2 additions & 2 deletions trunk/drivers/pci/hotplug/acpiphp.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ struct acpiphp_slot;
struct slot {
struct hotplug_slot *hotplug_slot;
struct acpiphp_slot *acpi_slot;
struct hotplug_slot_info info;
char name[SLOT_NAME_SIZE];
};



/**
* struct acpiphp_bridge - PCI bridge information
*
Expand Down
35 changes: 5 additions & 30 deletions trunk/drivers/pci/hotplug/acpiphp_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,18 +312,6 @@ static int __init init_acpi(void)
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
* @hotplug_slot: slot to free
Expand All @@ -334,8 +322,6 @@ static void release_slot(struct hotplug_slot *hotplug_slot)

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);
}
Expand All @@ -344,26 +330,19 @@ static void release_slot(struct hotplug_slot *hotplug_slot)
int acpiphp_register_hotplug_slot(struct acpiphp_slot *acpiphp_slot)
{
struct slot *slot;
struct hotplug_slot *hotplug_slot;
struct hotplug_slot_info *hotplug_slot_info;
int retval = -ENOMEM;

slot = kzalloc(sizeof(*slot), GFP_KERNEL);
if (!slot)
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)
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->release = &release_slot;
Expand All @@ -378,21 +357,17 @@ int acpiphp_register_hotplug_slot(struct acpiphp_slot *acpiphp_slot)
slot->hotplug_slot->info->cur_bus_speed = PCI_SPEED_UNKNOWN;

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);
if (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);

return 0;
error_name:
kfree(slot->hotplug_slot->name);
error_info:
kfree(slot->hotplug_slot->info);
error_hpslot:
kfree(slot->hotplug_slot);
error_slot:
Expand Down

0 comments on commit 8e454f8

Please sign in to comment.