Skip to content

Commit 7a9eb51

Browse files
oohalstewartsmith
authored andcommitted
astbmc/slot: Add _add_slot_info()
Currently slot_table_get_slot_info() scans the platform defined slot table looking for a slot table entry that matches the device and adds the relevant information to the struct pci_device. This patch splits the searching and adding of the slot information into separate functions so that we can allow the platform code to use a different searching critera. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
1 parent c079587 commit 7a9eb51

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

platforms/astbmc/astbmc.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ extern void astbmc_exit(void);
101101

102102
extern void slot_table_init(const struct slot_table_entry *top_table);
103103
extern void slot_table_get_slot_info(struct phb *phb, struct pci_device * pd);
104+
void slot_table_add_slot_info(struct pci_device *pd,
105+
const struct slot_table_entry *ent);
106+
104107
void dt_slot_get_slot_info(struct phb *phb, struct pci_device *pd);
105108

106109
#endif /* __ASTBMC_H */

platforms/astbmc/slots.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,18 +96,13 @@ static void slot_table_add_properties(struct pci_slot *slot,
9696
pci_slot_add_loc(slot, np, NULL);
9797
}
9898

99-
void slot_table_get_slot_info(struct phb *phb, struct pci_device *pd)
99+
void slot_table_add_slot_info(struct pci_device *pd,
100+
const struct slot_table_entry *ent)
100101
{
101-
const struct slot_table_entry *ent;
102102
struct pci_slot *slot;
103103

104-
if (!pd || pd->slot)
105-
return;
106-
107-
ent = match_slot_dev_entry(phb, pd);
108-
109104
if (!ent || !ent->name) {
110-
slot = pcie_slot_create_dynamic(phb, pd);
105+
slot = pcie_slot_create_dynamic(pd->phb, pd);
111106
if (slot) {
112107
slot->ops.add_properties = slot_table_add_properties;
113108
slot->pluggable = true;
@@ -116,7 +111,7 @@ void slot_table_get_slot_info(struct phb *phb, struct pci_device *pd)
116111
return;
117112
}
118113

119-
slot = pcie_slot_create(phb, pd);
114+
slot = pcie_slot_create(pd->phb, pd);
120115
assert(slot);
121116

122117
slot->pluggable = !!(ent->etype == st_pluggable_slot);
@@ -125,6 +120,17 @@ void slot_table_get_slot_info(struct phb *phb, struct pci_device *pd)
125120
slot->data = (void *)ent;
126121
}
127122

123+
void slot_table_get_slot_info(struct phb *phb, struct pci_device *pd)
124+
{
125+
const struct slot_table_entry *ent;
126+
127+
if (!pd || pd->slot)
128+
return;
129+
130+
ent = match_slot_dev_entry(phb, pd);
131+
slot_table_add_slot_info(pd, ent);
132+
}
133+
128134
static void dt_slot_add_properties(struct pci_slot *slot,
129135
struct dt_node *np)
130136
{

0 commit comments

Comments
 (0)