summaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/shpchp_ctrl.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-01-13 16:02:15 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2006-03-23 14:35:10 -0800
commit6aa4cdd07139ba4d5b89139b0070d795cc4dea88 (patch)
tree3bfe5e8ef916f0e27c0ea8ef0d073fcd01cfff29 /drivers/pci/hotplug/shpchp_ctrl.c
parentc408a3794d6222ab43ab26648385f850a82f0803 (diff)
[PATCH] PCI hotplug: convert semaphores to mutex
semaphore to mutex conversion. the conversion was generated via scripts, and the result was validated automatically via a script as well. build tested with allyesconfig. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci/hotplug/shpchp_ctrl.c')
-rw-r--r--drivers/pci/hotplug/shpchp_ctrl.c98
1 files changed, 49 insertions, 49 deletions
diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c
index 643252d9bf3..65e69252e2f 100644
--- a/drivers/pci/hotplug/shpchp_ctrl.c
+++ b/drivers/pci/hotplug/shpchp_ctrl.c
@@ -242,10 +242,10 @@ static int change_bus_speed(struct controller *ctrl, struct slot *p_slot,
int rc = 0;
dbg("%s: change to speed %d\n", __FUNCTION__, speed);
- down(&ctrl->crit_sect);
+ mutex_lock(&ctrl->crit_sect);
if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, speed))) {
err("%s: Issue of set bus speed mode command failed\n", __FUNCTION__);
- up(&ctrl->crit_sect);
+ mutex_unlock(&ctrl->crit_sect);
return WRONG_BUS_FREQUENCY;
}
@@ -253,10 +253,10 @@ static int change_bus_speed(struct controller *ctrl, struct slot *p_slot,
err("%s: Can't set bus speed/mode in the case of adapter & bus mismatch\n",
__FUNCTION__);
err("%s: Error code (%d)\n", __FUNCTION__, rc);
- up(&ctrl->crit_sect);
+ mutex_unlock(&ctrl->crit_sect);
return WRONG_BUS_FREQUENCY;
}
- up(&ctrl->crit_sect);
+ mutex_unlock(&ctrl->crit_sect);
return rc;
}
@@ -319,14 +319,14 @@ static int board_added(struct slot *p_slot)
ctrl->slot_device_offset, hp_slot);
/* Wait for exclusive access to hardware */
- down(&ctrl->crit_sect);
+ mutex_lock(&ctrl->crit_sect);
/* Power on slot without connecting to bus */
rc = p_slot->hpc_ops->power_on_slot(p_slot);
if (rc) {
err("%s: Failed to power on slot\n", __FUNCTION__);
/* Done with exclusive hardware access */
- up(&ctrl->crit_sect);
+ mutex_unlock(&ctrl->crit_sect);
return -1;
}
@@ -334,7 +334,7 @@ static int board_added(struct slot *p_slot)
if (rc) {
err("%s: Failed to power on slot, error code(%d)\n", __FUNCTION__, rc);
/* Done with exclusive hardware access */
- up(&ctrl->crit_sect);
+ mutex_unlock(&ctrl->crit_sect);
return -1;
}
@@ -345,7 +345,7 @@ static int board_added(struct slot *p_slot)
if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, PCI_SPEED_33MHz))) {
err("%s: Issue of set bus speed mode command failed\n", __FUNCTION__);
- up(&ctrl->crit_sect);
+ mutex_unlock(&ctrl->crit_sect);
return WRONG_BUS_FREQUENCY;
}
@@ -353,19 +353,19 @@ static int board_added(struct slot *p_slot)
err("%s: Can't set bus speed/mode in the case of adapter & bus mismatch\n",
__FUNCTION__);
err("%s: Error code (%d)\n", __FUNCTION__, rc);
- up(&ctrl->crit_sect);
+ mutex_unlock(&ctrl->crit_sect);
return WRONG_BUS_FREQUENCY;
}
/* turn on board, blink green LED, turn off Amber LED */
if ((rc = p_slot->hpc_ops->slot_enable(p_slot))) {
err("%s: Issue of Slot Enable command failed\n", __FUNCTION__);
- up(&ctrl->crit_sect);
+ mutex_unlock(&ctrl->crit_sect);
return rc;
}
if ((rc = p_slot->hpc_ops->check_cmd_status(ctrl))) {
err("%s: Failed to enable slot, error code(%d)\n", __FUNCTION__, rc);
- up(&ctrl->crit_sect);
+ mutex_unlock(&ctrl->crit_sect);
return rc;
}
}
@@ -380,7 +380,7 @@ static int board_added(struct slot *p_slot)
if (rc || adapter_speed == PCI_SPEED_UNKNOWN) {
err("%s: Can't get adapter speed or bus mode mismatch\n", __FUNCTION__);
/* Done with exclusive hardware access */
- up(&ctrl->crit_sect);
+ mutex_unlock(&ctrl->crit_sect);
return WRONG_BUS_FREQUENCY;
}
@@ -388,7 +388,7 @@ static int board_added(struct slot *p_slot)
if (rc || bus_speed == PCI_SPEED_UNKNOWN) {
err("%s: Can't get bus operation speed\n", __FUNCTION__);
/* Done with exclusive hardware access */
- up(&ctrl->crit_sect);
+ mutex_unlock(&ctrl->crit_sect);
return WRONG_BUS_FREQUENCY;
}
@@ -399,7 +399,7 @@ static int board_added(struct slot *p_slot)
}
/* Done with exclusive hardware access */
- up(&ctrl->crit_sect);
+ mutex_unlock(&ctrl->crit_sect);
if ((rc = p_slot->hpc_ops->get_prog_int(p_slot, &pi))) {
err("%s: Can't get controller programming interface, set it to 1\n", __FUNCTION__);
@@ -481,21 +481,21 @@ static int board_added(struct slot *p_slot)
return rc;
}
- down(&ctrl->crit_sect);
+ mutex_lock(&ctrl->crit_sect);
/* turn on board, blink green LED, turn off Amber LED */
if ((rc = p_slot->hpc_ops->slot_enable(p_slot))) {
err("%s: Issue of Slot Enable command failed\n", __FUNCTION__);
- up(&ctrl->crit_sect);
+ mutex_unlock(&ctrl->crit_sect);
return rc;
}
if ((rc = p_slot->hpc_ops->check_cmd_status(ctrl))) {
err("%s: Failed to enable slot, error code(%d)\n", __FUNCTION__, rc);
- up(&ctrl->crit_sect);
+ mutex_unlock(&ctrl->crit_sect);
return rc;
}
- up(&ctrl->crit_sect);
+ mutex_unlock(&ctrl->crit_sect);
/* Wait for ~1 second */
wait_for_ctrl_irq (ctrl);
@@ -521,25 +521,25 @@ static int board_added(struct slot *p_slot)
p_slot->pwr_save = 1;
/* Wait for exclusive access to hardware */
- down(&ctrl->crit_sect);
+ mutex_lock(&ctrl->crit_sect);
p_slot->hpc_ops->green_led_on(p_slot);
/* Done with exclusive hardware access */
- up(&ctrl->crit_sect);
+ mutex_unlock(&ctrl->crit_sect);
return 0;
err_exit:
/* Wait for exclusive access to hardware */
- down(&ctrl->crit_sect);
+ mutex_lock(&ctrl->crit_sect);
/* turn off slot, turn on Amber LED, turn off Green LED */
rc = p_slot->hpc_ops->slot_disable(p_slot);
if (rc) {
err("%s: Issue of Slot Disable command failed\n", __FUNCTION__);
/* Done with exclusive hardware access */
- up(&ctrl->crit_sect);
+ mutex_unlock(&ctrl->crit_sect);
return rc;
}
@@ -547,12 +547,12 @@ err_exit:
if (rc) {
err("%s: Failed to disable slot, error code(%d)\n", __FUNCTION__, rc);
/* Done with exclusive hardware access */
- up(&ctrl->crit_sect);
+ mutex_unlock(&ctrl->crit_sect);
return rc;
}
/* Done with exclusive hardware access */
- up(&ctrl->crit_sect);
+ mutex_unlock(&ctrl->crit_sect);
return(rc);
}
@@ -581,14 +581,14 @@ static int remove_board(struct slot *p_slot)
p_slot->status = 0x01;
/* Wait for exclusive access to hardware */
- down(&ctrl->crit_sect);
+ mutex_lock(&ctrl->crit_sect);
/* turn off slot, turn on Amber LED, turn off Green LED */
rc = p_slot->hpc_ops->slot_disable(p_slot);
if (rc) {
err("%s: Issue of Slot Disable command failed\n", __FUNCTION__);
/* Done with exclusive hardware access */
- up(&ctrl->crit_sect);
+ mutex_unlock(&ctrl->crit_sect);
return rc;
}
@@ -596,7 +596,7 @@ static int remove_board(struct slot *p_slot)
if (rc) {
err("%s: Failed to disable slot, error code(%d)\n", __FUNCTION__, rc);
/* Done with exclusive hardware access */
- up(&ctrl->crit_sect);
+ mutex_unlock(&ctrl->crit_sect);
return rc;
}
@@ -604,12 +604,12 @@ static int remove_board(struct slot *p_slot)
if (rc) {
err("%s: Issue of Set Attention command failed\n", __FUNCTION__);
/* Done with exclusive hardware access */
- up(&ctrl->crit_sect);
+ mutex_unlock(&ctrl->crit_sect);
return rc;
}
/* Done with exclusive hardware access */
- up(&ctrl->crit_sect);
+ mutex_unlock(&ctrl->crit_sect);
p_slot->pwr_save = 0;
p_slot->is_a_board = 0;
@@ -656,12 +656,12 @@ static void shpchp_pushbutton_thread (unsigned long slot)
if (shpchp_enable_slot(p_slot)) {
/* Wait for exclusive access to hardware */
- down(&p_slot->ctrl->crit_sect);
+ mutex_lock(&p_slot->ctrl->crit_sect);
p_slot->hpc_ops->green_led_off(p_slot);
/* Done with exclusive hardware access */
- up(&p_slot->ctrl->crit_sect);
+ mutex_unlock(&p_slot->ctrl->crit_sect);
}
p_slot->state = STATIC_STATE;
}
@@ -768,25 +768,25 @@ static void interrupt_event_handler(struct controller *ctrl)
switch (p_slot->state) {
case BLINKINGOFF_STATE:
/* Wait for exclusive access to hardware */
- down(&ctrl->crit_sect);
+ mutex_lock(&ctrl->crit_sect);
p_slot->hpc_ops->green_led_on(p_slot);
p_slot->hpc_ops->set_attention_status(p_slot, 0);
/* Done with exclusive hardware access */
- up(&ctrl->crit_sect);
+ mutex_unlock(&ctrl->crit_sect);
break;
case BLINKINGON_STATE:
/* Wait for exclusive access to hardware */
- down(&ctrl->crit_sect);
+ mutex_lock(&ctrl->crit_sect);
p_slot->hpc_ops->green_led_off(p_slot);
p_slot->hpc_ops->set_attention_status(p_slot, 0);
/* Done with exclusive hardware access */
- up(&ctrl->crit_sect);
+ mutex_unlock(&ctrl->crit_sect);
break;
default:
@@ -813,7 +813,7 @@ static void interrupt_event_handler(struct controller *ctrl)
}
/* Wait for exclusive access to hardware */
- down(&ctrl->crit_sect);
+ mutex_lock(&ctrl->crit_sect);
/* blink green LED and turn off amber */
p_slot->hpc_ops->green_led_blink(p_slot);
@@ -821,7 +821,7 @@ static void interrupt_event_handler(struct controller *ctrl)
p_slot->hpc_ops->set_attention_status(p_slot, 0);
/* Done with exclusive hardware access */
- up(&ctrl->crit_sect);
+ mutex_unlock(&ctrl->crit_sect);
init_timer(&p_slot->task_event);
p_slot->task_event.expires = jiffies + 5 * HZ; /* 5 second delay */
@@ -834,14 +834,14 @@ static void interrupt_event_handler(struct controller *ctrl)
/***********POWER FAULT********************/
dbg("%s: power fault\n", __FUNCTION__);
/* Wait for exclusive access to hardware */
- down(&ctrl->crit_sect);
+ mutex_lock(&ctrl->crit_sect);
p_slot->hpc_ops->set_attention_status(p_slot, 1);
p_slot->hpc_ops->green_led_off(p_slot);
/* Done with exclusive hardware access */
- up(&ctrl->crit_sect);
+ mutex_unlock(&ctrl->crit_sect);
} else {
/* refresh notification */
if (p_slot)
@@ -865,26 +865,26 @@ int shpchp_enable_slot (struct slot *p_slot)
int rc;
/* Check to see if (latch closed, card present, power off) */
- down(&p_slot->ctrl->crit_sect);
+ mutex_lock(&p_slot->ctrl->crit_sect);
rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus);
if (rc || !getstatus) {
info("%s: no adapter on slot(%x)\n", __FUNCTION__, p_slot->number);
- up(&p_slot->ctrl->crit_sect);
+ mutex_unlock(&p_slot->ctrl->crit_sect);
return -ENODEV;
}
rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
if (rc || getstatus) {
info("%s: latch open on slot(%x)\n", __FUNCTION__, p_slot->number);
- up(&p_slot->ctrl->crit_sect);
+ mutex_unlock(&p_slot->ctrl->crit_sect);
return -ENODEV;
}
rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
if (rc || getstatus) {
info("%s: already enabled on slot(%x)\n", __FUNCTION__, p_slot->number);
- up(&p_slot->ctrl->crit_sect);
+ mutex_unlock(&p_slot->ctrl->crit_sect);
return -ENODEV;
}
- up(&p_slot->ctrl->crit_sect);
+ mutex_unlock(&p_slot->ctrl->crit_sect);
p_slot->is_a_board = 1;
@@ -925,27 +925,27 @@ int shpchp_disable_slot (struct slot *p_slot)
return -ENODEV;
/* Check to see if (latch closed, card present, power on) */
- down(&p_slot->ctrl->crit_sect);
+ mutex_lock(&p_slot->ctrl->crit_sect);
ret = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus);
if (ret || !getstatus) {
info("%s: no adapter on slot(%x)\n", __FUNCTION__, p_slot->number);
- up(&p_slot->ctrl->crit_sect);
+ mutex_unlock(&p_slot->ctrl->crit_sect);
return -ENODEV;
}
ret = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
if (ret || getstatus) {
info("%s: latch open on slot(%x)\n", __FUNCTION__, p_slot->number);
- up(&p_slot->ctrl->crit_sect);
+ mutex_unlock(&p_slot->ctrl->crit_sect);
return -ENODEV;
}
ret = p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
if (ret || !getstatus) {
info("%s: already disabled slot(%x)\n", __FUNCTION__, p_slot->number);
- up(&p_slot->ctrl->crit_sect);
+ mutex_unlock(&p_slot->ctrl->crit_sect);
return -ENODEV;
}
- up(&p_slot->ctrl->crit_sect);
+ mutex_unlock(&p_slot->ctrl->crit_sect);
ret = remove_board(p_slot);
update_slot_info(p_slot);