diff options
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/hotplug/acpiphp.h | 4 | ||||
-rw-r--r-- | drivers/pci/hotplug/acpiphp_core.c | 35 |
2 files changed, 7 insertions, 32 deletions
diff --git a/drivers/pci/hotplug/acpiphp.h b/drivers/pci/hotplug/acpiphp.h index 59c5b242d86d..ddbadd95387e 100644 --- a/drivers/pci/hotplug/acpiphp.h +++ b/drivers/pci/hotplug/acpiphp.h | |||
@@ -62,10 +62,10 @@ struct acpiphp_slot; | |||
62 | struct slot { | 62 | struct slot { |
63 | struct hotplug_slot *hotplug_slot; | 63 | struct hotplug_slot *hotplug_slot; |
64 | struct acpiphp_slot *acpi_slot; | 64 | struct acpiphp_slot *acpi_slot; |
65 | struct hotplug_slot_info info; | ||
66 | char name[SLOT_NAME_SIZE]; | ||
65 | }; | 67 | }; |
66 | 68 | ||
67 | |||
68 | |||
69 | /** | 69 | /** |
70 | * struct acpiphp_bridge - PCI bridge information | 70 | * struct acpiphp_bridge - PCI bridge information |
71 | * | 71 | * |
diff --git a/drivers/pci/hotplug/acpiphp_core.c b/drivers/pci/hotplug/acpiphp_core.c index c8b690741149..40c79b03c7ef 100644 --- a/drivers/pci/hotplug/acpiphp_core.c +++ b/drivers/pci/hotplug/acpiphp_core.c | |||
@@ -312,18 +312,6 @@ static int __init init_acpi(void) | |||
312 | return retval; | 312 | return retval; |
313 | } | 313 | } |
314 | 314 | ||
315 | |||
316 | /** | ||
317 | * make_slot_name - make a slot name that appears in pcihpfs | ||
318 | * @slot: slot to name | ||
319 | * | ||
320 | */ | ||
321 | static void make_slot_name(struct slot *slot) | ||
322 | { | ||
323 | snprintf(slot->hotplug_slot->name, SLOT_NAME_SIZE, "%u", | ||
324 | slot->acpi_slot->sun); | ||
325 | } | ||
326 | |||
327 | /** | 315 | /** |
328 | * release_slot - free up the memory used by a slot | 316 | * release_slot - free up the memory used by a slot |
329 | * @hotplug_slot: slot to free | 317 | * @hotplug_slot: slot to free |
@@ -334,8 +322,6 @@ static void release_slot(struct hotplug_slot *hotplug_slot) | |||
334 | 322 | ||
335 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 323 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); |
336 | 324 | ||
337 | kfree(slot->hotplug_slot->info); | ||
338 | kfree(slot->hotplug_slot->name); | ||
339 | kfree(slot->hotplug_slot); | 325 | kfree(slot->hotplug_slot); |
340 | kfree(slot); | 326 | kfree(slot); |
341 | } | 327 | } |
@@ -344,26 +330,19 @@ static void release_slot(struct hotplug_slot *hotplug_slot) | |||
344 | int acpiphp_register_hotplug_slot(struct acpiphp_slot *acpiphp_slot) | 330 | int acpiphp_register_hotplug_slot(struct acpiphp_slot *acpiphp_slot) |
345 | { | 331 | { |
346 | struct slot *slot; | 332 | struct slot *slot; |
347 | struct hotplug_slot *hotplug_slot; | ||
348 | struct hotplug_slot_info *hotplug_slot_info; | ||
349 | int retval = -ENOMEM; | 333 | int retval = -ENOMEM; |
350 | 334 | ||
351 | slot = kzalloc(sizeof(*slot), GFP_KERNEL); | 335 | slot = kzalloc(sizeof(*slot), GFP_KERNEL); |
352 | if (!slot) | 336 | if (!slot) |
353 | goto error; | 337 | goto error; |
354 | 338 | ||
355 | slot->hotplug_slot = kzalloc(sizeof(*hotplug_slot), GFP_KERNEL); | 339 | slot->hotplug_slot = kzalloc(sizeof(*slot->hotplug_slot), GFP_KERNEL); |
356 | if (!slot->hotplug_slot) | 340 | if (!slot->hotplug_slot) |
357 | goto error_slot; | 341 | goto error_slot; |
358 | 342 | ||
359 | slot->hotplug_slot->info = kzalloc(sizeof(*hotplug_slot_info), | 343 | slot->hotplug_slot->info = &slot->info; |
360 | GFP_KERNEL); | ||
361 | if (!slot->hotplug_slot->info) | ||
362 | goto error_hpslot; | ||
363 | 344 | ||
364 | slot->hotplug_slot->name = kzalloc(SLOT_NAME_SIZE, GFP_KERNEL); | 345 | slot->hotplug_slot->name = slot->name; |
365 | if (!slot->hotplug_slot->name) | ||
366 | goto error_info; | ||
367 | 346 | ||
368 | slot->hotplug_slot->private = slot; | 347 | slot->hotplug_slot->private = slot; |
369 | slot->hotplug_slot->release = &release_slot; | 348 | slot->hotplug_slot->release = &release_slot; |
@@ -378,21 +357,17 @@ int acpiphp_register_hotplug_slot(struct acpiphp_slot *acpiphp_slot) | |||
378 | slot->hotplug_slot->info->cur_bus_speed = PCI_SPEED_UNKNOWN; | 357 | slot->hotplug_slot->info->cur_bus_speed = PCI_SPEED_UNKNOWN; |
379 | 358 | ||
380 | acpiphp_slot->slot = slot; | 359 | acpiphp_slot->slot = slot; |
381 | make_slot_name(slot); | 360 | snprintf(slot->name, sizeof(slot->name), "%u", slot->acpi_slot->sun); |
382 | 361 | ||
383 | retval = pci_hp_register(slot->hotplug_slot); | 362 | retval = pci_hp_register(slot->hotplug_slot); |
384 | if (retval) { | 363 | if (retval) { |
385 | err("pci_hp_register failed with error %d\n", retval); | 364 | err("pci_hp_register failed with error %d\n", retval); |
386 | goto error_name; | 365 | goto error_hpslot; |
387 | } | 366 | } |
388 | 367 | ||
389 | info("Slot [%s] registered\n", slot->hotplug_slot->name); | 368 | info("Slot [%s] registered\n", slot->hotplug_slot->name); |
390 | 369 | ||
391 | return 0; | 370 | return 0; |
392 | error_name: | ||
393 | kfree(slot->hotplug_slot->name); | ||
394 | error_info: | ||
395 | kfree(slot->hotplug_slot->info); | ||
396 | error_hpslot: | 371 | error_hpslot: |
397 | kfree(slot->hotplug_slot); | 372 | kfree(slot->hotplug_slot); |
398 | error_slot: | 373 | error_slot: |