diff options
Diffstat (limited to 'drivers/pci/hotplug/pciehp_ctrl.c')
-rw-r--r-- | drivers/pci/hotplug/pciehp_ctrl.c | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c index 83c4b865718a..33d198768356 100644 --- a/drivers/pci/hotplug/pciehp_ctrl.c +++ b/drivers/pci/hotplug/pciehp_ctrl.c | |||
@@ -229,13 +229,13 @@ u8 pciehp_handle_power_fault(u8 hp_slot, void *inst_id) | |||
229 | static void set_slot_off(struct controller *ctrl, struct slot * pslot) | 229 | static void set_slot_off(struct controller *ctrl, struct slot * pslot) |
230 | { | 230 | { |
231 | /* Wait for exclusive access to hardware */ | 231 | /* Wait for exclusive access to hardware */ |
232 | down(&ctrl->crit_sect); | 232 | mutex_lock(&ctrl->crit_sect); |
233 | 233 | ||
234 | /* turn off slot, turn on Amber LED, turn off Green LED if supported*/ | 234 | /* turn off slot, turn on Amber LED, turn off Green LED if supported*/ |
235 | if (POWER_CTRL(ctrl->ctrlcap)) { | 235 | if (POWER_CTRL(ctrl->ctrlcap)) { |
236 | if (pslot->hpc_ops->power_off_slot(pslot)) { | 236 | if (pslot->hpc_ops->power_off_slot(pslot)) { |
237 | err("%s: Issue of Slot Power Off command failed\n", __FUNCTION__); | 237 | err("%s: Issue of Slot Power Off command failed\n", __FUNCTION__); |
238 | up(&ctrl->crit_sect); | 238 | mutex_unlock(&ctrl->crit_sect); |
239 | return; | 239 | return; |
240 | } | 240 | } |
241 | wait_for_ctrl_irq (ctrl); | 241 | wait_for_ctrl_irq (ctrl); |
@@ -249,14 +249,14 @@ static void set_slot_off(struct controller *ctrl, struct slot * pslot) | |||
249 | if (ATTN_LED(ctrl->ctrlcap)) { | 249 | if (ATTN_LED(ctrl->ctrlcap)) { |
250 | if (pslot->hpc_ops->set_attention_status(pslot, 1)) { | 250 | if (pslot->hpc_ops->set_attention_status(pslot, 1)) { |
251 | err("%s: Issue of Set Attention Led command failed\n", __FUNCTION__); | 251 | err("%s: Issue of Set Attention Led command failed\n", __FUNCTION__); |
252 | up(&ctrl->crit_sect); | 252 | mutex_unlock(&ctrl->crit_sect); |
253 | return; | 253 | return; |
254 | } | 254 | } |
255 | wait_for_ctrl_irq (ctrl); | 255 | wait_for_ctrl_irq (ctrl); |
256 | } | 256 | } |
257 | 257 | ||
258 | /* Done with exclusive hardware access */ | 258 | /* Done with exclusive hardware access */ |
259 | up(&ctrl->crit_sect); | 259 | mutex_unlock(&ctrl->crit_sect); |
260 | } | 260 | } |
261 | 261 | ||
262 | /** | 262 | /** |
@@ -279,13 +279,13 @@ static int board_added(struct slot *p_slot) | |||
279 | ctrl->slot_device_offset, hp_slot); | 279 | ctrl->slot_device_offset, hp_slot); |
280 | 280 | ||
281 | /* Wait for exclusive access to hardware */ | 281 | /* Wait for exclusive access to hardware */ |
282 | down(&ctrl->crit_sect); | 282 | mutex_lock(&ctrl->crit_sect); |
283 | 283 | ||
284 | if (POWER_CTRL(ctrl->ctrlcap)) { | 284 | if (POWER_CTRL(ctrl->ctrlcap)) { |
285 | /* Power on slot */ | 285 | /* Power on slot */ |
286 | rc = p_slot->hpc_ops->power_on_slot(p_slot); | 286 | rc = p_slot->hpc_ops->power_on_slot(p_slot); |
287 | if (rc) { | 287 | if (rc) { |
288 | up(&ctrl->crit_sect); | 288 | mutex_unlock(&ctrl->crit_sect); |
289 | return -1; | 289 | return -1; |
290 | } | 290 | } |
291 | 291 | ||
@@ -301,7 +301,7 @@ static int board_added(struct slot *p_slot) | |||
301 | } | 301 | } |
302 | 302 | ||
303 | /* Done with exclusive hardware access */ | 303 | /* Done with exclusive hardware access */ |
304 | up(&ctrl->crit_sect); | 304 | mutex_unlock(&ctrl->crit_sect); |
305 | 305 | ||
306 | /* Wait for ~1 second */ | 306 | /* Wait for ~1 second */ |
307 | wait_for_ctrl_irq (ctrl); | 307 | wait_for_ctrl_irq (ctrl); |
@@ -335,7 +335,7 @@ static int board_added(struct slot *p_slot) | |||
335 | pci_fixup_device(pci_fixup_final, ctrl->pci_dev); | 335 | pci_fixup_device(pci_fixup_final, ctrl->pci_dev); |
336 | if (PWR_LED(ctrl->ctrlcap)) { | 336 | if (PWR_LED(ctrl->ctrlcap)) { |
337 | /* Wait for exclusive access to hardware */ | 337 | /* Wait for exclusive access to hardware */ |
338 | down(&ctrl->crit_sect); | 338 | mutex_lock(&ctrl->crit_sect); |
339 | 339 | ||
340 | p_slot->hpc_ops->green_led_on(p_slot); | 340 | p_slot->hpc_ops->green_led_on(p_slot); |
341 | 341 | ||
@@ -343,7 +343,7 @@ static int board_added(struct slot *p_slot) | |||
343 | wait_for_ctrl_irq (ctrl); | 343 | wait_for_ctrl_irq (ctrl); |
344 | 344 | ||
345 | /* Done with exclusive hardware access */ | 345 | /* Done with exclusive hardware access */ |
346 | up(&ctrl->crit_sect); | 346 | mutex_unlock(&ctrl->crit_sect); |
347 | } | 347 | } |
348 | return 0; | 348 | return 0; |
349 | 349 | ||
@@ -375,14 +375,14 @@ static int remove_board(struct slot *p_slot) | |||
375 | dbg("In %s, hp_slot = %d\n", __FUNCTION__, hp_slot); | 375 | dbg("In %s, hp_slot = %d\n", __FUNCTION__, hp_slot); |
376 | 376 | ||
377 | /* Wait for exclusive access to hardware */ | 377 | /* Wait for exclusive access to hardware */ |
378 | down(&ctrl->crit_sect); | 378 | mutex_lock(&ctrl->crit_sect); |
379 | 379 | ||
380 | if (POWER_CTRL(ctrl->ctrlcap)) { | 380 | if (POWER_CTRL(ctrl->ctrlcap)) { |
381 | /* power off slot */ | 381 | /* power off slot */ |
382 | rc = p_slot->hpc_ops->power_off_slot(p_slot); | 382 | rc = p_slot->hpc_ops->power_off_slot(p_slot); |
383 | if (rc) { | 383 | if (rc) { |
384 | err("%s: Issue of Slot Disable command failed\n", __FUNCTION__); | 384 | err("%s: Issue of Slot Disable command failed\n", __FUNCTION__); |
385 | up(&ctrl->crit_sect); | 385 | mutex_unlock(&ctrl->crit_sect); |
386 | return rc; | 386 | return rc; |
387 | } | 387 | } |
388 | /* Wait for the command to complete */ | 388 | /* Wait for the command to complete */ |
@@ -398,7 +398,7 @@ static int remove_board(struct slot *p_slot) | |||
398 | } | 398 | } |
399 | 399 | ||
400 | /* Done with exclusive hardware access */ | 400 | /* Done with exclusive hardware access */ |
401 | up(&ctrl->crit_sect); | 401 | mutex_unlock(&ctrl->crit_sect); |
402 | 402 | ||
403 | return 0; | 403 | return 0; |
404 | } | 404 | } |
@@ -445,7 +445,7 @@ static void pciehp_pushbutton_thread(unsigned long slot) | |||
445 | 445 | ||
446 | if (pciehp_enable_slot(p_slot) && PWR_LED(p_slot->ctrl->ctrlcap)) { | 446 | if (pciehp_enable_slot(p_slot) && PWR_LED(p_slot->ctrl->ctrlcap)) { |
447 | /* Wait for exclusive access to hardware */ | 447 | /* Wait for exclusive access to hardware */ |
448 | down(&p_slot->ctrl->crit_sect); | 448 | mutex_lock(&p_slot->ctrl->crit_sect); |
449 | 449 | ||
450 | p_slot->hpc_ops->green_led_off(p_slot); | 450 | p_slot->hpc_ops->green_led_off(p_slot); |
451 | 451 | ||
@@ -453,7 +453,7 @@ static void pciehp_pushbutton_thread(unsigned long slot) | |||
453 | wait_for_ctrl_irq (p_slot->ctrl); | 453 | wait_for_ctrl_irq (p_slot->ctrl); |
454 | 454 | ||
455 | /* Done with exclusive hardware access */ | 455 | /* Done with exclusive hardware access */ |
456 | up(&p_slot->ctrl->crit_sect); | 456 | mutex_unlock(&p_slot->ctrl->crit_sect); |
457 | } | 457 | } |
458 | p_slot->state = STATIC_STATE; | 458 | p_slot->state = STATIC_STATE; |
459 | } | 459 | } |
@@ -495,7 +495,7 @@ static void pciehp_surprise_rm_thread(unsigned long slot) | |||
495 | 495 | ||
496 | if (pciehp_enable_slot(p_slot) && PWR_LED(p_slot->ctrl->ctrlcap)) { | 496 | if (pciehp_enable_slot(p_slot) && PWR_LED(p_slot->ctrl->ctrlcap)) { |
497 | /* Wait for exclusive access to hardware */ | 497 | /* Wait for exclusive access to hardware */ |
498 | down(&p_slot->ctrl->crit_sect); | 498 | mutex_lock(&p_slot->ctrl->crit_sect); |
499 | 499 | ||
500 | p_slot->hpc_ops->green_led_off(p_slot); | 500 | p_slot->hpc_ops->green_led_off(p_slot); |
501 | 501 | ||
@@ -503,7 +503,7 @@ static void pciehp_surprise_rm_thread(unsigned long slot) | |||
503 | wait_for_ctrl_irq (p_slot->ctrl); | 503 | wait_for_ctrl_irq (p_slot->ctrl); |
504 | 504 | ||
505 | /* Done with exclusive hardware access */ | 505 | /* Done with exclusive hardware access */ |
506 | up(&p_slot->ctrl->crit_sect); | 506 | mutex_unlock(&p_slot->ctrl->crit_sect); |
507 | } | 507 | } |
508 | p_slot->state = STATIC_STATE; | 508 | p_slot->state = STATIC_STATE; |
509 | } | 509 | } |
@@ -616,7 +616,7 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
616 | switch (p_slot->state) { | 616 | switch (p_slot->state) { |
617 | case BLINKINGOFF_STATE: | 617 | case BLINKINGOFF_STATE: |
618 | /* Wait for exclusive access to hardware */ | 618 | /* Wait for exclusive access to hardware */ |
619 | down(&ctrl->crit_sect); | 619 | mutex_lock(&ctrl->crit_sect); |
620 | 620 | ||
621 | if (PWR_LED(ctrl->ctrlcap)) { | 621 | if (PWR_LED(ctrl->ctrlcap)) { |
622 | p_slot->hpc_ops->green_led_on(p_slot); | 622 | p_slot->hpc_ops->green_led_on(p_slot); |
@@ -630,11 +630,11 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
630 | wait_for_ctrl_irq (ctrl); | 630 | wait_for_ctrl_irq (ctrl); |
631 | } | 631 | } |
632 | /* Done with exclusive hardware access */ | 632 | /* Done with exclusive hardware access */ |
633 | up(&ctrl->crit_sect); | 633 | mutex_unlock(&ctrl->crit_sect); |
634 | break; | 634 | break; |
635 | case BLINKINGON_STATE: | 635 | case BLINKINGON_STATE: |
636 | /* Wait for exclusive access to hardware */ | 636 | /* Wait for exclusive access to hardware */ |
637 | down(&ctrl->crit_sect); | 637 | mutex_lock(&ctrl->crit_sect); |
638 | 638 | ||
639 | if (PWR_LED(ctrl->ctrlcap)) { | 639 | if (PWR_LED(ctrl->ctrlcap)) { |
640 | p_slot->hpc_ops->green_led_off(p_slot); | 640 | p_slot->hpc_ops->green_led_off(p_slot); |
@@ -647,7 +647,7 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
647 | wait_for_ctrl_irq (ctrl); | 647 | wait_for_ctrl_irq (ctrl); |
648 | } | 648 | } |
649 | /* Done with exclusive hardware access */ | 649 | /* Done with exclusive hardware access */ |
650 | up(&ctrl->crit_sect); | 650 | mutex_unlock(&ctrl->crit_sect); |
651 | 651 | ||
652 | break; | 652 | break; |
653 | default: | 653 | default: |
@@ -676,7 +676,7 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
676 | } | 676 | } |
677 | 677 | ||
678 | /* Wait for exclusive access to hardware */ | 678 | /* Wait for exclusive access to hardware */ |
679 | down(&ctrl->crit_sect); | 679 | mutex_lock(&ctrl->crit_sect); |
680 | 680 | ||
681 | /* blink green LED and turn off amber */ | 681 | /* blink green LED and turn off amber */ |
682 | if (PWR_LED(ctrl->ctrlcap)) { | 682 | if (PWR_LED(ctrl->ctrlcap)) { |
@@ -693,7 +693,7 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
693 | } | 693 | } |
694 | 694 | ||
695 | /* Done with exclusive hardware access */ | 695 | /* Done with exclusive hardware access */ |
696 | up(&ctrl->crit_sect); | 696 | mutex_unlock(&ctrl->crit_sect); |
697 | 697 | ||
698 | init_timer(&p_slot->task_event); | 698 | init_timer(&p_slot->task_event); |
699 | p_slot->task_event.expires = jiffies + 5 * HZ; /* 5 second delay */ | 699 | p_slot->task_event.expires = jiffies + 5 * HZ; /* 5 second delay */ |
@@ -708,7 +708,7 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
708 | if (POWER_CTRL(ctrl->ctrlcap)) { | 708 | if (POWER_CTRL(ctrl->ctrlcap)) { |
709 | dbg("power fault\n"); | 709 | dbg("power fault\n"); |
710 | /* Wait for exclusive access to hardware */ | 710 | /* Wait for exclusive access to hardware */ |
711 | down(&ctrl->crit_sect); | 711 | mutex_lock(&ctrl->crit_sect); |
712 | 712 | ||
713 | if (ATTN_LED(ctrl->ctrlcap)) { | 713 | if (ATTN_LED(ctrl->ctrlcap)) { |
714 | p_slot->hpc_ops->set_attention_status(p_slot, 1); | 714 | p_slot->hpc_ops->set_attention_status(p_slot, 1); |
@@ -721,7 +721,7 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
721 | } | 721 | } |
722 | 722 | ||
723 | /* Done with exclusive hardware access */ | 723 | /* Done with exclusive hardware access */ |
724 | up(&ctrl->crit_sect); | 724 | mutex_unlock(&ctrl->crit_sect); |
725 | } | 725 | } |
726 | } | 726 | } |
727 | /***********SURPRISE REMOVAL********************/ | 727 | /***********SURPRISE REMOVAL********************/ |
@@ -756,19 +756,19 @@ int pciehp_enable_slot(struct slot *p_slot) | |||
756 | int rc; | 756 | int rc; |
757 | 757 | ||
758 | /* Check to see if (latch closed, card present, power off) */ | 758 | /* Check to see if (latch closed, card present, power off) */ |
759 | down(&p_slot->ctrl->crit_sect); | 759 | mutex_lock(&p_slot->ctrl->crit_sect); |
760 | 760 | ||
761 | rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); | 761 | rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); |
762 | if (rc || !getstatus) { | 762 | if (rc || !getstatus) { |
763 | info("%s: no adapter on slot(%x)\n", __FUNCTION__, p_slot->number); | 763 | info("%s: no adapter on slot(%x)\n", __FUNCTION__, p_slot->number); |
764 | up(&p_slot->ctrl->crit_sect); | 764 | mutex_unlock(&p_slot->ctrl->crit_sect); |
765 | return 1; | 765 | return 1; |
766 | } | 766 | } |
767 | if (MRL_SENS(p_slot->ctrl->ctrlcap)) { | 767 | if (MRL_SENS(p_slot->ctrl->ctrlcap)) { |
768 | rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); | 768 | rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); |
769 | if (rc || getstatus) { | 769 | if (rc || getstatus) { |
770 | info("%s: latch open on slot(%x)\n", __FUNCTION__, p_slot->number); | 770 | info("%s: latch open on slot(%x)\n", __FUNCTION__, p_slot->number); |
771 | up(&p_slot->ctrl->crit_sect); | 771 | mutex_unlock(&p_slot->ctrl->crit_sect); |
772 | return 1; | 772 | return 1; |
773 | } | 773 | } |
774 | } | 774 | } |
@@ -777,11 +777,11 @@ int pciehp_enable_slot(struct slot *p_slot) | |||
777 | rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); | 777 | rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); |
778 | if (rc || getstatus) { | 778 | if (rc || getstatus) { |
779 | info("%s: already enabled on slot(%x)\n", __FUNCTION__, p_slot->number); | 779 | info("%s: already enabled on slot(%x)\n", __FUNCTION__, p_slot->number); |
780 | up(&p_slot->ctrl->crit_sect); | 780 | mutex_unlock(&p_slot->ctrl->crit_sect); |
781 | return 1; | 781 | return 1; |
782 | } | 782 | } |
783 | } | 783 | } |
784 | up(&p_slot->ctrl->crit_sect); | 784 | mutex_unlock(&p_slot->ctrl->crit_sect); |
785 | 785 | ||
786 | p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); | 786 | p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); |
787 | 787 | ||
@@ -806,13 +806,13 @@ int pciehp_disable_slot(struct slot *p_slot) | |||
806 | return 1; | 806 | return 1; |
807 | 807 | ||
808 | /* Check to see if (latch closed, card present, power on) */ | 808 | /* Check to see if (latch closed, card present, power on) */ |
809 | down(&p_slot->ctrl->crit_sect); | 809 | mutex_lock(&p_slot->ctrl->crit_sect); |
810 | 810 | ||
811 | if (!HP_SUPR_RM(p_slot->ctrl->ctrlcap)) { | 811 | if (!HP_SUPR_RM(p_slot->ctrl->ctrlcap)) { |
812 | ret = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); | 812 | ret = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); |
813 | if (ret || !getstatus) { | 813 | if (ret || !getstatus) { |
814 | info("%s: no adapter on slot(%x)\n", __FUNCTION__, p_slot->number); | 814 | info("%s: no adapter on slot(%x)\n", __FUNCTION__, p_slot->number); |
815 | up(&p_slot->ctrl->crit_sect); | 815 | mutex_unlock(&p_slot->ctrl->crit_sect); |
816 | return 1; | 816 | return 1; |
817 | } | 817 | } |
818 | } | 818 | } |
@@ -821,7 +821,7 @@ int pciehp_disable_slot(struct slot *p_slot) | |||
821 | ret = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); | 821 | ret = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); |
822 | if (ret || getstatus) { | 822 | if (ret || getstatus) { |
823 | info("%s: latch open on slot(%x)\n", __FUNCTION__, p_slot->number); | 823 | info("%s: latch open on slot(%x)\n", __FUNCTION__, p_slot->number); |
824 | up(&p_slot->ctrl->crit_sect); | 824 | mutex_unlock(&p_slot->ctrl->crit_sect); |
825 | return 1; | 825 | return 1; |
826 | } | 826 | } |
827 | } | 827 | } |
@@ -830,12 +830,12 @@ int pciehp_disable_slot(struct slot *p_slot) | |||
830 | ret = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); | 830 | ret = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); |
831 | if (ret || !getstatus) { | 831 | if (ret || !getstatus) { |
832 | info("%s: already disabled slot(%x)\n", __FUNCTION__, p_slot->number); | 832 | info("%s: already disabled slot(%x)\n", __FUNCTION__, p_slot->number); |
833 | up(&p_slot->ctrl->crit_sect); | 833 | mutex_unlock(&p_slot->ctrl->crit_sect); |
834 | return 1; | 834 | return 1; |
835 | } | 835 | } |
836 | } | 836 | } |
837 | 837 | ||
838 | up(&p_slot->ctrl->crit_sect); | 838 | mutex_unlock(&p_slot->ctrl->crit_sect); |
839 | 839 | ||
840 | ret = remove_board(p_slot); | 840 | ret = remove_board(p_slot); |
841 | update_slot_info(p_slot); | 841 | update_slot_info(p_slot); |