Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 39889
b: refs/heads/master
c: dd5619c
h: refs/heads/master
i:
  39887: e245577
v: v3
  • Loading branch information
Kenji Kaneshige authored and Greg Kroah-Hartman committed Oct 18, 2006
1 parent 4853336 commit 9335844
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 31 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 49ed2b4963cd00993eab518b820a6700f94f222d
refs/heads/master: dd5619cb4407e830a8921a93c949be37c81105b5
1 change: 1 addition & 0 deletions trunk/drivers/pci/hotplug/pciehp.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ struct php_ctlr_state_s {
struct controller {
struct controller *next;
struct mutex crit_sect; /* critical section mutex */
struct mutex ctrl_lock; /* controller lock */
struct php_ctlr_state_s *hpc_ctlr_handle; /* HPC controller handle */
int num_slots; /* Number of slots on ctlr */
int slot_num_inc; /* 1 or -1 */
Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/pci/hotplug/pciehp_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,23 +448,23 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_
}

/* Wait for exclusive access to hardware */
mutex_lock(&ctrl->crit_sect);
mutex_lock(&ctrl->ctrl_lock);

t_slot->hpc_ops->get_adapter_status(t_slot, &value); /* Check if slot is occupied */

if ((POWER_CTRL(ctrl->ctrlcap)) && !value) {
rc = t_slot->hpc_ops->power_off_slot(t_slot); /* Power off slot if not occupied*/
if (rc) {
/* Done with exclusive hardware access */
mutex_unlock(&ctrl->crit_sect);
mutex_unlock(&ctrl->ctrl_lock);
goto err_out_free_ctrl_slot;
} else
/* Wait for the command to complete */
wait_for_ctrl_irq (ctrl);
}

/* Done with exclusive hardware access */
mutex_unlock(&ctrl->crit_sect);
mutex_unlock(&ctrl->ctrl_lock);

return 0;

Expand Down
54 changes: 27 additions & 27 deletions trunk/drivers/pci/hotplug/pciehp_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,13 +234,13 @@ u8 pciehp_handle_power_fault(u8 hp_slot, void *inst_id)
static void set_slot_off(struct controller *ctrl, struct slot * pslot)
{
/* Wait for exclusive access to hardware */
mutex_lock(&ctrl->crit_sect);
mutex_lock(&ctrl->ctrl_lock);

/* turn off slot, turn on Amber LED, turn off Green LED if supported*/
if (POWER_CTRL(ctrl->ctrlcap)) {
if (pslot->hpc_ops->power_off_slot(pslot)) {
err("%s: Issue of Slot Power Off command failed\n", __FUNCTION__);
mutex_unlock(&ctrl->crit_sect);
mutex_unlock(&ctrl->ctrl_lock);
return;
}
wait_for_ctrl_irq (ctrl);
Expand All @@ -254,14 +254,14 @@ static void set_slot_off(struct controller *ctrl, struct slot * pslot)
if (ATTN_LED(ctrl->ctrlcap)) {
if (pslot->hpc_ops->set_attention_status(pslot, 1)) {
err("%s: Issue of Set Attention Led command failed\n", __FUNCTION__);
mutex_unlock(&ctrl->crit_sect);
mutex_unlock(&ctrl->ctrl_lock);
return;
}
wait_for_ctrl_irq (ctrl);
}

/* Done with exclusive hardware access */
mutex_unlock(&ctrl->crit_sect);
mutex_unlock(&ctrl->ctrl_lock);
}

/**
Expand All @@ -284,13 +284,13 @@ static int board_added(struct slot *p_slot)
ctrl->slot_device_offset, hp_slot);

/* Wait for exclusive access to hardware */
mutex_lock(&ctrl->crit_sect);
mutex_lock(&ctrl->ctrl_lock);

if (POWER_CTRL(ctrl->ctrlcap)) {
/* Power on slot */
rc = p_slot->hpc_ops->power_on_slot(p_slot);
if (rc) {
mutex_unlock(&ctrl->crit_sect);
mutex_unlock(&ctrl->ctrl_lock);
return -1;
}

Expand All @@ -306,7 +306,7 @@ static int board_added(struct slot *p_slot)
}

/* Done with exclusive hardware access */
mutex_unlock(&ctrl->crit_sect);
mutex_unlock(&ctrl->ctrl_lock);

/* Wait for ~1 second */
wait_for_ctrl_irq (ctrl);
Expand Down Expand Up @@ -340,15 +340,15 @@ static int board_added(struct slot *p_slot)
pci_fixup_device(pci_fixup_final, ctrl->pci_dev);
if (PWR_LED(ctrl->ctrlcap)) {
/* Wait for exclusive access to hardware */
mutex_lock(&ctrl->crit_sect);
mutex_lock(&ctrl->ctrl_lock);

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 */
mutex_unlock(&ctrl->crit_sect);
mutex_unlock(&ctrl->ctrl_lock);
}
return 0;

Expand Down Expand Up @@ -380,14 +380,14 @@ static int remove_board(struct slot *p_slot)
dbg("In %s, hp_slot = %d\n", __FUNCTION__, hp_slot);

/* Wait for exclusive access to hardware */
mutex_lock(&ctrl->crit_sect);
mutex_lock(&ctrl->ctrl_lock);

if (POWER_CTRL(ctrl->ctrlcap)) {
/* power off slot */
rc = p_slot->hpc_ops->power_off_slot(p_slot);
if (rc) {
err("%s: Issue of Slot Disable command failed\n", __FUNCTION__);
mutex_unlock(&ctrl->crit_sect);
mutex_unlock(&ctrl->ctrl_lock);
return rc;
}
/* Wait for the command to complete */
Expand All @@ -403,7 +403,7 @@ static int remove_board(struct slot *p_slot)
}

/* Done with exclusive hardware access */
mutex_unlock(&ctrl->crit_sect);
mutex_unlock(&ctrl->ctrl_lock);

return 0;
}
Expand Down Expand Up @@ -450,15 +450,15 @@ static void pciehp_pushbutton_thread(unsigned long slot)

if (pciehp_enable_slot(p_slot) && PWR_LED(p_slot->ctrl->ctrlcap)) {
/* Wait for exclusive access to hardware */
mutex_lock(&p_slot->ctrl->crit_sect);
mutex_lock(&p_slot->ctrl->ctrl_lock);

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 */
mutex_unlock(&p_slot->ctrl->crit_sect);
mutex_unlock(&p_slot->ctrl->ctrl_lock);
}
p_slot->state = STATIC_STATE;
}
Expand Down Expand Up @@ -500,15 +500,15 @@ static void pciehp_surprise_rm_thread(unsigned long slot)

