Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 174758
b: refs/heads/master
c: 445f798
h: refs/heads/master
v: v3
  • Loading branch information
Kenji Kaneshige authored and Jesse Barnes committed Nov 4, 2009
1 parent 811dab6 commit 50deca4
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 93 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: 586f1d6688c68a6c7fa4e6a00fa3968b16daef75
refs/heads/master: 445f798555e218a5601222ca5849e8553ddd866a
55 changes: 8 additions & 47 deletions trunk/drivers/pci/hotplug/pciehp_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,9 @@ static int init_slot(struct controller *ctrl)
ctrl->pcie->port->subordinate->number, PSN(ctrl));
retval = pci_hp_register(hotplug,
ctrl->pcie->port->subordinate, 0, name);
if (retval) {
if (retval)
ctrl_err(ctrl,
"pci_hp_register failed with error %d\n", retval);
goto out;
}
get_power_status(hotplug, &info->power_status);
get_attention_status(hotplug, &info->attention_status);
get_latch_status(hotplug, &info->latch_status);
get_adapter_status(hotplug, &info->adapter_status);
out:
if (retval) {
kfree(ops);
Expand All @@ -168,10 +162,7 @@ static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 status)
ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
__func__, slot_name(slot));

hotplug_slot->info->attention_status = status;
pciehp_set_attention_status(slot, status);

return 0;
return pciehp_set_attention_status(slot, status);
}


Expand Down Expand Up @@ -199,92 +190,62 @@ static int disable_slot(struct hotplug_slot *hotplug_slot)
static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value)
{
struct slot *slot = hotplug_slot->private;
int retval;

ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
__func__, slot_name(slot));

retval = pciehp_get_power_status(slot, value);
if (retval < 0)
*value = hotplug_slot->info->power_status;

return 0;
return pciehp_get_power_status(slot, value);
}

static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value)
{
struct slot *slot = hotplug_slot->private;
int retval;

ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
__func__, slot_name(slot));

retval = pciehp_get_attention_status(slot, value);
if (retval < 0)
*value = hotplug_slot->info->attention_status;

return 0;
return pciehp_get_attention_status(slot, value);
}

static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value)
{
struct slot *slot = hotplug_slot->private;
int retval;

ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
__func__, slot_name(slot));

retval = pciehp_get_latch_status(slot, value);
if (retval < 0)
*value = hotplug_slot->info->latch_status;

return 0;
return pciehp_get_latch_status(slot, value);
}

static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value)
{
struct slot *slot = hotplug_slot->private;
int retval;

ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
__func__, slot_name(slot));

retval = pciehp_get_adapter_status(slot, value);
if (retval < 0)
*value = hotplug_slot->info->adapter_status;

return 0;
return pciehp_get_adapter_status(slot, value);
}

static int get_max_bus_speed(struct hotplug_slot *hotplug_slot,
enum pci_bus_speed *value)
{
struct slot *slot = hotplug_slot->private;
int retval;

ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
__func__, slot_name(slot));

retval = pciehp_get_max_link_speed(slot, value);
if (retval < 0)
*value = PCI_SPEED_UNKNOWN;

return 0;
return pciehp_get_max_link_speed(slot, value);
}

static int get_cur_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value)
{
struct slot *slot = hotplug_slot->private;
int retval;

ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
__func__, slot_name(slot));

retval = pciehp_get_cur_link_speed(slot, value);
if (retval < 0)
*value = PCI_SPEED_UNKNOWN;

return 0;
return pciehp_get_cur_link_speed(slot, value);
}

static int pciehp_probe(struct pcie_device *dev)
Expand Down
30 changes: 1 addition & 29 deletions trunk/drivers/pci/hotplug/pciehp_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,25 +363,6 @@ void pciehp_queue_pushbutton_work(struct work_struct *work)
mutex_unlock(&p_slot->lock);
}

static int update_slot_info(struct slot *slot)
{
struct hotplug_slot_info *info;
int result;

info = kmalloc(sizeof(*info), GFP_KERNEL);
if (!info)
return -ENOMEM;

pciehp_get_power_status(slot, &info->power_status);
pciehp_get_attention_status(slot, &info->attention_status);
pciehp_get_latch_status(slot, &info->latch_status);
pciehp_get_adapter_status(slot, &info->adapter_status);

result = pci_hp_change_slot_info(slot->hotplug_slot, info);
kfree (info);
return result;
}

/*
* Note: This function must be called with slot->lock held
*/
Expand Down Expand Up @@ -442,7 +423,6 @@ static void handle_button_press_event(struct slot *p_slot)
* to hot-add or hot-remove is undergoing
*/
ctrl_info(ctrl, "Button ignore on Slot(%s)\n", slot_name(p_slot));
update_slot_info(p_slot);
break;
default:
ctrl_warn(ctrl, "Not a valid state\n");
Expand Down Expand Up @@ -500,11 +480,9 @@ static void interrupt_event_handler(struct work_struct *work)
if (!HP_SUPR_RM(ctrl))
break;
ctrl_dbg(ctrl, "Surprise Removal\n");
update_slot_info(p_slot);
handle_surprise_event(p_slot);
break;
default:
update_slot_info(p_slot);
break;
}
mutex_unlock(&p_slot->lock);
Expand Down Expand Up @@ -547,9 +525,6 @@ int pciehp_enable_slot(struct slot *p_slot)
if (rc) {
pciehp_get_latch_status(p_slot, &getstatus);
}

update_slot_info(p_slot);

return rc;
}

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

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

return ret;
return remove_board(p_slot);
}

int pciehp_sysfs_enable_slot(struct slot *p_slot)
Expand Down
29 changes: 13 additions & 16 deletions trunk/drivers/pci/hotplug/pciehp_hpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,27 +427,24 @@ int pciehp_set_attention_status(struct slot *slot, u8 value)
struct controller *ctrl = slot->ctrl;
u16 slot_cmd;
u16 cmd_mask;
int rc;

cmd_mask = PCI_EXP_SLTCTL_AIC;
switch (value) {
case 0 : /* turn off */
slot_cmd = 0x00C0;
break;
case 1: /* turn on */
slot_cmd = 0x0040;
break;
case 2: /* turn blink */
slot_cmd = 0x0080;
break;
default:
return -1;
}
rc = pcie_write_cmd(ctrl, slot_cmd, cmd_mask);
case 0 : /* turn off */
slot_cmd = 0x00C0;
break;
case 1: /* turn on */
slot_cmd = 0x0040;
break;
case 2: /* turn blink */
slot_cmd = 0x0080;
break;
default:
return -EINVAL;
}
ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n",
__func__, ctrl->cap_base + PCI_EXP_SLTCTL, slot_cmd);

return rc;
return pcie_write_cmd(ctrl, slot_cmd, cmd_mask);
}

void pciehp_green_led_on(struct slot *slot)
Expand Down

0 comments on commit 50deca4

Please sign in to comment.