From bd62e271401c5ebf33a0dd24d89baf706f213251 Mon Sep 17 00:00:00 2001 From: Kenji Kaneshige Date: Fri, 25 Nov 2005 12:28:53 +0900 Subject: [PATCH] shpchp: fix improper wait for command completion Current SHPCHP driver uses msleep_interruptible() function to wait for a command completion event. But I think this would cause an unnecessary long wait until timeout, if command completion interrupt came before task state was changed to TASK_INTERRUPTIBLE. This patch fixes this issue. With this patch, command completion becomes faster as follows: o Without this patch # time echo 1 > power real 0m4.708s user 0m0.000s sys 0m0.524s o With this patch # time echo 1 > power real 0m2.221s user 0m0.000s sys 0m0.532s Signed-off-by: Kenji Kaneshige Signed-off-by: Greg Kroah-Hartman --- drivers/pci/hotplug/shpchp_ctrl.c | 37 ------------------------------------- 1 file changed, 37 deletions(-) (limited to 'drivers/pci/hotplug/shpchp_ctrl.c') diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c index 58619359ad08..25ccb0e47593 100644 --- a/drivers/pci/hotplug/shpchp_ctrl.c +++ b/drivers/pci/hotplug/shpchp_ctrl.c @@ -248,7 +248,6 @@ static int change_bus_speed(struct controller *ctrl, struct slot *p_slot, up(&ctrl->crit_sect); return WRONG_BUS_FREQUENCY; } - wait_for_ctrl_irq (ctrl); if ((rc = p_slot->hpc_ops->check_cmd_status(ctrl))) { err("%s: Can't set bus speed/mode in the case of adapter & bus mismatch\n", @@ -330,9 +329,6 @@ static int board_added(struct slot *p_slot) up(&ctrl->crit_sect); return -1; } - - /* Wait for the command to complete */ - wait_for_ctrl_irq (ctrl); rc = p_slot->hpc_ops->check_cmd_status(ctrl); if (rc) { @@ -352,7 +348,6 @@ static int board_added(struct slot *p_slot) up(&ctrl->crit_sect); return WRONG_BUS_FREQUENCY; } - wait_for_ctrl_irq (ctrl); if ((rc = p_slot->hpc_ops->check_cmd_status(ctrl))) { err("%s: Can't set bus speed/mode in the case of adapter & bus mismatch\n", @@ -367,7 +362,6 @@ static int board_added(struct slot *p_slot) up(&ctrl->crit_sect); return rc; } - wait_for_ctrl_irq (ctrl); if ((rc = p_slot->hpc_ops->check_cmd_status(ctrl))) { err("%s: Failed to enable slot, error code(%d)\n", __FUNCTION__, rc); @@ -494,7 +488,6 @@ static int board_added(struct slot *p_slot) up(&ctrl->crit_sect); return rc; } - wait_for_ctrl_irq (ctrl); if ((rc = p_slot->hpc_ops->check_cmd_status(ctrl))) { err("%s: Failed to enable slot, error code(%d)\n", __FUNCTION__, rc); @@ -532,9 +525,6 @@ static int board_added(struct slot *p_slot) p_slot->hpc_ops->green_led_on(p_slot); - /* Wait for the command to complete */ - wait_for_ctrl_irq (ctrl); - /* Done with exclusive hardware access */ up(&ctrl->crit_sect); @@ -552,8 +542,6 @@ err_exit: up(&ctrl->crit_sect); return rc; } - /* Wait for the command to complete */ - wait_for_ctrl_irq (ctrl); rc = p_slot->hpc_ops->check_cmd_status(ctrl); if (rc) { @@ -603,8 +591,6 @@ static int remove_board(struct slot *p_slot) up(&ctrl->crit_sect); return rc; } - /* Wait for the command to complete */ - wait_for_ctrl_irq (ctrl); rc = p_slot->hpc_ops->check_cmd_status(ctrl); if (rc) { @@ -621,8 +607,6 @@ static int remove_board(struct slot *p_slot) up(&ctrl->crit_sect); return rc; } - /* Wait for the command to complete */ - wait_for_ctrl_irq (ctrl); /* Done with exclusive hardware access */ up(&ctrl->crit_sect); @@ -676,9 +660,6 @@ static void shpchp_pushbutton_thread (unsigned long slot) p_slot->hpc_ops->green_led_off(p_slot); - /* Wait for the command to complete */ - wait_for_ctrl_irq (p_slot->ctrl); - /* Done with exclusive hardware access */ up(&p_slot->ctrl->crit_sect); } @@ -790,14 +771,9 @@ static void interrupt_event_handler(struct controller *ctrl) down(&ctrl->crit_sect); p_slot->hpc_ops->green_led_on(p_slot); - /* Wait for the command to complete */ - wait_for_ctrl_irq (ctrl); p_slot->hpc_ops->set_attention_status(p_slot, 0); - /* Wait for the command to complete */ - wait_for_ctrl_irq (ctrl); - /* Done with exclusive hardware access */ up(&ctrl->crit_sect); break; @@ -806,12 +782,8 @@ static void interrupt_event_handler(struct controller *ctrl) down(&ctrl->crit_sect); p_slot->hpc_ops->green_led_off(p_slot); - /* Wait for the command to complete */ - wait_for_ctrl_irq (ctrl); p_slot->hpc_ops->set_attention_status(p_slot, 0); - /* Wait for the command to complete */ - wait_for_ctrl_irq (ctrl); /* Done with exclusive hardware access */ up(&ctrl->crit_sect); @@ -845,14 +817,9 @@ static void interrupt_event_handler(struct controller *ctrl) /* blink green LED and turn off amber */ p_slot->hpc_ops->green_led_blink(p_slot); - /* Wait for the command to complete */ - wait_for_ctrl_irq (ctrl); p_slot->hpc_ops->set_attention_status(p_slot, 0); - /* Wait for the command to complete */ - wait_for_ctrl_irq (ctrl); - /* Done with exclusive hardware access */ up(&ctrl->crit_sect); @@ -870,12 +837,8 @@ static void interrupt_event_handler(struct controller *ctrl) down(&ctrl->crit_sect); p_slot->hpc_ops->set_attention_status(p_slot, 1); - /* Wait for the command to complete */ - wait_for_ctrl_irq (ctrl); p_slot->hpc_ops->green_led_off(p_slot); - /* Wait for the command to complete */ - wait_for_ctrl_irq (ctrl); /* Done with exclusive hardware access */ up(&ctrl->crit_sect); -- cgit v1.2.1