aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/pciehp_ctrl.c
diff options
context:
space:
mode:
authorKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>2009-10-05 04:42:59 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2009-11-04 12:01:59 -0500
commit445f798555e218a5601222ca5849e8553ddd866a (patch)
tree54437d660ae3a98b5480050e48f6ecf4051cb660 /drivers/pci/hotplug/pciehp_ctrl.c
parent586f1d6688c68a6c7fa4e6a00fa3968b16daef75 (diff)
PCI: pciehp: return error on read/write failure
Current pciehp returns successfully on read/write failure with dummy state values. It should return error instead. With this patch, pciehp no longer uses hotplug_slot_info data structure. So this also removes hotplug_slot_info related code. But note that it still allocates hotplug_slot_info because it is required by pci hotplug core. 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.c30
1 files changed, 1 insertions, 29 deletions
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c
index 84487d126e4d..15ce2a3cc0f1 100644
--- a/drivers/pci/hotplug/pciehp_ctrl.c
+++ b/drivers/pci/hotplug/pciehp_ctrl.c
@@ -363,25 +363,6 @@ void pciehp_queue_pushbutton_work(struct work_struct *work)
363 mutex_unlock(&p_slot->lock); 363 mutex_unlock(&p_slot->lock);
364} 364}
365 365
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/* 366/*
386 * Note: This function must be called with slot->lock held 367 * Note: This function must be called with slot->lock held
387 */ 368 */
@@ -442,7 +423,6 @@ static void handle_button_press_event(struct slot *p_slot)
442 * to hot-add or hot-remove is undergoing 423 * to hot-add or hot-remove is undergoing
443 */ 424 */
444 ctrl_info(ctrl, "Button ignore on Slot(%s)\n", slot_name(p_slot)); 425 ctrl_info(ctrl, "Button ignore on Slot(%s)\n", slot_name(p_slot));
445 update_slot_info(p_slot);
446 break; 426 break;
447 default: 427 default:
448 ctrl_warn(ctrl, "Not a valid state\n"); 428 ctrl_warn(ctrl, "Not a valid state\n");
@@ -500,11 +480,9 @@ static void interrupt_event_handler(struct work_struct *work)
500 if (!HP_SUPR_RM(ctrl)) 480 if (!HP_SUPR_RM(ctrl))
501 break; 481 break;
502 ctrl_dbg(ctrl, "Surprise Removal\n"); 482 ctrl_dbg(ctrl, "Surprise Removal\n");
503 update_slot_info(p_slot);
504 handle_surprise_event(p_slot); 483 handle_surprise_event(p_slot);
505 break; 484 break;
506 default: 485 default:
507 update_slot_info(p_slot);
508 break; 486 break;
509 } 487 }
510 mutex_unlock(&p_slot->lock); 488 mutex_unlock(&p_slot->lock);
@@ -547,9 +525,6 @@ int pciehp_enable_slot(struct slot *p_slot)
547 if (rc) { 525 if (rc) {
548 pciehp_get_latch_status(p_slot, &getstatus); 526 pciehp_get_latch_status(p_slot, &getstatus);
549 } 527 }
550
551 update_slot_info(p_slot);
552
553 return rc; 528 return rc;
554} 529}
555 530
@@ -590,10 +565,7 @@ int pciehp_disable_slot(struct slot *p_slot)
590 } 565 }
591 } 566 }
592 567
593 ret = remove_board(p_slot); 568 return remove_board(p_slot);
594 update_slot_info(p_slot);
595
596 return ret;
597} 569}
598 570
599int pciehp_sysfs_enable_slot(struct slot *p_slot) 571int pciehp_sysfs_enable_slot(struct slot *p_slot)