Commit a32615a1a661f83661e8a26c3bc7763f716da8f3

Authored by Alex Chiang
Committed by Jesse Barnes
1 parent 43caae884b

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>

Showing 2 changed files with 9 additions and 16 deletions Side-by-side Diff

drivers/pci/hotplug/ibmphp.h
... ... @@ -707,17 +707,16 @@
707 707 u8 device;
708 708 u8 number;
709 709 u8 real_physical_slot_num;
710   - char name[100];
711 710 u32 capabilities;
712 711 u8 supported_speed;
713 712 u8 supported_bus_mode;
  713 + u8 flag; /* this is for disable slot and polling */
  714 + u8 ctlr_index;
714 715 struct hotplug_slot *hotplug_slot;
715 716 struct controller *ctrl;
716 717 struct pci_func *func;
717 718 u8 irq[4];
718   - u8 flag; /* this is for disable slot and polling */
719 719 int bit_mode; /* 0 = 32, 1 = 64 */
720   - u8 ctlr_index;
721 720 struct bus_info *bus_on;
722 721 struct list_head ibm_slot_list;
723 722 u8 status;
drivers/pci/hotplug/ibmphp_ebda.c
... ... @@ -587,11 +587,14 @@
587 587 return first_slot + 1;
588 588  
589 589 }
  590 +
  591 +#define SLOT_NAME_SIZE 30
  592 +
590 593 static char *create_file_name (struct slot * slot_cur)
591 594 {
592 595 struct opt_rio *opt_vg_ptr = NULL;
593 596 struct opt_rio_lo *opt_lo_ptr = NULL;
594   - static char str[30];
  597 + static char str[SLOT_NAME_SIZE];
595 598 int which = 0; /* rxe = 1, chassis = 0 */
596 599 u8 number = 1; /* either chassis or rxe # */
597 600 u8 first_slot = 1;
... ... @@ -703,7 +706,6 @@
703 706  
704 707 slot = hotplug_slot->private;
705 708 kfree(slot->hotplug_slot->info);
706   - kfree(slot->hotplug_slot->name);
707 709 kfree(slot->hotplug_slot);
708 710 slot->ctrl = NULL;
709 711 slot->bus_on = NULL;
... ... @@ -734,6 +736,7 @@
734 736 struct bus_info *bus_info_ptr1, *bus_info_ptr2;
735 737 int rc;
736 738 struct slot *tmp_slot;
  739 + char name[SLOT_NAME_SIZE];
737 740  
738 741 addr = hpc_list_ptr->phys_addr;
739 742 for (ctlr = 0; ctlr < hpc_list_ptr->num_ctlrs; ctlr++) {
... ... @@ -897,12 +900,6 @@
897 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 903 tmp_slot = kzalloc(sizeof(*tmp_slot), GFP_KERNEL);
907 904 if (!tmp_slot) {
908 905 rc = -ENOMEM;
909 906  
... ... @@ -964,10 +961,9 @@
964 961 } /* each hpc */
965 962  
966 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 965 pci_hp_register(tmp_slot->hotplug_slot,
969   - pci_find_bus(0, tmp_slot->bus), tmp_slot->device,
970   - tmp_slot->hotplug_slot->name);
  966 + pci_find_bus(0, tmp_slot->bus), tmp_slot->device, name);
971 967 }
972 968  
973 969 print_ebda_hpc ();
... ... @@ -977,8 +973,6 @@
977 973 error:
978 974 kfree (hp_slot_ptr->private);
979 975 error_no_slot:
980   - kfree (hp_slot_ptr->name);
981   -error_no_hp_name:
982 976 kfree (hp_slot_ptr->info);
983 977 error_no_hp_info:
984 978 kfree (hp_slot_ptr);