aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/pciehp_ctrl.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/hotplug/pciehp_ctrl.c')
-rw-r--r--drivers/pci/hotplug/pciehp_ctrl.c57
1 files changed, 7 insertions, 50 deletions
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c
index 84487d126e4d..d6ac1b261dd9 100644
--- a/drivers/pci/hotplug/pciehp_ctrl.c
+++ b/drivers/pci/hotplug/pciehp_ctrl.c
@@ -142,23 +142,9 @@ u8 pciehp_handle_power_fault(struct slot *p_slot)
142 142
143 /* power fault */ 143 /* power fault */
144 ctrl_dbg(ctrl, "Power fault interrupt received\n"); 144 ctrl_dbg(ctrl, "Power fault interrupt received\n");
145 145 ctrl_err(ctrl, "Power fault on slot %s\n", slot_name(p_slot));
146 if (!pciehp_query_power_fault(p_slot)) { 146 event_type = INT_POWER_FAULT;
147 /* 147 ctrl_info(ctrl, "Power fault bit %x set\n", 0);
148 * power fault Cleared
149 */
150 ctrl_info(ctrl, "Power fault cleared on Slot(%s)\n",
151 slot_name(p_slot));
152 event_type = INT_POWER_FAULT_CLEAR;
153 } else {
154 /*
155 * power fault
156 */
157 ctrl_info(ctrl, "Power fault on Slot(%s)\n", slot_name(p_slot));
158 event_type = INT_POWER_FAULT;
159 ctrl_info(ctrl, "Power fault bit %x set\n", 0);
160 }
161
162 queue_interrupt_event(p_slot, event_type); 148 queue_interrupt_event(p_slot, event_type);
163 149
164 return 1; 150 return 1;
@@ -224,13 +210,12 @@ static int board_added(struct slot *p_slot)
224 retval = pciehp_check_link_status(ctrl); 210 retval = pciehp_check_link_status(ctrl);
225 if (retval) { 211 if (retval) {
226 ctrl_err(ctrl, "Failed to check link status\n"); 212 ctrl_err(ctrl, "Failed to check link status\n");
227 set_slot_off(ctrl, p_slot); 213 goto err_exit;
228 return retval;
229 } 214 }
230 215
231 /* Check for a power fault */ 216 /* Check for a power fault */
232 if (pciehp_query_power_fault(p_slot)) { 217 if (ctrl->power_fault_detected || pciehp_query_power_fault(p_slot)) {
233 ctrl_dbg(ctrl, "Power fault detected\n"); 218 ctrl_err(ctrl, "Power fault on slot %s\n", slot_name(p_slot));
234 retval = -EIO; 219 retval = -EIO;
235 goto err_exit; 220 goto err_exit;
236 } 221 }
@@ -363,25 +348,6 @@ void pciehp_queue_pushbutton_work(struct work_struct *work)
363 mutex_unlock(&p_slot->lock); 348 mutex_unlock(&p_slot->lock);
364} 349}
365 350
366static int update_slot_info(struct slot *slot)
367{
368 struct hotplug_slot_info *info;
369 int result;
370
371 info = kmalloc(sizeof(*info), GFP_KERNEL);
372 if (!info)
373 return -ENOMEM;
374
375 pciehp_get_power_status(slot, &info->power_status);
376 pciehp_get_attention_status(slot, &info->attention_status);
377 pciehp_get_latch_status(slot, &info->latch_status);
378 pciehp_get_adapter_status(slot, &info->adapter_status);
379
380 result = pci_hp_change_slot_info(slot->hotplug_slot, info);
381 kfree (info);
382 return result;
383}
384
385/* 351/*
386 * Note: This function must be called with slot->lock held 352 * Note: This function must be called with slot->lock held
387 */ 353 */
@@ -442,7 +408,6 @@ static void handle_button_press_event(struct slot *p_slot)
442 * to hot-add or hot-remove is undergoing 408 * to hot-add or hot-remove is undergoing
443 */ 409 */
444 ctrl_info(ctrl, "Button ignore on Slot(%s)\n", slot_name(p_slot)); 410 ctrl_info(ctrl, "Button ignore on Slot(%s)\n", slot_name(p_slot));
445 update_slot_info(p_slot);
446 break; 411 break;
447 default: 412 default:
448 ctrl_warn(ctrl, "Not a valid state\n"); 413 ctrl_warn(ctrl, "Not a valid state\n");
@@ -500,11 +465,9 @@ static void interrupt_event_handler(struct work_struct *work)
500 if (!HP_SUPR_RM(ctrl)) 465 if (!HP_SUPR_RM(ctrl))
501 break; 466 break;
502 ctrl_dbg(ctrl, "Surprise Removal\n"); 467 ctrl_dbg(ctrl, "Surprise Removal\n");
503 update_slot_info(p_slot);
504 handle_surprise_event(p_slot); 468 handle_surprise_event(p_slot);
505 break; 469 break;
506 default: 470 default:
507 update_slot_info(p_slot);
508 break; 471 break;
509 } 472 }
510 mutex_unlock(&p_slot->lock); 473 mutex_unlock(&p_slot->lock);
@@ -547,9 +510,6 @@ int pciehp_enable_slot(struct slot *p_slot)
547 if (rc) { 510 if (rc) {
548 pciehp_get_latch_status(p_slot, &getstatus); 511 pciehp_get_latch_status(p_slot, &getstatus);
549 } 512 }
550
551 update_slot_info(p_slot);
552
553 return rc; 513 return rc;
554} 514}
555 515
@@ -590,10 +550,7 @@ int pciehp_disable_slot(struct slot *p_slot)
590 } 550 }
591 } 551 }
592 552
593 ret = remove_board(p_slot); 553 return remove_board(p_slot);
594 update_slot_info(p_slot);
595
596 return ret;
597} 554}
598 555
599int pciehp_sysfs_enable_slot(struct slot *p_slot) 556int pciehp_sysfs_enable_slot(struct slot *p_slot)