aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/pciehp_hpc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/hotplug/pciehp_hpc.c')
-rw-r--r--drivers/pci/hotplug/pciehp_hpc.c144
1 files changed, 72 insertions, 72 deletions
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 698975a6a21c..b4bbd07d1e39 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -258,7 +258,7 @@ static int pcie_write_cmd(struct slot *slot, u16 cmd, u16 mask)
258 258
259 retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); 259 retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status);
260 if (retval) { 260 if (retval) {
261 err("%s: Cannot read SLOTSTATUS register\n", __FUNCTION__); 261 err("%s: Cannot read SLOTSTATUS register\n", __func__);
262 goto out; 262 goto out;
263 } 263 }
264 264
@@ -267,13 +267,13 @@ static int pcie_write_cmd(struct slot *slot, u16 cmd, u16 mask)
267 proceed forward to issue the next command according 267 proceed forward to issue the next command according
268 to spec. Just print out the error message */ 268 to spec. Just print out the error message */
269 dbg("%s: CMD_COMPLETED not clear after 1 sec.\n", 269 dbg("%s: CMD_COMPLETED not clear after 1 sec.\n",
270 __FUNCTION__); 270 __func__);
271 } 271 }
272 272
273 spin_lock_irqsave(&ctrl->lock, flags); 273 spin_lock_irqsave(&ctrl->lock, flags);
274 retval = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl); 274 retval = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl);
275 if (retval) { 275 if (retval) {
276 err("%s: Cannot read SLOTCTRL register\n", __FUNCTION__); 276 err("%s: Cannot read SLOTCTRL register\n", __func__);
277 goto out_spin_unlock; 277 goto out_spin_unlock;
278 } 278 }
279 279
@@ -283,7 +283,7 @@ static int pcie_write_cmd(struct slot *slot, u16 cmd, u16 mask)
283 ctrl->cmd_busy = 1; 283 ctrl->cmd_busy = 1;
284 retval = pciehp_writew(ctrl, SLOTCTRL, slot_ctrl); 284 retval = pciehp_writew(ctrl, SLOTCTRL, slot_ctrl);
285 if (retval) 285 if (retval)
286 err("%s: Cannot write to SLOTCTRL register\n", __FUNCTION__); 286 err("%s: Cannot write to SLOTCTRL register\n", __func__);
287 287
288 out_spin_unlock: 288 out_spin_unlock:
289 spin_unlock_irqrestore(&ctrl->lock, flags); 289 spin_unlock_irqrestore(&ctrl->lock, flags);
@@ -305,14 +305,14 @@ static int hpc_check_lnk_status(struct controller *ctrl)
305 305
306 retval = pciehp_readw(ctrl, LNKSTATUS, &lnk_status); 306 retval = pciehp_readw(ctrl, LNKSTATUS, &lnk_status);
307 if (retval) { 307 if (retval) {
308 err("%s: Cannot read LNKSTATUS register\n", __FUNCTION__); 308 err("%s: Cannot read LNKSTATUS register\n", __func__);
309 return retval; 309 return retval;
310 } 310 }
311 311
312 dbg("%s: lnk_status = %x\n", __FUNCTION__, lnk_status); 312 dbg("%s: lnk_status = %x\n", __func__, lnk_status);
313 if ( (lnk_status & LNK_TRN) || (lnk_status & LNK_TRN_ERR) || 313 if ( (lnk_status & LNK_TRN) || (lnk_status & LNK_TRN_ERR) ||
314 !(lnk_status & NEG_LINK_WD)) { 314 !(lnk_status & NEG_LINK_WD)) {
315 err("%s : Link Training Error occurs \n", __FUNCTION__); 315 err("%s : Link Training Error occurs \n", __func__);
316 retval = -1; 316 retval = -1;
317 return retval; 317 return retval;
318 } 318 }
@@ -329,12 +329,12 @@ static int hpc_get_attention_status(struct slot *slot, u8 *status)
329 329
330 retval = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl); 330 retval = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl);
331 if (retval) { 331 if (retval) {
332 err("%s: Cannot read SLOTCTRL register\n", __FUNCTION__); 332 err("%s: Cannot read SLOTCTRL register\n", __func__);
333 return retval; 333 return retval;
334 } 334 }
335 335
336 dbg("%s: SLOTCTRL %x, value read %x\n", 336 dbg("%s: SLOTCTRL %x, value read %x\n",
337 __FUNCTION__, ctrl->cap_base + SLOTCTRL, slot_ctrl); 337 __func__, ctrl->cap_base + SLOTCTRL, slot_ctrl);
338 338
339 atten_led_state = (slot_ctrl & ATTN_LED_CTRL) >> 6; 339 atten_led_state = (slot_ctrl & ATTN_LED_CTRL) >> 6;
340 340
@@ -368,11 +368,11 @@ static int hpc_get_power_status(struct slot *slot, u8 *status)
368 368
369 retval = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl); 369 retval = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl);
370 if (retval) { 370 if (retval) {
371 err("%s: Cannot read SLOTCTRL register\n", __FUNCTION__); 371 err("%s: Cannot read SLOTCTRL register\n", __func__);
372 return retval; 372 return retval;
373 } 373 }
374 dbg("%s: SLOTCTRL %x value read %x\n", 374 dbg("%s: SLOTCTRL %x value read %x\n",
375 __FUNCTION__, ctrl->cap_base + SLOTCTRL, slot_ctrl); 375 __func__, ctrl->cap_base + SLOTCTRL, slot_ctrl);
376 376
377 pwr_state = (slot_ctrl & PWR_CTRL) >> 10; 377 pwr_state = (slot_ctrl & PWR_CTRL) >> 10;
378 378
@@ -399,7 +399,7 @@ static int hpc_get_latch_status(struct slot *slot, u8 *status)
399 399
400 retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); 400 retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status);
401 if (retval) { 401 if (retval) {
402 err("%s: Cannot read SLOTSTATUS register\n", __FUNCTION__); 402 err("%s: Cannot read SLOTSTATUS register\n", __func__);
403 return retval; 403 return retval;
404 } 404 }
405 405
@@ -417,7 +417,7 @@ static int hpc_get_adapter_status(struct slot *slot, u8 *status)
417 417
418 retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); 418 retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status);
419 if (retval) { 419 if (retval) {
420 err("%s: Cannot read SLOTSTATUS register\n", __FUNCTION__); 420 err("%s: Cannot read SLOTSTATUS register\n", __func__);
421 return retval; 421 return retval;
422 } 422 }
423 card_state = (u8)((slot_status & PRSN_STATE) >> 6); 423 card_state = (u8)((slot_status & PRSN_STATE) >> 6);
@@ -435,7 +435,7 @@ static int hpc_query_power_fault(struct slot *slot)
435 435
436 retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); 436 retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status);
437 if (retval) { 437 if (retval) {
438 err("%s: Cannot check for power fault\n", __FUNCTION__); 438 err("%s: Cannot check for power fault\n", __func__);
439 return retval; 439 return retval;
440 } 440 }
441 pwr_fault = (u8)((slot_status & PWR_FAULT_DETECTED) >> 1); 441 pwr_fault = (u8)((slot_status & PWR_FAULT_DETECTED) >> 1);
@@ -451,7 +451,7 @@ static int hpc_get_emi_status(struct slot *slot, u8 *status)
451 451
452 retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); 452 retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status);
453 if (retval) { 453 if (retval) {
454 err("%s : Cannot check EMI status\n", __FUNCTION__); 454 err("%s : Cannot check EMI status\n", __func__);
455 return retval; 455 return retval;
456 } 456 }
457 *status = (slot_status & EMI_STATE) >> EMI_STATUS_BIT; 457 *status = (slot_status & EMI_STATE) >> EMI_STATUS_BIT;
@@ -506,7 +506,7 @@ static int hpc_set_attention_status(struct slot *slot, u8 value)
506 506
507 rc = pcie_write_cmd(slot, slot_cmd, cmd_mask); 507 rc = pcie_write_cmd(slot, slot_cmd, cmd_mask);
508 dbg("%s: SLOTCTRL %x write cmd %x\n", 508 dbg("%s: SLOTCTRL %x write cmd %x\n",
509 __FUNCTION__, ctrl->cap_base + SLOTCTRL, slot_cmd); 509 __func__, ctrl->cap_base + SLOTCTRL, slot_cmd);
510 510
511 return rc; 511 return rc;
512} 512}
@@ -527,7 +527,7 @@ static void hpc_set_green_led_on(struct slot *slot)
527 pcie_write_cmd(slot, slot_cmd, cmd_mask); 527 pcie_write_cmd(slot, slot_cmd, cmd_mask);
528 528
529 dbg("%s: SLOTCTRL %x write cmd %x\n", 529 dbg("%s: SLOTCTRL %x write cmd %x\n",
530 __FUNCTION__, ctrl->cap_base + SLOTCTRL, slot_cmd); 530 __func__, ctrl->cap_base + SLOTCTRL, slot_cmd);
531} 531}
532 532
533static void hpc_set_green_led_off(struct slot *slot) 533static void hpc_set_green_led_off(struct slot *slot)
@@ -545,7 +545,7 @@ static void hpc_set_green_led_off(struct slot *slot)
545 545
546 pcie_write_cmd(slot, slot_cmd, cmd_mask); 546 pcie_write_cmd(slot, slot_cmd, cmd_mask);
547 dbg("%s: SLOTCTRL %x write cmd %x\n", 547 dbg("%s: SLOTCTRL %x write cmd %x\n",
548 __FUNCTION__, ctrl->cap_base + SLOTCTRL, slot_cmd); 548 __func__, ctrl->cap_base + SLOTCTRL, slot_cmd);
549} 549}
550 550
551static void hpc_set_green_led_blink(struct slot *slot) 551static void hpc_set_green_led_blink(struct slot *slot)
@@ -564,7 +564,7 @@ static void hpc_set_green_led_blink(struct slot *slot)
564 pcie_write_cmd(slot, slot_cmd, cmd_mask); 564 pcie_write_cmd(slot, slot_cmd, cmd_mask);
565 565
566 dbg("%s: SLOTCTRL %x write cmd %x\n", 566 dbg("%s: SLOTCTRL %x write cmd %x\n",
567 __FUNCTION__, ctrl->cap_base + SLOTCTRL, slot_cmd); 567 __func__, ctrl->cap_base + SLOTCTRL, slot_cmd);
568} 568}
569 569
570static void hpc_release_ctlr(struct controller *ctrl) 570static void hpc_release_ctlr(struct controller *ctrl)
@@ -590,12 +590,12 @@ static int hpc_power_on_slot(struct slot * slot)
590 u16 slot_status; 590 u16 slot_status;
591 int retval = 0; 591 int retval = 0;
592 592
593 dbg("%s: slot->hp_slot %x\n", __FUNCTION__, slot->hp_slot); 593 dbg("%s: slot->hp_slot %x\n", __func__, slot->hp_slot);
594 594
595 /* Clear sticky power-fault bit from previous power failures */ 595 /* Clear sticky power-fault bit from previous power failures */
596 retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); 596 retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status);
597 if (retval) { 597 if (retval) {
598 err("%s: Cannot read SLOTSTATUS register\n", __FUNCTION__); 598 err("%s: Cannot read SLOTSTATUS register\n", __func__);
599 return retval; 599 return retval;
600 } 600 }
601 slot_status &= PWR_FAULT_DETECTED; 601 slot_status &= PWR_FAULT_DETECTED;
@@ -603,7 +603,7 @@ static int hpc_power_on_slot(struct slot * slot)
603 retval = pciehp_writew(ctrl, SLOTSTATUS, slot_status); 603 retval = pciehp_writew(ctrl, SLOTSTATUS, slot_status);
604 if (retval) { 604 if (retval) {
605 err("%s: Cannot write to SLOTSTATUS register\n", 605 err("%s: Cannot write to SLOTSTATUS register\n",
606 __FUNCTION__); 606 __func__);
607 return retval; 607 return retval;
608 } 608 }
609 } 609 }
@@ -627,11 +627,11 @@ static int hpc_power_on_slot(struct slot * slot)
627 retval = pcie_write_cmd(slot, slot_cmd, cmd_mask); 627 retval = pcie_write_cmd(slot, slot_cmd, cmd_mask);
628 628
629 if (retval) { 629 if (retval) {
630 err("%s: Write %x command failed!\n", __FUNCTION__, slot_cmd); 630 err("%s: Write %x command failed!\n", __func__, slot_cmd);
631 return -1; 631 return -1;
632 } 632 }
633 dbg("%s: SLOTCTRL %x write cmd %x\n", 633 dbg("%s: SLOTCTRL %x write cmd %x\n",
634 __FUNCTION__, ctrl->cap_base + SLOTCTRL, slot_cmd); 634 __func__, ctrl->cap_base + SLOTCTRL, slot_cmd);
635 635
636 return retval; 636 return retval;
637} 637}
@@ -677,7 +677,7 @@ static int hpc_power_off_slot(struct slot * slot)
677 int retval = 0; 677 int retval = 0;
678 int changed; 678 int changed;
679 679
680 dbg("%s: slot->hp_slot %x\n", __FUNCTION__, slot->hp_slot); 680 dbg("%s: slot->hp_slot %x\n", __func__, slot->hp_slot);
681 681
682 /* 682 /*
683 * Set Bad DLLP Mask bit in Correctable Error Mask 683 * Set Bad DLLP Mask bit in Correctable Error Mask
@@ -710,12 +710,12 @@ static int hpc_power_off_slot(struct slot * slot)
710 710
711 retval = pcie_write_cmd(slot, slot_cmd, cmd_mask); 711 retval = pcie_write_cmd(slot, slot_cmd, cmd_mask);
712 if (retval) { 712 if (retval) {
713 err("%s: Write command failed!\n", __FUNCTION__); 713 err("%s: Write command failed!\n", __func__);
714 retval = -1; 714 retval = -1;
715 goto out; 715 goto out;
716 } 716 }
717 dbg("%s: SLOTCTRL %x write cmd %x\n", 717 dbg("%s: SLOTCTRL %x write cmd %x\n",
718 __FUNCTION__, ctrl->cap_base + SLOTCTRL, slot_cmd); 718 __func__, ctrl->cap_base + SLOTCTRL, slot_cmd);
719 719
720 /* 720 /*
721 * After turning power off, we must wait for at least 1 second 721 * After turning power off, we must wait for at least 1 second
@@ -741,7 +741,7 @@ static irqreturn_t pcie_isr(int irq, void *dev_id)
741 741
742 rc = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); 742 rc = pciehp_readw(ctrl, SLOTSTATUS, &slot_status);
743 if (rc) { 743 if (rc) {
744 err("%s: Cannot read SLOTSTATUS register\n", __FUNCTION__); 744 err("%s: Cannot read SLOTSTATUS register\n", __func__);
745 return IRQ_NONE; 745 return IRQ_NONE;
746 } 746 }
747 747
@@ -754,26 +754,26 @@ static irqreturn_t pcie_isr(int irq, void *dev_id)
754 if ( !intr_loc ) 754 if ( !intr_loc )
755 return IRQ_NONE; 755 return IRQ_NONE;
756 756
757 dbg("%s: intr_loc %x\n", __FUNCTION__, intr_loc); 757 dbg("%s: intr_loc %x\n", __func__, intr_loc);
758 /* Mask Hot-plug Interrupt Enable */ 758 /* Mask Hot-plug Interrupt Enable */
759 if (!pciehp_poll_mode) { 759 if (!pciehp_poll_mode) {
760 spin_lock_irqsave(&ctrl->lock, flags); 760 spin_lock_irqsave(&ctrl->lock, flags);
761 rc = pciehp_readw(ctrl, SLOTCTRL, &temp_word); 761 rc = pciehp_readw(ctrl, SLOTCTRL, &temp_word);
762 if (rc) { 762 if (rc) {
763 err("%s: Cannot read SLOT_CTRL register\n", 763 err("%s: Cannot read SLOT_CTRL register\n",
764 __FUNCTION__); 764 __func__);
765 spin_unlock_irqrestore(&ctrl->lock, flags); 765 spin_unlock_irqrestore(&ctrl->lock, flags);
766 return IRQ_NONE; 766 return IRQ_NONE;
767 } 767 }
768 768
769 dbg("%s: pciehp_readw(SLOTCTRL) with value %x\n", 769 dbg("%s: pciehp_readw(SLOTCTRL) with value %x\n",
770 __FUNCTION__, temp_word); 770 __func__, temp_word);
771 temp_word = (temp_word & ~HP_INTR_ENABLE & 771 temp_word = (temp_word & ~HP_INTR_ENABLE &
772 ~CMD_CMPL_INTR_ENABLE) | 0x00; 772 ~CMD_CMPL_INTR_ENABLE) | 0x00;
773 rc = pciehp_writew(ctrl, SLOTCTRL, temp_word); 773 rc = pciehp_writew(ctrl, SLOTCTRL, temp_word);
774 if (rc) { 774 if (rc) {
775 err("%s: Cannot write to SLOTCTRL register\n", 775 err("%s: Cannot write to SLOTCTRL register\n",
776 __FUNCTION__); 776 __func__);
777 spin_unlock_irqrestore(&ctrl->lock, flags); 777 spin_unlock_irqrestore(&ctrl->lock, flags);
778 return IRQ_NONE; 778 return IRQ_NONE;
779 } 779 }
@@ -782,18 +782,18 @@ static irqreturn_t pcie_isr(int irq, void *dev_id)
782 rc = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); 782 rc = pciehp_readw(ctrl, SLOTSTATUS, &slot_status);
783 if (rc) { 783 if (rc) {
784 err("%s: Cannot read SLOT_STATUS register\n", 784 err("%s: Cannot read SLOT_STATUS register\n",
785 __FUNCTION__); 785 __func__);
786 return IRQ_NONE; 786 return IRQ_NONE;
787 } 787 }
788 dbg("%s: pciehp_readw(SLOTSTATUS) with value %x\n", 788 dbg("%s: pciehp_readw(SLOTSTATUS) with value %x\n",
789 __FUNCTION__, slot_status); 789 __func__, slot_status);
790 790
791 /* Clear command complete interrupt caused by this write */ 791 /* Clear command complete interrupt caused by this write */
792 temp_word = 0x1f; 792 temp_word = 0x1f;
793 rc = pciehp_writew(ctrl, SLOTSTATUS, temp_word); 793 rc = pciehp_writew(ctrl, SLOTSTATUS, temp_word);
794 if (rc) { 794 if (rc) {
795 err("%s: Cannot write to SLOTSTATUS register\n", 795 err("%s: Cannot write to SLOTSTATUS register\n",
796 __FUNCTION__); 796 __func__);
797 return IRQ_NONE; 797 return IRQ_NONE;
798 } 798 }
799 } 799 }
@@ -822,7 +822,7 @@ static irqreturn_t pcie_isr(int irq, void *dev_id)
822 temp_word = 0x1F; 822 temp_word = 0x1F;
823 rc = pciehp_writew(ctrl, SLOTSTATUS, temp_word); 823 rc = pciehp_writew(ctrl, SLOTSTATUS, temp_word);
824 if (rc) { 824 if (rc) {
825 err("%s: Cannot write to SLOTSTATUS register\n", __FUNCTION__); 825 err("%s: Cannot write to SLOTSTATUS register\n", __func__);
826 return IRQ_NONE; 826 return IRQ_NONE;
827 } 827 }
828 /* Unmask Hot-plug Interrupt Enable */ 828 /* Unmask Hot-plug Interrupt Enable */
@@ -831,18 +831,18 @@ static irqreturn_t pcie_isr(int irq, void *dev_id)
831 rc = pciehp_readw(ctrl, SLOTCTRL, &temp_word); 831 rc = pciehp_readw(ctrl, SLOTCTRL, &temp_word);
832 if (rc) { 832 if (rc) {
833 err("%s: Cannot read SLOTCTRL register\n", 833 err("%s: Cannot read SLOTCTRL register\n",
834 __FUNCTION__); 834 __func__);
835 spin_unlock_irqrestore(&ctrl->lock, flags); 835 spin_unlock_irqrestore(&ctrl->lock, flags);
836 return IRQ_NONE; 836 return IRQ_NONE;
837 } 837 }
838 838
839 dbg("%s: Unmask Hot-plug Interrupt Enable\n", __FUNCTION__); 839 dbg("%s: Unmask Hot-plug Interrupt Enable\n", __func__);
840 temp_word = (temp_word & ~HP_INTR_ENABLE) | HP_INTR_ENABLE; 840 temp_word = (temp_word & ~HP_INTR_ENABLE) | HP_INTR_ENABLE;
841 841
842 rc = pciehp_writew(ctrl, SLOTCTRL, temp_word); 842 rc = pciehp_writew(ctrl, SLOTCTRL, temp_word);
843 if (rc) { 843 if (rc) {
844 err("%s: Cannot write to SLOTCTRL register\n", 844 err("%s: Cannot write to SLOTCTRL register\n",
845 __FUNCTION__); 845 __func__);
846 spin_unlock_irqrestore(&ctrl->lock, flags); 846 spin_unlock_irqrestore(&ctrl->lock, flags);
847 return IRQ_NONE; 847 return IRQ_NONE;
848 } 848 }
@@ -851,7 +851,7 @@ static irqreturn_t pcie_isr(int irq, void *dev_id)
851 rc = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); 851 rc = pciehp_readw(ctrl, SLOTSTATUS, &slot_status);
852 if (rc) { 852 if (rc) {
853 err("%s: Cannot read SLOT_STATUS register\n", 853 err("%s: Cannot read SLOT_STATUS register\n",
854 __FUNCTION__); 854 __func__);
855 return IRQ_NONE; 855 return IRQ_NONE;
856 } 856 }
857 857
@@ -860,11 +860,11 @@ static irqreturn_t pcie_isr(int irq, void *dev_id)
860 rc = pciehp_writew(ctrl, SLOTSTATUS, temp_word); 860 rc = pciehp_writew(ctrl, SLOTSTATUS, temp_word);
861 if (rc) { 861 if (rc) {
862 err("%s: Cannot write to SLOTSTATUS failed\n", 862 err("%s: Cannot write to SLOTSTATUS failed\n",
863 __FUNCTION__); 863 __func__);
864 return IRQ_NONE; 864 return IRQ_NONE;
865 } 865 }
866 dbg("%s: pciehp_writew(SLOTSTATUS) with value %x\n", 866 dbg("%s: pciehp_writew(SLOTSTATUS) with value %x\n",
867 __FUNCTION__, temp_word); 867 __func__, temp_word);
868 } 868 }
869 869
870 return IRQ_HANDLED; 870 return IRQ_HANDLED;
@@ -879,7 +879,7 @@ static int hpc_get_max_lnk_speed(struct slot *slot, enum pci_bus_speed *value)
879 879
880 retval = pciehp_readl(ctrl, LNKCAP, &lnk_cap); 880 retval = pciehp_readl(ctrl, LNKCAP, &lnk_cap);
881 if (retval) { 881 if (retval) {
882 err("%s: Cannot read LNKCAP register\n", __FUNCTION__); 882 err("%s: Cannot read LNKCAP register\n", __func__);
883 return retval; 883 return retval;
884 } 884 }
885 885
@@ -908,7 +908,7 @@ static int hpc_get_max_lnk_width(struct slot *slot,
908 908
909 retval = pciehp_readl(ctrl, LNKCAP, &lnk_cap); 909 retval = pciehp_readl(ctrl, LNKCAP, &lnk_cap);
910 if (retval) { 910 if (retval) {
911 err("%s: Cannot read LNKCAP register\n", __FUNCTION__); 911 err("%s: Cannot read LNKCAP register\n", __func__);
912 return retval; 912 return retval;
913 } 913 }
914 914
@@ -957,7 +957,7 @@ static int hpc_get_cur_lnk_speed(struct slot *slot, enum pci_bus_speed *value)
957 957
958 retval = pciehp_readw(ctrl, LNKSTATUS, &lnk_status); 958 retval = pciehp_readw(ctrl, LNKSTATUS, &lnk_status);
959 if (retval) { 959 if (retval) {
960 err("%s: Cannot read LNKSTATUS register\n", __FUNCTION__); 960 err("%s: Cannot read LNKSTATUS register\n", __func__);
961 return retval; 961 return retval;
962 } 962 }
963 963
@@ -986,7 +986,7 @@ static int hpc_get_cur_lnk_width(struct slot *slot,
986 986
987 retval = pciehp_readw(ctrl, LNKSTATUS, &lnk_status); 987 retval = pciehp_readw(ctrl, LNKSTATUS, &lnk_status);
988 if (retval) { 988 if (retval) {
989 err("%s: Cannot read LNKSTATUS register\n", __FUNCTION__); 989 err("%s: Cannot read LNKSTATUS register\n", __func__);
990 return retval; 990 return retval;
991 } 991 }
992 992
@@ -1130,38 +1130,38 @@ static int pcie_init_hardware_part1(struct controller *ctrl,
1130 1130
1131 rc = pciehp_readl(ctrl, SLOTCAP, &slot_cap); 1131 rc = pciehp_readl(ctrl, SLOTCAP, &slot_cap);
1132 if (rc) { 1132 if (rc) {
1133 err("%s: Cannot read SLOTCAP register\n", __FUNCTION__); 1133 err("%s: Cannot read SLOTCAP register\n", __func__);
1134 return -1; 1134 return -1;
1135 } 1135 }
1136 1136
1137 /* Mask Hot-plug Interrupt Enable */ 1137 /* Mask Hot-plug Interrupt Enable */
1138 rc = pciehp_readw(ctrl, SLOTCTRL, &temp_word); 1138 rc = pciehp_readw(ctrl, SLOTCTRL, &temp_word);
1139 if (rc) { 1139 if (rc) {
1140 err("%s: Cannot read SLOTCTRL register\n", __FUNCTION__); 1140 err("%s: Cannot read SLOTCTRL register\n", __func__);
1141 return -1; 1141 return -1;
1142 } 1142 }
1143 1143
1144 dbg("%s: SLOTCTRL %x value read %x\n", 1144 dbg("%s: SLOTCTRL %x value read %x\n",
1145 __FUNCTION__, ctrl->cap_base + SLOTCTRL, temp_word); 1145 __func__, ctrl->cap_base + SLOTCTRL, temp_word);
1146 temp_word = (temp_word & ~HP_INTR_ENABLE & ~CMD_CMPL_INTR_ENABLE) | 1146 temp_word = (temp_word & ~HP_INTR_ENABLE & ~CMD_CMPL_INTR_ENABLE) |
1147 0x00; 1147 0x00;
1148 1148
1149 rc = pciehp_writew(ctrl, SLOTCTRL, temp_word); 1149 rc = pciehp_writew(ctrl, SLOTCTRL, temp_word);
1150 if (rc) { 1150 if (rc) {
1151 err("%s: Cannot write to SLOTCTRL register\n", __FUNCTION__); 1151 err("%s: Cannot write to SLOTCTRL register\n", __func__);
1152 return -1; 1152 return -1;
1153 } 1153 }
1154 1154
1155 rc = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); 1155 rc = pciehp_readw(ctrl, SLOTSTATUS, &slot_status);
1156 if (rc) { 1156 if (rc) {
1157 err("%s: Cannot read SLOTSTATUS register\n", __FUNCTION__); 1157 err("%s: Cannot read SLOTSTATUS register\n", __func__);
1158 return -1; 1158 return -1;
1159 } 1159 }
1160 1160
1161 temp_word = 0x1F; /* Clear all events */ 1161 temp_word = 0x1F; /* Clear all events */
1162 rc = pciehp_writew(ctrl, SLOTSTATUS, temp_word); 1162 rc = pciehp_writew(ctrl, SLOTSTATUS, temp_word);
1163 if (rc) { 1163 if (rc) {
1164 err("%s: Cannot write to SLOTSTATUS register\n", __FUNCTION__); 1164 err("%s: Cannot write to SLOTSTATUS register\n", __func__);
1165 return -1; 1165 return -1;
1166 } 1166 }
1167 return 0; 1167 return 0;
@@ -1177,7 +1177,7 @@ int pcie_init_hardware_part2(struct controller *ctrl, struct pcie_device *dev)
1177 1177
1178 rc = pciehp_readw(ctrl, SLOTCTRL, &temp_word); 1178 rc = pciehp_readw(ctrl, SLOTCTRL, &temp_word);
1179 if (rc) { 1179 if (rc) {
1180 err("%s: Cannot read SLOTCTRL register\n", __FUNCTION__); 1180 err("%s: Cannot read SLOTCTRL register\n", __func__);
1181 goto abort; 1181 goto abort;
1182 } 1182 }
1183 1183
@@ -1185,7 +1185,7 @@ int pcie_init_hardware_part2(struct controller *ctrl, struct pcie_device *dev)
1185 1185
1186 rc = pciehp_readl(ctrl, SLOTCAP, &slot_cap); 1186 rc = pciehp_readl(ctrl, SLOTCAP, &slot_cap);
1187 if (rc) { 1187 if (rc) {
1188 err("%s: Cannot read SLOTCAP register\n", __FUNCTION__); 1188 err("%s: Cannot read SLOTCAP register\n", __func__);
1189 goto abort; 1189 goto abort;
1190 } 1190 }
1191 1191
@@ -1212,19 +1212,19 @@ int pcie_init_hardware_part2(struct controller *ctrl, struct pcie_device *dev)
1212 */ 1212 */
1213 rc = pciehp_writew(ctrl, SLOTCTRL, temp_word); 1213 rc = pciehp_writew(ctrl, SLOTCTRL, temp_word);
1214 if (rc) { 1214 if (rc) {
1215 err("%s: Cannot write to SLOTCTRL register\n", __FUNCTION__); 1215 err("%s: Cannot write to SLOTCTRL register\n", __func__);
1216 goto abort; 1216 goto abort;
1217 } 1217 }
1218 rc = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); 1218 rc = pciehp_readw(ctrl, SLOTSTATUS, &slot_status);
1219 if (rc) { 1219 if (rc) {
1220 err("%s: Cannot read SLOTSTATUS register\n", __FUNCTION__); 1220 err("%s: Cannot read SLOTSTATUS register\n", __func__);
1221 goto abort_disable_intr; 1221 goto abort_disable_intr;
1222 } 1222 }
1223 1223
1224 temp_word = 0x1F; /* Clear all events */ 1224 temp_word = 0x1F; /* Clear all events */
1225 rc = pciehp_writew(ctrl, SLOTSTATUS, temp_word); 1225 rc = pciehp_writew(ctrl, SLOTSTATUS, temp_word);
1226 if (rc) { 1226 if (rc) {
1227 err("%s: Cannot write to SLOTSTATUS register\n", __FUNCTION__); 1227 err("%s: Cannot write to SLOTSTATUS register\n", __func__);
1228 goto abort_disable_intr; 1228 goto abort_disable_intr;
1229 } 1229 }
1230 1230
@@ -1247,7 +1247,7 @@ abort_disable_intr:
1247 rc = pciehp_writew(ctrl, SLOTCTRL, temp_word); 1247 rc = pciehp_writew(ctrl, SLOTCTRL, temp_word);
1248 } 1248 }
1249 if (rc) 1249 if (rc)
1250 err("%s : disabling interrupts failed\n", __FUNCTION__); 1250 err("%s : disabling interrupts failed\n", __func__);
1251abort: 1251abort:
1252 return -1; 1252 return -1;
1253} 1253}
@@ -1265,62 +1265,62 @@ int pcie_init(struct controller *ctrl, struct pcie_device *dev)
1265 ctrl->pci_dev = pdev; /* save pci_dev in context */ 1265 ctrl->pci_dev = pdev; /* save pci_dev in context */
1266 1266
1267 dbg("%s: hotplug controller vendor id 0x%x device id 0x%x\n", 1267 dbg("%s: hotplug controller vendor id 0x%x device id 0x%x\n",
1268 __FUNCTION__, pdev->vendor, pdev->device); 1268 __func__, pdev->vendor, pdev->device);
1269 1269
1270 cap_base = pci_find_capability(pdev, PCI_CAP_ID_EXP); 1270 cap_base = pci_find_capability(pdev, PCI_CAP_ID_EXP);
1271 if (cap_base == 0) { 1271 if (cap_base == 0) {
1272 dbg("%s: Can't find PCI_CAP_ID_EXP (0x10)\n", __FUNCTION__); 1272 dbg("%s: Can't find PCI_CAP_ID_EXP (0x10)\n", __func__);
1273 goto abort; 1273 goto abort;
1274 } 1274 }
1275 1275
1276 ctrl->cap_base = cap_base; 1276 ctrl->cap_base = cap_base;
1277 1277
1278 dbg("%s: pcie_cap_base %x\n", __FUNCTION__, cap_base); 1278 dbg("%s: pcie_cap_base %x\n", __func__, cap_base);
1279 1279
1280 rc = pciehp_readw(ctrl, CAPREG, &cap_reg); 1280 rc = pciehp_readw(ctrl, CAPREG, &cap_reg);
1281 if (rc) { 1281 if (rc) {
1282 err("%s: Cannot read CAPREG register\n", __FUNCTION__); 1282 err("%s: Cannot read CAPREG register\n", __func__);
1283 goto abort; 1283 goto abort;
1284 } 1284 }
1285 dbg("%s: CAPREG offset %x cap_reg %x\n", 1285 dbg("%s: CAPREG offset %x cap_reg %x\n",
1286 __FUNCTION__, ctrl->cap_base + CAPREG, cap_reg); 1286 __func__, ctrl->cap_base + CAPREG, cap_reg);
1287 1287
1288 if (((cap_reg & SLOT_IMPL) == 0) || 1288 if (((cap_reg & SLOT_IMPL) == 0) ||
1289 (((cap_reg & DEV_PORT_TYPE) != 0x0040) 1289 (((cap_reg & DEV_PORT_TYPE) != 0x0040)
1290 && ((cap_reg & DEV_PORT_TYPE) != 0x0060))) { 1290 && ((cap_reg & DEV_PORT_TYPE) != 0x0060))) {
1291 dbg("%s : This is not a root port or the port is not " 1291 dbg("%s : This is not a root port or the port is not "
1292 "connected to a slot\n", __FUNCTION__); 1292 "connected to a slot\n", __func__);
1293 goto abort; 1293 goto abort;
1294 } 1294 }
1295 1295
1296 rc = pciehp_readl(ctrl, SLOTCAP, &slot_cap); 1296 rc = pciehp_readl(ctrl, SLOTCAP, &slot_cap);
1297 if (rc) { 1297 if (rc) {
1298 err("%s: Cannot read SLOTCAP register\n", __FUNCTION__); 1298 err("%s: Cannot read SLOTCAP register\n", __func__);
1299 goto abort; 1299 goto abort;
1300 } 1300 }
1301 dbg("%s: SLOTCAP offset %x slot_cap %x\n", 1301 dbg("%s: SLOTCAP offset %x slot_cap %x\n",
1302 __FUNCTION__, ctrl->cap_base + SLOTCAP, slot_cap); 1302 __func__, ctrl->cap_base + SLOTCAP, slot_cap);
1303 1303
1304 if (!(slot_cap & HP_CAP)) { 1304 if (!(slot_cap & HP_CAP)) {
1305 dbg("%s : This slot is not hot-plug capable\n", __FUNCTION__); 1305 dbg("%s : This slot is not hot-plug capable\n", __func__);
1306 goto abort; 1306 goto abort;
1307 } 1307 }
1308 /* For debugging purpose */ 1308 /* For debugging purpose */
1309 rc = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); 1309 rc = pciehp_readw(ctrl, SLOTSTATUS, &slot_status);
1310 if (rc) { 1310 if (rc) {
1311 err("%s: Cannot read SLOTSTATUS register\n", __FUNCTION__); 1311 err("%s: Cannot read SLOTSTATUS register\n", __func__);
1312 goto abort; 1312 goto abort;
1313 } 1313 }
1314 dbg("%s: SLOTSTATUS offset %x slot_status %x\n", 1314 dbg("%s: SLOTSTATUS offset %x slot_status %x\n",
1315 __FUNCTION__, ctrl->cap_base + SLOTSTATUS, slot_status); 1315 __func__, ctrl->cap_base + SLOTSTATUS, slot_status);
1316 1316
1317 rc = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl); 1317 rc = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl);
1318 if (rc) { 1318 if (rc) {
1319 err("%s: Cannot read SLOTCTRL register\n", __FUNCTION__); 1319 err("%s: Cannot read SLOTCTRL register\n", __func__);
1320 goto abort; 1320 goto abort;
1321 } 1321 }
1322 dbg("%s: SLOTCTRL offset %x slot_ctrl %x\n", 1322 dbg("%s: SLOTCTRL offset %x slot_ctrl %x\n",
1323 __FUNCTION__, ctrl->cap_base + SLOTCTRL, slot_ctrl); 1323 __func__, ctrl->cap_base + SLOTCTRL, slot_ctrl);
1324 1324
1325 for (rc = 0; rc < DEVICE_COUNT_RESOURCE; rc++) 1325 for (rc = 0; rc < DEVICE_COUNT_RESOURCE; rc++)
1326 if (pci_resource_len(pdev, rc) > 0) 1326 if (pci_resource_len(pdev, rc) > 0)
@@ -1358,7 +1358,7 @@ int pcie_init(struct controller *ctrl, struct pcie_device *dev)
1358 rc = request_irq(ctrl->pci_dev->irq, pcie_isr, IRQF_SHARED, 1358 rc = request_irq(ctrl->pci_dev->irq, pcie_isr, IRQF_SHARED,
1359 MY_NAME, (void *)ctrl); 1359 MY_NAME, (void *)ctrl);
1360 dbg("%s: request_irq %d for hpc%d (returns %d)\n", 1360 dbg("%s: request_irq %d for hpc%d (returns %d)\n",
1361 __FUNCTION__, ctrl->pci_dev->irq, 1361 __func__, ctrl->pci_dev->irq,
1362 atomic_read(&pciehp_num_controllers), rc); 1362 atomic_read(&pciehp_num_controllers), rc);
1363 if (rc) { 1363 if (rc) {
1364 err("Can't get irq %d for the hotplug controller\n", 1364 err("Can't get irq %d for the hotplug controller\n",