aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/pci/hotplug/ibmphp_core.c21
-rw-r--r--drivers/pci/hotplug/ibmphp_ebda.c24
-rw-r--r--drivers/pci/hotplug/ibmphp_hpc.c18
-rw-r--r--drivers/pci/hotplug/ibmphp_res.c32
-rw-r--r--drivers/pci/hotplug/pci_hotplug_core.c4
-rw-r--r--drivers/pci/hotplug/pcihp_skeleton.c7
-rw-r--r--drivers/pci/hotplug/rpadlpar_core.c7
-rw-r--r--drivers/pci/hotplug/rpaphp_core.c7
-rw-r--r--drivers/pci/hotplug/s390_pci_hpc.c7
-rw-r--r--drivers/pci/hotplug/shpchp_core.c7
10 files changed, 46 insertions, 88 deletions
diff --git a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c
index 15302475f5b7..010e46a0c466 100644
--- a/drivers/pci/hotplug/ibmphp_core.c
+++ b/drivers/pci/hotplug/ibmphp_core.c
@@ -116,11 +116,9 @@ static inline int slot_update(struct slot **sl)
116static int __init get_max_slots (void) 116static int __init get_max_slots (void)
117{ 117{
118 struct slot *slot_cur; 118 struct slot *slot_cur;
119 struct list_head *tmp;
120 u8 slot_count = 0; 119 u8 slot_count = 0;
121 120
122 list_for_each(tmp, &ibmphp_slot_head) { 121 list_for_each_entry(slot_cur, &ibmphp_slot_head, ibm_slot_list) {
123 slot_cur = list_entry(tmp, struct slot, ibm_slot_list);
124 /* sometimes the hot-pluggable slots start with 4 (not always from 1) */ 122 /* sometimes the hot-pluggable slots start with 4 (not always from 1) */
125 slot_count = max(slot_count, slot_cur->number); 123 slot_count = max(slot_count, slot_cur->number);
126 } 124 }
@@ -501,13 +499,10 @@ static int get_bus_name(struct hotplug_slot *hotplug_slot, char *value)
501static int __init init_ops(void) 499static int __init init_ops(void)
502{ 500{
503 struct slot *slot_cur; 501 struct slot *slot_cur;
504 struct list_head *tmp;
505 int retval; 502 int retval;
506 int rc; 503 int rc;
507 504
508 list_for_each(tmp, &ibmphp_slot_head) { 505 list_for_each_entry(slot_cur, &ibmphp_slot_head, ibm_slot_list) {
509 slot_cur = list_entry(tmp, struct slot, ibm_slot_list);
510
511 if (!slot_cur) 506 if (!slot_cur)
512 return -ENODEV; 507 return -ENODEV;
513 508
@@ -669,9 +664,7 @@ static struct pci_func *ibm_slot_find(u8 busno, u8 device, u8 function)
669{ 664{
670 struct pci_func *func_cur; 665 struct pci_func *func_cur;
671 struct slot *slot_cur; 666 struct slot *slot_cur;
672 struct list_head *tmp; 667 list_for_each_entry(slot_cur, &ibmphp_slot_head, ibm_slot_list) {
673 list_for_each(tmp, &ibmphp_slot_head) {
674 slot_cur = list_entry(tmp, struct slot, ibm_slot_list);
675 if (slot_cur->func) { 668 if (slot_cur->func) {
676 func_cur = slot_cur->func; 669 func_cur = slot_cur->func;
677 while (func_cur) { 670 while (func_cur) {
@@ -693,14 +686,12 @@ static struct pci_func *ibm_slot_find(u8 busno, u8 device, u8 function)
693 *************************************************************/ 686 *************************************************************/
694static void free_slots(void) 687static void free_slots(void)
695{ 688{
696 struct slot *slot_cur; 689 struct slot *slot_cur, *next;
697 struct list_head *tmp;
698 struct list_head *next;
699 690
700 debug("%s -- enter\n", __func__); 691 debug("%s -- enter\n", __func__);
701 692
702 list_for_each_safe(tmp, next, &ibmphp_slot_head) { 693 list_for_each_entry_safe(slot_cur, next, &ibmphp_slot_head,
703 slot_cur = list_entry(tmp, struct slot, ibm_slot_list); 694 ibm_slot_list) {
704 pci_hp_deregister(slot_cur->hotplug_slot); 695 pci_hp_deregister(slot_cur->hotplug_slot);
705 } 696 }
706 debug("%s -- exit\n", __func__); 697 debug("%s -- exit\n", __func__);
diff --git a/drivers/pci/hotplug/ibmphp_ebda.c b/drivers/pci/hotplug/ibmphp_ebda.c
index d9b197d5c6b4..664b5d1efb8f 100644
--- a/drivers/pci/hotplug/ibmphp_ebda.c
+++ b/drivers/pci/hotplug/ibmphp_ebda.c
@@ -1117,25 +1117,21 @@ int ibmphp_get_bus_index (u8 num)
1117 1117
1118void ibmphp_free_bus_info_queue (void) 1118void ibmphp_free_bus_info_queue (void)
1119{ 1119{
1120 struct bus_info *bus_info; 1120 struct bus_info *bus_info, *next;
1121 struct list_head *list;
1122 struct list_head *next;
1123 1121
1124 list_for_each_safe (list, next, &bus_info_head ) { 1122 list_for_each_entry_safe(bus_info, next, &bus_info_head,
1125 bus_info = list_entry (list, struct bus_info, bus_info_list); 1123 bus_info_list) {
1126 kfree (bus_info); 1124 kfree (bus_info);
1127 } 1125 }
1128} 1126}
1129 1127
1130void ibmphp_free_ebda_hpc_queue (void) 1128void ibmphp_free_ebda_hpc_queue (void)
1131{ 1129{
1132 struct controller *controller = NULL; 1130 struct controller *controller = NULL, *next;
1133 struct list_head *list;
1134 struct list_head *next;
1135 int pci_flag = 0; 1131 int pci_flag = 0;
1136 1132
1137 list_for_each_safe (list, next, &ebda_hpc_head) { 1133 list_for_each_entry_safe(controller, next, &ebda_hpc_head,
1138 controller = list_entry (list, struct controller, ebda_hpc_list); 1134 ebda_hpc_list) {
1139 if (controller->ctlr_type == 0) 1135 if (controller->ctlr_type == 0)
1140 release_region (controller->u.isa_ctlr.io_start, (controller->u.isa_ctlr.io_end - controller->u.isa_ctlr.io_start + 1)); 1136 release_region (controller->u.isa_ctlr.io_start, (controller->u.isa_ctlr.io_end - controller->u.isa_ctlr.io_start + 1));
1141 else if ((controller->ctlr_type == 1) && (!pci_flag)) { 1137 else if ((controller->ctlr_type == 1) && (!pci_flag)) {
@@ -1148,12 +1144,10 @@ void ibmphp_free_ebda_hpc_queue (void)
1148 1144
1149void ibmphp_free_ebda_pci_rsrc_queue (void) 1145void ibmphp_free_ebda_pci_rsrc_queue (void)
1150{ 1146{
1151 struct ebda_pci_rsrc *resource; 1147 struct ebda_pci_rsrc *resource, *next;
1152 struct list_head *list;
1153 struct list_head *next;
1154 1148
1155 list_for_each_safe (list, next, &ibmphp_ebda_pci_rsrc_head) { 1149 list_for_each_entry_safe(resource, next, &ibmphp_ebda_pci_rsrc_head,
1156 resource = list_entry (list, struct ebda_pci_rsrc, ebda_pci_rsrc_list); 1150 ebda_pci_rsrc_list) {
1157 kfree (resource); 1151 kfree (resource);
1158 resource = NULL; 1152 resource = NULL;
1159 } 1153 }
diff --git a/drivers/pci/hotplug/ibmphp_hpc.c b/drivers/pci/hotplug/ibmphp_hpc.c
index 220876715a08..e2608585abd3 100644
--- a/drivers/pci/hotplug/ibmphp_hpc.c
+++ b/drivers/pci/hotplug/ibmphp_hpc.c
@@ -537,7 +537,6 @@ int ibmphp_hpc_readslot (struct slot *pslot, u8 cmd, u8 *pstatus)
537{ 537{
538 void __iomem *wpg_bbar = NULL; 538 void __iomem *wpg_bbar = NULL;
539 struct controller *ctlr_ptr; 539 struct controller *ctlr_ptr;
540 struct list_head *pslotlist;
541 u8 index, status; 540 u8 index, status;
542 int rc = 0; 541 int rc = 0;
543 int busindex; 542 int busindex;
@@ -628,8 +627,8 @@ int ibmphp_hpc_readslot (struct slot *pslot, u8 cmd, u8 *pstatus)
628 627
629 // Not used 628 // Not used
630 case READ_ALLSLOT: 629 case READ_ALLSLOT:
631 list_for_each (pslotlist, &ibmphp_slot_head) { 630 list_for_each_entry(pslot, &ibmphp_slot_head,
632 pslot = list_entry (pslotlist, struct slot, ibm_slot_list); 631 ibm_slot_list) {
633 index = pslot->ctlr_index; 632 index = pslot->ctlr_index;
634 rc = hpc_wait_ctlr_notworking (HPC_CTLR_WORKING_TOUT, ctlr_ptr, 633 rc = hpc_wait_ctlr_notworking (HPC_CTLR_WORKING_TOUT, ctlr_ptr,
635 wpg_bbar, &status); 634 wpg_bbar, &status);
@@ -820,7 +819,6 @@ static int poll_hpc(void *data)
820{ 819{
821 struct slot myslot; 820 struct slot myslot;
822 struct slot *pslot = NULL; 821 struct slot *pslot = NULL;
823 struct list_head *pslotlist;
824 int rc; 822 int rc;
825 int poll_state = POLL_LATCH_REGISTER; 823 int poll_state = POLL_LATCH_REGISTER;
826 u8 oldlatchlow = 0x00; 824 u8 oldlatchlow = 0x00;
@@ -838,10 +836,10 @@ static int poll_hpc(void *data)
838 case POLL_LATCH_REGISTER: 836 case POLL_LATCH_REGISTER:
839 oldlatchlow = curlatchlow; 837 oldlatchlow = curlatchlow;
840 ctrl_count = 0x00; 838 ctrl_count = 0x00;
841 list_for_each (pslotlist, &ibmphp_slot_head) { 839 list_for_each_entry(pslot, &ibmphp_slot_head,
840 ibm_slot_list) {
842 if (ctrl_count >= ibmphp_get_total_controllers()) 841 if (ctrl_count >= ibmphp_get_total_controllers())
843 break; 842 break;
844 pslot = list_entry (pslotlist, struct slot, ibm_slot_list);
845 if (pslot->ctrl->ctlr_relative_id == ctrl_count) { 843 if (pslot->ctrl->ctlr_relative_id == ctrl_count) {
846 ctrl_count++; 844 ctrl_count++;
847 if (READ_SLOT_LATCH (pslot->ctrl)) { 845 if (READ_SLOT_LATCH (pslot->ctrl)) {
@@ -859,8 +857,8 @@ static int poll_hpc(void *data)
859 poll_state = POLL_SLEEP; 857 poll_state = POLL_SLEEP;
860 break; 858 break;
861 case POLL_SLOTS: 859 case POLL_SLOTS:
862 list_for_each (pslotlist, &ibmphp_slot_head) { 860 list_for_each_entry(pslot, &ibmphp_slot_head,
863 pslot = list_entry (pslotlist, struct slot, ibm_slot_list); 861 ibm_slot_list) {
864 // make a copy of the old status 862 // make a copy of the old status
865 memcpy ((void *) &myslot, (void *) pslot, 863 memcpy ((void *) &myslot, (void *) pslot,
866 sizeof (struct slot)); 864 sizeof (struct slot));
@@ -870,10 +868,10 @@ static int poll_hpc(void *data)
870 process_changeinstatus (pslot, &myslot); 868 process_changeinstatus (pslot, &myslot);
871 } 869 }
872 ctrl_count = 0x00; 870 ctrl_count = 0x00;
873 list_for_each (pslotlist, &ibmphp_slot_head) { 871 list_for_each_entry(pslot, &ibmphp_slot_head,
872 ibm_slot_list) {
874 if (ctrl_count >= ibmphp_get_total_controllers()) 873 if (ctrl_count >= ibmphp_get_total_controllers())
875 break; 874 break;
876 pslot = list_entry (pslotlist, struct slot, ibm_slot_list);
877 if (pslot->ctrl->ctlr_relative_id == ctrl_count) { 875 if (pslot->ctrl->ctlr_relative_id == ctrl_count) {
878 ctrl_count++; 876 ctrl_count++;
879 if (READ_SLOT_LATCH (pslot->ctrl)) 877 if (READ_SLOT_LATCH (pslot->ctrl))
diff --git a/drivers/pci/hotplug/ibmphp_res.c b/drivers/pci/hotplug/ibmphp_res.c
index f279060cf6e2..b5f2851e8cbe 100644
--- a/drivers/pci/hotplug/ibmphp_res.c
+++ b/drivers/pci/hotplug/ibmphp_res.c
@@ -203,15 +203,13 @@ int __init ibmphp_rsrc_init (void)
203 struct bus_node *newbus = NULL; 203 struct bus_node *newbus = NULL;
204 struct bus_node *bus_cur; 204 struct bus_node *bus_cur;
205 struct bus_node *bus_prev; 205 struct bus_node *bus_prev;
206 struct list_head *tmp;
207 struct resource_node *new_io = NULL; 206 struct resource_node *new_io = NULL;
208 struct resource_node *new_mem = NULL; 207 struct resource_node *new_mem = NULL;
209 struct resource_node *new_pfmem = NULL; 208 struct resource_node *new_pfmem = NULL;
210 int rc; 209 int rc;
211 struct list_head *tmp_ebda;
212 210
213 list_for_each (tmp_ebda, &ibmphp_ebda_pci_rsrc_head) { 211 list_for_each_entry(curr, &ibmphp_ebda_pci_rsrc_head,
214 curr = list_entry (tmp_ebda, struct ebda_pci_rsrc, ebda_pci_rsrc_list); 212 ebda_pci_rsrc_list) {
215 if (!(curr->rsrc_type & PCIDEVMASK)) { 213 if (!(curr->rsrc_type & PCIDEVMASK)) {
216 /* EBDA still lists non PCI devices, so ignore... */ 214 /* EBDA still lists non PCI devices, so ignore... */
217 debug ("this is not a PCI DEVICE in rsrc_init, please take care\n"); 215 debug ("this is not a PCI DEVICE in rsrc_init, please take care\n");
@@ -369,8 +367,7 @@ int __init ibmphp_rsrc_init (void)
369 } 367 }
370 } 368 }
371 369
372 list_for_each (tmp, &gbuses) { 370 list_for_each_entry(bus_cur, &gbuses, bus_list) {
373 bus_cur = list_entry (tmp, struct bus_node, bus_list);
374 /* This is to get info about PPB resources, since EBDA doesn't put this info into the primary bus info */ 371 /* This is to get info about PPB resources, since EBDA doesn't put this info into the primary bus info */
375 rc = update_bridge_ranges (&bus_cur); 372 rc = update_bridge_ranges (&bus_cur);
376 if (rc) 373 if (rc)
@@ -1571,19 +1568,16 @@ int ibmphp_find_resource (struct bus_node *bus, u32 start_address, struct resour
1571 ***********************************************************************/ 1568 ***********************************************************************/
1572void ibmphp_free_resources (void) 1569void ibmphp_free_resources (void)
1573{ 1570{
1574 struct bus_node *bus_cur = NULL; 1571 struct bus_node *bus_cur = NULL, *next;
1575 struct bus_node *bus_tmp; 1572 struct bus_node *bus_tmp;
1576 struct range_node *range_cur; 1573 struct range_node *range_cur;
1577 struct range_node *range_tmp; 1574 struct range_node *range_tmp;
1578 struct resource_node *res_cur; 1575 struct resource_node *res_cur;
1579 struct resource_node *res_tmp; 1576 struct resource_node *res_tmp;
1580 struct list_head *tmp;
1581 struct list_head *next;
1582 int i = 0; 1577 int i = 0;
1583 flags = 1; 1578 flags = 1;
1584 1579
1585 list_for_each_safe (tmp, next, &gbuses) { 1580 list_for_each_entry_safe(bus_cur, next, &gbuses, bus_list) {
1586 bus_cur = list_entry (tmp, struct bus_node, bus_list);
1587 if (bus_cur->noIORanges) { 1581 if (bus_cur->noIORanges) {
1588 range_cur = bus_cur->rangeIO; 1582 range_cur = bus_cur->rangeIO;
1589 for (i = 0; i < bus_cur->noIORanges; i++) { 1583 for (i = 0; i < bus_cur->noIORanges; i++) {
@@ -1691,10 +1685,8 @@ static int __init once_over (void)
1691 struct resource_node *pfmem_prev; 1685 struct resource_node *pfmem_prev;
1692 struct resource_node *mem; 1686 struct resource_node *mem;
1693 struct bus_node *bus_cur; 1687 struct bus_node *bus_cur;
1694 struct list_head *tmp;
1695 1688
1696 list_for_each (tmp, &gbuses) { 1689 list_for_each_entry(bus_cur, &gbuses, bus_list) {
1697 bus_cur = list_entry (tmp, struct bus_node, bus_list);
1698 if ((!bus_cur->rangePFMem) && (bus_cur->firstPFMem)) { 1690 if ((!bus_cur->rangePFMem) && (bus_cur->firstPFMem)) {
1699 for (pfmem_cur = bus_cur->firstPFMem, pfmem_prev = NULL; pfmem_cur; pfmem_prev = pfmem_cur, pfmem_cur = pfmem_cur->next) { 1691 for (pfmem_cur = bus_cur->firstPFMem, pfmem_prev = NULL; pfmem_cur; pfmem_prev = pfmem_cur, pfmem_cur = pfmem_cur->next) {
1700 pfmem_cur->fromMem = 1; 1692 pfmem_cur->fromMem = 1;
@@ -1767,14 +1759,10 @@ struct bus_node *ibmphp_find_res_bus (u8 bus_number)
1767static struct bus_node *find_bus_wprev (u8 bus_number, struct bus_node **prev, u8 flag) 1759static struct bus_node *find_bus_wprev (u8 bus_number, struct bus_node **prev, u8 flag)
1768{ 1760{
1769 struct bus_node *bus_cur; 1761 struct bus_node *bus_cur;
1770 struct list_head *tmp;
1771 struct list_head *tmp_prev;
1772 1762
1773 list_for_each (tmp, &gbuses) { 1763 list_for_each_entry(bus_cur, &gbuses, bus_list) {
1774 tmp_prev = tmp->prev;
1775 bus_cur = list_entry (tmp, struct bus_node, bus_list);
1776 if (flag) 1764 if (flag)
1777 *prev = list_entry (tmp_prev, struct bus_node, bus_list); 1765 *prev = list_prev_entry(bus_cur, bus_list);
1778 if (bus_cur->busno == bus_number) 1766 if (bus_cur->busno == bus_number)
1779 return bus_cur; 1767 return bus_cur;
1780 } 1768 }
@@ -1788,7 +1776,6 @@ void ibmphp_print_test (void)
1788 struct bus_node *bus_cur = NULL; 1776 struct bus_node *bus_cur = NULL;
1789 struct range_node *range; 1777 struct range_node *range;
1790 struct resource_node *res; 1778 struct resource_node *res;
1791 struct list_head *tmp;
1792 1779
1793 debug_pci ("*****************START**********************\n"); 1780 debug_pci ("*****************START**********************\n");
1794 1781
@@ -1797,8 +1784,7 @@ void ibmphp_print_test (void)
1797 return; 1784 return;
1798 } 1785 }
1799 1786
1800 list_for_each (tmp, &gbuses) { 1787 list_for_each_entry(bus_cur, &gbuses, bus_list) {
1801 bus_cur = list_entry (tmp, struct bus_node, bus_list);
1802 debug_pci ("This is bus # %d. There are\n", bus_cur->busno); 1788 debug_pci ("This is bus # %d. There are\n", bus_cur->busno);
1803 debug_pci ("IORanges = %d\t", bus_cur->noIORanges); 1789 debug_pci ("IORanges = %d\t", bus_cur->noIORanges);
1804 debug_pci ("MemRanges = %d\t", bus_cur->noMemRanges); 1790 debug_pci ("MemRanges = %d\t", bus_cur->noMemRanges);
diff --git a/drivers/pci/hotplug/pci_hotplug_core.c b/drivers/pci/hotplug/pci_hotplug_core.c
index d1fab97d6b01..fcd5e73c5b48 100644
--- a/drivers/pci/hotplug/pci_hotplug_core.c
+++ b/drivers/pci/hotplug/pci_hotplug_core.c
@@ -396,10 +396,8 @@ static void fs_remove_slot(struct pci_slot *pci_slot)
396static struct hotplug_slot *get_slot_from_name(const char *name) 396static struct hotplug_slot *get_slot_from_name(const char *name)
397{ 397{
398 struct hotplug_slot *slot; 398 struct hotplug_slot *slot;
399 struct list_head *tmp;
400 399
401 list_for_each(tmp, &pci_hotplug_slot_list) { 400 list_for_each_entry(slot, &pci_hotplug_slot_list, slot_list) {
402 slot = list_entry(tmp, struct hotplug_slot, slot_list);
403 if (strcmp(hotplug_slot_name(slot), name) == 0) 401 if (strcmp(hotplug_slot_name(slot), name) == 0)
404 return slot; 402 return slot;
405 } 403 }
diff --git a/drivers/pci/hotplug/pcihp_skeleton.c b/drivers/pci/hotplug/pcihp_skeleton.c
index d062c008fc95..9d4a95e66bda 100644
--- a/drivers/pci/hotplug/pcihp_skeleton.c
+++ b/drivers/pci/hotplug/pcihp_skeleton.c
@@ -321,17 +321,14 @@ error:
321 321
322static void __exit cleanup_slots(void) 322static void __exit cleanup_slots(void)
323{ 323{
324 struct list_head *tmp; 324 struct slot *slot, *next;
325 struct list_head *next;
326 struct slot *slot;
327 325
328 /* 326 /*
329 * Unregister all of our slots with the pci_hotplug subsystem. 327 * Unregister all of our slots with the pci_hotplug subsystem.
330 * Memory will be freed in release_slot() callback after slot's 328 * Memory will be freed in release_slot() callback after slot's
331 * lifespan is finished. 329 * lifespan is finished.
332 */ 330 */
333 list_for_each_safe(tmp, next, &slot_list) { 331 list_for_each_entry_safe(slot, next, &slot_list, slot_list) {
334 slot = list_entry(tmp, struct slot, slot_list);
335 list_del(&slot->slot_list); 332 list_del(&slot->slot_list);
336 pci_hp_deregister(slot->hotplug_slot); 333 pci_hp_deregister(slot->hotplug_slot);
337 } 334 }
diff --git a/drivers/pci/hotplug/rpadlpar_core.c b/drivers/pci/hotplug/rpadlpar_core.c
index e12bafdc42e0..b46b57d870fc 100644
--- a/drivers/pci/hotplug/rpadlpar_core.c
+++ b/drivers/pci/hotplug/rpadlpar_core.c
@@ -114,11 +114,10 @@ static struct device_node *find_dlpar_node(char *drc_name, int *node_type)
114 */ 114 */
115static struct slot *find_php_slot(struct device_node *dn) 115static struct slot *find_php_slot(struct device_node *dn)
116{ 116{
117 struct list_head *tmp, *n; 117 struct slot *slot, *next;
118 struct slot *slot;
119 118
120 list_for_each_safe(tmp, n, &rpaphp_slot_head) { 119 list_for_each_entry_safe(slot, next, &rpaphp_slot_head,
121 slot = list_entry(tmp, struct slot, rpaphp_slot_list); 120 rpaphp_slot_list) {
122 if (slot->dn == dn) 121 if (slot->dn == dn)
123 return slot; 122 return slot;
124 } 123 }
diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c
index f2945fa73d4f..5a11232cf766 100644
--- a/drivers/pci/hotplug/rpaphp_core.c
+++ b/drivers/pci/hotplug/rpaphp_core.c
@@ -356,8 +356,7 @@ EXPORT_SYMBOL_GPL(rpaphp_add_slot);
356 356
357static void __exit cleanup_slots(void) 357static void __exit cleanup_slots(void)
358{ 358{
359 struct list_head *tmp, *n; 359 struct slot *slot, *next;
360 struct slot *slot;
361 360
362 /* 361 /*
363 * Unregister all of our slots with the pci_hotplug subsystem, 362 * Unregister all of our slots with the pci_hotplug subsystem,
@@ -365,8 +364,8 @@ static void __exit cleanup_slots(void)
365 * memory will be freed in release_slot callback. 364 * memory will be freed in release_slot callback.
366 */ 365 */
367 366
368 list_for_each_safe(tmp, n, &rpaphp_slot_head) { 367 list_for_each_entry_safe(slot, next, &rpaphp_slot_head,
369 slot = list_entry(tmp, struct slot, rpaphp_slot_list); 368 rpaphp_slot_list) {
370 list_del(&slot->rpaphp_slot_list); 369 list_del(&slot->rpaphp_slot_list);
371 pci_hp_deregister(slot->hotplug_slot); 370 pci_hp_deregister(slot->hotplug_slot);
372 } 371 }
diff --git a/drivers/pci/hotplug/s390_pci_hpc.c b/drivers/pci/hotplug/s390_pci_hpc.c
index d77e46bca54c..eb5efaef06ea 100644
--- a/drivers/pci/hotplug/s390_pci_hpc.c
+++ b/drivers/pci/hotplug/s390_pci_hpc.c
@@ -201,11 +201,10 @@ error:
201 201
202void zpci_exit_slot(struct zpci_dev *zdev) 202void zpci_exit_slot(struct zpci_dev *zdev)
203{ 203{
204 struct list_head *tmp, *n; 204 struct slot *slot, *next;
205 struct slot *slot;
206 205
207 list_for_each_safe(tmp, n, &s390_hotplug_slot_list) { 206 list_for_each_entry_safe(slot, next, &s390_hotplug_slot_list,
208 slot = list_entry(tmp, struct slot, slot_list); 207 slot_list) {
209 if (slot->zdev != zdev) 208 if (slot->zdev != zdev)
210 continue; 209 continue;
211 list_del(&slot->slot_list); 210 list_del(&slot->slot_list);
diff --git a/drivers/pci/hotplug/shpchp_core.c b/drivers/pci/hotplug/shpchp_core.c
index 294ef4b10cf1..7c854b6847d1 100644
--- a/drivers/pci/hotplug/shpchp_core.c
+++ b/drivers/pci/hotplug/shpchp_core.c
@@ -178,12 +178,9 @@ error:
178 178
179void cleanup_slots(struct controller *ctrl) 179void cleanup_slots(struct controller *ctrl)
180{ 180{
181 struct list_head *tmp; 181 struct slot *slot, *next;
182 struct list_head *next;
183 struct slot *slot;
184 182
185 list_for_each_safe(tmp, next, &ctrl->slot_list) { 183 list_for_each_entry_safe(slot, next, &ctrl->slot_list, slot_list) {
186 slot = list_entry(tmp, struct slot, slot_list);
187 list_del(&slot->slot_list); 184 list_del(&slot->slot_list);
188 cancel_delayed_work(&slot->work); 185 cancel_delayed_work(&slot->work);
189 destroy_workqueue(slot->wq); 186 destroy_workqueue(slot->wq);