summary refs log tree commit diff
path: root/drivers/pci/hotplug/shpchp.h
diff options
context:
space:
mode:
authorKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>2006-01-26 09:57:40 +0900
committerGreg Kroah-Hartman <gregkh@suse.de>2006-03-23 14:35:11 -0800
commit5b1a960d180e9660a87b0c661a754efabc1b1d3a (patch)
treef49931b000ff784c3267f134ff3734f640fcd5d7 /drivers/pci/hotplug/shpchp.h
parentdfcd5f68ec916414532e88583d1557b6ac0197f5 (diff)
downloadlinux-5b1a960d180e9660a87b0c661a754efabc1b1d3a.tar.gz
[PATCH] shpchp - cleanup slot list
This patch changes SHPCHP driver to use list_head structure for
managing slot list.

Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci/hotplug/shpchp.h')
-rw-r--r--drivers/pci/hotplug/shpchp.h21
1 files changed, 8 insertions, 13 deletions
diff --git a/drivers/pci/hotplug/shpchp.h b/drivers/pci/hotplug/shpchp.h
index e03ee0826700..c0be7a1c3ff7 100644
--- a/drivers/pci/hotplug/shpchp.h
+++ b/drivers/pci/hotplug/shpchp.h
@@ -56,7 +56,6 @@ extern int shpchp_debug;
 #define SLOT_MAGIC	0x67267321
 struct slot {
 	u32 magic;
-	struct slot *next;
 	u8 bus;
 	u8 device;
 	u16 status;
@@ -87,7 +86,7 @@ struct controller {
 	struct pci_dev *pci_dev;
 	struct pci_bus *pci_bus;
 	struct event_info event_queue[10];
-	struct slot *slot;
+	struct list_head slot_list;
 	struct hpc_ops *hpc_ops;
 	wait_queue_head_t queue;	/* sleep & wake process */
 	u8 next_event;
@@ -315,23 +314,19 @@ static inline struct slot *get_slot (struct hotplug_slot *hotplug_slot, const ch
 
 static inline struct slot *shpchp_find_slot (struct controller *ctrl, u8 device)
 {
-	struct slot *p_slot, *tmp_slot = NULL;
+	struct slot *slot;
 
 	if (!ctrl)
 		return NULL;
 
-	p_slot = ctrl->slot;
-
-	while (p_slot && (p_slot->device != device)) {
-		tmp_slot = p_slot;
-		p_slot = p_slot->next;
-	}
-	if (p_slot == NULL) {
-		err("ERROR: shpchp_find_slot device=0x%x\n", device);
-		p_slot = tmp_slot;
+	list_for_each_entry(slot, &ctrl->slot_list, slot_list) {
+		if (slot->device == device)
+			return 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)