diff options
Diffstat (limited to 'drivers/pci/hotplug')
-rw-r--r-- | drivers/pci/hotplug/ibmphp_ebda.c | 92 | ||||
-rw-r--r-- | drivers/pci/hotplug/pci_hotplug_core.c | 14 | ||||
-rw-r--r-- | drivers/pci/hotplug/pciehp.h | 16 | ||||
-rw-r--r-- | drivers/pci/hotplug/pciehp_core.c | 78 | ||||
-rw-r--r-- | drivers/pci/hotplug/pciehp_ctrl.c | 136 | ||||
-rw-r--r-- | drivers/pci/hotplug/pciehp_hpc.c | 202 | ||||
-rw-r--r-- | drivers/pci/hotplug/pciehp_pci.c | 26 | ||||
-rw-r--r-- | drivers/pci/hotplug/rpaphp.h | 4 | ||||
-rw-r--r-- | drivers/pci/hotplug/rpaphp_core.c | 4 | ||||
-rw-r--r-- | drivers/pci/hotplug/rpaphp_pci.c | 2 |
10 files changed, 303 insertions, 271 deletions
diff --git a/drivers/pci/hotplug/ibmphp_ebda.c b/drivers/pci/hotplug/ibmphp_ebda.c index 7d27631e6e62..8cfd1c4926c8 100644 --- a/drivers/pci/hotplug/ibmphp_ebda.c +++ b/drivers/pci/hotplug/ibmphp_ebda.c | |||
@@ -123,10 +123,8 @@ static struct ebda_pci_rsrc *alloc_ebda_pci_rsrc (void) | |||
123 | static void __init print_bus_info (void) | 123 | static void __init print_bus_info (void) |
124 | { | 124 | { |
125 | struct bus_info *ptr; | 125 | struct bus_info *ptr; |
126 | struct list_head *ptr1; | ||
127 | 126 | ||
128 | list_for_each (ptr1, &bus_info_head) { | 127 | list_for_each_entry(ptr, &bus_info_head, bus_info_list) { |
129 | ptr = list_entry (ptr1, struct bus_info, bus_info_list); | ||
130 | debug ("%s - slot_min = %x\n", __func__, ptr->slot_min); | 128 | debug ("%s - slot_min = %x\n", __func__, ptr->slot_min); |
131 | debug ("%s - slot_max = %x\n", __func__, ptr->slot_max); | 129 | debug ("%s - slot_max = %x\n", __func__, ptr->slot_max); |
132 | debug ("%s - slot_count = %x\n", __func__, ptr->slot_count); | 130 | debug ("%s - slot_count = %x\n", __func__, ptr->slot_count); |
@@ -146,10 +144,8 @@ static void __init print_bus_info (void) | |||
146 | static void print_lo_info (void) | 144 | static void print_lo_info (void) |
147 | { | 145 | { |
148 | struct rio_detail *ptr; | 146 | struct rio_detail *ptr; |
149 | struct list_head *ptr1; | ||
150 | debug ("print_lo_info ----\n"); | 147 | debug ("print_lo_info ----\n"); |
151 | list_for_each (ptr1, &rio_lo_head) { | 148 | list_for_each_entry(ptr, &rio_lo_head, rio_detail_list) { |
152 | ptr = list_entry (ptr1, struct rio_detail, rio_detail_list); | ||
153 | debug ("%s - rio_node_id = %x\n", __func__, ptr->rio_node_id); | 149 | debug ("%s - rio_node_id = %x\n", __func__, ptr->rio_node_id); |
154 | debug ("%s - rio_type = %x\n", __func__, ptr->rio_type); | 150 | debug ("%s - rio_type = %x\n", __func__, ptr->rio_type); |
155 | debug ("%s - owner_id = %x\n", __func__, ptr->owner_id); | 151 | debug ("%s - owner_id = %x\n", __func__, ptr->owner_id); |
@@ -163,10 +159,8 @@ static void print_lo_info (void) | |||
163 | static void print_vg_info (void) | 159 | static void print_vg_info (void) |
164 | { | 160 | { |
165 | struct rio_detail *ptr; | 161 | struct rio_detail *ptr; |
166 | struct list_head *ptr1; | ||
167 | debug ("%s ---\n", __func__); | 162 | debug ("%s ---\n", __func__); |
168 | list_for_each (ptr1, &rio_vg_head) { | 163 | list_for_each_entry(ptr, &rio_vg_head, rio_detail_list) { |
169 | ptr = list_entry (ptr1, struct rio_detail, rio_detail_list); | ||
170 | debug ("%s - rio_node_id = %x\n", __func__, ptr->rio_node_id); | 164 | debug ("%s - rio_node_id = %x\n", __func__, ptr->rio_node_id); |
171 | debug ("%s - rio_type = %x\n", __func__, ptr->rio_type); | 165 | debug ("%s - rio_type = %x\n", __func__, ptr->rio_type); |
172 | debug ("%s - owner_id = %x\n", __func__, ptr->owner_id); | 166 | debug ("%s - owner_id = %x\n", __func__, ptr->owner_id); |
@@ -180,10 +174,8 @@ static void print_vg_info (void) | |||
180 | static void __init print_ebda_pci_rsrc (void) | 174 | static void __init print_ebda_pci_rsrc (void) |
181 | { | 175 | { |
182 | struct ebda_pci_rsrc *ptr; | 176 | struct ebda_pci_rsrc *ptr; |
183 | struct list_head *ptr1; | ||
184 | 177 | ||
185 | list_for_each (ptr1, &ibmphp_ebda_pci_rsrc_head) { | 178 | list_for_each_entry(ptr, &ibmphp_ebda_pci_rsrc_head, ebda_pci_rsrc_list) { |
186 | ptr = list_entry (ptr1, struct ebda_pci_rsrc, ebda_pci_rsrc_list); | ||
187 | debug ("%s - rsrc type: %x bus#: %x dev_func: %x start addr: %x end addr: %x\n", | 179 | debug ("%s - rsrc type: %x bus#: %x dev_func: %x start addr: %x end addr: %x\n", |
188 | __func__, ptr->rsrc_type ,ptr->bus_num, ptr->dev_fun,ptr->start_addr, ptr->end_addr); | 180 | __func__, ptr->rsrc_type ,ptr->bus_num, ptr->dev_fun,ptr->start_addr, ptr->end_addr); |
189 | } | 181 | } |
@@ -192,10 +184,8 @@ static void __init print_ebda_pci_rsrc (void) | |||
192 | static void __init print_ibm_slot (void) | 184 | static void __init print_ibm_slot (void) |
193 | { | 185 | { |
194 | struct slot *ptr; | 186 | struct slot *ptr; |
195 | struct list_head *ptr1; | ||
196 | 187 | ||
197 | list_for_each (ptr1, &ibmphp_slot_head) { | 188 | list_for_each_entry(ptr, &ibmphp_slot_head, ibm_slot_list) { |
198 | ptr = list_entry (ptr1, struct slot, ibm_slot_list); | ||
199 | debug ("%s - slot_number: %x\n", __func__, ptr->number); | 189 | debug ("%s - slot_number: %x\n", __func__, ptr->number); |
200 | } | 190 | } |
201 | } | 191 | } |
@@ -203,10 +193,8 @@ static void __init print_ibm_slot (void) | |||
203 | static void __init print_opt_vg (void) | 193 | static void __init print_opt_vg (void) |
204 | { | 194 | { |
205 | struct opt_rio *ptr; | 195 | struct opt_rio *ptr; |
206 | struct list_head *ptr1; | ||
207 | debug ("%s ---\n", __func__); | 196 | debug ("%s ---\n", __func__); |
208 | list_for_each (ptr1, &opt_vg_head) { | 197 | list_for_each_entry(ptr, &opt_vg_head, opt_rio_list) { |
209 | ptr = list_entry (ptr1, struct opt_rio, opt_rio_list); | ||
210 | debug ("%s - rio_type %x\n", __func__, ptr->rio_type); | 198 | debug ("%s - rio_type %x\n", __func__, ptr->rio_type); |
211 | debug ("%s - chassis_num: %x\n", __func__, ptr->chassis_num); | 199 | debug ("%s - chassis_num: %x\n", __func__, ptr->chassis_num); |
212 | debug ("%s - first_slot_num: %x\n", __func__, ptr->first_slot_num); | 200 | debug ("%s - first_slot_num: %x\n", __func__, ptr->first_slot_num); |
@@ -217,13 +205,9 @@ static void __init print_opt_vg (void) | |||
217 | static void __init print_ebda_hpc (void) | 205 | static void __init print_ebda_hpc (void) |
218 | { | 206 | { |
219 | struct controller *hpc_ptr; | 207 | struct controller *hpc_ptr; |
220 | struct list_head *ptr1; | ||
221 | u16 index; | 208 | u16 index; |
222 | 209 | ||
223 | list_for_each (ptr1, &ebda_hpc_head) { | 210 | list_for_each_entry(hpc_ptr, &ebda_hpc_head, ebda_hpc_list) { |
224 | |||
225 | hpc_ptr = list_entry (ptr1, struct controller, ebda_hpc_list); | ||
226 | |||
227 | for (index = 0; index < hpc_ptr->slot_count; index++) { | 211 | for (index = 0; index < hpc_ptr->slot_count; index++) { |
228 | debug ("%s - physical slot#: %x\n", __func__, hpc_ptr->slots[index].slot_num); | 212 | debug ("%s - physical slot#: %x\n", __func__, hpc_ptr->slots[index].slot_num); |
229 | debug ("%s - pci bus# of the slot: %x\n", __func__, hpc_ptr->slots[index].slot_bus_num); | 213 | debug ("%s - pci bus# of the slot: %x\n", __func__, hpc_ptr->slots[index].slot_bus_num); |
@@ -460,9 +444,7 @@ static int __init ebda_rio_table (void) | |||
460 | static struct opt_rio *search_opt_vg (u8 chassis_num) | 444 | static struct opt_rio *search_opt_vg (u8 chassis_num) |
461 | { | 445 | { |
462 | struct opt_rio *ptr; | 446 | struct opt_rio *ptr; |
463 | struct list_head *ptr1; | 447 | list_for_each_entry(ptr, &opt_vg_head, opt_rio_list) { |
464 | list_for_each (ptr1, &opt_vg_head) { | ||
465 | ptr = list_entry (ptr1, struct opt_rio, opt_rio_list); | ||
466 | if (ptr->chassis_num == chassis_num) | 448 | if (ptr->chassis_num == chassis_num) |
467 | return ptr; | 449 | return ptr; |
468 | } | 450 | } |
@@ -473,10 +455,8 @@ static int __init combine_wpg_for_chassis (void) | |||
473 | { | 455 | { |
474 | struct opt_rio *opt_rio_ptr = NULL; | 456 | struct opt_rio *opt_rio_ptr = NULL; |
475 | struct rio_detail *rio_detail_ptr = NULL; | 457 | struct rio_detail *rio_detail_ptr = NULL; |
476 | struct list_head *list_head_ptr = NULL; | ||
477 | 458 | ||
478 | list_for_each (list_head_ptr, &rio_vg_head) { | 459 | list_for_each_entry(rio_detail_ptr, &rio_vg_head, rio_detail_list) { |
479 | rio_detail_ptr = list_entry (list_head_ptr, struct rio_detail, rio_detail_list); | ||
480 | opt_rio_ptr = search_opt_vg (rio_detail_ptr->chassis_num); | 460 | opt_rio_ptr = search_opt_vg (rio_detail_ptr->chassis_num); |
481 | if (!opt_rio_ptr) { | 461 | if (!opt_rio_ptr) { |
482 | opt_rio_ptr = kzalloc(sizeof(struct opt_rio), GFP_KERNEL); | 462 | opt_rio_ptr = kzalloc(sizeof(struct opt_rio), GFP_KERNEL); |
@@ -497,14 +477,12 @@ static int __init combine_wpg_for_chassis (void) | |||
497 | } | 477 | } |
498 | 478 | ||
499 | /* | 479 | /* |
500 | * reorgnizing linked list of expansion box | 480 | * reorganizing linked list of expansion box |
501 | */ | 481 | */ |
502 | static struct opt_rio_lo *search_opt_lo (u8 chassis_num) | 482 | static struct opt_rio_lo *search_opt_lo (u8 chassis_num) |
503 | { | 483 | { |
504 | struct opt_rio_lo *ptr; | 484 | struct opt_rio_lo *ptr; |
505 | struct list_head *ptr1; | 485 | list_for_each_entry(ptr, &opt_lo_head, opt_rio_lo_list) { |
506 | list_for_each (ptr1, &opt_lo_head) { | ||
507 | ptr = list_entry (ptr1, struct opt_rio_lo, opt_rio_lo_list); | ||
508 | if (ptr->chassis_num == chassis_num) | 486 | if (ptr->chassis_num == chassis_num) |
509 | return ptr; | 487 | return ptr; |
510 | } | 488 | } |
@@ -515,10 +493,8 @@ static int combine_wpg_for_expansion (void) | |||
515 | { | 493 | { |
516 | struct opt_rio_lo *opt_rio_lo_ptr = NULL; | 494 | struct opt_rio_lo *opt_rio_lo_ptr = NULL; |
517 | struct rio_detail *rio_detail_ptr = NULL; | 495 | struct rio_detail *rio_detail_ptr = NULL; |
518 | struct list_head *list_head_ptr = NULL; | ||
519 | 496 | ||
520 | list_for_each (list_head_ptr, &rio_lo_head) { | 497 | list_for_each_entry(rio_detail_ptr, &rio_lo_head, rio_detail_list) { |
521 | rio_detail_ptr = list_entry (list_head_ptr, struct rio_detail, rio_detail_list); | ||
522 | opt_rio_lo_ptr = search_opt_lo (rio_detail_ptr->chassis_num); | 498 | opt_rio_lo_ptr = search_opt_lo (rio_detail_ptr->chassis_num); |
523 | if (!opt_rio_lo_ptr) { | 499 | if (!opt_rio_lo_ptr) { |
524 | opt_rio_lo_ptr = kzalloc(sizeof(struct opt_rio_lo), GFP_KERNEL); | 500 | opt_rio_lo_ptr = kzalloc(sizeof(struct opt_rio_lo), GFP_KERNEL); |
@@ -550,20 +526,17 @@ static int first_slot_num (u8 slot_num, u8 first_slot, u8 var) | |||
550 | { | 526 | { |
551 | struct opt_rio *opt_vg_ptr = NULL; | 527 | struct opt_rio *opt_vg_ptr = NULL; |
552 | struct opt_rio_lo *opt_lo_ptr = NULL; | 528 | struct opt_rio_lo *opt_lo_ptr = NULL; |
553 | struct list_head *ptr = NULL; | ||
554 | int rc = 0; | 529 | int rc = 0; |
555 | 530 | ||
556 | if (!var) { | 531 | if (!var) { |
557 | list_for_each (ptr, &opt_vg_head) { | 532 | list_for_each_entry(opt_vg_ptr, &opt_vg_head, opt_rio_list) { |
558 | opt_vg_ptr = list_entry (ptr, struct opt_rio, opt_rio_list); | ||
559 | if ((first_slot < opt_vg_ptr->first_slot_num) && (slot_num >= opt_vg_ptr->first_slot_num)) { | 533 | if ((first_slot < opt_vg_ptr->first_slot_num) && (slot_num >= opt_vg_ptr->first_slot_num)) { |
560 | rc = -ENODEV; | 534 | rc = -ENODEV; |
561 | break; | 535 | break; |
562 | } | 536 | } |
563 | } | 537 | } |
564 | } else { | 538 | } else { |
565 | list_for_each (ptr, &opt_lo_head) { | 539 | list_for_each_entry(opt_lo_ptr, &opt_lo_head, opt_rio_lo_list) { |
566 | opt_lo_ptr = list_entry (ptr, struct opt_rio_lo, opt_rio_lo_list); | ||
567 | if ((first_slot < opt_lo_ptr->first_slot_num) && (slot_num >= opt_lo_ptr->first_slot_num)) { | 540 | if ((first_slot < opt_lo_ptr->first_slot_num) && (slot_num >= opt_lo_ptr->first_slot_num)) { |
568 | rc = -ENODEV; | 541 | rc = -ENODEV; |
569 | break; | 542 | break; |
@@ -576,10 +549,8 @@ static int first_slot_num (u8 slot_num, u8 first_slot, u8 var) | |||
576 | static struct opt_rio_lo * find_rxe_num (u8 slot_num) | 549 | static struct opt_rio_lo * find_rxe_num (u8 slot_num) |
577 | { | 550 | { |
578 | struct opt_rio_lo *opt_lo_ptr; | 551 | struct opt_rio_lo *opt_lo_ptr; |
579 | struct list_head *ptr; | ||
580 | 552 | ||
581 | list_for_each (ptr, &opt_lo_head) { | 553 | list_for_each_entry(opt_lo_ptr, &opt_lo_head, opt_rio_lo_list) { |
582 | opt_lo_ptr = list_entry (ptr, struct opt_rio_lo, opt_rio_lo_list); | ||
583 | //check to see if this slot_num belongs to expansion box | 554 | //check to see if this slot_num belongs to expansion box |
584 | if ((slot_num >= opt_lo_ptr->first_slot_num) && (!first_slot_num (slot_num, opt_lo_ptr->first_slot_num, 1))) | 555 | if ((slot_num >= opt_lo_ptr->first_slot_num) && (!first_slot_num (slot_num, opt_lo_ptr->first_slot_num, 1))) |
585 | return opt_lo_ptr; | 556 | return opt_lo_ptr; |
@@ -590,10 +561,8 @@ static struct opt_rio_lo * find_rxe_num (u8 slot_num) | |||
590 | static struct opt_rio * find_chassis_num (u8 slot_num) | 561 | static struct opt_rio * find_chassis_num (u8 slot_num) |
591 | { | 562 | { |
592 | struct opt_rio *opt_vg_ptr; | 563 | struct opt_rio *opt_vg_ptr; |
593 | struct list_head *ptr; | ||
594 | 564 | ||
595 | list_for_each (ptr, &opt_vg_head) { | 565 | list_for_each_entry(opt_vg_ptr, &opt_vg_head, opt_rio_list) { |
596 | opt_vg_ptr = list_entry (ptr, struct opt_rio, opt_rio_list); | ||
597 | //check to see if this slot_num belongs to chassis | 566 | //check to see if this slot_num belongs to chassis |
598 | if ((slot_num >= opt_vg_ptr->first_slot_num) && (!first_slot_num (slot_num, opt_vg_ptr->first_slot_num, 0))) | 567 | if ((slot_num >= opt_vg_ptr->first_slot_num) && (!first_slot_num (slot_num, opt_vg_ptr->first_slot_num, 0))) |
599 | return opt_vg_ptr; | 568 | return opt_vg_ptr; |
@@ -607,11 +576,9 @@ static struct opt_rio * find_chassis_num (u8 slot_num) | |||
607 | static u8 calculate_first_slot (u8 slot_num) | 576 | static u8 calculate_first_slot (u8 slot_num) |
608 | { | 577 | { |
609 | u8 first_slot = 1; | 578 | u8 first_slot = 1; |
610 | struct list_head * list; | ||
611 | struct slot * slot_cur; | 579 | struct slot * slot_cur; |
612 | 580 | ||
613 | list_for_each (list, &ibmphp_slot_head) { | 581 | list_for_each_entry(slot_cur, &ibmphp_slot_head, ibm_slot_list) { |
614 | slot_cur = list_entry (list, struct slot, ibm_slot_list); | ||
615 | if (slot_cur->ctrl) { | 582 | if (slot_cur->ctrl) { |
616 | if ((slot_cur->ctrl->ctlr_type != 4) && (slot_cur->ctrl->ending_slot_num > first_slot) && (slot_num > slot_cur->ctrl->ending_slot_num)) | 583 | if ((slot_cur->ctrl->ctlr_type != 4) && (slot_cur->ctrl->ending_slot_num > first_slot) && (slot_num > slot_cur->ctrl->ending_slot_num)) |
617 | first_slot = slot_cur->ctrl->ending_slot_num; | 584 | first_slot = slot_cur->ctrl->ending_slot_num; |
@@ -767,7 +734,6 @@ static int __init ebda_rsrc_controller (void) | |||
767 | struct bus_info *bus_info_ptr1, *bus_info_ptr2; | 734 | struct bus_info *bus_info_ptr1, *bus_info_ptr2; |
768 | int rc; | 735 | int rc; |
769 | struct slot *tmp_slot; | 736 | struct slot *tmp_slot; |
770 | struct list_head *list; | ||
771 | 737 | ||
772 | addr = hpc_list_ptr->phys_addr; | 738 | addr = hpc_list_ptr->phys_addr; |
773 | for (ctlr = 0; ctlr < hpc_list_ptr->num_ctlrs; ctlr++) { | 739 | for (ctlr = 0; ctlr < hpc_list_ptr->num_ctlrs; ctlr++) { |
@@ -997,9 +963,7 @@ static int __init ebda_rsrc_controller (void) | |||
997 | 963 | ||
998 | } /* each hpc */ | 964 | } /* each hpc */ |
999 | 965 | ||
1000 | list_for_each (list, &ibmphp_slot_head) { | 966 | list_for_each_entry(tmp_slot, &ibmphp_slot_head, ibm_slot_list) { |
1001 | tmp_slot = list_entry (list, struct slot, ibm_slot_list); | ||
1002 | |||
1003 | snprintf (tmp_slot->hotplug_slot->name, 30, "%s", create_file_name (tmp_slot)); | 967 | snprintf (tmp_slot->hotplug_slot->name, 30, "%s", create_file_name (tmp_slot)); |
1004 | pci_hp_register(tmp_slot->hotplug_slot, | 968 | pci_hp_register(tmp_slot->hotplug_slot, |
1005 | pci_find_bus(0, tmp_slot->bus), tmp_slot->device); | 969 | pci_find_bus(0, tmp_slot->bus), tmp_slot->device); |
@@ -1101,10 +1065,8 @@ u16 ibmphp_get_total_controllers (void) | |||
1101 | struct slot *ibmphp_get_slot_from_physical_num (u8 physical_num) | 1065 | struct slot *ibmphp_get_slot_from_physical_num (u8 physical_num) |
1102 | { | 1066 | { |
1103 | struct slot *slot; | 1067 | struct slot *slot; |
1104 | struct list_head *list; | ||
1105 | 1068 | ||
1106 | list_for_each (list, &ibmphp_slot_head) { | 1069 | list_for_each_entry(slot, &ibmphp_slot_head, ibm_slot_list) { |
1107 | slot = list_entry (list, struct slot, ibm_slot_list); | ||
1108 | if (slot->number == physical_num) | 1070 | if (slot->number == physical_num) |
1109 | return slot; | 1071 | return slot; |
1110 | } | 1072 | } |
@@ -1120,10 +1082,8 @@ struct slot *ibmphp_get_slot_from_physical_num (u8 physical_num) | |||
1120 | struct bus_info *ibmphp_find_same_bus_num (u32 num) | 1082 | struct bus_info *ibmphp_find_same_bus_num (u32 num) |
1121 | { | 1083 | { |
1122 | struct bus_info *ptr; | 1084 | struct bus_info *ptr; |
1123 | struct list_head *ptr1; | ||
1124 | 1085 | ||
1125 | list_for_each (ptr1, &bus_info_head) { | 1086 | list_for_each_entry(ptr, &bus_info_head, bus_info_list) { |
1126 | ptr = list_entry (ptr1, struct bus_info, bus_info_list); | ||
1127 | if (ptr->busno == num) | 1087 | if (ptr->busno == num) |
1128 | return ptr; | 1088 | return ptr; |
1129 | } | 1089 | } |
@@ -1136,10 +1096,8 @@ struct bus_info *ibmphp_find_same_bus_num (u32 num) | |||
1136 | int ibmphp_get_bus_index (u8 num) | 1096 | int ibmphp_get_bus_index (u8 num) |
1137 | { | 1097 | { |
1138 | struct bus_info *ptr; | 1098 | struct bus_info *ptr; |
1139 | struct list_head *ptr1; | ||
1140 | 1099 | ||
1141 | list_for_each (ptr1, &bus_info_head) { | 1100 | list_for_each_entry(ptr, &bus_info_head, bus_info_list) { |
1142 | ptr = list_entry (ptr1, struct bus_info, bus_info_list); | ||
1143 | if (ptr->busno == num) | 1101 | if (ptr->busno == num) |
1144 | return ptr->index; | 1102 | return ptr->index; |
1145 | } | 1103 | } |
@@ -1212,11 +1170,9 @@ static struct pci_driver ibmphp_driver = { | |||
1212 | int ibmphp_register_pci (void) | 1170 | int ibmphp_register_pci (void) |
1213 | { | 1171 | { |
1214 | struct controller *ctrl; | 1172 | struct controller *ctrl; |
1215 | struct list_head *tmp; | ||
1216 | int rc = 0; | 1173 | int rc = 0; |
1217 | 1174 | ||
1218 | list_for_each (tmp, &ebda_hpc_head) { | 1175 | list_for_each_entry(ctrl, &ebda_hpc_head, ebda_hpc_list) { |
1219 | ctrl = list_entry (tmp, struct controller, ebda_hpc_list); | ||
1220 | if (ctrl->ctlr_type == 1) { | 1176 | if (ctrl->ctlr_type == 1) { |
1221 | rc = pci_register_driver(&ibmphp_driver); | 1177 | rc = pci_register_driver(&ibmphp_driver); |
1222 | break; | 1178 | break; |
@@ -1227,12 +1183,10 @@ int ibmphp_register_pci (void) | |||
1227 | static int ibmphp_probe (struct pci_dev * dev, const struct pci_device_id *ids) | 1183 | static int ibmphp_probe (struct pci_dev * dev, const struct pci_device_id *ids) |
1228 | { | 1184 | { |
1229 | struct controller *ctrl; | 1185 | struct controller *ctrl; |
1230 | struct list_head *tmp; | ||
1231 | 1186 | ||
1232 | debug ("inside ibmphp_probe\n"); | 1187 | debug ("inside ibmphp_probe\n"); |
1233 | 1188 | ||
1234 | list_for_each (tmp, &ebda_hpc_head) { | 1189 | list_for_each_entry(ctrl, &ebda_hpc_head, ebda_hpc_list) { |
1235 | ctrl = list_entry (tmp, struct controller, ebda_hpc_list); | ||
1236 | if (ctrl->ctlr_type == 1) { | 1190 | if (ctrl->ctlr_type == 1) { |
1237 | if ((dev->devfn == ctrl->u.pci_ctlr.dev_fun) && (dev->bus->number == ctrl->u.pci_ctlr.bus)) { | 1191 | if ((dev->devfn == ctrl->u.pci_ctlr.dev_fun) && (dev->bus->number == ctrl->u.pci_ctlr.bus)) { |
1238 | ctrl->ctrl_dev = dev; | 1192 | ctrl->ctrl_dev = dev; |
diff --git a/drivers/pci/hotplug/pci_hotplug_core.c b/drivers/pci/hotplug/pci_hotplug_core.c index 5f85b1b120e3..2e6c4474644e 100644 --- a/drivers/pci/hotplug/pci_hotplug_core.c +++ b/drivers/pci/hotplug/pci_hotplug_core.c | |||
@@ -102,13 +102,13 @@ static int get_##name (struct hotplug_slot *slot, type *value) \ | |||
102 | { \ | 102 | { \ |
103 | struct hotplug_slot_ops *ops = slot->ops; \ | 103 | struct hotplug_slot_ops *ops = slot->ops; \ |
104 | int retval = 0; \ | 104 | int retval = 0; \ |
105 | if (try_module_get(ops->owner)) { \ | 105 | if (!try_module_get(ops->owner)) \ |
106 | if (ops->get_##name) \ | 106 | return -ENODEV; \ |
107 | retval = ops->get_##name(slot, value); \ | 107 | if (ops->get_##name) \ |
108 | else \ | 108 | retval = ops->get_##name(slot, value); \ |
109 | *value = slot->info->name; \ | 109 | else \ |
110 | module_put(ops->owner); \ | 110 | *value = slot->info->name; \ |
111 | } \ | 111 | module_put(ops->owner); \ |
112 | return retval; \ | 112 | return retval; \ |
113 | } | 113 | } |
114 | 114 | ||
diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h index 9e6cec67e1cc..c367978bd7fe 100644 --- a/drivers/pci/hotplug/pciehp.h +++ b/drivers/pci/hotplug/pciehp.h | |||
@@ -57,6 +57,19 @@ extern struct workqueue_struct *pciehp_wq; | |||
57 | #define warn(format, arg...) \ | 57 | #define warn(format, arg...) \ |
58 | printk(KERN_WARNING "%s: " format, MY_NAME , ## arg) | 58 | printk(KERN_WARNING "%s: " format, MY_NAME , ## arg) |
59 | 59 | ||
60 | #define ctrl_dbg(ctrl, format, arg...) \ | ||
61 | do { \ | ||
62 | if (pciehp_debug) \ | ||
63 | dev_printk(, &ctrl->pcie->device, \ | ||
64 | format, ## arg); \ | ||
65 | } while (0) | ||
66 | #define ctrl_err(ctrl, format, arg...) \ | ||
67 | dev_err(&ctrl->pcie->device, format, ## arg) | ||
68 | #define ctrl_info(ctrl, format, arg...) \ | ||
69 | dev_info(&ctrl->pcie->device, format, ## arg) | ||
70 | #define ctrl_warn(ctrl, format, arg...) \ | ||
71 | dev_warn(&ctrl->pcie->device, format, ## arg) | ||
72 | |||
60 | #define SLOT_NAME_SIZE 10 | 73 | #define SLOT_NAME_SIZE 10 |
61 | struct slot { | 74 | struct slot { |
62 | u8 bus; | 75 | u8 bus; |
@@ -87,6 +100,7 @@ struct controller { | |||
87 | int num_slots; /* Number of slots on ctlr */ | 100 | int num_slots; /* Number of slots on ctlr */ |
88 | int slot_num_inc; /* 1 or -1 */ | 101 | int slot_num_inc; /* 1 or -1 */ |
89 | struct pci_dev *pci_dev; | 102 | struct pci_dev *pci_dev; |
103 | struct pcie_device *pcie; /* PCI Express port service */ | ||
90 | struct list_head slot_list; | 104 | struct list_head slot_list; |
91 | struct hpc_ops *hpc_ops; | 105 | struct hpc_ops *hpc_ops; |
92 | wait_queue_head_t queue; /* sleep & wake process */ | 106 | wait_queue_head_t queue; /* sleep & wake process */ |
@@ -170,7 +184,7 @@ static inline struct slot *pciehp_find_slot(struct controller *ctrl, u8 device) | |||
170 | return slot; | 184 | return slot; |
171 | } | 185 | } |
172 | 186 | ||
173 | err("%s: slot (device=0x%x) not found\n", __func__, device); | 187 | ctrl_err(ctrl, "%s: slot (device=0x%x) not found\n", __func__, device); |
174 | return NULL; | 188 | return NULL; |
175 | } | 189 | } |
176 | 190 | ||
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c index 4fd5355bc3b5..c748a19db89d 100644 --- a/drivers/pci/hotplug/pciehp_core.c +++ b/drivers/pci/hotplug/pciehp_core.c | |||
@@ -144,9 +144,10 @@ set_lock_exit: | |||
144 | * sysfs interface which allows the user to toggle the Electro Mechanical | 144 | * sysfs interface which allows the user to toggle the Electro Mechanical |
145 | * Interlock. Valid values are either 0 or 1. 0 == unlock, 1 == lock | 145 | * Interlock. Valid values are either 0 or 1. 0 == unlock, 1 == lock |
146 | */ | 146 | */ |
147 | static ssize_t lock_write_file(struct hotplug_slot *slot, const char *buf, | 147 | static ssize_t lock_write_file(struct hotplug_slot *hotplug_slot, |
148 | size_t count) | 148 | const char *buf, size_t count) |
149 | { | 149 | { |
150 | struct slot *slot = hotplug_slot->private; | ||
150 | unsigned long llock; | 151 | unsigned long llock; |
151 | u8 lock; | 152 | u8 lock; |
152 | int retval = 0; | 153 | int retval = 0; |
@@ -157,10 +158,11 @@ static ssize_t lock_write_file(struct hotplug_slot *slot, const char *buf, | |||
157 | switch (lock) { | 158 | switch (lock) { |
158 | case 0: | 159 | case 0: |
159 | case 1: | 160 | case 1: |
160 | retval = set_lock_status(slot, lock); | 161 | retval = set_lock_status(hotplug_slot, lock); |
161 | break; | 162 | break; |
162 | default: | 163 | default: |
163 | err ("%d is an invalid lock value\n", lock); | 164 | ctrl_err(slot->ctrl, "%d is an invalid lock value\n", |
165 | lock); | ||
164 | retval = -EINVAL; | 166 | retval = -EINVAL; |
165 | } | 167 | } |
166 | if (retval) | 168 | if (retval) |
@@ -180,7 +182,10 @@ static struct hotplug_slot_attribute hotplug_slot_attr_lock = { | |||
180 | */ | 182 | */ |
181 | static void release_slot(struct hotplug_slot *hotplug_slot) | 183 | static void release_slot(struct hotplug_slot *hotplug_slot) |
182 | { | 184 | { |
183 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); | 185 | struct slot *slot = hotplug_slot->private; |
186 | |||
187 | ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", | ||
188 | __func__, hotplug_slot->name); | ||
184 | 189 | ||
185 | kfree(hotplug_slot->info); | 190 | kfree(hotplug_slot->info); |
186 | kfree(hotplug_slot); | 191 | kfree(hotplug_slot); |
@@ -215,9 +220,9 @@ static int init_slots(struct controller *ctrl) | |||
215 | get_adapter_status(hotplug_slot, &info->adapter_status); | 220 | get_adapter_status(hotplug_slot, &info->adapter_status); |
216 | slot->hotplug_slot = hotplug_slot; | 221 | slot->hotplug_slot = hotplug_slot; |
217 | 222 | ||
218 | dbg("Registering bus=%x dev=%x hp_slot=%x sun=%x " | 223 | ctrl_dbg(ctrl, "Registering bus=%x dev=%x hp_slot=%x sun=%x " |
219 | "slot_device_offset=%x\n", slot->bus, slot->device, | 224 | "slot_device_offset=%x\n", slot->bus, slot->device, |
220 | slot->hp_slot, slot->number, ctrl->slot_device_offset); | 225 | slot->hp_slot, slot->number, ctrl->slot_device_offset); |
221 | duplicate_name: | 226 | duplicate_name: |
222 | retval = pci_hp_register(hotplug_slot, | 227 | retval = pci_hp_register(hotplug_slot, |
223 | ctrl->pci_dev->subordinate, | 228 | ctrl->pci_dev->subordinate, |
@@ -233,9 +238,11 @@ duplicate_name: | |||
233 | if (len < SLOT_NAME_SIZE) | 238 | if (len < SLOT_NAME_SIZE) |
234 | goto duplicate_name; | 239 | goto duplicate_name; |
235 | else | 240 | else |
236 | err("duplicate slot name overflow\n"); | 241 | ctrl_err(ctrl, "duplicate slot name " |
242 | "overflow\n"); | ||
237 | } | 243 | } |
238 | err("pci_hp_register failed with error %d\n", retval); | 244 | ctrl_err(ctrl, "pci_hp_register failed with error %d\n", |
245 | retval); | ||
239 | goto error_info; | 246 | goto error_info; |
240 | } | 247 | } |
241 | /* create additional sysfs entries */ | 248 | /* create additional sysfs entries */ |
@@ -244,7 +251,8 @@ duplicate_name: | |||
244 | &hotplug_slot_attr_lock.attr); | 251 | &hotplug_slot_attr_lock.attr); |
245 | if (retval) { | 252 | if (retval) { |
246 | pci_hp_deregister(hotplug_slot); | 253 | pci_hp_deregister(hotplug_slot); |
247 | err("cannot create additional sysfs entries\n"); | 254 | ctrl_err(ctrl, "cannot create additional sysfs " |
255 | "entries\n"); | ||
248 | goto error_info; | 256 | goto error_info; |
249 | } | 257 | } |
250 | } | 258 | } |
@@ -278,7 +286,8 @@ static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 status) | |||
278 | { | 286 | { |
279 | struct slot *slot = hotplug_slot->private; | 287 | struct slot *slot = hotplug_slot->private; |
280 | 288 | ||
281 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); | 289 | ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", |
290 | __func__, hotplug_slot->name); | ||
282 | 291 | ||
283 | hotplug_slot->info->attention_status = status; | 292 | hotplug_slot->info->attention_status = status; |
284 | 293 | ||
@@ -293,7 +302,8 @@ static int enable_slot(struct hotplug_slot *hotplug_slot) | |||
293 | { | 302 | { |
294 | struct slot *slot = hotplug_slot->private; | 303 | struct slot *slot = hotplug_slot->private; |
295 | 304 | ||
296 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); | 305 | ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", |
306 | __func__, hotplug_slot->name); | ||
297 | 307 | ||
298 | return pciehp_sysfs_enable_slot(slot); | 308 | return pciehp_sysfs_enable_slot(slot); |
299 | } | 309 | } |
@@ -303,7 +313,8 @@ static int disable_slot(struct hotplug_slot *hotplug_slot) | |||
303 | { | 313 | { |
304 | struct slot *slot = hotplug_slot->private; | 314 | struct slot *slot = hotplug_slot->private; |
305 | 315 | ||
306 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); | 316 | ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", |
317 | __func__, hotplug_slot->name); | ||
307 | 318 | ||
308 | return pciehp_sysfs_disable_slot(slot); | 319 | return pciehp_sysfs_disable_slot(slot); |
309 | } | 320 | } |
@@ -313,7 +324,8 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
313 | struct slot *slot = hotplug_slot->private; | 324 | struct slot *slot = hotplug_slot->private; |
314 | int retval; | 325 | int retval; |
315 | 326 | ||
316 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); | 327 | ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", |
328 | __func__, hotplug_slot->name); | ||
317 | 329 | ||
318 | retval = slot->hpc_ops->get_power_status(slot, value); | 330 | retval = slot->hpc_ops->get_power_status(slot, value); |
319 | if (retval < 0) | 331 | if (retval < 0) |
@@ -327,7 +339,8 @@ static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
327 | struct slot *slot = hotplug_slot->private; | 339 | struct slot *slot = hotplug_slot->private; |
328 | int retval; | 340 | int retval; |
329 | 341 | ||
330 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); | 342 | ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", |
343 | __func__, hotplug_slot->name); | ||
331 | 344 | ||
332 | retval = slot->hpc_ops->get_attention_status(slot, value); | 345 | retval = slot->hpc_ops->get_attention_status(slot, value); |
333 | if (retval < 0) | 346 | if (retval < 0) |
@@ -341,7 +354,8 @@ static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
341 | struct slot *slot = hotplug_slot->private; | 354 | struct slot *slot = hotplug_slot->private; |
342 | int retval; | 355 | int retval; |
343 | 356 | ||
344 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); | 357 | ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", |
358 | __func__, hotplug_slot->name); | ||
345 | 359 | ||
346 | retval = slot->hpc_ops->get_latch_status(slot, value); | 360 | retval = slot->hpc_ops->get_latch_status(slot, value); |
347 | if (retval < 0) | 361 | if (retval < 0) |
@@ -355,7 +369,8 @@ static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
355 | struct slot *slot = hotplug_slot->private; | 369 | struct slot *slot = hotplug_slot->private; |
356 | int retval; | 370 | int retval; |
357 | 371 | ||
358 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); | 372 | ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", |
373 | __func__, hotplug_slot->name); | ||
359 | 374 | ||
360 | retval = slot->hpc_ops->get_adapter_status(slot, value); | 375 | retval = slot->hpc_ops->get_adapter_status(slot, value); |
361 | if (retval < 0) | 376 | if (retval < 0) |
@@ -370,7 +385,8 @@ static int get_max_bus_speed(struct hotplug_slot *hotplug_slot, | |||
370 | struct slot *slot = hotplug_slot->private; | 385 | struct slot *slot = hotplug_slot->private; |
371 | int retval; | 386 | int retval; |
372 | 387 | ||
373 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); | 388 | ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", |
389 | __func__, hotplug_slot->name); | ||
374 | 390 | ||
375 | retval = slot->hpc_ops->get_max_bus_speed(slot, value); | 391 | retval = slot->hpc_ops->get_max_bus_speed(slot, value); |
376 | if (retval < 0) | 392 | if (retval < 0) |
@@ -384,7 +400,8 @@ static int get_cur_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_spe | |||
384 | struct slot *slot = hotplug_slot->private; | 400 | struct slot *slot = hotplug_slot->private; |
385 | int retval; | 401 | int retval; |
386 | 402 | ||
387 | dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); | 403 | ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", |
404 | __func__, hotplug_slot->name); | ||
388 | 405 | ||
389 | retval = slot->hpc_ops->get_cur_bus_speed(slot, value); | 406 | retval = slot->hpc_ops->get_cur_bus_speed(slot, value); |
390 | if (retval < 0) | 407 | if (retval < 0) |
@@ -402,14 +419,15 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_ | |||
402 | struct pci_dev *pdev = dev->port; | 419 | struct pci_dev *pdev = dev->port; |
403 | 420 | ||
404 | if (pciehp_force) | 421 | if (pciehp_force) |
405 | dbg("Bypassing BIOS check for pciehp use on %s\n", | 422 | dev_info(&dev->device, |
406 | pci_name(pdev)); | 423 | "Bypassing BIOS check for pciehp use on %s\n", |
424 | pci_name(pdev)); | ||
407 | else if (pciehp_get_hp_hw_control_from_firmware(pdev)) | 425 | else if (pciehp_get_hp_hw_control_from_firmware(pdev)) |
408 | goto err_out_none; | 426 | goto err_out_none; |
409 | 427 | ||
410 | ctrl = pcie_init(dev); | 428 | ctrl = pcie_init(dev); |
411 | if (!ctrl) { | 429 | if (!ctrl) { |
412 | dbg("%s: controller initialization failed\n", PCIE_MODULE_NAME); | 430 | dev_err(&dev->device, "controller initialization failed\n"); |
413 | goto err_out_none; | 431 | goto err_out_none; |
414 | } | 432 | } |
415 | set_service_data(dev, ctrl); | 433 | set_service_data(dev, ctrl); |
@@ -418,11 +436,10 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_ | |||
418 | rc = init_slots(ctrl); | 436 | rc = init_slots(ctrl); |
419 | if (rc) { | 437 | if (rc) { |
420 | if (rc == -EBUSY) | 438 | if (rc == -EBUSY) |
421 | warn("%s: slot already registered by another " | 439 | ctrl_warn(ctrl, "slot already registered by another " |
422 | "hotplug driver\n", PCIE_MODULE_NAME); | 440 | "hotplug driver\n"); |
423 | else | 441 | else |
424 | err("%s: slot initialization failed\n", | 442 | ctrl_err(ctrl, "slot initialization failed\n"); |
425 | PCIE_MODULE_NAME); | ||
426 | goto err_out_release_ctlr; | 443 | goto err_out_release_ctlr; |
427 | } | 444 | } |
428 | 445 | ||
@@ -461,13 +478,13 @@ static void pciehp_remove (struct pcie_device *dev) | |||
461 | #ifdef CONFIG_PM | 478 | #ifdef CONFIG_PM |
462 | static int pciehp_suspend (struct pcie_device *dev, pm_message_t state) | 479 | static int pciehp_suspend (struct pcie_device *dev, pm_message_t state) |
463 | { | 480 | { |
464 | printk("%s ENTRY\n", __func__); | 481 | dev_info(&dev->device, "%s ENTRY\n", __func__); |
465 | return 0; | 482 | return 0; |
466 | } | 483 | } |
467 | 484 | ||
468 | static int pciehp_resume (struct pcie_device *dev) | 485 | static int pciehp_resume (struct pcie_device *dev) |
469 | { | 486 | { |
470 | printk("%s ENTRY\n", __func__); | 487 | dev_info(&dev->device, "%s ENTRY\n", __func__); |
471 | if (pciehp_force) { | 488 | if (pciehp_force) { |
472 | struct controller *ctrl = get_service_data(dev); | 489 | struct controller *ctrl = get_service_data(dev); |
473 | struct slot *t_slot; | 490 | struct slot *t_slot; |
@@ -497,10 +514,9 @@ static struct pcie_port_service_id port_pci_ids[] = { { | |||
497 | .driver_data = 0, | 514 | .driver_data = 0, |
498 | }, { /* end: all zeroes */ } | 515 | }, { /* end: all zeroes */ } |
499 | }; | 516 | }; |
500 | static const char device_name[] = "hpdriver"; | ||
501 | 517 | ||
502 | static struct pcie_port_service_driver hpdriver_portdrv = { | 518 | static struct pcie_port_service_driver hpdriver_portdrv = { |
503 | .name = (char *)device_name, | 519 | .name = PCIE_MODULE_NAME, |
504 | .id_table = &port_pci_ids[0], | 520 | .id_table = &port_pci_ids[0], |
505 | 521 | ||
506 | .probe = pciehp_probe, | 522 | .probe = pciehp_probe, |
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c index 96a5d55a4983..acb7f9efd182 100644 --- a/drivers/pci/hotplug/pciehp_ctrl.c +++ b/drivers/pci/hotplug/pciehp_ctrl.c | |||
@@ -58,14 +58,15 @@ static int queue_interrupt_event(struct slot *p_slot, u32 event_type) | |||
58 | u8 pciehp_handle_attention_button(struct slot *p_slot) | 58 | u8 pciehp_handle_attention_button(struct slot *p_slot) |
59 | { | 59 | { |
60 | u32 event_type; | 60 | u32 event_type; |
61 | struct controller *ctrl = p_slot->ctrl; | ||
61 | 62 | ||
62 | /* Attention Button Change */ | 63 | /* Attention Button Change */ |
63 | dbg("pciehp: Attention button interrupt received.\n"); | 64 | ctrl_dbg(ctrl, "Attention button interrupt received.\n"); |
64 | 65 | ||
65 | /* | 66 | /* |
66 | * Button pressed - See if need to TAKE ACTION!!! | 67 | * Button pressed - See if need to TAKE ACTION!!! |
67 | */ | 68 | */ |
68 | info("Button pressed on Slot(%s)\n", p_slot->name); | 69 | ctrl_info(ctrl, "Button pressed on Slot(%s)\n", p_slot->name); |
69 | event_type = INT_BUTTON_PRESS; | 70 | event_type = INT_BUTTON_PRESS; |
70 | 71 | ||
71 | queue_interrupt_event(p_slot, event_type); | 72 | queue_interrupt_event(p_slot, event_type); |
@@ -77,22 +78,23 @@ u8 pciehp_handle_switch_change(struct slot *p_slot) | |||
77 | { | 78 | { |
78 | u8 getstatus; | 79 | u8 getstatus; |
79 | u32 event_type; | 80 | u32 event_type; |
81 | struct controller *ctrl = p_slot->ctrl; | ||
80 | 82 | ||
81 | /* Switch Change */ | 83 | /* Switch Change */ |
82 | dbg("pciehp: Switch interrupt received.\n"); | 84 | ctrl_dbg(ctrl, "Switch interrupt received.\n"); |
83 | 85 | ||
84 | p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); | 86 | p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); |
85 | if (getstatus) { | 87 | if (getstatus) { |
86 | /* | 88 | /* |
87 | * Switch opened | 89 | * Switch opened |
88 | */ | 90 | */ |
89 | info("Latch open on Slot(%s)\n", p_slot->name); | 91 | ctrl_info(ctrl, "Latch open on Slot(%s)\n", p_slot->name); |
90 | event_type = INT_SWITCH_OPEN; | 92 | event_type = INT_SWITCH_OPEN; |
91 | } else { | 93 | } else { |
92 | /* | 94 | /* |
93 | * Switch closed | 95 | * Switch closed |
94 | */ | 96 | */ |
95 | info("Latch close on Slot(%s)\n", p_slot->name); | 97 | ctrl_info(ctrl, "Latch close on Slot(%s)\n", p_slot->name); |
96 | event_type = INT_SWITCH_CLOSE; | 98 | event_type = INT_SWITCH_CLOSE; |
97 | } | 99 | } |
98 | 100 | ||
@@ -105,9 +107,10 @@ u8 pciehp_handle_presence_change(struct slot *p_slot) | |||
105 | { | 107 | { |
106 | u32 event_type; | 108 | u32 event_type; |
107 | u8 presence_save; | 109 | u8 presence_save; |
110 | struct controller *ctrl = p_slot->ctrl; | ||
108 | 111 | ||
109 | /* Presence Change */ | 112 | /* Presence Change */ |
110 | dbg("pciehp: Presence/Notify input change.\n"); | 113 | ctrl_dbg(ctrl, "Presence/Notify input change.\n"); |
111 | 114 | ||
112 | /* Switch is open, assume a presence change | 115 | /* Switch is open, assume a presence change |
113 | * Save the presence state | 116 | * Save the presence state |
@@ -117,13 +120,13 @@ u8 pciehp_handle_presence_change(struct slot *p_slot) | |||
117 | /* | 120 | /* |
118 | * Card Present | 121 | * Card Present |
119 | */ | 122 | */ |
120 | info("Card present on Slot(%s)\n", p_slot->name); | 123 | ctrl_info(ctrl, "Card present on Slot(%s)\n", p_slot->name); |
121 | event_type = INT_PRESENCE_ON; | 124 | event_type = INT_PRESENCE_ON; |
122 | } else { | 125 | } else { |
123 | /* | 126 | /* |
124 | * Not Present | 127 | * Not Present |
125 | */ | 128 | */ |
126 | info("Card not present on Slot(%s)\n", p_slot->name); | 129 | ctrl_info(ctrl, "Card not present on Slot(%s)\n", p_slot->name); |
127 | event_type = INT_PRESENCE_OFF; | 130 | event_type = INT_PRESENCE_OFF; |
128 | } | 131 | } |
129 | 132 | ||
@@ -135,23 +138,25 @@ u8 pciehp_handle_presence_change(struct slot *p_slot) | |||
135 | u8 pciehp_handle_power_fault(struct slot *p_slot) | 138 | u8 pciehp_handle_power_fault(struct slot *p_slot) |
136 | { | 139 | { |
137 | u32 event_type; | 140 | u32 event_type; |
141 | struct controller *ctrl = p_slot->ctrl; | ||
138 | 142 | ||
139 | /* power fault */ | 143 | /* power fault */ |
140 | dbg("pciehp: Power fault interrupt received.\n"); | 144 | ctrl_dbg(ctrl, "Power fault interrupt received.\n"); |
141 | 145 | ||
142 | if ( !(p_slot->hpc_ops->query_power_fault(p_slot))) { | 146 | if ( !(p_slot->hpc_ops->query_power_fault(p_slot))) { |
143 | /* | 147 | /* |
144 | * power fault Cleared | 148 | * power fault Cleared |
145 | */ | 149 | */ |
146 | info("Power fault cleared on Slot(%s)\n", p_slot->name); | 150 | ctrl_info(ctrl, "Power fault cleared on Slot(%s)\n", |
151 | p_slot->name); | ||
147 | event_type = INT_POWER_FAULT_CLEAR; | 152 | event_type = INT_POWER_FAULT_CLEAR; |
148 | } else { | 153 | } else { |
149 | /* | 154 | /* |
150 | * power fault | 155 | * power fault |
151 | */ | 156 | */ |
152 | info("Power fault on Slot(%s)\n", p_slot->name); | 157 | ctrl_info(ctrl, "Power fault on Slot(%s)\n", p_slot->name); |
153 | event_type = INT_POWER_FAULT; | 158 | event_type = INT_POWER_FAULT; |
154 | info("power fault bit %x set\n", 0); | 159 | ctrl_info(ctrl, "power fault bit %x set\n", 0); |
155 | } | 160 | } |
156 | 161 | ||
157 | queue_interrupt_event(p_slot, event_type); | 162 | queue_interrupt_event(p_slot, event_type); |
@@ -168,8 +173,9 @@ static void set_slot_off(struct controller *ctrl, struct slot * pslot) | |||
168 | /* turn off slot, turn on Amber LED, turn off Green LED if supported*/ | 173 | /* turn off slot, turn on Amber LED, turn off Green LED if supported*/ |
169 | if (POWER_CTRL(ctrl)) { | 174 | if (POWER_CTRL(ctrl)) { |
170 | if (pslot->hpc_ops->power_off_slot(pslot)) { | 175 | if (pslot->hpc_ops->power_off_slot(pslot)) { |
171 | err("%s: Issue of Slot Power Off command failed\n", | 176 | ctrl_err(ctrl, |
172 | __func__); | 177 | "%s: Issue of Slot Power Off command failed\n", |
178 | __func__); | ||
173 | return; | 179 | return; |
174 | } | 180 | } |
175 | } | 181 | } |
@@ -186,8 +192,8 @@ static void set_slot_off(struct controller *ctrl, struct slot * pslot) | |||
186 | 192 | ||
187 | if (ATTN_LED(ctrl)) { | 193 | if (ATTN_LED(ctrl)) { |
188 | if (pslot->hpc_ops->set_attention_status(pslot, 1)) { | 194 | if (pslot->hpc_ops->set_attention_status(pslot, 1)) { |
189 | err("%s: Issue of Set Attention Led command failed\n", | 195 | ctrl_err(ctrl, "%s: Issue of Set Attention " |
190 | __func__); | 196 | "Led command failed\n", __func__); |
191 | return; | 197 | return; |
192 | } | 198 | } |
193 | } | 199 | } |
@@ -205,9 +211,9 @@ static int board_added(struct slot *p_slot) | |||
205 | int retval = 0; | 211 | int retval = 0; |
206 | struct controller *ctrl = p_slot->ctrl; | 212 | struct controller *ctrl = p_slot->ctrl; |
207 | 213 | ||
208 | dbg("%s: slot device, slot offset, hp slot = %d, %d ,%d\n", | 214 | ctrl_dbg(ctrl, "%s: slot device, slot offset, hp slot = %d, %d ,%d\n", |
209 | __func__, p_slot->device, | 215 | __func__, p_slot->device, ctrl->slot_device_offset, |
210 | ctrl->slot_device_offset, p_slot->hp_slot); | 216 | p_slot->hp_slot); |
211 | 217 | ||
212 | if (POWER_CTRL(ctrl)) { | 218 | if (POWER_CTRL(ctrl)) { |
213 | /* Power on slot */ | 219 | /* Power on slot */ |
@@ -225,22 +231,22 @@ static int board_added(struct slot *p_slot) | |||
225 | /* Check link training status */ | 231 | /* Check link training status */ |
226 | retval = p_slot->hpc_ops->check_lnk_status(ctrl); | 232 | retval = p_slot->hpc_ops->check_lnk_status(ctrl); |
227 | if (retval) { | 233 | if (retval) { |
228 | err("%s: Failed to check link status\n", __func__); | 234 | ctrl_err(ctrl, "%s: Failed to check link status\n", __func__); |
229 | set_slot_off(ctrl, p_slot); | 235 | set_slot_off(ctrl, p_slot); |
230 | return retval; | 236 | return retval; |
231 | } | 237 | } |
232 | 238 | ||
233 | /* Check for a power fault */ | 239 | /* Check for a power fault */ |
234 | if (p_slot->hpc_ops->query_power_fault(p_slot)) { | 240 | if (p_slot->hpc_ops->query_power_fault(p_slot)) { |
235 | dbg("%s: power fault detected\n", __func__); | 241 | ctrl_dbg(ctrl, "%s: power fault detected\n", __func__); |
236 | retval = POWER_FAILURE; | 242 | retval = POWER_FAILURE; |
237 | goto err_exit; | 243 | goto err_exit; |
238 | } | 244 | } |
239 | 245 | ||
240 | retval = pciehp_configure_device(p_slot); | 246 | retval = pciehp_configure_device(p_slot); |
241 | if (retval) { | 247 | if (retval) { |
242 | err("Cannot add device 0x%x:%x\n", p_slot->bus, | 248 | ctrl_err(ctrl, "Cannot add device 0x%x:%x\n", |
243 | p_slot->device); | 249 | p_slot->bus, p_slot->device); |
244 | goto err_exit; | 250 | goto err_exit; |
245 | } | 251 | } |
246 | 252 | ||
@@ -272,14 +278,14 @@ static int remove_board(struct slot *p_slot) | |||
272 | if (retval) | 278 | if (retval) |
273 | return retval; | 279 | return retval; |
274 | 280 | ||
275 | dbg("In %s, hp_slot = %d\n", __func__, p_slot->hp_slot); | 281 | ctrl_dbg(ctrl, "In %s, hp_slot = %d\n", __func__, p_slot->hp_slot); |
276 | 282 | ||
277 | if (POWER_CTRL(ctrl)) { | 283 | if (POWER_CTRL(ctrl)) { |
278 | /* power off slot */ | 284 | /* power off slot */ |
279 | retval = p_slot->hpc_ops->power_off_slot(p_slot); | 285 | retval = p_slot->hpc_ops->power_off_slot(p_slot); |
280 | if (retval) { | 286 | if (retval) { |
281 | err("%s: Issue of Slot Disable command failed\n", | 287 | ctrl_err(ctrl, "%s: Issue of Slot Disable command " |
282 | __func__); | 288 | "failed\n", __func__); |
283 | return retval; | 289 | return retval; |
284 | } | 290 | } |
285 | } | 291 | } |
@@ -320,8 +326,8 @@ static void pciehp_power_thread(struct work_struct *work) | |||
320 | switch (p_slot->state) { | 326 | switch (p_slot->state) { |
321 | case POWEROFF_STATE: | 327 | case POWEROFF_STATE: |
322 | mutex_unlock(&p_slot->lock); | 328 | mutex_unlock(&p_slot->lock); |
323 | dbg("%s: disabling bus:device(%x:%x)\n", | 329 | ctrl_dbg(p_slot->ctrl, "%s: disabling bus:device(%x:%x)\n", |
324 | __func__, p_slot->bus, p_slot->device); | 330 | __func__, p_slot->bus, p_slot->device); |
325 | pciehp_disable_slot(p_slot); | 331 | pciehp_disable_slot(p_slot); |
326 | mutex_lock(&p_slot->lock); | 332 | mutex_lock(&p_slot->lock); |
327 | p_slot->state = STATIC_STATE; | 333 | p_slot->state = STATIC_STATE; |
@@ -349,7 +355,8 @@ void pciehp_queue_pushbutton_work(struct work_struct *work) | |||
349 | 355 | ||
350 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 356 | info = kmalloc(sizeof(*info), GFP_KERNEL); |
351 | if (!info) { | 357 | if (!info) { |
352 | err("%s: Cannot allocate memory\n", __func__); | 358 | ctrl_err(p_slot->ctrl, "%s: Cannot allocate memory\n", |
359 | __func__); | ||
353 | return; | 360 | return; |
354 | } | 361 | } |
355 | info->p_slot = p_slot; | 362 | info->p_slot = p_slot; |
@@ -403,12 +410,14 @@ static void handle_button_press_event(struct slot *p_slot) | |||
403 | p_slot->hpc_ops->get_power_status(p_slot, &getstatus); | 410 | p_slot->hpc_ops->get_power_status(p_slot, &getstatus); |
404 | if (getstatus) { | 411 | if (getstatus) { |
405 | p_slot->state = BLINKINGOFF_STATE; | 412 | p_slot->state = BLINKINGOFF_STATE; |
406 | info("PCI slot #%s - powering off due to button " | 413 | ctrl_info(ctrl, |
407 | "press.\n", p_slot->name); | 414 | "PCI slot #%s - powering off due to button " |
415 | "press.\n", p_slot->name); | ||
408 | } else { | 416 | } else { |
409 | p_slot->state = BLINKINGON_STATE; | 417 | p_slot->state = BLINKINGON_STATE; |
410 | info("PCI slot #%s - powering on due to button " | 418 | ctrl_info(ctrl, |
411 | "press.\n", p_slot->name); | 419 | "PCI slot #%s - powering on due to button " |
420 | "press.\n", p_slot->name); | ||
412 | } | 421 | } |
413 | /* blink green LED and turn off amber */ | 422 | /* blink green LED and turn off amber */ |
414 | if (PWR_LED(ctrl)) | 423 | if (PWR_LED(ctrl)) |
@@ -425,8 +434,8 @@ static void handle_button_press_event(struct slot *p_slot) | |||
425 | * press the attention again before the 5 sec. limit | 434 | * press the attention again before the 5 sec. limit |
426 | * expires to cancel hot-add or hot-remove | 435 | * expires to cancel hot-add or hot-remove |
427 | */ | 436 | */ |
428 | info("Button cancel on Slot(%s)\n", p_slot->name); | 437 | ctrl_info(ctrl, "Button cancel on Slot(%s)\n", p_slot->name); |
429 | dbg("%s: button cancel\n", __func__); | 438 | ctrl_dbg(ctrl, "%s: button cancel\n", __func__); |
430 | cancel_delayed_work(&p_slot->work); | 439 | cancel_delayed_work(&p_slot->work); |
431 | if (p_slot->state == BLINKINGOFF_STATE) { | 440 | if (p_slot->state == BLINKINGOFF_STATE) { |
432 | if (PWR_LED(ctrl)) | 441 | if (PWR_LED(ctrl)) |
@@ -437,8 +446,8 @@ static void handle_button_press_event(struct slot *p_slot) | |||
437 | } | 446 | } |
438 | if (ATTN_LED(ctrl)) | 447 | if (ATTN_LED(ctrl)) |
439 | p_slot->hpc_ops->set_attention_status(p_slot, 0); | 448 | p_slot->hpc_ops->set_attention_status(p_slot, 0); |
440 | info("PCI slot #%s - action canceled due to button press\n", | 449 | ctrl_info(ctrl, "PCI slot #%s - action canceled " |
441 | p_slot->name); | 450 | "due to button press\n", p_slot->name); |
442 | p_slot->state = STATIC_STATE; | 451 | p_slot->state = STATIC_STATE; |
443 | break; | 452 | break; |
444 | case POWEROFF_STATE: | 453 | case POWEROFF_STATE: |
@@ -448,11 +457,11 @@ static void handle_button_press_event(struct slot *p_slot) | |||
448 | * this means that the previous attention button action | 457 | * this means that the previous attention button action |
449 | * to hot-add or hot-remove is undergoing | 458 | * to hot-add or hot-remove is undergoing |
450 | */ | 459 | */ |
451 | info("Button ignore on Slot(%s)\n", p_slot->name); | 460 | ctrl_info(ctrl, "Button ignore on Slot(%s)\n", p_slot->name); |
452 | update_slot_info(p_slot); | 461 | update_slot_info(p_slot); |
453 | break; | 462 | break; |
454 | default: | 463 | default: |
455 | warn("Not a valid state\n"); | 464 | ctrl_warn(ctrl, "Not a valid state\n"); |
456 | break; | 465 | break; |
457 | } | 466 | } |
458 | } | 467 | } |
@@ -467,7 +476,8 @@ static void handle_surprise_event(struct slot *p_slot) | |||
467 | 476 | ||
468 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 477 | info = kmalloc(sizeof(*info), GFP_KERNEL); |
469 | if (!info) { | 478 | if (!info) { |
470 | err("%s: Cannot allocate memory\n", __func__); | 479 | ctrl_err(p_slot->ctrl, "%s: Cannot allocate memory\n", |
480 | __func__); | ||
471 | return; | 481 | return; |
472 | } | 482 | } |
473 | info->p_slot = p_slot; | 483 | info->p_slot = p_slot; |
@@ -505,7 +515,7 @@ static void interrupt_event_handler(struct work_struct *work) | |||
505 | case INT_PRESENCE_OFF: | 515 | case INT_PRESENCE_OFF: |
506 | if (!HP_SUPR_RM(ctrl)) | 516 | if (!HP_SUPR_RM(ctrl)) |
507 | break; | 517 | break; |
508 | dbg("Surprise Removal\n"); | 518 | ctrl_dbg(ctrl, "Surprise Removal\n"); |
509 | update_slot_info(p_slot); | 519 | update_slot_info(p_slot); |
510 | handle_surprise_event(p_slot); | 520 | handle_surprise_event(p_slot); |
511 | break; | 521 | break; |
@@ -522,22 +532,23 @@ int pciehp_enable_slot(struct slot *p_slot) | |||
522 | { | 532 | { |
523 | u8 getstatus = 0; | 533 | u8 getstatus = 0; |
524 | int rc; | 534 | int rc; |
535 | struct controller *ctrl = p_slot->ctrl; | ||
525 | 536 | ||
526 | /* Check to see if (latch closed, card present, power off) */ | 537 | /* Check to see if (latch closed, card present, power off) */ |
527 | mutex_lock(&p_slot->ctrl->crit_sect); | 538 | mutex_lock(&p_slot->ctrl->crit_sect); |
528 | 539 | ||
529 | rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); | 540 | rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); |
530 | if (rc || !getstatus) { | 541 | if (rc || !getstatus) { |
531 | info("%s: no adapter on slot(%s)\n", __func__, | 542 | ctrl_info(ctrl, "%s: no adapter on slot(%s)\n", |
532 | p_slot->name); | 543 | __func__, p_slot->name); |
533 | mutex_unlock(&p_slot->ctrl->crit_sect); | 544 | mutex_unlock(&p_slot->ctrl->crit_sect); |
534 | return -ENODEV; | 545 | return -ENODEV; |
535 | } | 546 | } |
536 | if (MRL_SENS(p_slot->ctrl)) { | 547 | if (MRL_SENS(p_slot->ctrl)) { |
537 | rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); | 548 | rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); |
538 | if (rc || getstatus) { | 549 | if (rc || getstatus) { |
539 | info("%s: latch open on slot(%s)\n", __func__, | 550 | ctrl_info(ctrl, "%s: latch open on slot(%s)\n", |
540 | p_slot->name); | 551 | __func__, p_slot->name); |
541 | mutex_unlock(&p_slot->ctrl->crit_sect); | 552 | mutex_unlock(&p_slot->ctrl->crit_sect); |
542 | return -ENODEV; | 553 | return -ENODEV; |
543 | } | 554 | } |
@@ -546,8 +557,8 @@ int pciehp_enable_slot(struct slot *p_slot) | |||
546 | if (POWER_CTRL(p_slot->ctrl)) { | 557 | if (POWER_CTRL(p_slot->ctrl)) { |
547 | rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); | 558 | rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); |
548 | if (rc || getstatus) { | 559 | if (rc || getstatus) { |
549 | info("%s: already enabled on slot(%s)\n", __func__, | 560 | ctrl_info(ctrl, "%s: already enabled on slot(%s)\n", |
550 | p_slot->name); | 561 | __func__, p_slot->name); |
551 | mutex_unlock(&p_slot->ctrl->crit_sect); | 562 | mutex_unlock(&p_slot->ctrl->crit_sect); |
552 | return -EINVAL; | 563 | return -EINVAL; |
553 | } | 564 | } |
@@ -571,6 +582,7 @@ int pciehp_disable_slot(struct slot *p_slot) | |||
571 | { | 582 | { |
572 | u8 getstatus = 0; | 583 | u8 getstatus = 0; |
573 | int ret = 0; | 584 | int ret = 0; |
585 | struct controller *ctrl = p_slot->ctrl; | ||
574 | 586 | ||
575 | if (!p_slot->ctrl) | 587 | if (!p_slot->ctrl) |
576 | return 1; | 588 | return 1; |
@@ -581,8 +593,8 @@ int pciehp_disable_slot(struct slot *p_slot) | |||
581 | if (!HP_SUPR_RM(p_slot->ctrl)) { | 593 | if (!HP_SUPR_RM(p_slot->ctrl)) { |
582 | ret = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); | 594 | ret = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); |
583 | if (ret || !getstatus) { | 595 | if (ret || !getstatus) { |
584 | info("%s: no adapter on slot(%s)\n", __func__, | 596 | ctrl_info(ctrl, "%s: no adapter on slot(%s)\n", |
585 | p_slot->name); | 597 | __func__, p_slot->name); |
586 | mutex_unlock(&p_slot->ctrl->crit_sect); | 598 | mutex_unlock(&p_slot->ctrl->crit_sect); |
587 | return -ENODEV; | 599 | return -ENODEV; |
588 | } | 600 | } |
@@ -591,8 +603,8 @@ int pciehp_disable_slot(struct slot *p_slot) | |||
591 | if (MRL_SENS(p_slot->ctrl)) { | 603 | if (MRL_SENS(p_slot->ctrl)) { |
592 | ret = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); | 604 | ret = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); |
593 | if (ret || getstatus) { | 605 | if (ret || getstatus) { |
594 | info("%s: latch open on slot(%s)\n", __func__, | 606 | ctrl_info(ctrl, "%s: latch open on slot(%s)\n", |
595 | p_slot->name); | 607 | __func__, p_slot->name); |
596 | mutex_unlock(&p_slot->ctrl->crit_sect); | 608 | mutex_unlock(&p_slot->ctrl->crit_sect); |
597 | return -ENODEV; | 609 | return -ENODEV; |
598 | } | 610 | } |
@@ -601,8 +613,8 @@ int pciehp_disable_slot(struct slot *p_slot) | |||
601 | if (POWER_CTRL(p_slot->ctrl)) { | 613 | if (POWER_CTRL(p_slot->ctrl)) { |
602 | ret = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); | 614 | ret = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); |
603 | if (ret || !getstatus) { | 615 | if (ret || !getstatus) { |
604 | info("%s: already disabled slot(%s)\n", __func__, | 616 | ctrl_info(ctrl, "%s: already disabled slot(%s)\n", |
605 | p_slot->name); | 617 | __func__, p_slot->name); |
606 | mutex_unlock(&p_slot->ctrl->crit_sect); | 618 | mutex_unlock(&p_slot->ctrl->crit_sect); |
607 | return -EINVAL; | 619 | return -EINVAL; |
608 | } | 620 | } |
@@ -618,6 +630,7 @@ int pciehp_disable_slot(struct slot *p_slot) | |||
618 | int pciehp_sysfs_enable_slot(struct slot *p_slot) | 630 | int pciehp_sysfs_enable_slot(struct slot *p_slot) |
619 | { | 631 | { |
620 | int retval = -ENODEV; | 632 | int retval = -ENODEV; |
633 | struct controller *ctrl = p_slot->ctrl; | ||
621 | 634 | ||
622 | mutex_lock(&p_slot->lock); | 635 | mutex_lock(&p_slot->lock); |
623 | switch (p_slot->state) { | 636 | switch (p_slot->state) { |
@@ -631,15 +644,15 @@ int pciehp_sysfs_enable_slot(struct slot *p_slot) | |||
631 | p_slot->state = STATIC_STATE; | 644 | p_slot->state = STATIC_STATE; |
632 | break; | 645 | break; |
633 | case POWERON_STATE: | 646 | case POWERON_STATE: |
634 | info("Slot %s is already in powering on state\n", | 647 | ctrl_info(ctrl, "Slot %s is already in powering on state\n", |
635 | p_slot->name); | 648 | p_slot->name); |
636 | break; | 649 | break; |
637 | case BLINKINGOFF_STATE: | 650 | case BLINKINGOFF_STATE: |
638 | case POWEROFF_STATE: | 651 | case POWEROFF_STATE: |
639 | info("Already enabled on slot %s\n", p_slot->name); | 652 | ctrl_info(ctrl, "Already enabled on slot %s\n", p_slot->name); |
640 | break; | 653 | break; |
641 | default: | 654 | default: |
642 | err("Not a valid state on slot %s\n", p_slot->name); | 655 | ctrl_err(ctrl, "Not a valid state on slot %s\n", p_slot->name); |
643 | break; | 656 | break; |
644 | } | 657 | } |
645 | mutex_unlock(&p_slot->lock); | 658 | mutex_unlock(&p_slot->lock); |
@@ -650,6 +663,7 @@ int pciehp_sysfs_enable_slot(struct slot *p_slot) | |||
650 | int pciehp_sysfs_disable_slot(struct slot *p_slot) | 663 | int pciehp_sysfs_disable_slot(struct slot *p_slot) |
651 | { | 664 | { |
652 | int retval = -ENODEV; | 665 | int retval = -ENODEV; |
666 | struct controller *ctrl = p_slot->ctrl; | ||
653 | 667 | ||
654 | mutex_lock(&p_slot->lock); | 668 | mutex_lock(&p_slot->lock); |
655 | switch (p_slot->state) { | 669 | switch (p_slot->state) { |
@@ -663,15 +677,15 @@ int pciehp_sysfs_disable_slot(struct slot *p_slot) | |||
663 | p_slot->state = STATIC_STATE; | 677 | p_slot->state = STATIC_STATE; |
664 | break; | 678 | break; |
665 | case POWEROFF_STATE: | 679 | case POWEROFF_STATE: |
666 | info("Slot %s is already in powering off state\n", | 680 | ctrl_info(ctrl, "Slot %s is already in powering off state\n", |
667 | p_slot->name); | 681 | p_slot->name); |
668 | break; | 682 | break; |
669 | case BLINKINGON_STATE: | 683 | case BLINKINGON_STATE: |
670 | case POWERON_STATE: | 684 | case POWERON_STATE: |
671 | info("Already disabled on slot %s\n", p_slot->name); | 685 | ctrl_info(ctrl, "Already disabled on slot %s\n", p_slot->name); |
672 | break; | 686 | break; |
673 | default: | 687 | default: |
674 | err("Not a valid state on slot %s\n", p_slot->name); | 688 | ctrl_err(ctrl, "Not a valid state on slot %s\n", p_slot->name); |
675 | break; | 689 | break; |
676 | } | 690 | } |
677 | mutex_unlock(&p_slot->lock); | 691 | mutex_unlock(&p_slot->lock); |
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index 9d934ddee956..8e9530c4c36d 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c | |||
@@ -223,7 +223,7 @@ static void start_int_poll_timer(struct controller *ctrl, int sec) | |||
223 | 223 | ||
224 | static inline int pciehp_request_irq(struct controller *ctrl) | 224 | static inline int pciehp_request_irq(struct controller *ctrl) |
225 | { | 225 | { |
226 | int retval, irq = ctrl->pci_dev->irq; | 226 | int retval, irq = ctrl->pcie->irq; |
227 | 227 | ||
228 | /* Install interrupt polling timer. Start with 10 sec delay */ | 228 | /* Install interrupt polling timer. Start with 10 sec delay */ |
229 | if (pciehp_poll_mode) { | 229 | if (pciehp_poll_mode) { |
@@ -235,7 +235,8 @@ static inline int pciehp_request_irq(struct controller *ctrl) | |||
235 | /* Installs the interrupt handler */ | 235 | /* Installs the interrupt handler */ |
236 | retval = request_irq(irq, pcie_isr, IRQF_SHARED, MY_NAME, ctrl); | 236 | retval = request_irq(irq, pcie_isr, IRQF_SHARED, MY_NAME, ctrl); |
237 | if (retval) | 237 | if (retval) |
238 | err("Cannot get irq %d for the hotplug controller\n", irq); | 238 | ctrl_err(ctrl, "Cannot get irq %d for the hotplug controller\n", |
239 | irq); | ||
239 | return retval; | 240 | return retval; |
240 | } | 241 | } |
241 | 242 | ||
@@ -244,7 +245,7 @@ static inline void pciehp_free_irq(struct controller *ctrl) | |||
244 | if (pciehp_poll_mode) | 245 | if (pciehp_poll_mode) |
245 | del_timer_sync(&ctrl->poll_timer); | 246 | del_timer_sync(&ctrl->poll_timer); |
246 | else | 247 | else |
247 | free_irq(ctrl->pci_dev->irq, ctrl); | 248 | free_irq(ctrl->pcie->irq, ctrl); |
248 | } | 249 | } |
249 | 250 | ||
250 | static int pcie_poll_cmd(struct controller *ctrl) | 251 | static int pcie_poll_cmd(struct controller *ctrl) |
@@ -282,7 +283,7 @@ static void pcie_wait_cmd(struct controller *ctrl, int poll) | |||
282 | else | 283 | else |
283 | rc = wait_event_timeout(ctrl->queue, !ctrl->cmd_busy, timeout); | 284 | rc = wait_event_timeout(ctrl->queue, !ctrl->cmd_busy, timeout); |
284 | if (!rc) | 285 | if (!rc) |
285 | dbg("Command not completed in 1000 msec\n"); | 286 | ctrl_dbg(ctrl, "Command not completed in 1000 msec\n"); |
286 | } | 287 | } |
287 | 288 | ||
288 | /** | 289 | /** |
@@ -301,7 +302,8 @@ static int pcie_write_cmd(struct controller *ctrl, u16 cmd, u16 mask) | |||
301 | 302 | ||
302 | retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); | 303 | retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); |
303 | if (retval) { | 304 | if (retval) { |
304 | err("%s: Cannot read SLOTSTATUS register\n", __func__); | 305 | ctrl_err(ctrl, "%s: Cannot read SLOTSTATUS register\n", |
306 | __func__); | ||
305 | goto out; | 307 | goto out; |
306 | } | 308 | } |
307 | 309 | ||
@@ -312,26 +314,28 @@ static int pcie_write_cmd(struct controller *ctrl, u16 cmd, u16 mask) | |||
312 | * proceed forward to issue the next command according | 314 | * proceed forward to issue the next command according |
313 | * to spec. Just print out the error message. | 315 | * to spec. Just print out the error message. |
314 | */ | 316 | */ |
315 | dbg("%s: CMD_COMPLETED not clear after 1 sec.\n", | 317 | ctrl_dbg(ctrl, |
316 | __func__); | 318 | "%s: CMD_COMPLETED not clear after 1 sec.\n", |
319 | __func__); | ||
317 | } else if (!NO_CMD_CMPL(ctrl)) { | 320 | } else if (!NO_CMD_CMPL(ctrl)) { |
318 | /* | 321 | /* |
319 | * This controller semms to notify of command completed | 322 | * This controller semms to notify of command completed |
320 | * event even though it supports none of power | 323 | * event even though it supports none of power |
321 | * controller, attention led, power led and EMI. | 324 | * controller, attention led, power led and EMI. |
322 | */ | 325 | */ |
323 | dbg("%s: Unexpected CMD_COMPLETED. Need to wait for " | 326 | ctrl_dbg(ctrl, "%s: Unexpected CMD_COMPLETED. Need to " |
324 | "command completed event.\n", __func__); | 327 | "wait for command completed event.\n", |
328 | __func__); | ||
325 | ctrl->no_cmd_complete = 0; | 329 | ctrl->no_cmd_complete = 0; |
326 | } else { | 330 | } else { |
327 | dbg("%s: Unexpected CMD_COMPLETED. Maybe the " | 331 | ctrl_dbg(ctrl, "%s: Unexpected CMD_COMPLETED. Maybe " |
328 | "controller is broken.\n", __func__); | 332 | "the controller is broken.\n", __func__); |
329 | } | 333 | } |
330 | } | 334 | } |
331 | 335 | ||
332 | retval = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl); | 336 | retval = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl); |
333 | if (retval) { | 337 | if (retval) { |
334 | err("%s: Cannot read SLOTCTRL register\n", __func__); | 338 | ctrl_err(ctrl, "%s: Cannot read SLOTCTRL register\n", __func__); |
335 | goto out; | 339 | goto out; |
336 | } | 340 | } |
337 | 341 | ||
@@ -341,7 +345,8 @@ static int pcie_write_cmd(struct controller *ctrl, u16 cmd, u16 mask) | |||
341 | smp_mb(); | 345 | smp_mb(); |
342 | retval = pciehp_writew(ctrl, SLOTCTRL, slot_ctrl); | 346 | retval = pciehp_writew(ctrl, SLOTCTRL, slot_ctrl); |
343 | if (retval) | 347 | if (retval) |
344 | err("%s: Cannot write to SLOTCTRL register\n", __func__); | 348 | ctrl_err(ctrl, "%s: Cannot write to SLOTCTRL register\n", |
349 | __func__); | ||
345 | 350 | ||
346 | /* | 351 | /* |
347 | * Wait for command completion. | 352 | * Wait for command completion. |
@@ -370,14 +375,15 @@ static int hpc_check_lnk_status(struct controller *ctrl) | |||
370 | 375 | ||
371 | retval = pciehp_readw(ctrl, LNKSTATUS, &lnk_status); | 376 | retval = pciehp_readw(ctrl, LNKSTATUS, &lnk_status); |
372 | if (retval) { | 377 | if (retval) { |
373 | err("%s: Cannot read LNKSTATUS register\n", __func__); | 378 | ctrl_err(ctrl, "%s: Cannot read LNKSTATUS register\n", |
379 | __func__); | ||
374 | return retval; | 380 | return retval; |
375 | } | 381 | } |
376 | 382 | ||
377 | dbg("%s: lnk_status = %x\n", __func__, lnk_status); | 383 | ctrl_dbg(ctrl, "%s: lnk_status = %x\n", __func__, lnk_status); |
378 | if ( (lnk_status & LNK_TRN) || (lnk_status & LNK_TRN_ERR) || | 384 | if ( (lnk_status & LNK_TRN) || (lnk_status & LNK_TRN_ERR) || |
379 | !(lnk_status & NEG_LINK_WD)) { | 385 | !(lnk_status & NEG_LINK_WD)) { |
380 | err("%s : Link Training Error occurs \n", __func__); | 386 | ctrl_err(ctrl, "%s : Link Training Error occurs \n", __func__); |
381 | retval = -1; | 387 | retval = -1; |
382 | return retval; | 388 | return retval; |
383 | } | 389 | } |
@@ -394,12 +400,12 @@ static int hpc_get_attention_status(struct slot *slot, u8 *status) | |||
394 | 400 | ||
395 | retval = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl); | 401 | retval = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl); |
396 | if (retval) { | 402 | if (retval) { |
397 | err("%s: Cannot read SLOTCTRL register\n", __func__); | 403 | ctrl_err(ctrl, "%s: Cannot read SLOTCTRL register\n", __func__); |
398 | return retval; | 404 | return retval; |
399 | } | 405 | } |
400 | 406 | ||
401 | dbg("%s: SLOTCTRL %x, value read %x\n", | 407 | ctrl_dbg(ctrl, "%s: SLOTCTRL %x, value read %x\n", |
402 | __func__, ctrl->cap_base + SLOTCTRL, slot_ctrl); | 408 | __func__, ctrl->cap_base + SLOTCTRL, slot_ctrl); |
403 | 409 | ||
404 | atten_led_state = (slot_ctrl & ATTN_LED_CTRL) >> 6; | 410 | atten_led_state = (slot_ctrl & ATTN_LED_CTRL) >> 6; |
405 | 411 | ||
@@ -433,11 +439,11 @@ static int hpc_get_power_status(struct slot *slot, u8 *status) | |||
433 | 439 | ||
434 | retval = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl); | 440 | retval = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl); |
435 | if (retval) { | 441 | if (retval) { |
436 | err("%s: Cannot read SLOTCTRL register\n", __func__); | 442 | ctrl_err(ctrl, "%s: Cannot read SLOTCTRL register\n", __func__); |
437 | return retval; | 443 | return retval; |
438 | } | 444 | } |
439 | dbg("%s: SLOTCTRL %x value read %x\n", | 445 | ctrl_dbg(ctrl, "%s: SLOTCTRL %x value read %x\n", |
440 | __func__, ctrl->cap_base + SLOTCTRL, slot_ctrl); | 446 | __func__, ctrl->cap_base + SLOTCTRL, slot_ctrl); |
441 | 447 | ||
442 | pwr_state = (slot_ctrl & PWR_CTRL) >> 10; | 448 | pwr_state = (slot_ctrl & PWR_CTRL) >> 10; |
443 | 449 | ||
@@ -464,7 +470,8 @@ static int hpc_get_latch_status(struct slot *slot, u8 *status) | |||
464 | 470 | ||
465 | retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); | 471 | retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); |
466 | if (retval) { | 472 | if (retval) { |
467 | err("%s: Cannot read SLOTSTATUS register\n", __func__); | 473 | ctrl_err(ctrl, "%s: Cannot read SLOTSTATUS register\n", |
474 | __func__); | ||
468 | return retval; | 475 | return retval; |
469 | } | 476 | } |
470 | 477 | ||
@@ -482,7 +489,8 @@ static int hpc_get_adapter_status(struct slot *slot, u8 *status) | |||
482 | 489 | ||
483 | retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); | 490 | retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); |
484 | if (retval) { | 491 | if (retval) { |
485 | err("%s: Cannot read SLOTSTATUS register\n", __func__); | 492 | ctrl_err(ctrl, "%s: Cannot read SLOTSTATUS register\n", |
493 | __func__); | ||
486 | return retval; | 494 | return retval; |
487 | } | 495 | } |
488 | card_state = (u8)((slot_status & PRSN_STATE) >> 6); | 496 | card_state = (u8)((slot_status & PRSN_STATE) >> 6); |
@@ -500,7 +508,7 @@ static int hpc_query_power_fault(struct slot *slot) | |||
500 | 508 | ||
501 | retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); | 509 | retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); |
502 | if (retval) { | 510 | if (retval) { |
503 | err("%s: Cannot check for power fault\n", __func__); | 511 | ctrl_err(ctrl, "%s: Cannot check for power fault\n", __func__); |
504 | return retval; | 512 | return retval; |
505 | } | 513 | } |
506 | pwr_fault = (u8)((slot_status & PWR_FAULT_DETECTED) >> 1); | 514 | pwr_fault = (u8)((slot_status & PWR_FAULT_DETECTED) >> 1); |
@@ -516,7 +524,7 @@ static int hpc_get_emi_status(struct slot *slot, u8 *status) | |||
516 | 524 | ||
517 | retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); | 525 | retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); |
518 | if (retval) { | 526 | if (retval) { |
519 | err("%s : Cannot check EMI status\n", __func__); | 527 | ctrl_err(ctrl, "%s : Cannot check EMI status\n", __func__); |
520 | return retval; | 528 | return retval; |
521 | } | 529 | } |
522 | *status = (slot_status & EMI_STATE) >> EMI_STATUS_BIT; | 530 | *status = (slot_status & EMI_STATE) >> EMI_STATUS_BIT; |
@@ -560,8 +568,8 @@ static int hpc_set_attention_status(struct slot *slot, u8 value) | |||
560 | return -1; | 568 | return -1; |
561 | } | 569 | } |
562 | rc = pcie_write_cmd(ctrl, slot_cmd, cmd_mask); | 570 | rc = pcie_write_cmd(ctrl, slot_cmd, cmd_mask); |
563 | dbg("%s: SLOTCTRL %x write cmd %x\n", | 571 | ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", |
564 | __func__, ctrl->cap_base + SLOTCTRL, slot_cmd); | 572 | __func__, ctrl->cap_base + SLOTCTRL, slot_cmd); |
565 | 573 | ||
566 | return rc; | 574 | return rc; |
567 | } | 575 | } |
@@ -575,8 +583,8 @@ static void hpc_set_green_led_on(struct slot *slot) | |||
575 | slot_cmd = 0x0100; | 583 | slot_cmd = 0x0100; |
576 | cmd_mask = PWR_LED_CTRL; | 584 | cmd_mask = PWR_LED_CTRL; |
577 | pcie_write_cmd(ctrl, slot_cmd, cmd_mask); | 585 | pcie_write_cmd(ctrl, slot_cmd, cmd_mask); |
578 | dbg("%s: SLOTCTRL %x write cmd %x\n", | 586 | ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", |
579 | __func__, ctrl->cap_base + SLOTCTRL, slot_cmd); | 587 | __func__, ctrl->cap_base + SLOTCTRL, slot_cmd); |
580 | } | 588 | } |
581 | 589 | ||
582 | static void hpc_set_green_led_off(struct slot *slot) | 590 | static void hpc_set_green_led_off(struct slot *slot) |
@@ -588,8 +596,8 @@ static void hpc_set_green_led_off(struct slot *slot) | |||
588 | slot_cmd = 0x0300; | 596 | slot_cmd = 0x0300; |
589 | cmd_mask = PWR_LED_CTRL; | 597 | cmd_mask = PWR_LED_CTRL; |
590 | pcie_write_cmd(ctrl, slot_cmd, cmd_mask); | 598 | pcie_write_cmd(ctrl, slot_cmd, cmd_mask); |
591 | dbg("%s: SLOTCTRL %x write cmd %x\n", | 599 | ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", |
592 | __func__, ctrl->cap_base + SLOTCTRL, slot_cmd); | 600 | __func__, ctrl->cap_base + SLOTCTRL, slot_cmd); |
593 | } | 601 | } |
594 | 602 | ||
595 | static void hpc_set_green_led_blink(struct slot *slot) | 603 | static void hpc_set_green_led_blink(struct slot *slot) |
@@ -601,8 +609,8 @@ static void hpc_set_green_led_blink(struct slot *slot) | |||
601 | slot_cmd = 0x0200; | 609 | slot_cmd = 0x0200; |
602 | cmd_mask = PWR_LED_CTRL; | 610 | cmd_mask = PWR_LED_CTRL; |
603 | pcie_write_cmd(ctrl, slot_cmd, cmd_mask); | 611 | pcie_write_cmd(ctrl, slot_cmd, cmd_mask); |
604 | dbg("%s: SLOTCTRL %x write cmd %x\n", | 612 | ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", |
605 | __func__, ctrl->cap_base + SLOTCTRL, slot_cmd); | 613 | __func__, ctrl->cap_base + SLOTCTRL, slot_cmd); |
606 | } | 614 | } |
607 | 615 | ||
608 | static int hpc_power_on_slot(struct slot * slot) | 616 | static int hpc_power_on_slot(struct slot * slot) |
@@ -613,20 +621,22 @@ static int hpc_power_on_slot(struct slot * slot) | |||
613 | u16 slot_status; | 621 | u16 slot_status; |
614 | int retval = 0; | 622 | int retval = 0; |
615 | 623 | ||
616 | dbg("%s: slot->hp_slot %x\n", __func__, slot->hp_slot); | 624 | ctrl_dbg(ctrl, "%s: slot->hp_slot %x\n", __func__, slot->hp_slot); |
617 | 625 | ||
618 | /* Clear sticky power-fault bit from previous power failures */ | 626 | /* Clear sticky power-fault bit from previous power failures */ |
619 | retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); | 627 | retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); |
620 | if (retval) { | 628 | if (retval) { |
621 | err("%s: Cannot read SLOTSTATUS register\n", __func__); | 629 | ctrl_err(ctrl, "%s: Cannot read SLOTSTATUS register\n", |
630 | __func__); | ||
622 | return retval; | 631 | return retval; |
623 | } | 632 | } |
624 | slot_status &= PWR_FAULT_DETECTED; | 633 | slot_status &= PWR_FAULT_DETECTED; |
625 | if (slot_status) { | 634 | if (slot_status) { |
626 | retval = pciehp_writew(ctrl, SLOTSTATUS, slot_status); | 635 | retval = pciehp_writew(ctrl, SLOTSTATUS, slot_status); |
627 | if (retval) { | 636 | if (retval) { |
628 | err("%s: Cannot write to SLOTSTATUS register\n", | 637 | ctrl_err(ctrl, |
629 | __func__); | 638 | "%s: Cannot write to SLOTSTATUS register\n", |
639 | __func__); | ||
630 | return retval; | 640 | return retval; |
631 | } | 641 | } |
632 | } | 642 | } |
@@ -644,11 +654,12 @@ static int hpc_power_on_slot(struct slot * slot) | |||
644 | retval = pcie_write_cmd(ctrl, slot_cmd, cmd_mask); | 654 | retval = pcie_write_cmd(ctrl, slot_cmd, cmd_mask); |
645 | 655 | ||
646 | if (retval) { | 656 | if (retval) { |
647 | err("%s: Write %x command failed!\n", __func__, slot_cmd); | 657 | ctrl_err(ctrl, "%s: Write %x command failed!\n", |
658 | __func__, slot_cmd); | ||
648 | return -1; | 659 | return -1; |
649 | } | 660 | } |
650 | dbg("%s: SLOTCTRL %x write cmd %x\n", | 661 | ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", |
651 | __func__, ctrl->cap_base + SLOTCTRL, slot_cmd); | 662 | __func__, ctrl->cap_base + SLOTCTRL, slot_cmd); |
652 | 663 | ||
653 | return retval; | 664 | return retval; |
654 | } | 665 | } |
@@ -694,7 +705,7 @@ static int hpc_power_off_slot(struct slot * slot) | |||
694 | int retval = 0; | 705 | int retval = 0; |
695 | int changed; | 706 | int changed; |
696 | 707 | ||
697 | dbg("%s: slot->hp_slot %x\n", __func__, slot->hp_slot); | 708 | ctrl_dbg(ctrl, "%s: slot->hp_slot %x\n", __func__, slot->hp_slot); |
698 | 709 | ||
699 | /* | 710 | /* |
700 | * Set Bad DLLP Mask bit in Correctable Error Mask | 711 | * Set Bad DLLP Mask bit in Correctable Error Mask |
@@ -722,12 +733,12 @@ static int hpc_power_off_slot(struct slot * slot) | |||
722 | 733 | ||
723 | retval = pcie_write_cmd(ctrl, slot_cmd, cmd_mask); | 734 | retval = pcie_write_cmd(ctrl, slot_cmd, cmd_mask); |
724 | if (retval) { | 735 | if (retval) { |
725 | err("%s: Write command failed!\n", __func__); | 736 | ctrl_err(ctrl, "%s: Write command failed!\n", __func__); |
726 | retval = -1; | 737 | retval = -1; |
727 | goto out; | 738 | goto out; |
728 | } | 739 | } |
729 | dbg("%s: SLOTCTRL %x write cmd %x\n", | 740 | ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", |
730 | __func__, ctrl->cap_base + SLOTCTRL, slot_cmd); | 741 | __func__, ctrl->cap_base + SLOTCTRL, slot_cmd); |
731 | out: | 742 | out: |
732 | if (changed) | 743 | if (changed) |
733 | pcie_unmask_bad_dllp(ctrl); | 744 | pcie_unmask_bad_dllp(ctrl); |
@@ -749,7 +760,8 @@ static irqreturn_t pcie_isr(int irq, void *dev_id) | |||
749 | intr_loc = 0; | 760 | intr_loc = 0; |
750 | do { | 761 | do { |
751 | if (pciehp_readw(ctrl, SLOTSTATUS, &detected)) { | 762 | if (pciehp_readw(ctrl, SLOTSTATUS, &detected)) { |
752 | err("%s: Cannot read SLOTSTATUS\n", __func__); | 763 | ctrl_err(ctrl, "%s: Cannot read SLOTSTATUS\n", |
764 | __func__); | ||
753 | return IRQ_NONE; | 765 | return IRQ_NONE; |
754 | } | 766 | } |
755 | 767 | ||
@@ -760,12 +772,13 @@ static irqreturn_t pcie_isr(int irq, void *dev_id) | |||
760 | if (!intr_loc) | 772 | if (!intr_loc) |
761 | return IRQ_NONE; | 773 | return IRQ_NONE; |
762 | if (detected && pciehp_writew(ctrl, SLOTSTATUS, detected)) { | 774 | if (detected && pciehp_writew(ctrl, SLOTSTATUS, detected)) { |
763 | err("%s: Cannot write to SLOTSTATUS\n", __func__); | 775 | ctrl_err(ctrl, "%s: Cannot write to SLOTSTATUS\n", |
776 | __func__); | ||
764 | return IRQ_NONE; | 777 | return IRQ_NONE; |
765 | } | 778 | } |
766 | } while (detected); | 779 | } while (detected); |
767 | 780 | ||
768 | dbg("%s: intr_loc %x\n", __FUNCTION__, intr_loc); | 781 | ctrl_dbg(ctrl, "%s: intr_loc %x\n", __func__, intr_loc); |
769 | 782 | ||
770 | /* Check Command Complete Interrupt Pending */ | 783 | /* Check Command Complete Interrupt Pending */ |
771 | if (intr_loc & CMD_COMPLETED) { | 784 | if (intr_loc & CMD_COMPLETED) { |
@@ -807,7 +820,7 @@ static int hpc_get_max_lnk_speed(struct slot *slot, enum pci_bus_speed *value) | |||
807 | 820 | ||
808 | retval = pciehp_readl(ctrl, LNKCAP, &lnk_cap); | 821 | retval = pciehp_readl(ctrl, LNKCAP, &lnk_cap); |
809 | if (retval) { | 822 | if (retval) { |
810 | err("%s: Cannot read LNKCAP register\n", __func__); | 823 | ctrl_err(ctrl, "%s: Cannot read LNKCAP register\n", __func__); |
811 | return retval; | 824 | return retval; |
812 | } | 825 | } |
813 | 826 | ||
@@ -821,7 +834,7 @@ static int hpc_get_max_lnk_speed(struct slot *slot, enum pci_bus_speed *value) | |||
821 | } | 834 | } |
822 | 835 | ||
823 | *value = lnk_speed; | 836 | *value = lnk_speed; |
824 | dbg("Max link speed = %d\n", lnk_speed); | 837 | ctrl_dbg(ctrl, "Max link speed = %d\n", lnk_speed); |
825 | 838 | ||
826 | return retval; | 839 | return retval; |
827 | } | 840 | } |
@@ -836,7 +849,7 @@ static int hpc_get_max_lnk_width(struct slot *slot, | |||
836 | 849 | ||
837 | retval = pciehp_readl(ctrl, LNKCAP, &lnk_cap); | 850 | retval = pciehp_readl(ctrl, LNKCAP, &lnk_cap); |
838 | if (retval) { | 851 | if (retval) { |
839 | err("%s: Cannot read LNKCAP register\n", __func__); | 852 | ctrl_err(ctrl, "%s: Cannot read LNKCAP register\n", __func__); |
840 | return retval; | 853 | return retval; |
841 | } | 854 | } |
842 | 855 | ||
@@ -871,7 +884,7 @@ static int hpc_get_max_lnk_width(struct slot *slot, | |||
871 | } | 884 | } |
872 | 885 | ||
873 | *value = lnk_wdth; | 886 | *value = lnk_wdth; |
874 | dbg("Max link width = %d\n", lnk_wdth); | 887 | ctrl_dbg(ctrl, "Max link width = %d\n", lnk_wdth); |
875 | 888 | ||
876 | return retval; | 889 | return retval; |
877 | } | 890 | } |
@@ -885,7 +898,8 @@ static int hpc_get_cur_lnk_speed(struct slot *slot, enum pci_bus_speed *value) | |||
885 | 898 | ||
886 | retval = pciehp_readw(ctrl, LNKSTATUS, &lnk_status); | 899 | retval = pciehp_readw(ctrl, LNKSTATUS, &lnk_status); |
887 | if (retval) { | 900 | if (retval) { |
888 | err("%s: Cannot read LNKSTATUS register\n", __func__); | 901 | ctrl_err(ctrl, "%s: Cannot read LNKSTATUS register\n", |
902 | __func__); | ||
889 | return retval; | 903 | return retval; |
890 | } | 904 | } |
891 | 905 | ||
@@ -899,7 +913,7 @@ static int hpc_get_cur_lnk_speed(struct slot *slot, enum pci_bus_speed *value) | |||
899 | } | 913 | } |
900 | 914 | ||
901 | *value = lnk_speed; | 915 | *value = lnk_speed; |
902 | dbg("Current link speed = %d\n", lnk_speed); | 916 | ctrl_dbg(ctrl, "Current link speed = %d\n", lnk_speed); |
903 | 917 | ||
904 | return retval; | 918 | return retval; |
905 | } | 919 | } |
@@ -914,7 +928,8 @@ static int hpc_get_cur_lnk_width(struct slot *slot, | |||
914 | 928 | ||
915 | retval = pciehp_readw(ctrl, LNKSTATUS, &lnk_status); | 929 | retval = pciehp_readw(ctrl, LNKSTATUS, &lnk_status); |
916 | if (retval) { | 930 | if (retval) { |
917 | err("%s: Cannot read LNKSTATUS register\n", __func__); | 931 | ctrl_err(ctrl, "%s: Cannot read LNKSTATUS register\n", |
932 | __func__); | ||
918 | return retval; | 933 | return retval; |
919 | } | 934 | } |
920 | 935 | ||
@@ -949,7 +964,7 @@ static int hpc_get_cur_lnk_width(struct slot *slot, | |||
949 | } | 964 | } |
950 | 965 | ||
951 | *value = lnk_wdth; | 966 | *value = lnk_wdth; |
952 | dbg("Current link width = %d\n", lnk_wdth); | 967 | ctrl_dbg(ctrl, "Current link width = %d\n", lnk_wdth); |
953 | 968 | ||
954 | return retval; | 969 | return retval; |
955 | } | 970 | } |
@@ -998,7 +1013,8 @@ int pcie_enable_notification(struct controller *ctrl) | |||
998 | PWR_FAULT_DETECT_ENABLE | HP_INTR_ENABLE | CMD_CMPL_INTR_ENABLE; | 1013 | PWR_FAULT_DETECT_ENABLE | HP_INTR_ENABLE | CMD_CMPL_INTR_ENABLE; |
999 | 1014 | ||
1000 | if (pcie_write_cmd(ctrl, cmd, mask)) { | 1015 | if (pcie_write_cmd(ctrl, cmd, mask)) { |
1001 | err("%s: Cannot enable software notification\n", __func__); | 1016 | ctrl_err(ctrl, "%s: Cannot enable software notification\n", |
1017 | __func__); | ||
1002 | return -1; | 1018 | return -1; |
1003 | } | 1019 | } |
1004 | return 0; | 1020 | return 0; |
@@ -1010,7 +1026,8 @@ static void pcie_disable_notification(struct controller *ctrl) | |||
1010 | mask = PRSN_DETECT_ENABLE | ATTN_BUTTN_ENABLE | MRL_DETECT_ENABLE | | 1026 | mask = PRSN_DETECT_ENABLE | ATTN_BUTTN_ENABLE | MRL_DETECT_ENABLE | |
1011 | PWR_FAULT_DETECT_ENABLE | HP_INTR_ENABLE | CMD_CMPL_INTR_ENABLE; | 1027 | PWR_FAULT_DETECT_ENABLE | HP_INTR_ENABLE | CMD_CMPL_INTR_ENABLE; |
1012 | if (pcie_write_cmd(ctrl, 0, mask)) | 1028 | if (pcie_write_cmd(ctrl, 0, mask)) |
1013 | warn("%s: Cannot disable software notification\n", __func__); | 1029 | ctrl_warn(ctrl, "%s: Cannot disable software notification\n", |
1030 | __func__); | ||
1014 | } | 1031 | } |
1015 | 1032 | ||
1016 | static int pcie_init_notification(struct controller *ctrl) | 1033 | static int pcie_init_notification(struct controller *ctrl) |
@@ -1071,34 +1088,45 @@ static inline void dbg_ctrl(struct controller *ctrl) | |||
1071 | if (!pciehp_debug) | 1088 | if (!pciehp_debug) |
1072 | return; | 1089 | return; |
1073 | 1090 | ||
1074 | dbg("Hotplug Controller:\n"); | 1091 | ctrl_info(ctrl, "Hotplug Controller:\n"); |
1075 | dbg(" Seg/Bus/Dev/Func/IRQ : %s IRQ %d\n", pci_name(pdev), pdev->irq); | 1092 | ctrl_info(ctrl, " Seg/Bus/Dev/Func/IRQ : %s IRQ %d\n", |
1076 | dbg(" Vendor ID : 0x%04x\n", pdev->vendor); | 1093 | pci_name(pdev), pdev->irq); |
1077 | dbg(" Device ID : 0x%04x\n", pdev->device); | 1094 | ctrl_info(ctrl, " Vendor ID : 0x%04x\n", pdev->vendor); |
1078 | dbg(" Subsystem ID : 0x%04x\n", pdev->subsystem_device); | 1095 | ctrl_info(ctrl, " Device ID : 0x%04x\n", pdev->device); |
1079 | dbg(" Subsystem Vendor ID : 0x%04x\n", pdev->subsystem_vendor); | 1096 | ctrl_info(ctrl, " Subsystem ID : 0x%04x\n", |
1080 | dbg(" PCIe Cap offset : 0x%02x\n", ctrl->cap_base); | 1097 | pdev->subsystem_device); |
1098 | ctrl_info(ctrl, " Subsystem Vendor ID : 0x%04x\n", | ||
1099 | pdev->subsystem_vendor); | ||
1100 | ctrl_info(ctrl, " PCIe Cap offset : 0x%02x\n", ctrl->cap_base); | ||
1081 | for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { | 1101 | for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { |
1082 | if (!pci_resource_len(pdev, i)) | 1102 | if (!pci_resource_len(pdev, i)) |
1083 | continue; | 1103 | continue; |
1084 | dbg(" PCI resource [%d] : 0x%llx@0x%llx\n", i, | 1104 | ctrl_info(ctrl, " PCI resource [%d] : 0x%llx@0x%llx\n", |
1085 | (unsigned long long)pci_resource_len(pdev, i), | 1105 | i, (unsigned long long)pci_resource_len(pdev, i), |
1086 | (unsigned long long)pci_resource_start(pdev, i)); | 1106 | (unsigned long long)pci_resource_start(pdev, i)); |
1087 | } | 1107 | } |
1088 | dbg("Slot Capabilities : 0x%08x\n", ctrl->slot_cap); | 1108 | ctrl_info(ctrl, "Slot Capabilities : 0x%08x\n", ctrl->slot_cap); |
1089 | dbg(" Physical Slot Number : %d\n", ctrl->first_slot); | 1109 | ctrl_info(ctrl, " Physical Slot Number : %d\n", ctrl->first_slot); |
1090 | dbg(" Attention Button : %3s\n", ATTN_BUTTN(ctrl) ? "yes" : "no"); | 1110 | ctrl_info(ctrl, " Attention Button : %3s\n", |
1091 | dbg(" Power Controller : %3s\n", POWER_CTRL(ctrl) ? "yes" : "no"); | 1111 | ATTN_BUTTN(ctrl) ? "yes" : "no"); |
1092 | dbg(" MRL Sensor : %3s\n", MRL_SENS(ctrl) ? "yes" : "no"); | 1112 | ctrl_info(ctrl, " Power Controller : %3s\n", |
1093 | dbg(" Attention Indicator : %3s\n", ATTN_LED(ctrl) ? "yes" : "no"); | 1113 | POWER_CTRL(ctrl) ? "yes" : "no"); |
1094 | dbg(" Power Indicator : %3s\n", PWR_LED(ctrl) ? "yes" : "no"); | 1114 | ctrl_info(ctrl, " MRL Sensor : %3s\n", |
1095 | dbg(" Hot-Plug Surprise : %3s\n", HP_SUPR_RM(ctrl) ? "yes" : "no"); | 1115 | MRL_SENS(ctrl) ? "yes" : "no"); |
1096 | dbg(" EMI Present : %3s\n", EMI(ctrl) ? "yes" : "no"); | 1116 | ctrl_info(ctrl, " Attention Indicator : %3s\n", |
1097 | dbg(" Command Completed : %3s\n", NO_CMD_CMPL(ctrl)? "no" : "yes"); | 1117 | ATTN_LED(ctrl) ? "yes" : "no"); |
1118 | ctrl_info(ctrl, " Power Indicator : %3s\n", | ||
1119 | PWR_LED(ctrl) ? "yes" : "no"); | ||
1120 | ctrl_info(ctrl, " Hot-Plug Surprise : %3s\n", | ||
1121 | HP_SUPR_RM(ctrl) ? "yes" : "no"); | ||
1122 | ctrl_info(ctrl, " EMI Present : %3s\n", | ||
1123 | EMI(ctrl) ? "yes" : "no"); | ||
1124 | ctrl_info(ctrl, " Command Completed : %3s\n", | ||
1125 | NO_CMD_CMPL(ctrl) ? "no" : "yes"); | ||
1098 | pciehp_readw(ctrl, SLOTSTATUS, ®16); | 1126 | pciehp_readw(ctrl, SLOTSTATUS, ®16); |
1099 | dbg("Slot Status : 0x%04x\n", reg16); | 1127 | ctrl_info(ctrl, "Slot Status : 0x%04x\n", reg16); |
1100 | pciehp_readw(ctrl, SLOTCTRL, ®16); | 1128 | pciehp_readw(ctrl, SLOTCTRL, ®16); |
1101 | dbg("Slot Control : 0x%04x\n", reg16); | 1129 | ctrl_info(ctrl, "Slot Control : 0x%04x\n", reg16); |
1102 | } | 1130 | } |
1103 | 1131 | ||
1104 | struct controller *pcie_init(struct pcie_device *dev) | 1132 | struct controller *pcie_init(struct pcie_device *dev) |
@@ -1109,19 +1137,21 @@ struct controller *pcie_init(struct pcie_device *dev) | |||
1109 | 1137 | ||
1110 | ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL); | 1138 | ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL); |
1111 | if (!ctrl) { | 1139 | if (!ctrl) { |
1112 | err("%s : out of memory\n", __func__); | 1140 | dev_err(&dev->device, "%s : out of memory\n", __func__); |
1113 | goto abort; | 1141 | goto abort; |
1114 | } | 1142 | } |
1115 | INIT_LIST_HEAD(&ctrl->slot_list); | 1143 | INIT_LIST_HEAD(&ctrl->slot_list); |
1116 | 1144 | ||
1145 | ctrl->pcie = dev; | ||
1117 | ctrl->pci_dev = pdev; | 1146 | ctrl->pci_dev = pdev; |
1118 | ctrl->cap_base = pci_find_capability(pdev, PCI_CAP_ID_EXP); | 1147 | ctrl->cap_base = pci_find_capability(pdev, PCI_CAP_ID_EXP); |
1119 | if (!ctrl->cap_base) { | 1148 | if (!ctrl->cap_base) { |
1120 | err("%s: Cannot find PCI Express capability\n", __func__); | 1149 | ctrl_err(ctrl, "%s: Cannot find PCI Express capability\n", |
1150 | __func__); | ||
1121 | goto abort; | 1151 | goto abort; |
1122 | } | 1152 | } |
1123 | if (pciehp_readl(ctrl, SLOTCAP, &slot_cap)) { | 1153 | if (pciehp_readl(ctrl, SLOTCAP, &slot_cap)) { |
1124 | err("%s: Cannot read SLOTCAP register\n", __func__); | 1154 | ctrl_err(ctrl, "%s: Cannot read SLOTCAP register\n", __func__); |
1125 | goto abort; | 1155 | goto abort; |
1126 | } | 1156 | } |
1127 | 1157 | ||
@@ -1161,9 +1191,9 @@ struct controller *pcie_init(struct pcie_device *dev) | |||
1161 | goto abort_ctrl; | 1191 | goto abort_ctrl; |
1162 | } | 1192 | } |
1163 | 1193 | ||
1164 | info("HPC vendor_id %x device_id %x ss_vid %x ss_did %x\n", | 1194 | ctrl_info(ctrl, "HPC vendor_id %x device_id %x ss_vid %x ss_did %x\n", |
1165 | pdev->vendor, pdev->device, | 1195 | pdev->vendor, pdev->device, pdev->subsystem_vendor, |
1166 | pdev->subsystem_vendor, pdev->subsystem_device); | 1196 | pdev->subsystem_device); |
1167 | 1197 | ||
1168 | if (pcie_init_slot(ctrl)) | 1198 | if (pcie_init_slot(ctrl)) |
1169 | goto abort_ctrl; | 1199 | goto abort_ctrl; |
diff --git a/drivers/pci/hotplug/pciehp_pci.c b/drivers/pci/hotplug/pciehp_pci.c index 6040dcceb256..ffd11148fbe2 100644 --- a/drivers/pci/hotplug/pciehp_pci.c +++ b/drivers/pci/hotplug/pciehp_pci.c | |||
@@ -198,18 +198,20 @@ int pciehp_configure_device(struct slot *p_slot) | |||
198 | struct pci_dev *dev; | 198 | struct pci_dev *dev; |
199 | struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; | 199 | struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; |
200 | int num, fn; | 200 | int num, fn; |
201 | struct controller *ctrl = p_slot->ctrl; | ||
201 | 202 | ||
202 | dev = pci_get_slot(parent, PCI_DEVFN(p_slot->device, 0)); | 203 | dev = pci_get_slot(parent, PCI_DEVFN(p_slot->device, 0)); |
203 | if (dev) { | 204 | if (dev) { |
204 | err("Device %s already exists at %x:%x, cannot hot-add\n", | 205 | ctrl_err(ctrl, |
205 | pci_name(dev), p_slot->bus, p_slot->device); | 206 | "Device %s already exists at %x:%x, cannot hot-add\n", |
207 | pci_name(dev), p_slot->bus, p_slot->device); | ||
206 | pci_dev_put(dev); | 208 | pci_dev_put(dev); |
207 | return -EINVAL; | 209 | return -EINVAL; |
208 | } | 210 | } |
209 | 211 | ||
210 | num = pci_scan_slot(parent, PCI_DEVFN(p_slot->device, 0)); | 212 | num = pci_scan_slot(parent, PCI_DEVFN(p_slot->device, 0)); |
211 | if (num == 0) { | 213 | if (num == 0) { |
212 | err("No new device found\n"); | 214 | ctrl_err(ctrl, "No new device found\n"); |
213 | return -ENODEV; | 215 | return -ENODEV; |
214 | } | 216 | } |
215 | 217 | ||
@@ -218,8 +220,8 @@ int pciehp_configure_device(struct slot *p_slot) | |||
218 | if (!dev) | 220 | if (!dev) |
219 | continue; | 221 | continue; |
220 | if ((dev->class >> 16) == PCI_BASE_CLASS_DISPLAY) { | 222 | if ((dev->class >> 16) == PCI_BASE_CLASS_DISPLAY) { |
221 | err("Cannot hot-add display device %s\n", | 223 | ctrl_err(ctrl, "Cannot hot-add display device %s\n", |
222 | pci_name(dev)); | 224 | pci_name(dev)); |
223 | pci_dev_put(dev); | 225 | pci_dev_put(dev); |
224 | continue; | 226 | continue; |
225 | } | 227 | } |
@@ -244,9 +246,10 @@ int pciehp_unconfigure_device(struct slot *p_slot) | |||
244 | u8 presence = 0; | 246 | u8 presence = 0; |
245 | struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; | 247 | struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; |
246 | u16 command; | 248 | u16 command; |
249 | struct controller *ctrl = p_slot->ctrl; | ||
247 | 250 | ||
248 | dbg("%s: bus/dev = %x/%x\n", __func__, p_slot->bus, | 251 | ctrl_dbg(ctrl, "%s: bus/dev = %x/%x\n", __func__, |
249 | p_slot->device); | 252 | p_slot->bus, p_slot->device); |
250 | ret = p_slot->hpc_ops->get_adapter_status(p_slot, &presence); | 253 | ret = p_slot->hpc_ops->get_adapter_status(p_slot, &presence); |
251 | if (ret) | 254 | if (ret) |
252 | presence = 0; | 255 | presence = 0; |
@@ -257,16 +260,17 @@ int pciehp_unconfigure_device(struct slot *p_slot) | |||
257 | if (!temp) | 260 | if (!temp) |
258 | continue; | 261 | continue; |
259 | if ((temp->class >> 16) == PCI_BASE_CLASS_DISPLAY) { | 262 | if ((temp->class >> 16) == PCI_BASE_CLASS_DISPLAY) { |
260 | err("Cannot remove display device %s\n", | 263 | ctrl_err(ctrl, "Cannot remove display device %s\n", |
261 | pci_name(temp)); | 264 | pci_name(temp)); |
262 | pci_dev_put(temp); | 265 | pci_dev_put(temp); |
263 | continue; | 266 | continue; |
264 | } | 267 | } |
265 | if (temp->hdr_type == PCI_HEADER_TYPE_BRIDGE && presence) { | 268 | if (temp->hdr_type == PCI_HEADER_TYPE_BRIDGE && presence) { |
266 | pci_read_config_byte(temp, PCI_BRIDGE_CONTROL, &bctl); | 269 | pci_read_config_byte(temp, PCI_BRIDGE_CONTROL, &bctl); |
267 | if (bctl & PCI_BRIDGE_CTL_VGA) { | 270 | if (bctl & PCI_BRIDGE_CTL_VGA) { |
268 | err("Cannot remove display device %s\n", | 271 | ctrl_err(ctrl, |
269 | pci_name(temp)); | 272 | "Cannot remove display device %s\n", |
273 | pci_name(temp)); | ||
270 | pci_dev_put(temp); | 274 | pci_dev_put(temp); |
271 | continue; | 275 | continue; |
272 | } | 276 | } |
diff --git a/drivers/pci/hotplug/rpaphp.h b/drivers/pci/hotplug/rpaphp.h index 7d5921b1ee78..419919a87b0f 100644 --- a/drivers/pci/hotplug/rpaphp.h +++ b/drivers/pci/hotplug/rpaphp.h | |||
@@ -46,10 +46,10 @@ | |||
46 | #define PRESENT 1 /* Card in slot */ | 46 | #define PRESENT 1 /* Card in slot */ |
47 | 47 | ||
48 | #define MY_NAME "rpaphp" | 48 | #define MY_NAME "rpaphp" |
49 | extern int debug; | 49 | extern int rpaphp_debug; |
50 | #define dbg(format, arg...) \ | 50 | #define dbg(format, arg...) \ |
51 | do { \ | 51 | do { \ |
52 | if (debug) \ | 52 | if (rpaphp_debug) \ |
53 | printk(KERN_DEBUG "%s: " format, \ | 53 | printk(KERN_DEBUG "%s: " format, \ |
54 | MY_NAME , ## arg); \ | 54 | MY_NAME , ## arg); \ |
55 | } while (0) | 55 | } while (0) |
diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c index 1f84f402acdb..95d02a08fdc7 100644 --- a/drivers/pci/hotplug/rpaphp_core.c +++ b/drivers/pci/hotplug/rpaphp_core.c | |||
@@ -37,7 +37,7 @@ | |||
37 | /* and pci_do_scan_bus */ | 37 | /* and pci_do_scan_bus */ |
38 | #include "rpaphp.h" | 38 | #include "rpaphp.h" |
39 | 39 | ||
40 | int debug; | 40 | int rpaphp_debug; |
41 | LIST_HEAD(rpaphp_slot_head); | 41 | LIST_HEAD(rpaphp_slot_head); |
42 | 42 | ||
43 | #define DRIVER_VERSION "0.1" | 43 | #define DRIVER_VERSION "0.1" |
@@ -50,7 +50,7 @@ MODULE_AUTHOR(DRIVER_AUTHOR); | |||
50 | MODULE_DESCRIPTION(DRIVER_DESC); | 50 | MODULE_DESCRIPTION(DRIVER_DESC); |
51 | MODULE_LICENSE("GPL"); | 51 | MODULE_LICENSE("GPL"); |
52 | 52 | ||
53 | module_param(debug, bool, 0644); | 53 | module_param_named(debug, rpaphp_debug, bool, 0644); |
54 | 54 | ||
55 | /** | 55 | /** |
56 | * set_attention_status - set attention LED | 56 | * set_attention_status - set attention LED |
diff --git a/drivers/pci/hotplug/rpaphp_pci.c b/drivers/pci/hotplug/rpaphp_pci.c index 5acfd4f3d4cb..513e1e282391 100644 --- a/drivers/pci/hotplug/rpaphp_pci.c +++ b/drivers/pci/hotplug/rpaphp_pci.c | |||
@@ -123,7 +123,7 @@ int rpaphp_enable_slot(struct slot *slot) | |||
123 | slot->state = CONFIGURED; | 123 | slot->state = CONFIGURED; |
124 | } | 124 | } |
125 | 125 | ||
126 | if (debug) { | 126 | if (rpaphp_debug) { |
127 | struct pci_dev *dev; | 127 | struct pci_dev *dev; |
128 | dbg("%s: pci_devs of slot[%s]\n", __func__, slot->dn->full_name); | 128 | dbg("%s: pci_devs of slot[%s]\n", __func__, slot->dn->full_name); |
129 | list_for_each_entry (dev, &bus->devices, bus_list) | 129 | list_for_each_entry (dev, &bus->devices, bus_list) |