PCI: hotplug: Use list_for_each_entry() to simplify code

Use list_for_each_entry() instead of list_for_each() to simplify the code.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
This commit is contained in:
Geliang Tang
2015-12-12 21:36:57 +08:00
committed by Bjorn Helgaas
parent 1b47fd4551
commit 2ac83cccab
10 changed files with 46 additions and 88 deletions

View File

@@ -1117,25 +1117,21 @@ int ibmphp_get_bus_index (u8 num)
void ibmphp_free_bus_info_queue (void)
{
struct bus_info *bus_info;
struct list_head *list;
struct list_head *next;
struct bus_info *bus_info, *next;
list_for_each_safe (list, next, &bus_info_head ) {
bus_info = list_entry (list, struct bus_info, bus_info_list);
list_for_each_entry_safe(bus_info, next, &bus_info_head,
bus_info_list) {
kfree (bus_info);
}
}
void ibmphp_free_ebda_hpc_queue (void)
{
struct controller *controller = NULL;
struct list_head *list;
struct list_head *next;
struct controller *controller = NULL, *next;
int pci_flag = 0;
list_for_each_safe (list, next, &ebda_hpc_head) {
controller = list_entry (list, struct controller, ebda_hpc_list);
list_for_each_entry_safe(controller, next, &ebda_hpc_head,
ebda_hpc_list) {
if (controller->ctlr_type == 0)
release_region (controller->u.isa_ctlr.io_start, (controller->u.isa_ctlr.io_end - controller->u.isa_ctlr.io_start + 1));
else if ((controller->ctlr_type == 1) && (!pci_flag)) {
@@ -1148,12 +1144,10 @@ void ibmphp_free_ebda_hpc_queue (void)
void ibmphp_free_ebda_pci_rsrc_queue (void)
{
struct ebda_pci_rsrc *resource;
struct list_head *list;
struct list_head *next;
struct ebda_pci_rsrc *resource, *next;
list_for_each_safe (list, next, &ibmphp_ebda_pci_rsrc_head) {
resource = list_entry (list, struct ebda_pci_rsrc, ebda_pci_rsrc_list);
list_for_each_entry_safe(resource, next, &ibmphp_ebda_pci_rsrc_head,
ebda_pci_rsrc_list) {
kfree (resource);
resource = NULL;
}