diff options
Diffstat (limited to 'drivers/pci/hotplug/pciehp_ctrl.c')
-rw-r--r-- | drivers/pci/hotplug/pciehp_ctrl.c | 104 |
1 files changed, 57 insertions, 47 deletions
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c index 41290a106bd8..372c63e35aa9 100644 --- a/drivers/pci/hotplug/pciehp_ctrl.c +++ b/drivers/pci/hotplug/pciehp_ctrl.c | |||
@@ -43,6 +43,11 @@ static int event_finished; | |||
43 | static unsigned long pushbutton_pending; /* = 0 */ | 43 | static unsigned long pushbutton_pending; /* = 0 */ |
44 | static unsigned long surprise_rm_pending; /* = 0 */ | 44 | static unsigned long surprise_rm_pending; /* = 0 */ |
45 | 45 | ||
46 | static inline char *slot_name(struct slot *p_slot) | ||
47 | { | ||
48 | return p_slot->hotplug_slot->name; | ||
49 | } | ||
50 | |||
46 | u8 pciehp_handle_attention_button(u8 hp_slot, void *inst_id) | 51 | u8 pciehp_handle_attention_button(u8 hp_slot, void *inst_id) |
47 | { | 52 | { |
48 | struct controller *ctrl = (struct controller *) inst_id; | 53 | struct controller *ctrl = (struct controller *) inst_id; |
@@ -68,7 +73,7 @@ u8 pciehp_handle_attention_button(u8 hp_slot, void *inst_id) | |||
68 | /* | 73 | /* |
69 | * Button pressed - See if need to TAKE ACTION!!! | 74 | * Button pressed - See if need to TAKE ACTION!!! |
70 | */ | 75 | */ |
71 | info("Button pressed on Slot(%d)\n", ctrl->first_slot + hp_slot); | 76 | info("Button pressed on Slot(%s)\n", slot_name(p_slot)); |
72 | taskInfo->event_type = INT_BUTTON_PRESS; | 77 | taskInfo->event_type = INT_BUTTON_PRESS; |
73 | 78 | ||
74 | if ((p_slot->state == BLINKINGON_STATE) | 79 | if ((p_slot->state == BLINKINGON_STATE) |
@@ -78,7 +83,7 @@ u8 pciehp_handle_attention_button(u8 hp_slot, void *inst_id) | |||
78 | * or hot-remove | 83 | * or hot-remove |
79 | */ | 84 | */ |
80 | taskInfo->event_type = INT_BUTTON_CANCEL; | 85 | taskInfo->event_type = INT_BUTTON_CANCEL; |
81 | info("Button cancel on Slot(%d)\n", ctrl->first_slot + hp_slot); | 86 | info("Button cancel on Slot(%s)\n", slot_name(p_slot)); |
82 | } else if ((p_slot->state == POWERON_STATE) | 87 | } else if ((p_slot->state == POWERON_STATE) |
83 | || (p_slot->state == POWEROFF_STATE)) { | 88 | || (p_slot->state == POWEROFF_STATE)) { |
84 | /* Ignore if the slot is on power-on or power-off state; this | 89 | /* Ignore if the slot is on power-on or power-off state; this |
@@ -86,7 +91,7 @@ u8 pciehp_handle_attention_button(u8 hp_slot, void *inst_id) | |||
86 | * hot-remove is undergoing | 91 | * hot-remove is undergoing |
87 | */ | 92 | */ |
88 | taskInfo->event_type = INT_BUTTON_IGNORE; | 93 | taskInfo->event_type = INT_BUTTON_IGNORE; |
89 | info("Button ignore on Slot(%d)\n", ctrl->first_slot + hp_slot); | 94 | info("Button ignore on Slot(%s)\n", slot_name(p_slot)); |
90 | } | 95 | } |
91 | 96 | ||
92 | if (rc) | 97 | if (rc) |
@@ -122,13 +127,13 @@ u8 pciehp_handle_switch_change(u8 hp_slot, void *inst_id) | |||
122 | /* | 127 | /* |
123 | * Switch opened | 128 | * Switch opened |
124 | */ | 129 | */ |
125 | info("Latch open on Slot(%d)\n", ctrl->first_slot + hp_slot); | 130 | info("Latch open on Slot(%s)\n", slot_name(p_slot)); |
126 | taskInfo->event_type = INT_SWITCH_OPEN; | 131 | taskInfo->event_type = INT_SWITCH_OPEN; |
127 | } else { | 132 | } else { |
128 | /* | 133 | /* |
129 | * Switch closed | 134 | * Switch closed |
130 | */ | 135 | */ |
131 | info("Latch close on Slot(%d)\n", ctrl->first_slot + hp_slot); | 136 | info("Latch close on Slot(%s)\n", slot_name(p_slot)); |
132 | taskInfo->event_type = INT_SWITCH_CLOSE; | 137 | taskInfo->event_type = INT_SWITCH_CLOSE; |
133 | } | 138 | } |
134 | 139 | ||
@@ -166,13 +171,13 @@ u8 pciehp_handle_presence_change(u8 hp_slot, void *inst_id) | |||
166 | /* | 171 | /* |
167 | * Card Present | 172 | * Card Present |
168 | */ | 173 | */ |
169 | info("Card present on Slot(%d)\n", ctrl->first_slot + hp_slot); | 174 | info("Card present on Slot(%s)\n", slot_name(p_slot)); |
170 | taskInfo->event_type = INT_PRESENCE_ON; | 175 | taskInfo->event_type = INT_PRESENCE_ON; |
171 | } else { | 176 | } else { |
172 | /* | 177 | /* |
173 | * Not Present | 178 | * Not Present |
174 | */ | 179 | */ |
175 | info("Card not present on Slot(%d)\n", ctrl->first_slot + hp_slot); | 180 | info("Card not present on Slot(%s)\n", slot_name(p_slot)); |
176 | taskInfo->event_type = INT_PRESENCE_OFF; | 181 | taskInfo->event_type = INT_PRESENCE_OFF; |
177 | } | 182 | } |
178 | 183 | ||
@@ -206,13 +211,13 @@ u8 pciehp_handle_power_fault(u8 hp_slot, void *inst_id) | |||
206 | /* | 211 | /* |
207 | * power fault Cleared | 212 | * power fault Cleared |
208 | */ | 213 | */ |
209 | info("Power fault cleared on Slot(%d)\n", ctrl->first_slot + hp_slot); | 214 | info("Power fault cleared on Slot(%s)\n", slot_name(p_slot)); |
210 | taskInfo->event_type = INT_POWER_FAULT_CLEAR; | 215 | taskInfo->event_type = INT_POWER_FAULT_CLEAR; |
211 | } else { | 216 | } else { |
212 | /* | 217 | /* |
213 | * power fault | 218 | * power fault |
214 | */ | 219 | */ |
215 | info("Power fault on Slot(%d)\n", ctrl->first_slot + hp_slot); | 220 | info("Power fault on Slot(%s)\n", slot_name(p_slot)); |
216 | taskInfo->event_type = INT_POWER_FAULT; | 221 | taskInfo->event_type = INT_POWER_FAULT; |
217 | info("power fault bit %x set\n", hp_slot); | 222 | info("power fault bit %x set\n", hp_slot); |
218 | } | 223 | } |
@@ -229,13 +234,13 @@ u8 pciehp_handle_power_fault(u8 hp_slot, void *inst_id) | |||
229 | static void set_slot_off(struct controller *ctrl, struct slot * pslot) | 234 | static void set_slot_off(struct controller *ctrl, struct slot * pslot) |
230 | { | 235 | { |
231 | /* Wait for exclusive access to hardware */ | 236 | /* Wait for exclusive access to hardware */ |
232 | mutex_lock(&ctrl->crit_sect); | 237 | mutex_lock(&ctrl->ctrl_lock); |
233 | 238 | ||
234 | /* turn off slot, turn on Amber LED, turn off Green LED if supported*/ | 239 | /* turn off slot, turn on Amber LED, turn off Green LED if supported*/ |
235 | if (POWER_CTRL(ctrl->ctrlcap)) { | 240 | if (POWER_CTRL(ctrl->ctrlcap)) { |
236 | if (pslot->hpc_ops->power_off_slot(pslot)) { | 241 | if (pslot->hpc_ops->power_off_slot(pslot)) { |
237 | err("%s: Issue of Slot Power Off command failed\n", __FUNCTION__); | 242 | err("%s: Issue of Slot Power Off command failed\n", __FUNCTION__); |
238 | mutex_unlock(&ctrl->crit_sect); | 243 | mutex_unlock(&ctrl->ctrl_lock); |
239 | return; | 244 | return; |
240 | } | 245 | } |
241 | wait_for_ctrl_irq (ctrl); | 246 | wait_for_ctrl_irq (ctrl); |
@@ -249,14 +254,14 @@ static void set_slot_off(struct controller *ctrl, struct slot * pslot) | |||
249 | if (ATTN_LED(ctrl->ctrlcap)) { | 254 | if (ATTN_LED(ctrl->ctrlcap)) { |
250 | if (pslot->hpc_ops->set_attention_status(pslot, 1)) { | 255 | if (pslot->hpc_ops->set_attention_status(pslot, 1)) { |
251 | err("%s: Issue of Set Attention Led command failed\n", __FUNCTION__); | 256 | err("%s: Issue of Set Attention Led command failed\n", __FUNCTION__); |
252 | mutex_unlock(&ctrl->crit_sect); | 257 | mutex_unlock(&ctrl->ctrl_lock); |
253 | return; | 258 | return; |
254 | } | 259 | } |
255 | wait_for_ctrl_irq (ctrl); | 260 | wait_for_ctrl_irq (ctrl); |
256 | } | 261 | } |
257 | 262 | ||
258 | /* Done with exclusive hardware access */ | 263 | /* Done with exclusive hardware access */ |
259 | mutex_unlock(&ctrl->crit_sect); | 264 | mutex_unlock(&ctrl->ctrl_lock); |
260 | } | 265 | } |
261 | 266 | ||
262 | /** | 267 | /** |
@@ -279,13 +284,13 @@ static int board_added(struct slot *p_slot) | |||
279 | ctrl->slot_device_offset, hp_slot); | 284 | ctrl->slot_device_offset, hp_slot); |
280 | 285 | ||
281 | /* Wait for exclusive access to hardware */ | 286 | /* Wait for exclusive access to hardware */ |
282 | mutex_lock(&ctrl->crit_sect); | 287 | mutex_lock(&ctrl->ctrl_lock); |
283 | 288 | ||
284 | if (POWER_CTRL(ctrl->ctrlcap)) { | 289 | if (POWER_CTRL(ctrl->ctrlcap)) { |
285 | /* Power on slot */ | 290 | /* Power on slot */ |
286 | rc = p_slot->hpc_ops->power_on_slot(p_slot); | 291 | rc = p_slot->hpc_ops->power_on_slot(p_slot); |
287 | if (rc) { | 292 | if (rc) { |
288 | mutex_unlock(&ctrl->crit_sect); | 293 | mutex_unlock(&ctrl->ctrl_lock); |
289 | return -1; | 294 | return -1; |
290 | } | 295 | } |
291 | 296 | ||
@@ -301,7 +306,7 @@ static int board_added(struct slot *p_slot) | |||
301 | } | 306 | } |
302 | 307 | ||
303 | /* Done with exclusive hardware access */ | 308 | /* Done with exclusive hardware access */ |
304 | mutex_unlock(&ctrl->crit_sect); | 309 | mutex_unlock(&ctrl->ctrl_lock); |
305 | 310 | ||
306 | /* Wait for ~1 second */ | 311 | /* Wait for ~1 second */ |
307 | wait_for_ctrl_irq (ctrl); | 312 | wait_for_ctrl_irq (ctrl); |
@@ -335,7 +340,7 @@ static int board_added(struct slot *p_slot) | |||
335 | pci_fixup_device(pci_fixup_final, ctrl->pci_dev); | 340 | pci_fixup_device(pci_fixup_final, ctrl->pci_dev); |
336 | if (PWR_LED(ctrl->ctrlcap)) { | 341 | if (PWR_LED(ctrl->ctrlcap)) { |
337 | /* Wait for exclusive access to hardware */ | 342 | /* Wait for exclusive access to hardware */ |
338 | mutex_lock(&ctrl->crit_sect); | 343 | mutex_lock(&ctrl->ctrl_lock); |
339 | 344 | ||
340 | p_slot->hpc_ops->green_led_on(p_slot); | 345 | p_slot->hpc_ops->green_led_on(p_slot); |
341 | 346 | ||
@@ -343,7 +348,7 @@ static int board_added(struct slot *p_slot) | |||
343 | wait_for_ctrl_irq (ctrl); | 348 | wait_for_ctrl_irq (ctrl); |
344 | 349 | ||
345 | /* Done with exclusive hardware access */ | 350 | /* Done with exclusive hardware access */ |
346 | mutex_unlock(&ctrl->crit_sect); | 351 | mutex_unlock(&ctrl->ctrl_lock); |
347 | } | 352 | } |
348 | return 0; | 353 | return 0; |
349 | 354 | ||
@@ -375,14 +380,14 @@ static int remove_board(struct slot *p_slot) | |||
375 | dbg("In %s, hp_slot = %d\n", __FUNCTION__, hp_slot); | 380 | dbg("In %s, hp_slot = %d\n", __FUNCTION__, hp_slot); |
376 | 381 | ||
377 | /* Wait for exclusive access to hardware */ | 382 | /* Wait for exclusive access to hardware */ |
378 | mutex_lock(&ctrl->crit_sect); | 383 | mutex_lock(&ctrl->ctrl_lock); |
379 | 384 | ||
380 | if (POWER_CTRL(ctrl->ctrlcap)) { | 385 | if (POWER_CTRL(ctrl->ctrlcap)) { |
381 | /* power off slot */ | 386 | /* power off slot */ |
382 | rc = p_slot->hpc_ops->power_off_slot(p_slot); | 387 | rc = p_slot->hpc_ops->power_off_slot(p_slot); |
383 | if (rc) { | 388 | if (rc) { |
384 | err("%s: Issue of Slot Disable command failed\n", __FUNCTION__); | 389 | err("%s: Issue of Slot Disable command failed\n", __FUNCTION__); |
385 | mutex_unlock(&ctrl->crit_sect); | 390 | mutex_unlock(&ctrl->ctrl_lock); |
386 | return rc; | 391 | return rc; |
387 | } | 392 | } |
388 | /* Wait for the command to complete */ | 393 | /* Wait for the command to complete */ |
@@ -398,7 +403,7 @@ static int remove_board(struct slot *p_slot) | |||
398 | } | 403 | } |
399 | 404 | ||
400 | /* Done with exclusive hardware access */ | 405 | /* Done with exclusive hardware access */ |
401 | mutex_unlock(&ctrl->crit_sect); | 406 | mutex_unlock(&ctrl->ctrl_lock); |
402 | 407 | ||
403 | return 0; | 408 | return 0; |
404 | } | 409 | } |
@@ -445,7 +450,7 @@ static void pciehp_pushbutton_thread(unsigned long slot) | |||
445 | 450 | ||
446 | if (pciehp_enable_slot(p_slot) && PWR_LED(p_slot->ctrl->ctrlcap)) { | 451 | if (pciehp_enable_slot(p_slot) && PWR_LED(p_slot->ctrl->ctrlcap)) { |
447 | /* Wait for exclusive access to hardware */ | 452 | /* Wait for exclusive access to hardware */ |
448 | mutex_lock(&p_slot->ctrl->crit_sect); | 453 | mutex_lock(&p_slot->ctrl->ctrl_lock); |
449 | 454 | ||
450 | p_slot->hpc_ops->green_led_off(p_slot); | 455 | p_slot->hpc_ops->green_led_off(p_slot); |
451 | 456 | ||
@@ -453,7 +458,7 @@ static void pciehp_pushbutton_thread(unsigned long slot) | |||
453 | wait_for_ctrl_irq (p_slot->ctrl); | 458 | wait_for_ctrl_irq (p_slot->ctrl); |
454 | 459 | ||
455 | /* Done with exclusive hardware access */ | 460 | /* Done with exclusive hardware access */ |
456 | mutex_unlock(&p_slot->ctrl->crit_sect); | 461 | mutex_unlock(&p_slot->ctrl->ctrl_lock); |
457 | } | 462 | } |
458 | p_slot->state = STATIC_STATE; | 463 | p_slot->state = STATIC_STATE; |
459 | } | 464 | } |
@@ -495,7 +500,7 @@ static void pciehp_surprise_rm_thread(unsigned long slot) | |||
495 | 500 | ||
496 | if (pciehp_enable_slot(p_slot) && PWR_LED(p_slot->ctrl->ctrlcap)) { | 501 | if (pciehp_enable_slot(p_slot) && PWR_LED(p_slot->ctrl->ctrlcap)) { |
497 | /* Wait for exclusive access to hardware */ | 502 | /* Wait for exclusive access to hardware */ |
498 | mutex_lock(&p_slot->ctrl->crit_sect); | 503 | mutex_lock(&p_slot->ctrl->ctrl_lock); |
499 | 504 | ||
500 | p_slot->hpc_ops->green_led_off(p_slot); | 505 | p_slot->hpc_ops->green_led_off(p_slot); |
501 | 506 | ||
@@ -503,7 +508,7 @@ static void pciehp_surprise_rm_thread(unsigned long slot) | |||
503 | wait_for_ctrl_irq (p_slot->ctrl); | 508 | wait_for_ctrl_irq (p_slot->ctrl); |
504 | 509 | ||
505 | /* Done with exclusive hardware access */ | 510 | /* Done with exclusive hardware access */ |
506 | mutex_unlock(&p_slot->ctrl->crit_sect); | 511 | mutex_unlock(&p_slot->ctrl->ctrl_lock); |
507 | } | 512 | } |
508 | p_slot->state = STATIC_STATE; | 513 | p_slot->state = STATIC_STATE; |
509 | } | 514 | } |
@@ -616,7 +621,7 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
616 | switch (p_slot->state) { | 621 | switch (p_slot->state) { |
617 | case BLINKINGOFF_STATE: | 622 | case BLINKINGOFF_STATE: |
618 | /* Wait for exclusive access to hardware */ | 623 | /* Wait for exclusive access to hardware */ |
619 | mutex_lock(&ctrl->crit_sect); | 624 | mutex_lock(&ctrl->ctrl_lock); |
620 | 625 | ||
621 | if (PWR_LED(ctrl->ctrlcap)) { | 626 | if (PWR_LED(ctrl->ctrlcap)) { |
622 | p_slot->hpc_ops->green_led_on(p_slot); | 627 | p_slot->hpc_ops->green_led_on(p_slot); |
@@ -630,11 +635,11 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
630 | wait_for_ctrl_irq (ctrl); | 635 | wait_for_ctrl_irq (ctrl); |
631 | } | 636 | } |
632 | /* Done with exclusive hardware access */ | 637 | /* Done with exclusive hardware access */ |
633 | mutex_unlock(&ctrl->crit_sect); | 638 | mutex_unlock(&ctrl->ctrl_lock); |
634 | break; | 639 | break; |
635 | case BLINKINGON_STATE: | 640 | case BLINKINGON_STATE: |
636 | /* Wait for exclusive access to hardware */ | 641 | /* Wait for exclusive access to hardware */ |
637 | mutex_lock(&ctrl->crit_sect); | 642 | mutex_lock(&ctrl->ctrl_lock); |
638 | 643 | ||
639 | if (PWR_LED(ctrl->ctrlcap)) { | 644 | if (PWR_LED(ctrl->ctrlcap)) { |
640 | p_slot->hpc_ops->green_led_off(p_slot); | 645 | p_slot->hpc_ops->green_led_off(p_slot); |
@@ -647,14 +652,14 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
647 | wait_for_ctrl_irq (ctrl); | 652 | wait_for_ctrl_irq (ctrl); |
648 | } | 653 | } |
649 | /* Done with exclusive hardware access */ | 654 | /* Done with exclusive hardware access */ |
650 | mutex_unlock(&ctrl->crit_sect); | 655 | mutex_unlock(&ctrl->ctrl_lock); |
651 | 656 | ||
652 | break; | 657 | break; |
653 | default: | 658 | default: |
654 | warn("Not a valid state\n"); | 659 | warn("Not a valid state\n"); |
655 | return; | 660 | return; |
656 | } | 661 | } |
657 | info(msg_button_cancel, p_slot->number); | 662 | info(msg_button_cancel, slot_name(p_slot)); |
658 | p_slot->state = STATIC_STATE; | 663 | p_slot->state = STATIC_STATE; |
659 | } | 664 | } |
660 | /* ***********Button Pressed (No action on 1st press...) */ | 665 | /* ***********Button Pressed (No action on 1st press...) */ |
@@ -667,16 +672,16 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
667 | /* slot is on */ | 672 | /* slot is on */ |
668 | dbg("slot is on\n"); | 673 | dbg("slot is on\n"); |
669 | p_slot->state = BLINKINGOFF_STATE; | 674 | p_slot->state = BLINKINGOFF_STATE; |
670 | info(msg_button_off, p_slot->number); | 675 | info(msg_button_off, slot_name(p_slot)); |
671 | } else { | 676 | } else { |
672 | /* slot is off */ | 677 | /* slot is off */ |
673 | dbg("slot is off\n"); | 678 | dbg("slot is off\n"); |
674 | p_slot->state = BLINKINGON_STATE; | 679 | p_slot->state = BLINKINGON_STATE; |
675 | info(msg_button_on, p_slot->number); | 680 | info(msg_button_on, slot_name(p_slot)); |
676 | } | 681 | } |
677 | 682 | ||
678 | /* Wait for exclusive access to hardware */ | 683 | /* Wait for exclusive access to hardware */ |
679 | mutex_lock(&ctrl->crit_sect); | 684 | mutex_lock(&ctrl->ctrl_lock); |
680 | 685 | ||
681 | /* blink green LED and turn off amber */ | 686 | /* blink green LED and turn off amber */ |
682 | if (PWR_LED(ctrl->ctrlcap)) { | 687 | if (PWR_LED(ctrl->ctrlcap)) { |
@@ -693,7 +698,7 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
693 | } | 698 | } |
694 | 699 | ||
695 | /* Done with exclusive hardware access */ | 700 | /* Done with exclusive hardware access */ |
696 | mutex_unlock(&ctrl->crit_sect); | 701 | mutex_unlock(&ctrl->ctrl_lock); |
697 | 702 | ||
698 | init_timer(&p_slot->task_event); | 703 | init_timer(&p_slot->task_event); |
699 | p_slot->task_event.expires = jiffies + 5 * HZ; /* 5 second delay */ | 704 | p_slot->task_event.expires = jiffies + 5 * HZ; /* 5 second delay */ |
@@ -708,7 +713,7 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
708 | if (POWER_CTRL(ctrl->ctrlcap)) { | 713 | if (POWER_CTRL(ctrl->ctrlcap)) { |
709 | dbg("power fault\n"); | 714 | dbg("power fault\n"); |
710 | /* Wait for exclusive access to hardware */ | 715 | /* Wait for exclusive access to hardware */ |
711 | mutex_lock(&ctrl->crit_sect); | 716 | mutex_lock(&ctrl->ctrl_lock); |
712 | 717 | ||
713 | if (ATTN_LED(ctrl->ctrlcap)) { | 718 | if (ATTN_LED(ctrl->ctrlcap)) { |
714 | p_slot->hpc_ops->set_attention_status(p_slot, 1); | 719 | p_slot->hpc_ops->set_attention_status(p_slot, 1); |
@@ -721,7 +726,7 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
721 | } | 726 | } |
722 | 727 | ||
723 | /* Done with exclusive hardware access */ | 728 | /* Done with exclusive hardware access */ |
724 | mutex_unlock(&ctrl->crit_sect); | 729 | mutex_unlock(&ctrl->ctrl_lock); |
725 | } | 730 | } |
726 | } | 731 | } |
727 | /***********SURPRISE REMOVAL********************/ | 732 | /***********SURPRISE REMOVAL********************/ |
@@ -760,14 +765,16 @@ int pciehp_enable_slot(struct slot *p_slot) | |||
760 | 765 | ||
761 | rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); | 766 | rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); |
762 | if (rc || !getstatus) { | 767 | if (rc || !getstatus) { |
763 | info("%s: no adapter on slot(%x)\n", __FUNCTION__, p_slot->number); | 768 | info("%s: no adapter on slot(%s)\n", __FUNCTION__, |
769 | slot_name(p_slot)); | ||
764 | mutex_unlock(&p_slot->ctrl->crit_sect); | 770 | mutex_unlock(&p_slot->ctrl->crit_sect); |
765 | return -ENODEV; | 771 | return -ENODEV; |
766 | } | 772 | } |
767 | if (MRL_SENS(p_slot->ctrl->ctrlcap)) { | 773 | if (MRL_SENS(p_slot->ctrl->ctrlcap)) { |
768 | rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); | 774 | rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); |
769 | if (rc || getstatus) { | 775 | if (rc || getstatus) { |
770 | info("%s: latch open on slot(%x)\n", __FUNCTION__, p_slot->number); | 776 | info("%s: latch open on slot(%s)\n", __FUNCTION__, |
777 | slot_name(p_slot)); | ||
771 | mutex_unlock(&p_slot->ctrl->crit_sect); | 778 | mutex_unlock(&p_slot->ctrl->crit_sect); |
772 | return -ENODEV; | 779 | return -ENODEV; |
773 | } | 780 | } |
@@ -776,12 +783,12 @@ int pciehp_enable_slot(struct slot *p_slot) | |||
776 | if (POWER_CTRL(p_slot->ctrl->ctrlcap)) { | 783 | if (POWER_CTRL(p_slot->ctrl->ctrlcap)) { |
777 | rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); | 784 | rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); |
778 | if (rc || getstatus) { | 785 | if (rc || getstatus) { |
779 | info("%s: already enabled on slot(%x)\n", __FUNCTION__, p_slot->number); | 786 | info("%s: already enabled on slot(%s)\n", __FUNCTION__, |
787 | slot_name(p_slot)); | ||
780 | mutex_unlock(&p_slot->ctrl->crit_sect); | 788 | mutex_unlock(&p_slot->ctrl->crit_sect); |
781 | return -EINVAL; | 789 | return -EINVAL; |
782 | } | 790 | } |
783 | } | 791 | } |
784 | mutex_unlock(&p_slot->ctrl->crit_sect); | ||
785 | 792 | ||
786 | p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); | 793 | p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); |
787 | 794 | ||
@@ -790,9 +797,9 @@ int pciehp_enable_slot(struct slot *p_slot) | |||
790 | p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); | 797 | p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); |
791 | } | 798 | } |
792 | 799 | ||
793 | if (p_slot) | 800 | update_slot_info(p_slot); |
794 | update_slot_info(p_slot); | ||
795 | 801 | ||
802 | mutex_unlock(&p_slot->ctrl->crit_sect); | ||
796 | return rc; | 803 | return rc; |
797 | } | 804 | } |
798 | 805 | ||
@@ -811,7 +818,8 @@ int pciehp_disable_slot(struct slot *p_slot) | |||
811 | if (!HP_SUPR_RM(p_slot->ctrl->ctrlcap)) { | 818 | if (!HP_SUPR_RM(p_slot->ctrl->ctrlcap)) { |
812 | ret = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); | 819 | ret = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); |
813 | if (ret || !getstatus) { | 820 | if (ret || !getstatus) { |
814 | info("%s: no adapter on slot(%x)\n", __FUNCTION__, p_slot->number); | 821 | info("%s: no adapter on slot(%s)\n", __FUNCTION__, |
822 | slot_name(p_slot)); | ||
815 | mutex_unlock(&p_slot->ctrl->crit_sect); | 823 | mutex_unlock(&p_slot->ctrl->crit_sect); |
816 | return -ENODEV; | 824 | return -ENODEV; |
817 | } | 825 | } |
@@ -820,7 +828,8 @@ int pciehp_disable_slot(struct slot *p_slot) | |||
820 | if (MRL_SENS(p_slot->ctrl->ctrlcap)) { | 828 | if (MRL_SENS(p_slot->ctrl->ctrlcap)) { |
821 | ret = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); | 829 | ret = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); |
822 | if (ret || getstatus) { | 830 | if (ret || getstatus) { |
823 | info("%s: latch open on slot(%x)\n", __FUNCTION__, p_slot->number); | 831 | info("%s: latch open on slot(%s)\n", __FUNCTION__, |
832 | slot_name(p_slot)); | ||
824 | mutex_unlock(&p_slot->ctrl->crit_sect); | 833 | mutex_unlock(&p_slot->ctrl->crit_sect); |
825 | return -ENODEV; | 834 | return -ENODEV; |
826 | } | 835 | } |
@@ -829,16 +838,17 @@ int pciehp_disable_slot(struct slot *p_slot) | |||
829 | if (POWER_CTRL(p_slot->ctrl->ctrlcap)) { | 838 | if (POWER_CTRL(p_slot->ctrl->ctrlcap)) { |
830 | ret = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); | 839 | ret = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); |
831 | if (ret || !getstatus) { | 840 | if (ret || !getstatus) { |
832 | info("%s: already disabled slot(%x)\n", __FUNCTION__, p_slot->number); | 841 | info("%s: already disabled slot(%s)\n", __FUNCTION__, |
842 | slot_name(p_slot)); | ||
833 | mutex_unlock(&p_slot->ctrl->crit_sect); | 843 | mutex_unlock(&p_slot->ctrl->crit_sect); |
834 | return -EINVAL; | 844 | return -EINVAL; |
835 | } | 845 | } |
836 | } | 846 | } |
837 | 847 | ||
838 | mutex_unlock(&p_slot->ctrl->crit_sect); | ||
839 | |||
840 | ret = remove_board(p_slot); | 848 | ret = remove_board(p_slot); |
841 | update_slot_info(p_slot); | 849 | update_slot_info(p_slot); |
850 | |||
851 | mutex_unlock(&p_slot->ctrl->crit_sect); | ||
842 | return ret; | 852 | return ret; |
843 | } | 853 | } |
844 | 854 | ||