aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug
diff options
context:
space:
mode:
authorAlex Chiang <achiang@hp.com>2008-10-20 19:41:22 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2008-10-22 19:42:40 -0400
commit30ac7acd05d1449ac784de144c4b5237be25b0b4 (patch)
treef43389db83bb9a6bb56929a89624d79d0b2ca7e3 /drivers/pci/hotplug
parentd6c479e0b777afcd7a26ca62e122e3f878ccc830 (diff)
PCI: cpqphp: stop managing hotplug_slot->name
We no longer need to manage our version of hotplug_slot->name since the PCI and hotplug core manage it on our behalf. Now, we simply advise the PCI core of the name that we would like, and let the core take care of the rest. Cc: jbarnes@virtuousgeek.org Cc: kristen.c.accardi@intel.com Acked-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Signed-off-by: Alex Chiang <achiang@hp.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/hotplug')
-rw-r--r--drivers/pci/hotplug/cpqphp.h13
-rw-r--r--drivers/pci/hotplug/cpqphp_core.c42
2 files changed, 24 insertions, 31 deletions
diff --git a/drivers/pci/hotplug/cpqphp.h b/drivers/pci/hotplug/cpqphp.h
index b1decfa88b7a..afaf8f69f73e 100644
--- a/drivers/pci/hotplug/cpqphp.h
+++ b/drivers/pci/hotplug/cpqphp.h
@@ -449,6 +449,11 @@ extern u8 cpqhp_disk_irq;
449 449
450/* inline functions */ 450/* inline functions */
451 451
452static inline char *slot_name(struct slot *slot)
453{
454 return hotplug_slot_name(slot->hotplug_slot);
455}
456
452/* 457/*
453 * return_resource 458 * return_resource
454 * 459 *
@@ -696,14 +701,6 @@ static inline int get_presence_status(struct controller *ctrl, struct slot *slot
696 return presence_save; 701 return presence_save;
697} 702}
698 703
699#define SLOT_NAME_SIZE 10
700
701static inline void make_slot_name(char *buffer, int buffer_size, struct slot *slot)
702{
703 snprintf(buffer, buffer_size, "%d", slot->number);
704}
705
706
707static inline int wait_for_ctrl_irq(struct controller *ctrl) 704static inline int wait_for_ctrl_irq(struct controller *ctrl)
708{ 705{
709 DECLARE_WAITQUEUE(wait, current); 706 DECLARE_WAITQUEUE(wait, current);
diff --git a/drivers/pci/hotplug/cpqphp_core.c b/drivers/pci/hotplug/cpqphp_core.c
index a7fe4584f00b..724d42c4adbc 100644
--- a/drivers/pci/hotplug/cpqphp_core.c
+++ b/drivers/pci/hotplug/cpqphp_core.c
@@ -315,14 +315,15 @@ static void release_slot(struct hotplug_slot *hotplug_slot)
315{ 315{
316 struct slot *slot = hotplug_slot->private; 316 struct slot *slot = hotplug_slot->private;
317 317
318 dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); 318 dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
319 319
320 kfree(slot->hotplug_slot->info); 320 kfree(slot->hotplug_slot->info);
321 kfree(slot->hotplug_slot->name);
322 kfree(slot->hotplug_slot); 321 kfree(slot->hotplug_slot);
323 kfree(slot); 322 kfree(slot);
324} 323}
325 324
325#define SLOT_NAME_SIZE 10
326
326static int ctrl_slot_setup(struct controller *ctrl, 327static int ctrl_slot_setup(struct controller *ctrl,
327 void __iomem *smbios_start, 328 void __iomem *smbios_start,
328 void __iomem *smbios_table) 329 void __iomem *smbios_table)
@@ -335,6 +336,7 @@ static int ctrl_slot_setup(struct controller *ctrl,
335 u8 slot_number; 336 u8 slot_number;
336 u8 ctrl_slot; 337 u8 ctrl_slot;
337 u32 tempdword; 338 u32 tempdword;
339 char name[SLOT_NAME_SIZE];
338 void __iomem *slot_entry= NULL; 340 void __iomem *slot_entry= NULL;
339 int result = -ENOMEM; 341 int result = -ENOMEM;
340 342
@@ -363,16 +365,12 @@ static int ctrl_slot_setup(struct controller *ctrl,
363 if (!hotplug_slot->info) 365 if (!hotplug_slot->info)
364 goto error_hpslot; 366 goto error_hpslot;
365 hotplug_slot_info = hotplug_slot->info; 367 hotplug_slot_info = hotplug_slot->info;
366 hotplug_slot->name = kmalloc(SLOT_NAME_SIZE, GFP_KERNEL);
367
368 if (!hotplug_slot->name)
369 goto error_info;
370 368
371 slot->ctrl = ctrl; 369 slot->ctrl = ctrl;
372 slot->bus = ctrl->bus; 370 slot->bus = ctrl->bus;
373 slot->device = slot_device; 371 slot->device = slot_device;
374 slot->number = slot_number; 372 slot->number = slot_number;
375 dbg("slot->number = %d\n", slot->number); 373 dbg("slot->number = %u\n", slot->number);
376 374
377 slot_entry = get_SMBIOS_entry(smbios_start, smbios_table, 9, 375 slot_entry = get_SMBIOS_entry(smbios_start, smbios_table, 9,
378 slot_entry); 376 slot_entry);
@@ -418,9 +416,9 @@ static int ctrl_slot_setup(struct controller *ctrl,
418 /* register this slot with the hotplug pci core */ 416 /* register this slot with the hotplug pci core */
419 hotplug_slot->release = &release_slot; 417 hotplug_slot->release = &release_slot;
420 hotplug_slot->private = slot; 418 hotplug_slot->private = slot;
421 make_slot_name(hotplug_slot->name, SLOT_NAME_SIZE, slot); 419 snprintf(name, SLOT_NAME_SIZE, "%u", slot->number);
422 hotplug_slot->ops = &cpqphp_hotplug_slot_ops; 420 hotplug_slot->ops = &cpqphp_hotplug_slot_ops;
423 421
424 hotplug_slot_info->power_status = get_slot_enabled(ctrl, slot); 422 hotplug_slot_info->power_status = get_slot_enabled(ctrl, slot);
425 hotplug_slot_info->attention_status = 423 hotplug_slot_info->attention_status =
426 cpq_get_attention_status(ctrl, slot); 424 cpq_get_attention_status(ctrl, slot);
@@ -437,10 +435,10 @@ static int ctrl_slot_setup(struct controller *ctrl,
437 result = pci_hp_register(hotplug_slot, 435 result = pci_hp_register(hotplug_slot,
438 ctrl->pci_dev->subordinate, 436 ctrl->pci_dev->subordinate,
439 slot->device, 437 slot->device,
440 hotplug_slot->name); 438 name);
441 if (result) { 439 if (result) {
442 err("pci_hp_register failed with error %d\n", result); 440 err("pci_hp_register failed with error %d\n", result);
443 goto error_name; 441 goto error_info;
444 } 442 }
445 443
446 slot->next = ctrl->slot; 444 slot->next = ctrl->slot;
@@ -452,8 +450,6 @@ static int ctrl_slot_setup(struct controller *ctrl,
452 } 450 }
453 451
454 return 0; 452 return 0;
455error_name:
456 kfree(hotplug_slot->name);
457error_info: 453error_info:
458 kfree(hotplug_slot_info); 454 kfree(hotplug_slot_info);
459error_hpslot: 455error_hpslot:
@@ -639,7 +635,7 @@ static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status)
639 u8 device; 635 u8 device;
640 u8 function; 636 u8 function;
641 637
642 dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); 638 dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
643 639
644 if (cpqhp_get_bus_dev(ctrl, &bus, &devfn, slot->number) == -1) 640 if (cpqhp_get_bus_dev(ctrl, &bus, &devfn, slot->number) == -1)
645 return -ENODEV; 641 return -ENODEV;
@@ -666,7 +662,7 @@ static int process_SI(struct hotplug_slot *hotplug_slot)
666 u8 device; 662 u8 device;
667 u8 function; 663 u8 function;
668 664
669 dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); 665 dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
670 666
671 if (cpqhp_get_bus_dev(ctrl, &bus, &devfn, slot->number) == -1) 667 if (cpqhp_get_bus_dev(ctrl, &bus, &devfn, slot->number) == -1)
672 return -ENODEV; 668 return -ENODEV;
@@ -698,7 +694,7 @@ static int process_SS(struct hotplug_slot *hotplug_slot)
698 u8 device; 694 u8 device;
699 u8 function; 695 u8 function;
700 696
701 dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); 697 dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
702 698
703 if (cpqhp_get_bus_dev(ctrl, &bus, &devfn, slot->number) == -1) 699 if (cpqhp_get_bus_dev(ctrl, &bus, &devfn, slot->number) == -1)
704 return -ENODEV; 700 return -ENODEV;
@@ -721,7 +717,7 @@ static int hardware_test(struct hotplug_slot *hotplug_slot, u32 value)
721 struct slot *slot = hotplug_slot->private; 717 struct slot *slot = hotplug_slot->private;
722 struct controller *ctrl = slot->ctrl; 718 struct controller *ctrl = slot->ctrl;
723 719
724 dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); 720 dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
725 721
726 return cpqhp_hardware_test(ctrl, value); 722 return cpqhp_hardware_test(ctrl, value);
727} 723}
@@ -732,7 +728,7 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value)
732 struct slot *slot = hotplug_slot->private; 728 struct slot *slot = hotplug_slot->private;
733 struct controller *ctrl = slot->ctrl; 729 struct controller *ctrl = slot->ctrl;
734 730
735 dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); 731 dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
736 732
737 *value = get_slot_enabled(ctrl, slot); 733 *value = get_slot_enabled(ctrl, slot);
738 return 0; 734 return 0;
@@ -743,7 +739,7 @@ static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value)
743 struct slot *slot = hotplug_slot->private; 739 struct slot *slot = hotplug_slot->private;
744 struct controller *ctrl = slot->ctrl; 740 struct controller *ctrl = slot->ctrl;
745 741
746 dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); 742 dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
747 743
748 *value = cpq_get_attention_status(ctrl, slot); 744 *value = cpq_get_attention_status(ctrl, slot);
749 return 0; 745 return 0;
@@ -754,7 +750,7 @@ static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value)
754 struct slot *slot = hotplug_slot->private; 750 struct slot *slot = hotplug_slot->private;
755 struct controller *ctrl = slot->ctrl; 751 struct controller *ctrl = slot->ctrl;
756 752
757 dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); 753 dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
758 754
759 *value = cpq_get_latch_status(ctrl, slot); 755 *value = cpq_get_latch_status(ctrl, slot);
760 756
@@ -766,7 +762,7 @@ static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value)
766 struct slot *slot = hotplug_slot->private; 762 struct slot *slot = hotplug_slot->private;
767 struct controller *ctrl = slot->ctrl; 763 struct controller *ctrl = slot->ctrl;
768 764
769 dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); 765 dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
770 766
771 *value = get_presence_status(ctrl, slot); 767 *value = get_presence_status(ctrl, slot);
772 768
@@ -778,7 +774,7 @@ static int get_max_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_sp
778 struct slot *slot = hotplug_slot->private; 774 struct slot *slot = hotplug_slot->private;
779 struct controller *ctrl = slot->ctrl; 775 struct controller *ctrl = slot->ctrl;
780 776
781 dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); 777 dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
782 778
783 *value = ctrl->speed_capability; 779 *value = ctrl->speed_capability;
784 780
@@ -790,7 +786,7 @@ static int get_cur_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_sp
790 struct slot *slot = hotplug_slot->private; 786 struct slot *slot = hotplug_slot->private;
791 struct controller *ctrl = slot->ctrl; 787 struct controller *ctrl = slot->ctrl;
792 788
793 dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); 789 dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
794 790
795 *value = ctrl->speed; 791 *value = ctrl->speed;
796 792