Commit 2410fa4e authored by Kenji Kaneshige's avatar Kenji Kaneshige Committed by Greg Kroah-Hartman

pciehp: cleanup slot list

This patch cleans up slot list handling (use list_head). This has no
functional change.
Signed-off-by: default avatarKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: default avatarKristen Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent a0b17257
...@@ -52,7 +52,6 @@ extern int pciehp_force; ...@@ -52,7 +52,6 @@ extern int pciehp_force;
#define SLOT_NAME_SIZE 10 #define SLOT_NAME_SIZE 10
struct slot { struct slot {
struct slot *next;
u8 bus; u8 bus;
u8 device; u8 device;
u32 number; u32 number;
...@@ -99,6 +98,7 @@ struct controller { ...@@ -99,6 +98,7 @@ struct controller {
int slot_num_inc; /* 1 or -1 */ int slot_num_inc; /* 1 or -1 */
struct pci_dev *pci_dev; struct pci_dev *pci_dev;
struct pci_bus *pci_bus; struct pci_bus *pci_bus;
struct list_head slot_list;
struct event_info event_queue[MAX_EVENTS]; struct event_info event_queue[MAX_EVENTS];
struct slot *slot; struct slot *slot;
struct hpc_ops *hpc_ops; struct hpc_ops *hpc_ops;
...@@ -198,20 +198,15 @@ extern struct controller *pciehp_ctrl_list; ...@@ -198,20 +198,15 @@ extern struct controller *pciehp_ctrl_list;
static inline struct slot *pciehp_find_slot(struct controller *ctrl, u8 device) static inline struct slot *pciehp_find_slot(struct controller *ctrl, u8 device)
{ {
struct slot *p_slot, *tmp_slot = NULL; struct slot *slot;
p_slot = ctrl->slot;
while (p_slot && (p_slot->device != device)) { list_for_each_entry(slot, &ctrl->slot_list, slot_list) {
tmp_slot = p_slot; if (slot->device == device)
p_slot = p_slot->next; return slot;
}
if (p_slot == NULL) {
err("ERROR: pciehp_find_slot device=0x%x\n", device);
p_slot = tmp_slot;
} }
return p_slot; err("%s: slot (device=0x%x) not found\n", __FUNCTION__, device);
return NULL;
} }
static inline int wait_for_ctrl_irq(struct controller *ctrl) static inline int wait_for_ctrl_irq(struct controller *ctrl)
......
...@@ -160,8 +160,7 @@ static int init_slots(struct controller *ctrl) ...@@ -160,8 +160,7 @@ static int init_slots(struct controller *ctrl)
goto error_info; goto error_info;
} }
slot->next = ctrl->slot; list_add(&slot->slot_list, &ctrl->slot_list);
ctrl->slot = slot;
} }
return 0; return 0;
...@@ -175,22 +174,17 @@ static int init_slots(struct controller *ctrl) ...@@ -175,22 +174,17 @@ static int init_slots(struct controller *ctrl)
return retval; return retval;
} }
static void cleanup_slots(struct controller *ctrl)
static int cleanup_slots (struct controller * ctrl)
{ {
struct slot *old_slot, *next_slot; struct list_head *tmp;
struct list_head *next;
old_slot = ctrl->slot; struct slot *slot;
ctrl->slot = NULL;
while (old_slot) { list_for_each_safe(tmp, next, &ctrl->slot_list) {
next_slot = old_slot->next; slot = list_entry(tmp, struct slot, slot_list);
pci_hp_deregister (old_slot->hotplug_slot); list_del(&slot->slot_list);
old_slot = next_slot; pci_hp_deregister(slot->hotplug_slot);
} }
return(0);
} }
static int get_ctlr_slot_config(struct controller *ctrl) static int get_ctlr_slot_config(struct controller *ctrl)
...@@ -368,6 +362,7 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_ ...@@ -368,6 +362,7 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_
err("%s : out of memory\n", __FUNCTION__); err("%s : out of memory\n", __FUNCTION__);
goto err_out_none; goto err_out_none;
} }
INIT_LIST_HEAD(&ctrl->slot_list);
pdev = dev->port; pdev = dev->port;
ctrl->pci_dev = pdev; ctrl->pci_dev = pdev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment