Skip to content

Commit

Permalink
core/pci: Rename pci_slot_op poll to run_sm
Browse files Browse the repository at this point in the history
This renames the "poll" op to "run_sm" (short for run state machine).

I think this is a better name since the function does a bunch of
things like reseting the slot.  Also it avoids confusion with the
"poll_link" op which does something different (and can even be called
from run_sm).

No functional change.

Signed-off-by: Michael Neuling <mikey@neuling.org>
Acked-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
  • Loading branch information
mikey authored and stewartsmith committed May 31, 2017
1 parent 1c70570 commit 9abb449
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions core/pci-opal.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,11 +640,11 @@ static int64_t opal_pci_poll(uint64_t id)

if (!slot || !phb)
return OPAL_PARAMETER;
if (!slot->ops.poll)
if (!slot->ops.run_sm)
return OPAL_UNSUPPORTED;

phb_lock(phb);
rc = slot->ops.poll(slot);
rc = slot->ops.run_sm(slot);
phb_unlock(phb);

/* Return milliseconds for caller to sleep: round up */
Expand Down
4 changes: 2 additions & 2 deletions core/pci-slot.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ static void pci_slot_prepare_link_change(struct pci_slot *slot, bool up)
}
}

static int64_t pci_slot_sm_poll(struct pci_slot *slot)
static int64_t pci_slot_run_sm(struct pci_slot *slot)
{
uint64_t now = mftb();
int64_t ret;
Expand Down Expand Up @@ -176,7 +176,7 @@ struct pci_slot *pci_slot_alloc(struct phb *phb,
slot->pd = pd;
pci_slot_set_state(slot, PCI_SLOT_STATE_NORMAL);
slot->power_state = PCI_SLOT_POWER_ON;
slot->ops.poll = pci_slot_sm_poll;
slot->ops.run_sm = pci_slot_run_sm;
slot->ops.prepare_link_change = pci_slot_prepare_link_change;
if (!pd) {
slot->id = PCI_PHB_SLOT_ID(phb);
Expand Down
4 changes: 2 additions & 2 deletions core/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,7 @@ static void pci_reset_phb(void *data)
rc = slot->ops.freset(slot);
while (rc > 0) {
time_wait(rc);
rc = slot->ops.poll(slot);
rc = slot->ops.run_sm(slot);
}
pci_slot_remove_flags(slot, PCI_SLOT_FLAG_BOOTUP);
if (rc < 0)
Expand Down Expand Up @@ -1571,7 +1571,7 @@ void pci_reset(void)
rc = slot->ops.creset(slot);
while (rc > 0) {
time_wait(rc);
rc = slot->ops.poll(slot);
rc = slot->ops.run_sm(slot);
}
if (rc < 0) {
PCIERR(phb, 0, "Complete reset failed, aborting"
Expand Down
4 changes: 2 additions & 2 deletions hw/phb3.c
Original file line number Diff line number Diff line change
Expand Up @@ -2244,7 +2244,7 @@ static int64_t phb3_retry_state(struct pci_slot *slot)
slot->delay_tgt_tb = 0;
pci_slot_set_state(slot, slot->retry_state);
slot->retry_state = PCI_SLOT_STATE_NORMAL;
return slot->ops.poll(slot);
return slot->ops.run_sm(slot);
}

static int64_t phb3_poll_link(struct pci_slot *slot)
Expand Down Expand Up @@ -4680,7 +4680,7 @@ static bool phb3_host_sync_reset(void *data)
phb3_creset(slot);
return false;
default:
rc = slot->ops.poll(slot);
rc = slot->ops.run_sm(slot);
return rc <= OPAL_SUCCESS;
}
}
Expand Down
2 changes: 1 addition & 1 deletion hw/phb4.c
Original file line number Diff line number Diff line change
Expand Up @@ -1917,7 +1917,7 @@ static int64_t phb4_retry_state(struct pci_slot *slot)
slot->delay_tgt_tb = 0;
pci_slot_set_state(slot, slot->retry_state);
slot->retry_state = PCI_SLOT_STATE_NORMAL;
return slot->ops.poll(slot);
return slot->ops.run_sm(slot);
}

static int64_t phb4_poll_link(struct pci_slot *slot)
Expand Down
2 changes: 1 addition & 1 deletion include/pci-slot.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ struct pci_slot_ops {
int64_t (*creset)(struct pci_slot *slot);
int64_t (*freset)(struct pci_slot *slot);
int64_t (*hreset)(struct pci_slot *slot);
int64_t (*poll)(struct pci_slot *slot);
int64_t (*run_sm)(struct pci_slot *slot);

/* Auxillary functions */
void (*add_properties)(struct pci_slot *slot, struct dt_node *np);
Expand Down

0 comments on commit 9abb449

Please sign in to comment.