aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/pciehp_ctrl.c
diff options
context:
space:
mode:
authorKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>2009-09-15 04:30:48 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2009-09-17 13:06:31 -0400
commit82a9e79ef132cbf77de58aae35c1a14237f2fcde (patch)
tree1ca6f0dc69cb7e92df48d4f05b595b032e03e206 /drivers/pci/hotplug/pciehp_ctrl.c
parent385e24917ed8eeba25dddd8e63bf3fe3d53eafc5 (diff)
PCI: pciehp: remove hpc_ops
The struct hpc_ops seems a set of hooks to controller specific routines. But, it is meaningless because no hotplug controller driver follows this framework. Acked-by: Alex Chiang <achiang@hp.com> Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/hotplug/pciehp_ctrl.c')
-rw-r--r--drivers/pci/hotplug/pciehp_ctrl.c75
1 files changed, 37 insertions, 38 deletions
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c
index c3e5ca57af7c..81c322de137d 100644
--- a/drivers/pci/hotplug/pciehp_ctrl.c
+++ b/drivers/pci/hotplug/pciehp_ctrl.c
@@ -82,7 +82,7 @@ u8 pciehp_handle_switch_change(struct slot *p_slot)
82 /* Switch Change */ 82 /* Switch Change */
83 ctrl_dbg(ctrl, "Switch interrupt received\n"); 83 ctrl_dbg(ctrl, "Switch interrupt received\n");
84 84
85 p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 85 pciehp_get_latch_status(p_slot, &getstatus);
86 if (getstatus) { 86 if (getstatus) {
87 /* 87 /*
88 * Switch opened 88 * Switch opened
@@ -114,7 +114,7 @@ u8 pciehp_handle_presence_change(struct slot *p_slot)
114 /* Switch is open, assume a presence change 114 /* Switch is open, assume a presence change
115 * Save the presence state 115 * Save the presence state
116 */ 116 */
117 p_slot->hpc_ops->get_adapter_status(p_slot, &presence_save); 117 pciehp_get_adapter_status(p_slot, &presence_save);
118 if (presence_save) { 118 if (presence_save) {
119 /* 119 /*
120 * Card Present 120 * Card Present
@@ -143,7 +143,7 @@ u8 pciehp_handle_power_fault(struct slot *p_slot)
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
146 if ( !(p_slot->hpc_ops->query_power_fault(p_slot))) { 146 if (!pciehp_query_power_fault(p_slot)) {
147 /* 147 /*
148 * power fault Cleared 148 * power fault Cleared
149 */ 149 */
@@ -172,7 +172,7 @@ static void set_slot_off(struct controller *ctrl, struct slot * pslot)
172{ 172{
173 /* turn off slot, turn on Amber LED, turn off Green LED if supported*/ 173 /* turn off slot, turn on Amber LED, turn off Green LED if supported*/
174 if (POWER_CTRL(ctrl)) { 174 if (POWER_CTRL(ctrl)) {
175 if (pslot->hpc_ops->power_off_slot(pslot)) { 175 if (pciehp_power_off_slot(pslot)) {
176 ctrl_err(ctrl, 176 ctrl_err(ctrl,
177 "Issue of Slot Power Off command failed\n"); 177 "Issue of Slot Power Off command failed\n");
178 return; 178 return;
@@ -186,10 +186,10 @@ static void set_slot_off(struct controller *ctrl, struct slot * pslot)
186 } 186 }
187 187
188 if (PWR_LED(ctrl)) 188 if (PWR_LED(ctrl))
189 pslot->hpc_ops->green_led_off(pslot); 189 pciehp_green_led_off(pslot);
190 190
191 if (ATTN_LED(ctrl)) { 191 if (ATTN_LED(ctrl)) {
192 if (pslot->hpc_ops->set_attention_status(pslot, 1)) { 192 if (pciehp_set_attention_status(pslot, 1)) {
193 ctrl_err(ctrl, 193 ctrl_err(ctrl,
194 "Issue of Set Attention Led command failed\n"); 194 "Issue of Set Attention Led command failed\n");
195 return; 195 return;
@@ -212,16 +212,16 @@ static int board_added(struct slot *p_slot)
212 212
213 if (POWER_CTRL(ctrl)) { 213 if (POWER_CTRL(ctrl)) {
214 /* Power on slot */ 214 /* Power on slot */
215 retval = p_slot->hpc_ops->power_on_slot(p_slot); 215 retval = pciehp_power_on_slot(p_slot);
216 if (retval) 216 if (retval)
217 return retval; 217 return retval;
218 } 218 }
219 219
220 if (PWR_LED(ctrl)) 220 if (PWR_LED(ctrl))
221 p_slot->hpc_ops->green_led_blink(p_slot); 221 pciehp_green_led_blink(p_slot);
222 222
223 /* Check link training status */ 223 /* Check link training status */
224 retval = p_slot->hpc_ops->check_lnk_status(ctrl); 224 retval = pciehp_check_link_status(ctrl);
225 if (retval) { 225 if (retval) {
226 ctrl_err(ctrl, "Failed to check link status\n"); 226 ctrl_err(ctrl, "Failed to check link status\n");
227 set_slot_off(ctrl, p_slot); 227 set_slot_off(ctrl, p_slot);
@@ -229,7 +229,7 @@ static int board_added(struct slot *p_slot)
229 } 229 }
230 230
231 /* Check for a power fault */ 231 /* Check for a power fault */
232 if (p_slot->hpc_ops->query_power_fault(p_slot)) { 232 if (pciehp_query_power_fault(p_slot)) {
233 ctrl_dbg(ctrl, "Power fault detected\n"); 233 ctrl_dbg(ctrl, "Power fault detected\n");
234 retval = POWER_FAILURE; 234 retval = POWER_FAILURE;
235 goto err_exit; 235 goto err_exit;
@@ -243,7 +243,7 @@ static int board_added(struct slot *p_slot)
243 } 243 }
244 244
245 if (PWR_LED(ctrl)) 245 if (PWR_LED(ctrl))
246 p_slot->hpc_ops->green_led_on(p_slot); 246 pciehp_green_led_on(p_slot);
247 247
248 return 0; 248 return 0;
249 249
@@ -267,7 +267,7 @@ static int remove_board(struct slot *p_slot)
267 267
268 if (POWER_CTRL(ctrl)) { 268 if (POWER_CTRL(ctrl)) {
269 /* power off slot */ 269 /* power off slot */
270 retval = p_slot->hpc_ops->power_off_slot(p_slot); 270 retval = pciehp_power_off_slot(p_slot);
271 if (retval) { 271 if (retval) {
272 ctrl_err(ctrl, 272 ctrl_err(ctrl,
273 "Issue of Slot Disable command failed\n"); 273 "Issue of Slot Disable command failed\n");
@@ -281,9 +281,9 @@ static int remove_board(struct slot *p_slot)
281 msleep(1000); 281 msleep(1000);
282 } 282 }
283 283
284 /* turn off Green LED */
284 if (PWR_LED(ctrl)) 285 if (PWR_LED(ctrl))
285 /* turn off Green LED */ 286 pciehp_green_led_off(p_slot);
286 p_slot->hpc_ops->green_led_off(p_slot);
287 287
288 return 0; 288 return 0;
289} 289}
@@ -320,9 +320,8 @@ static void pciehp_power_thread(struct work_struct *work)
320 break; 320 break;
321 case POWERON_STATE: 321 case POWERON_STATE:
322 mutex_unlock(&p_slot->lock); 322 mutex_unlock(&p_slot->lock);
323 if (pciehp_enable_slot(p_slot) && 323 if (pciehp_enable_slot(p_slot) && PWR_LED(p_slot->ctrl))
324 PWR_LED(p_slot->ctrl)) 324 pciehp_green_led_off(p_slot);
325 p_slot->hpc_ops->green_led_off(p_slot);
326 mutex_lock(&p_slot->lock); 325 mutex_lock(&p_slot->lock);
327 p_slot->state = STATIC_STATE; 326 p_slot->state = STATIC_STATE;
328 break; 327 break;
@@ -373,10 +372,10 @@ static int update_slot_info(struct slot *slot)
373 if (!info) 372 if (!info)
374 return -ENOMEM; 373 return -ENOMEM;
375 374
376 slot->hpc_ops->get_power_status(slot, &(info->power_status)); 375 pciehp_get_power_status(slot, &info->power_status);
377 slot->hpc_ops->get_attention_status(slot, &(info->attention_status)); 376 pciehp_get_attention_status(slot, &info->attention_status);
378 slot->hpc_ops->get_latch_status(slot, &(info->latch_status)); 377 pciehp_get_latch_status(slot, &info->latch_status);
379 slot->hpc_ops->get_adapter_status(slot, &(info->adapter_status)); 378 pciehp_get_adapter_status(slot, &info->adapter_status);
380 379
381 result = pci_hp_change_slot_info(slot->hotplug_slot, info); 380 result = pci_hp_change_slot_info(slot->hotplug_slot, info);
382 kfree (info); 381 kfree (info);
@@ -393,7 +392,7 @@ static void handle_button_press_event(struct slot *p_slot)
393 392
394 switch (p_slot->state) { 393 switch (p_slot->state) {
395 case STATIC_STATE: 394 case STATIC_STATE:
396 p_slot->hpc_ops->get_power_status(p_slot, &getstatus); 395 pciehp_get_power_status(p_slot, &getstatus);
397 if (getstatus) { 396 if (getstatus) {
398 p_slot->state = BLINKINGOFF_STATE; 397 p_slot->state = BLINKINGOFF_STATE;
399 ctrl_info(ctrl, 398 ctrl_info(ctrl,
@@ -407,9 +406,9 @@ static void handle_button_press_event(struct slot *p_slot)
407 } 406 }
408 /* blink green LED and turn off amber */ 407 /* blink green LED and turn off amber */
409 if (PWR_LED(ctrl)) 408 if (PWR_LED(ctrl))
410 p_slot->hpc_ops->green_led_blink(p_slot); 409 pciehp_green_led_blink(p_slot);
411 if (ATTN_LED(ctrl)) 410 if (ATTN_LED(ctrl))
412 p_slot->hpc_ops->set_attention_status(p_slot, 0); 411 pciehp_set_attention_status(p_slot, 0);
413 412
414 schedule_delayed_work(&p_slot->work, 5*HZ); 413 schedule_delayed_work(&p_slot->work, 5*HZ);
415 break; 414 break;
@@ -424,13 +423,13 @@ static void handle_button_press_event(struct slot *p_slot)
424 cancel_delayed_work(&p_slot->work); 423 cancel_delayed_work(&p_slot->work);
425 if (p_slot->state == BLINKINGOFF_STATE) { 424 if (p_slot->state == BLINKINGOFF_STATE) {
426 if (PWR_LED(ctrl)) 425 if (PWR_LED(ctrl))
427 p_slot->hpc_ops->green_led_on(p_slot); 426 pciehp_green_led_on(p_slot);
428 } else { 427 } else {
429 if (PWR_LED(ctrl)) 428 if (PWR_LED(ctrl))
430 p_slot->hpc_ops->green_led_off(p_slot); 429 pciehp_green_led_off(p_slot);
431 } 430 }
432 if (ATTN_LED(ctrl)) 431 if (ATTN_LED(ctrl))
433 p_slot->hpc_ops->set_attention_status(p_slot, 0); 432 pciehp_set_attention_status(p_slot, 0);
434 ctrl_info(ctrl, "PCI slot #%s - action canceled " 433 ctrl_info(ctrl, "PCI slot #%s - action canceled "
435 "due to button press\n", slot_name(p_slot)); 434 "due to button press\n", slot_name(p_slot));
436 p_slot->state = STATIC_STATE; 435 p_slot->state = STATIC_STATE;
@@ -468,7 +467,7 @@ static void handle_surprise_event(struct slot *p_slot)
468 info->p_slot = p_slot; 467 info->p_slot = p_slot;
469 INIT_WORK(&info->work, pciehp_power_thread); 468 INIT_WORK(&info->work, pciehp_power_thread);
470 469
471 p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); 470 pciehp_get_adapter_status(p_slot, &getstatus);
472 if (!getstatus) 471 if (!getstatus)
473 p_slot->state = POWEROFF_STATE; 472 p_slot->state = POWEROFF_STATE;
474 else 473 else
@@ -492,9 +491,9 @@ static void interrupt_event_handler(struct work_struct *work)
492 if (!POWER_CTRL(ctrl)) 491 if (!POWER_CTRL(ctrl))
493 break; 492 break;
494 if (ATTN_LED(ctrl)) 493 if (ATTN_LED(ctrl))
495 p_slot->hpc_ops->set_attention_status(p_slot, 1); 494 pciehp_set_attention_status(p_slot, 1);
496 if (PWR_LED(ctrl)) 495 if (PWR_LED(ctrl))
497 p_slot->hpc_ops->green_led_off(p_slot); 496 pciehp_green_led_off(p_slot);
498 break; 497 break;
499 case INT_PRESENCE_ON: 498 case INT_PRESENCE_ON:
500 case INT_PRESENCE_OFF: 499 case INT_PRESENCE_OFF:
@@ -519,13 +518,13 @@ int pciehp_enable_slot(struct slot *p_slot)
519 int rc; 518 int rc;
520 struct controller *ctrl = p_slot->ctrl; 519 struct controller *ctrl = p_slot->ctrl;
521 520
522 rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); 521 rc = pciehp_get_adapter_status(p_slot, &getstatus);
523 if (rc || !getstatus) { 522 if (rc || !getstatus) {
524 ctrl_info(ctrl, "No adapter on slot(%s)\n", slot_name(p_slot)); 523 ctrl_info(ctrl, "No adapter on slot(%s)\n", slot_name(p_slot));
525 return -ENODEV; 524 return -ENODEV;
526 } 525 }
527 if (MRL_SENS(p_slot->ctrl)) { 526 if (MRL_SENS(p_slot->ctrl)) {
528 rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 527 rc = pciehp_get_latch_status(p_slot, &getstatus);
529 if (rc || getstatus) { 528 if (rc || getstatus) {
530 ctrl_info(ctrl, "Latch open on slot(%s)\n", 529 ctrl_info(ctrl, "Latch open on slot(%s)\n",
531 slot_name(p_slot)); 530 slot_name(p_slot));
@@ -534,7 +533,7 @@ int pciehp_enable_slot(struct slot *p_slot)
534 } 533 }
535 534
536 if (POWER_CTRL(p_slot->ctrl)) { 535 if (POWER_CTRL(p_slot->ctrl)) {
537 rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); 536 rc = pciehp_get_power_status(p_slot, &getstatus);
538 if (rc || getstatus) { 537 if (rc || getstatus) {
539 ctrl_info(ctrl, "Already enabled on slot(%s)\n", 538 ctrl_info(ctrl, "Already enabled on slot(%s)\n",
540 slot_name(p_slot)); 539 slot_name(p_slot));
@@ -542,11 +541,11 @@ int pciehp_enable_slot(struct slot *p_slot)
542 } 541 }
543 } 542 }
544 543
545 p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 544 pciehp_get_latch_status(p_slot, &getstatus);
546 545
547 rc = board_added(p_slot); 546 rc = board_added(p_slot);
548 if (rc) { 547 if (rc) {
549 p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 548 pciehp_get_latch_status(p_slot, &getstatus);
550 } 549 }
551 550
552 update_slot_info(p_slot); 551 update_slot_info(p_slot);
@@ -565,7 +564,7 @@ int pciehp_disable_slot(struct slot *p_slot)
565 return 1; 564 return 1;
566 565
567 if (!HP_SUPR_RM(p_slot->ctrl)) { 566 if (!HP_SUPR_RM(p_slot->ctrl)) {
568 ret = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); 567 ret = pciehp_get_adapter_status(p_slot, &getstatus);
569 if (ret || !getstatus) { 568 if (ret || !getstatus) {
570 ctrl_info(ctrl, "No adapter on slot(%s)\n", 569 ctrl_info(ctrl, "No adapter on slot(%s)\n",
571 slot_name(p_slot)); 570 slot_name(p_slot));
@@ -574,7 +573,7 @@ int pciehp_disable_slot(struct slot *p_slot)
574 } 573 }
575 574
576 if (MRL_SENS(p_slot->ctrl)) { 575 if (MRL_SENS(p_slot->ctrl)) {
577 ret = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 576 ret = pciehp_get_latch_status(p_slot, &getstatus);
578 if (ret || getstatus) { 577 if (ret || getstatus) {
579 ctrl_info(ctrl, "Latch open on slot(%s)\n", 578 ctrl_info(ctrl, "Latch open on slot(%s)\n",
580 slot_name(p_slot)); 579 slot_name(p_slot));
@@ -583,7 +582,7 @@ int pciehp_disable_slot(struct slot *p_slot)
583 } 582 }
584 583
585 if (POWER_CTRL(p_slot->ctrl)) { 584 if (POWER_CTRL(p_slot->ctrl)) {
586 ret = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); 585 ret = pciehp_get_power_status(p_slot, &getstatus);
587 if (ret || !getstatus) { 586 if (ret || !getstatus) {
588 ctrl_info(ctrl, "Already disabled on slot(%s)\n", 587 ctrl_info(ctrl, "Already disabled on slot(%s)\n",
589 slot_name(p_slot)); 588 slot_name(p_slot));