if (pciehp_enable_slot(p_slot) && PWR_LED(p_slot->ctrl->ctrlcap)) {
/* Wait for exclusive access to hardware */
mutex_lock(&p_slot->ctrl->crit_sect);
mutex_lock(&p_slot->ctrl->ctrl_lock);

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 */
mutex_unlock(&p_slot->ctrl->crit_sect);
mutex_unlock(&p_slot->ctrl->ctrl_lock);
}
p_slot->state = STATIC_STATE;
}
Expand Down Expand Up @@ -621,7 +621,7 @@ static void interrupt_event_handler(struct controller *ctrl)
switch (p_slot->state) {
case BLINKINGOFF_STATE:
/* Wait for exclusive access to hardware */
mutex_lock(&ctrl->crit_sect);
mutex_lock(&ctrl->ctrl_lock);

if (PWR_LED(ctrl->ctrlcap)) {
p_slot->hpc_ops->green_led_on(p_slot);
Expand All @@ -635,11 +635,11 @@ static void interrupt_event_handler(struct controller *ctrl)
wait_for_ctrl_irq (ctrl);
}
/* Done with exclusive hardware access */
mutex_unlock(&ctrl->crit_sect);
mutex_unlock(&ctrl->ctrl_lock);
break;
case BLINKINGON_STATE:
/* Wait for exclusive access to hardware */
mutex_lock(&ctrl->crit_sect);
mutex_lock(&ctrl->ctrl_lock);

if (PWR_LED(ctrl->ctrlcap)) {
p_slot->hpc_ops->green_led_off(p_slot);
Expand All @@ -652,7 +652,7 @@ static void interrupt_event_handler(struct controller *ctrl)
wait_for_ctrl_irq (ctrl);
}
/* Done with exclusive hardware access */
mutex_unlock(&ctrl->crit_sect);
mutex_unlock(&ctrl->ctrl_lock);

break;
default:
Expand Down Expand Up @@ -681,7 +681,7 @@ static void interrupt_event_handler(struct controller *ctrl)
}

/* Wait for exclusive access to hardware */
mutex_lock(&ctrl->crit_sect);
mutex_lock(&ctrl->ctrl_lock);

/* blink green LED and turn off amber */
if (PWR_LED(ctrl->ctrlcap)) {
Expand All @@ -698,7 +698,7 @@ static void interrupt_event_handler(struct controller *ctrl)
}

/* Done with exclusive hardware access */
mutex_unlock(&ctrl->crit_sect);
mutex_unlock(&ctrl->ctrl_lock);

init_timer(&p_slot->task_event);
p_slot->task_event.expires = jiffies + 5 * HZ; /* 5 second delay */
Expand All @@ -713,7 +713,7 @@ static void interrupt_event_handler(struct controller *ctrl)
if (POWER_CTRL(ctrl->ctrlcap)) {
dbg("power fault\n");
/* Wait for exclusive access to hardware */
mutex_lock(&ctrl->crit_sect);
mutex_lock(&ctrl->ctrl_lock);

if (ATTN_LED(ctrl->ctrlcap)) {
p_slot->hpc_ops->set_attention_status(p_slot, 1);
Expand All @@ -726,7 +726,7 @@ static void interrupt_event_handler(struct controller *ctrl)
}

/* Done with exclusive hardware access */
mutex_unlock(&ctrl->crit_sect);
mutex_unlock(&ctrl->ctrl_lock);
}
}
/***********SURPRISE REMOVAL********************/
Expand Down Expand Up @@ -789,7 +789,6 @@ int pciehp_enable_slot(struct slot *p_slot)
return -EINVAL;
}
}
mutex_unlock(&p_slot->ctrl->crit_sect);

p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);

Expand All @@ -801,6 +800,7 @@ int pciehp_enable_slot(struct slot *p_slot)
if (p_slot)
update_slot_info(p_slot);

mutex_unlock(&p_slot->ctrl->crit_sect);
return rc;
}

Expand Down Expand Up @@ -846,10 +846,10 @@ int pciehp_disable_slot(struct slot *p_slot)
}
}

mutex_unlock(&p_slot->ctrl->crit_sect);

ret = remove_board(p_slot);
update_slot_info(p_slot);

mutex_unlock(&p_slot->ctrl->crit_sect);
return ret;
}

2 changes: 2 additions & 0 deletions trunk/drivers/pci/hotplug/pciehp_hpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1402,6 +1402,8 @@ int pcie_init(struct controller * ctrl, struct pcie_device *dev)
pdev->subsystem_vendor, pdev->subsystem_device);

mutex_init(&ctrl->crit_sect);
mutex_init(&ctrl->ctrl_lock);

/* setup wait queue */
init_waitqueue_head(&ctrl->queue);

Expand Down

0 comments on commit 9335844

Please sign in to comment.