diff options
author | Alex Chiang <achiang@hp.com> | 2008-10-20 19:41:33 -0400 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2008-10-22 19:42:41 -0400 |
commit | a32615a1a661f83661e8a26c3bc7763f716da8f3 (patch) | |
tree | 3c33e4fc205f184d2fbd135bd800e05182aa18c6 | |
parent | 43caae884b5a5e2eacb4879225341cb49700e129 (diff) |
PCI: ibmphp: 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.
Additionally, slightly rearrange the members of struct slot
so they are naturally aligned to eliminate holes.
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>
-rw-r--r-- | drivers/pci/hotplug/ibmphp.h | 5 | ||||
-rw-r--r-- | drivers/pci/hotplug/ibmphp_ebda.c | 20 |
2 files changed, 9 insertions, 16 deletions
diff --git a/drivers/pci/hotplug/ibmphp.h b/drivers/pci/hotplug/ibmphp.h index 612d96301509..a8d391a4957d 100644 --- a/drivers/pci/hotplug/ibmphp.h +++ b/drivers/pci/hotplug/ibmphp.h | |||
@@ -707,17 +707,16 @@ struct slot { | |||
707 | u8 device; | 707 | u8 device; |
708 | u8 number; | 708 | u8 number; |
709 | u8 real_physical_slot_num; | 709 | u8 real_physical_slot_num; |
710 | char name[100]; | ||
711 | u32 capabilities; | 710 | u32 capabilities; |
712 | u8 supported_speed; | 711 | u8 supported_speed; |
713 | u8 supported_bus_mode; | 712 | u8 supported_bus_mode; |
713 | u8 flag; /* this is for disable slot and polling */ | ||
714 | u8 ctlr_index; | ||
714 | struct hotplug_slot *hotplug_slot; | 715 | struct hotplug_slot *hotplug_slot; |
715 | struct controller *ctrl; | 716 | struct controller *ctrl; |
716 | struct pci_func *func; | 717 | struct pci_func *func; |
717 | u8 irq[4]; | 718 | u8 irq[4]; |
718 | u8 flag; /* this is for disable slot and polling */ | ||
719 | int bit_mode; /* 0 = 32, 1 = 64 */ | 719 | int bit_mode; /* 0 = 32, 1 = 64 */ |
720 | u8 ctlr_index; | ||
721 | struct bus_info *bus_on; | 720 | struct bus_info *bus_on; |
722 | struct list_head ibm_slot_list; | 721 | struct list_head ibm_slot_list; |
723 | u8 status; | 722 | u8 status; |
diff --git a/drivers/pci/hotplug/ibmphp_ebda.c b/drivers/pci/hotplug/ibmphp_ebda.c index 342d3e8f77c8..c1abac8ab5c3 100644 --- a/drivers/pci/hotplug/ibmphp_ebda.c +++ b/drivers/pci/hotplug/ibmphp_ebda.c | |||
@@ -587,11 +587,14 @@ static u8 calculate_first_slot (u8 slot_num) | |||
587 | return first_slot + 1; | 587 | return first_slot + 1; |
588 | 588 | ||
589 | } | 589 | } |
590 | |||
591 | #define SLOT_NAME_SIZE 30 | ||
592 | |||
590 | static char *create_file_name (struct slot * slot_cur) | 593 | static char *create_file_name (struct slot * slot_cur) |
591 | { | 594 | { |
592 | struct opt_rio *opt_vg_ptr = NULL; | 595 | struct opt_rio *opt_vg_ptr = NULL; |
593 | struct opt_rio_lo *opt_lo_ptr = NULL; | 596 | struct opt_rio_lo *opt_lo_ptr = NULL; |
594 | static char str[30]; | 597 | static char str[SLOT_NAME_SIZE]; |
595 | int which = 0; /* rxe = 1, chassis = 0 */ | 598 | int which = 0; /* rxe = 1, chassis = 0 */ |
596 | u8 number = 1; /* either chassis or rxe # */ | 599 | u8 number = 1; /* either chassis or rxe # */ |
597 | u8 first_slot = 1; | 600 | u8 first_slot = 1; |
@@ -703,7 +706,6 @@ static void release_slot(struct hotplug_slot *hotplug_slot) | |||
703 | 706 | ||
704 | slot = hotplug_slot->private; | 707 | slot = hotplug_slot->private; |
705 | kfree(slot->hotplug_slot->info); | 708 | kfree(slot->hotplug_slot->info); |
706 | kfree(slot->hotplug_slot->name); | ||
707 | kfree(slot->hotplug_slot); | 709 | kfree(slot->hotplug_slot); |
708 | slot->ctrl = NULL; | 710 | slot->ctrl = NULL; |
709 | slot->bus_on = NULL; | 711 | slot->bus_on = NULL; |
@@ -734,6 +736,7 @@ static int __init ebda_rsrc_controller (void) | |||
734 | struct bus_info *bus_info_ptr1, *bus_info_ptr2; | 736 | struct bus_info *bus_info_ptr1, *bus_info_ptr2; |
735 | int rc; | 737 | int rc; |
736 | struct slot *tmp_slot; | 738 | struct slot *tmp_slot; |
739 | char name[SLOT_NAME_SIZE]; | ||
737 | 740 | ||
738 | addr = hpc_list_ptr->phys_addr; | 741 | addr = hpc_list_ptr->phys_addr; |
739 | for (ctlr = 0; ctlr < hpc_list_ptr->num_ctlrs; ctlr++) { | 742 | for (ctlr = 0; ctlr < hpc_list_ptr->num_ctlrs; ctlr++) { |
@@ -897,12 +900,6 @@ static int __init ebda_rsrc_controller (void) | |||
897 | goto error_no_hp_info; | 900 | goto error_no_hp_info; |
898 | } | 901 | } |
899 | 902 | ||
900 | hp_slot_ptr->name = kmalloc(30, GFP_KERNEL); | ||
901 | if (!hp_slot_ptr->name) { | ||
902 | rc = -ENOMEM; | ||
903 | goto error_no_hp_name; | ||
904 | } | ||
905 | |||
906 | tmp_slot = kzalloc(sizeof(*tmp_slot), GFP_KERNEL); | 903 | tmp_slot = kzalloc(sizeof(*tmp_slot), GFP_KERNEL); |
907 | if (!tmp_slot) { | 904 | if (!tmp_slot) { |
908 | rc = -ENOMEM; | 905 | rc = -ENOMEM; |
@@ -964,10 +961,9 @@ static int __init ebda_rsrc_controller (void) | |||
964 | } /* each hpc */ | 961 | } /* each hpc */ |
965 | 962 | ||
966 | list_for_each_entry(tmp_slot, &ibmphp_slot_head, ibm_slot_list) { | 963 | list_for_each_entry(tmp_slot, &ibmphp_slot_head, ibm_slot_list) { |
967 | snprintf (tmp_slot->hotplug_slot->name, 30, "%s", create_file_name (tmp_slot)); | 964 | snprintf(name, SLOT_NAME_SIZE, "%s", create_file_name(tmp_slot)); |
968 | pci_hp_register(tmp_slot->hotplug_slot, | 965 | pci_hp_register(tmp_slot->hotplug_slot, |
969 | pci_find_bus(0, tmp_slot->bus), tmp_slot->device, | 966 | pci_find_bus(0, tmp_slot->bus), tmp_slot->device, name); |
970 | tmp_slot->hotplug_slot->name); | ||
971 | } | 967 | } |
972 | 968 | ||
973 | print_ebda_hpc (); | 969 | print_ebda_hpc (); |
@@ -977,8 +973,6 @@ static int __init ebda_rsrc_controller (void) | |||
977 | error: | 973 | error: |
978 | kfree (hp_slot_ptr->private); | 974 | kfree (hp_slot_ptr->private); |
979 | error_no_slot: | 975 | error_no_slot: |
980 | kfree (hp_slot_ptr->name); | ||
981 | error_no_hp_name: | ||
982 | kfree (hp_slot_ptr->info); | 976 | kfree (hp_slot_ptr->info); |
983 | error_no_hp_info: | 977 | error_no_hp_info: |
984 | kfree (hp_slot_ptr); | 978 | kfree (hp_slot_ptr); |