Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6:
pciehp: add message about pciehp_slot_with_bus option
pci hotplug core: add check of duplicate slot name
pciehp: move msleep after power off
pciehp: poll cmd completion if hotplug interrupt is disabled
pciehp: fix slow probing
pciehp: fix NULL dereference in interrupt handler
shpchp: add message about shpchp_slot_with_bus option
PCI: don't enable ASPM on devices with mixed PCIe/PCI functions

+159 -54
+6 -1
drivers/pci/hotplug/pci_hotplug_core.c
··· 619 int pci_hp_register (struct hotplug_slot *slot) 620 { 621 int result; 622 623 if (slot == NULL) 624 return -ENODEV; ··· 631 return -EINVAL; 632 } 633 634 - /* this can fail if we have already registered a slot with the same name */ 635 slot->kobj.kset = pci_hotplug_slots_kset; 636 result = kobject_init_and_add(&slot->kobj, &hotplug_slot_ktype, NULL, 637 "%s", slot->name);
··· 619 int pci_hp_register (struct hotplug_slot *slot) 620 { 621 int result; 622 + struct hotplug_slot *tmp; 623 624 if (slot == NULL) 625 return -ENODEV; ··· 630 return -EINVAL; 631 } 632 633 + /* Check if we have already registered a slot with the same name. */ 634 + tmp = get_slot_from_name(slot->name); 635 + if (tmp) 636 + return -EEXIST; 637 + 638 slot->kobj.kset = pci_hotplug_slots_kset; 639 result = kobject_init_and_add(&slot->kobj, &hotplug_slot_ktype, NULL, 640 "%s", slot->name);
+7 -4
drivers/pci/hotplug/pciehp.h
··· 97 u8 cap_base; 98 struct timer_list poll_timer; 99 volatile int cmd_busy; 100 }; 101 102 #define INT_BUTTON_IGNORE 0 ··· 136 #define PWR_LED_PRSN 0x00000010 137 #define HP_SUPR_RM_SUP 0x00000020 138 #define EMI_PRSN 0x00020000 139 140 #define ATTN_BUTTN(ctrl) ((ctrl)->slot_cap & ATTN_BUTTN_PRSN) 141 #define POWER_CTRL(ctrl) ((ctrl)->slot_cap & PWR_CTRL_PRSN) ··· 145 #define PWR_LED(ctrl) ((ctrl)->slot_cap & PWR_LED_PRSN) 146 #define HP_SUPR_RM(ctrl) ((ctrl)->slot_cap & HP_SUPR_RM_SUP) 147 #define EMI(ctrl) ((ctrl)->slot_cap & EMI_PRSN) 148 149 extern int pciehp_sysfs_enable_slot(struct slot *slot); 150 extern int pciehp_sysfs_disable_slot(struct slot *slot); 151 - extern u8 pciehp_handle_attention_button(u8 hp_slot, struct controller *ctrl); 152 - extern u8 pciehp_handle_switch_change(u8 hp_slot, struct controller *ctrl); 153 - extern u8 pciehp_handle_presence_change(u8 hp_slot, struct controller *ctrl); 154 - extern u8 pciehp_handle_power_fault(u8 hp_slot, struct controller *ctrl); 155 extern int pciehp_configure_device(struct slot *p_slot); 156 extern int pciehp_unconfigure_device(struct slot *p_slot); 157 extern void pciehp_queue_pushbutton_work(struct work_struct *work);
··· 97 u8 cap_base; 98 struct timer_list poll_timer; 99 volatile int cmd_busy; 100 + unsigned int no_cmd_complete:1; 101 }; 102 103 #define INT_BUTTON_IGNORE 0 ··· 135 #define PWR_LED_PRSN 0x00000010 136 #define HP_SUPR_RM_SUP 0x00000020 137 #define EMI_PRSN 0x00020000 138 + #define NO_CMD_CMPL_SUP 0x00040000 139 140 #define ATTN_BUTTN(ctrl) ((ctrl)->slot_cap & ATTN_BUTTN_PRSN) 141 #define POWER_CTRL(ctrl) ((ctrl)->slot_cap & PWR_CTRL_PRSN) ··· 143 #define PWR_LED(ctrl) ((ctrl)->slot_cap & PWR_LED_PRSN) 144 #define HP_SUPR_RM(ctrl) ((ctrl)->slot_cap & HP_SUPR_RM_SUP) 145 #define EMI(ctrl) ((ctrl)->slot_cap & EMI_PRSN) 146 + #define NO_CMD_CMPL(ctrl) ((ctrl)->slot_cap & NO_CMD_CMPL_SUP) 147 148 extern int pciehp_sysfs_enable_slot(struct slot *slot); 149 extern int pciehp_sysfs_disable_slot(struct slot *slot); 150 + extern u8 pciehp_handle_attention_button(struct slot *p_slot); 151 + extern u8 pciehp_handle_switch_change(struct slot *p_slot); 152 + extern u8 pciehp_handle_presence_change(struct slot *p_slot); 153 + extern u8 pciehp_handle_power_fault(struct slot *p_slot); 154 extern int pciehp_configure_device(struct slot *p_slot); 155 extern int pciehp_unconfigure_device(struct slot *p_slot); 156 extern void pciehp_queue_pushbutton_work(struct work_struct *work);
+5 -1
drivers/pci/hotplug/pciehp_core.c
··· 254 slot->hp_slot, slot->number, ctrl->slot_device_offset); 255 retval = pci_hp_register(hotplug_slot); 256 if (retval) { 257 - err ("pci_hp_register failed with error %d\n", retval); 258 goto error_info; 259 } 260 /* create additional sysfs entries */
··· 254 slot->hp_slot, slot->number, ctrl->slot_device_offset); 255 retval = pci_hp_register(hotplug_slot); 256 if (retval) { 257 + err("pci_hp_register failed with error %d\n", retval); 258 + if (retval == -EEXIST) 259 + err("Failed to register slot because of name " 260 + "collision. Try \'pciehp_slot_with_bus\' " 261 + "module option.\n"); 262 goto error_info; 263 } 264 /* create additional sysfs entries */
+19 -17
drivers/pci/hotplug/pciehp_ctrl.c
··· 55 return 0; 56 } 57 58 - u8 pciehp_handle_attention_button(u8 hp_slot, struct controller *ctrl) 59 { 60 - struct slot *p_slot; 61 u32 event_type; 62 63 /* Attention Button Change */ 64 dbg("pciehp: Attention button interrupt received.\n"); 65 - 66 - p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); 67 68 /* 69 * Button pressed - See if need to TAKE ACTION!!! ··· 73 return 0; 74 } 75 76 - u8 pciehp_handle_switch_change(u8 hp_slot, struct controller *ctrl) 77 { 78 - struct slot *p_slot; 79 u8 getstatus; 80 u32 event_type; 81 82 /* Switch Change */ 83 dbg("pciehp: Switch interrupt received.\n"); 84 85 - p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); 86 p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 87 - 88 if (getstatus) { 89 /* 90 * Switch opened ··· 101 return 1; 102 } 103 104 - u8 pciehp_handle_presence_change(u8 hp_slot, struct controller *ctrl) 105 { 106 - struct slot *p_slot; 107 u32 event_type; 108 u8 presence_save; 109 110 /* Presence Change */ 111 dbg("pciehp: Presence/Notify input change.\n"); 112 - 113 - p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); 114 115 /* Switch is open, assume a presence change 116 * Save the presence state ··· 132 return 1; 133 } 134 135 - u8 pciehp_handle_power_fault(u8 hp_slot, struct controller *ctrl) 136 { 137 - struct slot *p_slot; 138 u32 event_type; 139 140 /* power fault */ 141 dbg("pciehp: Power fault interrupt received.\n"); 142 - 143 - p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); 144 145 if ( !(p_slot->hpc_ops->query_power_fault(p_slot))) { 146 /* ··· 151 */ 152 info("Power fault on Slot(%s)\n", p_slot->name); 153 event_type = INT_POWER_FAULT; 154 - info("power fault bit %x set\n", hp_slot); 155 } 156 157 queue_interrupt_event(p_slot, event_type); ··· 173 return; 174 } 175 } 176 177 if (PWR_LED(ctrl)) 178 pslot->hpc_ops->green_led_off(pslot); ··· 283 return retval; 284 } 285 } 286 287 if (PWR_LED(ctrl)) 288 /* turn off Green LED */
··· 55 return 0; 56 } 57 58 + u8 pciehp_handle_attention_button(struct slot *p_slot) 59 { 60 u32 event_type; 61 62 /* Attention Button Change */ 63 dbg("pciehp: Attention button interrupt received.\n"); 64 65 /* 66 * Button pressed - See if need to TAKE ACTION!!! ··· 76 return 0; 77 } 78 79 + u8 pciehp_handle_switch_change(struct slot *p_slot) 80 { 81 u8 getstatus; 82 u32 event_type; 83 84 /* Switch Change */ 85 dbg("pciehp: Switch interrupt received.\n"); 86 87 p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 88 if (getstatus) { 89 /* 90 * Switch opened ··· 107 return 1; 108 } 109 110 + u8 pciehp_handle_presence_change(struct slot *p_slot) 111 { 112 u32 event_type; 113 u8 presence_save; 114 115 /* Presence Change */ 116 dbg("pciehp: Presence/Notify input change.\n"); 117 118 /* Switch is open, assume a presence change 119 * Save the presence state ··· 141 return 1; 142 } 143 144 + u8 pciehp_handle_power_fault(struct slot *p_slot) 145 { 146 u32 event_type; 147 148 /* power fault */ 149 dbg("pciehp: Power fault interrupt received.\n"); 150 151 if ( !(p_slot->hpc_ops->query_power_fault(p_slot))) { 152 /* ··· 163 */ 164 info("Power fault on Slot(%s)\n", p_slot->name); 165 event_type = INT_POWER_FAULT; 166 + info("power fault bit %x set\n", 0); 167 } 168 169 queue_interrupt_event(p_slot, event_type); ··· 185 return; 186 } 187 } 188 + 189 + /* 190 + * After turning power off, we must wait for at least 1 second 191 + * before taking any action that relies on power having been 192 + * removed from the slot/adapter. 193 + */ 194 + msleep(1000); 195 196 if (PWR_LED(ctrl)) 197 pslot->hpc_ops->green_led_off(pslot); ··· 288 return retval; 289 } 290 } 291 + 292 + /* 293 + * After turning power off, we must wait for at least 1 second 294 + * before taking any action that relies on power having been 295 + * removed from the slot/adapter. 296 + */ 297 + msleep(1000); 298 299 if (PWR_LED(ctrl)) 300 /* turn off Green LED */
+98 -31
drivers/pci/hotplug/pciehp_hpc.c
··· 247 free_irq(ctrl->pci_dev->irq, ctrl); 248 } 249 250 - static inline int pcie_wait_cmd(struct controller *ctrl) 251 { 252 int retval = 0; 253 unsigned int msecs = pciehp_poll_mode ? 2500 : 1000; 254 unsigned long timeout = msecs_to_jiffies(msecs); 255 int rc; 256 257 - rc = wait_event_interruptible_timeout(ctrl->queue, 258 !ctrl->cmd_busy, timeout); 259 if (!rc) 260 dbg("Command not completed in 1000 msec\n"); ··· 310 goto out; 311 } 312 313 - if ((slot_status & CMD_COMPLETED) == CMD_COMPLETED ) { 314 - /* After 1 sec and CMD_COMPLETED still not set, just 315 - proceed forward to issue the next command according 316 - to spec. Just print out the error message */ 317 - dbg("%s: CMD_COMPLETED not clear after 1 sec.\n", 318 - __func__); 319 } 320 321 retval = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl); ··· 355 /* 356 * Wait for command completion. 357 */ 358 - if (!retval) 359 - retval = pcie_wait_cmd(ctrl); 360 out: 361 mutex_unlock(&ctrl->ctrl_lock); 362 return retval; ··· 754 } 755 dbg("%s: SLOTCTRL %x write cmd %x\n", 756 __func__, ctrl->cap_base + SLOTCTRL, slot_cmd); 757 - 758 - /* 759 - * After turning power off, we must wait for at least 1 second 760 - * before taking any action that relies on power having been 761 - * removed from the slot/adapter. 762 - */ 763 - msleep(1000); 764 out: 765 if (changed) 766 pcie_unmask_bad_dllp(ctrl); ··· 765 { 766 struct controller *ctrl = (struct controller *)dev_id; 767 u16 detected, intr_loc; 768 769 /* 770 * In order to guarantee that all interrupt events are ··· 800 wake_up_interruptible(&ctrl->queue); 801 } 802 803 /* Check MRL Sensor Changed */ 804 if (intr_loc & MRL_SENS_CHANGED) 805 - pciehp_handle_switch_change(0, ctrl); 806 807 /* Check Attention Button Pressed */ 808 if (intr_loc & ATTN_BUTTN_PRESSED) 809 - pciehp_handle_attention_button(0, ctrl); 810 811 /* Check Presence Detect Changed */ 812 if (intr_loc & PRSN_DETECT_CHANGED) 813 - pciehp_handle_presence_change(0, ctrl); 814 815 /* Check Power Fault Detected */ 816 if (intr_loc & PWR_FAULT_DETECTED) 817 - pciehp_handle_power_fault(0, ctrl); 818 819 return IRQ_HANDLED; 820 } ··· 1089 static int pcie_init_hardware_part1(struct controller *ctrl, 1090 struct pcie_device *dev) 1091 { 1092 /* Mask Hot-plug Interrupt Enable */ 1093 if (pcie_write_cmd(ctrl, 0, HP_INTR_ENABLE | CMD_CMPL_INTR_ENABLE)) { 1094 err("%s: Cannot mask hotplug interrupt enable\n", __func__); ··· 1106 int pcie_init_hardware_part2(struct controller *ctrl, struct pcie_device *dev) 1107 { 1108 u16 cmd, mask; 1109 - 1110 - /* 1111 - * We need to clear all events before enabling hotplug interrupt 1112 - * notification mechanism in order for hotplug controler to 1113 - * generate interrupts. 1114 - */ 1115 - if (pciehp_writew(ctrl, SLOTSTATUS, 0x1f)) { 1116 - err("%s: Cannot write to SLOTSTATUS register\n", __FUNCTION__); 1117 - return -1; 1118 - } 1119 1120 cmd = PRSN_DETECT_ENABLE; 1121 if (ATTN_BUTTN(ctrl)) ··· 1173 dbg(" Power Indicator : %3s\n", PWR_LED(ctrl) ? "yes" : "no"); 1174 dbg(" Hot-Plug Surprise : %3s\n", HP_SUPR_RM(ctrl) ? "yes" : "no"); 1175 dbg(" EMI Present : %3s\n", EMI(ctrl) ? "yes" : "no"); 1176 pciehp_readw(ctrl, SLOTSTATUS, &reg16); 1177 dbg("Slot Status : 0x%04x\n", reg16); 1178 pciehp_readw(ctrl, SLOTSTATUS, &reg16); ··· 1205 mutex_init(&ctrl->ctrl_lock); 1206 init_waitqueue_head(&ctrl->queue); 1207 dbg_ctrl(ctrl); 1208 1209 info("HPC vendor_id %x device_id %x ss_vid %x ss_did %x\n", 1210 pdev->vendor, pdev->device,
··· 247 free_irq(ctrl->pci_dev->irq, ctrl); 248 } 249 250 + static inline int pcie_poll_cmd(struct controller *ctrl) 251 + { 252 + u16 slot_status; 253 + int timeout = 1000; 254 + 255 + if (!pciehp_readw(ctrl, SLOTSTATUS, &slot_status)) 256 + if (slot_status & CMD_COMPLETED) 257 + goto completed; 258 + for (timeout = 1000; timeout > 0; timeout -= 100) { 259 + msleep(100); 260 + if (!pciehp_readw(ctrl, SLOTSTATUS, &slot_status)) 261 + if (slot_status & CMD_COMPLETED) 262 + goto completed; 263 + } 264 + return 0; /* timeout */ 265 + 266 + completed: 267 + pciehp_writew(ctrl, SLOTSTATUS, CMD_COMPLETED); 268 + return timeout; 269 + } 270 + 271 + static inline int pcie_wait_cmd(struct controller *ctrl, int poll) 272 { 273 int retval = 0; 274 unsigned int msecs = pciehp_poll_mode ? 2500 : 1000; 275 unsigned long timeout = msecs_to_jiffies(msecs); 276 int rc; 277 278 + if (poll) 279 + rc = pcie_poll_cmd(ctrl); 280 + else 281 + rc = wait_event_interruptible_timeout(ctrl->queue, 282 !ctrl->cmd_busy, timeout); 283 if (!rc) 284 dbg("Command not completed in 1000 msec\n"); ··· 286 goto out; 287 } 288 289 + if (slot_status & CMD_COMPLETED) { 290 + if (!ctrl->no_cmd_complete) { 291 + /* 292 + * After 1 sec and CMD_COMPLETED still not set, just 293 + * proceed forward to issue the next command according 294 + * to spec. Just print out the error message. 295 + */ 296 + dbg("%s: CMD_COMPLETED not clear after 1 sec.\n", 297 + __func__); 298 + } else if (!NO_CMD_CMPL(ctrl)) { 299 + /* 300 + * This controller semms to notify of command completed 301 + * event even though it supports none of power 302 + * controller, attention led, power led and EMI. 303 + */ 304 + dbg("%s: Unexpected CMD_COMPLETED. Need to wait for " 305 + "command completed event.\n", __func__); 306 + ctrl->no_cmd_complete = 0; 307 + } else { 308 + dbg("%s: Unexpected CMD_COMPLETED. Maybe the " 309 + "controller is broken.\n", __func__); 310 + } 311 } 312 313 retval = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl); ··· 315 /* 316 * Wait for command completion. 317 */ 318 + if (!retval && !ctrl->no_cmd_complete) { 319 + int poll = 0; 320 + /* 321 + * if hotplug interrupt is not enabled or command 322 + * completed interrupt is not enabled, we need to poll 323 + * command completed event. 324 + */ 325 + if (!(slot_ctrl & HP_INTR_ENABLE) || 326 + !(slot_ctrl & CMD_CMPL_INTR_ENABLE)) 327 + poll = 1; 328 + retval = pcie_wait_cmd(ctrl, poll); 329 + } 330 out: 331 mutex_unlock(&ctrl->ctrl_lock); 332 return retval; ··· 704 } 705 dbg("%s: SLOTCTRL %x write cmd %x\n", 706 __func__, ctrl->cap_base + SLOTCTRL, slot_cmd); 707 out: 708 if (changed) 709 pcie_unmask_bad_dllp(ctrl); ··· 722 { 723 struct controller *ctrl = (struct controller *)dev_id; 724 u16 detected, intr_loc; 725 + struct slot *p_slot; 726 727 /* 728 * In order to guarantee that all interrupt events are ··· 756 wake_up_interruptible(&ctrl->queue); 757 } 758 759 + if (!(intr_loc & ~CMD_COMPLETED)) 760 + return IRQ_HANDLED; 761 + 762 + /* 763 + * Return without handling events if this handler routine is 764 + * called before controller initialization is done. This may 765 + * happen if hotplug event or another interrupt that shares 766 + * the IRQ with pciehp arrives before slot initialization is 767 + * done after interrupt handler is registered. 768 + * 769 + * FIXME - Need more structural fixes. We need to be ready to 770 + * handle the event before installing interrupt handler. 771 + */ 772 + p_slot = pciehp_find_slot(ctrl, ctrl->slot_device_offset); 773 + if (!p_slot || !p_slot->hpc_ops) 774 + return IRQ_HANDLED; 775 + 776 /* Check MRL Sensor Changed */ 777 if (intr_loc & MRL_SENS_CHANGED) 778 + pciehp_handle_switch_change(p_slot); 779 780 /* Check Attention Button Pressed */ 781 if (intr_loc & ATTN_BUTTN_PRESSED) 782 + pciehp_handle_attention_button(p_slot); 783 784 /* Check Presence Detect Changed */ 785 if (intr_loc & PRSN_DETECT_CHANGED) 786 + pciehp_handle_presence_change(p_slot); 787 788 /* Check Power Fault Detected */ 789 if (intr_loc & PWR_FAULT_DETECTED) 790 + pciehp_handle_power_fault(p_slot); 791 792 return IRQ_HANDLED; 793 } ··· 1028 static int pcie_init_hardware_part1(struct controller *ctrl, 1029 struct pcie_device *dev) 1030 { 1031 + /* Clear all remaining event bits in Slot Status register */ 1032 + if (pciehp_writew(ctrl, SLOTSTATUS, 0x1f)) { 1033 + err("%s: Cannot write to SLOTSTATUS register\n", __func__); 1034 + return -1; 1035 + } 1036 + 1037 /* Mask Hot-plug Interrupt Enable */ 1038 if (pcie_write_cmd(ctrl, 0, HP_INTR_ENABLE | CMD_CMPL_INTR_ENABLE)) { 1039 err("%s: Cannot mask hotplug interrupt enable\n", __func__); ··· 1039 int pcie_init_hardware_part2(struct controller *ctrl, struct pcie_device *dev) 1040 { 1041 u16 cmd, mask; 1042 1043 cmd = PRSN_DETECT_ENABLE; 1044 if (ATTN_BUTTN(ctrl)) ··· 1116 dbg(" Power Indicator : %3s\n", PWR_LED(ctrl) ? "yes" : "no"); 1117 dbg(" Hot-Plug Surprise : %3s\n", HP_SUPR_RM(ctrl) ? "yes" : "no"); 1118 dbg(" EMI Present : %3s\n", EMI(ctrl) ? "yes" : "no"); 1119 + dbg(" Comamnd Completed : %3s\n", NO_CMD_CMPL(ctrl)? "no" : "yes"); 1120 pciehp_readw(ctrl, SLOTSTATUS, &reg16); 1121 dbg("Slot Status : 0x%04x\n", reg16); 1122 pciehp_readw(ctrl, SLOTSTATUS, &reg16); ··· 1147 mutex_init(&ctrl->ctrl_lock); 1148 init_waitqueue_head(&ctrl->queue); 1149 dbg_ctrl(ctrl); 1150 + /* 1151 + * Controller doesn't notify of command completion if the "No 1152 + * Command Completed Support" bit is set in Slot Capability 1153 + * register or the controller supports none of power 1154 + * controller, attention led, power led and EMI. 1155 + */ 1156 + if (NO_CMD_CMPL(ctrl) || 1157 + !(POWER_CTRL(ctrl) | ATTN_LED(ctrl) | PWR_LED(ctrl) | EMI(ctrl))) 1158 + ctrl->no_cmd_complete = 1; 1159 1160 info("HPC vendor_id %x device_id %x ss_vid %x ss_did %x\n", 1161 pdev->vendor, pdev->device,
+4
drivers/pci/hotplug/shpchp_core.c
··· 162 retval = pci_hp_register(slot->hotplug_slot); 163 if (retval) { 164 err("pci_hp_register failed with error %d\n", retval); 165 goto error_info; 166 } 167
··· 162 retval = pci_hp_register(slot->hotplug_slot); 163 if (retval) { 164 err("pci_hp_register failed with error %d\n", retval); 165 + if (retval == -EEXIST) 166 + err("Failed to register slot because of name " 167 + "collision. Try \'shpchp_slot_with_bus\' " 168 + "module option.\n"); 169 goto error_info; 170 } 171
+20
drivers/pci/pcie/aspm.c
··· 506 pdev->link_state = NULL; 507 } 508 509 /* 510 * pcie_aspm_init_link_state: Initiate PCI express link state. 511 * It is called after the pcie and its children devices are scaned. ··· 541 return; 542 down_read(&pci_bus_sem); 543 if (list_empty(&pdev->subordinate->devices)) 544 goto out; 545 546 mutex_lock(&aspm_lock);
··· 506 pdev->link_state = NULL; 507 } 508 509 + static int pcie_aspm_sanity_check(struct pci_dev *pdev) 510 + { 511 + struct pci_dev *child_dev; 512 + int child_pos; 513 + 514 + /* 515 + * Some functions in a slot might not all be PCIE functions, very 516 + * strange. Disable ASPM for the whole slot 517 + */ 518 + list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) { 519 + child_pos = pci_find_capability(child_dev, PCI_CAP_ID_EXP); 520 + if (!child_pos) 521 + return -EINVAL; 522 + } 523 + return 0; 524 + } 525 + 526 /* 527 * pcie_aspm_init_link_state: Initiate PCI express link state. 528 * It is called after the pcie and its children devices are scaned. ··· 524 return; 525 down_read(&pci_bus_sem); 526 if (list_empty(&pdev->subordinate->devices)) 527 + goto out; 528 + 529 + if (pcie_aspm_sanity_check(pdev)) 530 goto out; 531 532 mutex_lock(&aspm_lock);