Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 294707
b: refs/heads/master
c: bffc56d
h: refs/heads/master
i:
  294705: 289a14f
  294703: dbd097e
v: v3
  • Loading branch information
Yinghai Lu authored and Jesse Barnes committed Feb 14, 2012
1 parent bfedc9a commit f1b4b80
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b9b0bba96cf5acbf025f7829fbf6c09e74323b41
refs/heads/master: bffc56d41102705d809f88c29918a9c33d2900f7
36 changes: 19 additions & 17 deletions trunk/drivers/pci/setup-bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ struct pci_dev_resource {
unsigned long flags;
};

#define free_list(type, head) do { \
struct type *dev_res, *tmp; \
list_for_each_entry_safe(dev_res, tmp, head, list) { \
list_del(&dev_res->list); \
kfree(dev_res); \
} \
} while (0)
static void free_list(struct list_head *head)
{
struct pci_dev_resource *dev_res, *tmp;

list_for_each_entry_safe(dev_res, tmp, head, list) {
list_del(&dev_res->list);
kfree(dev_res);
}
}

int pci_realloc_enable = 0;
#define pci_realloc_enabled() pci_realloc_enable
Expand Down Expand Up @@ -329,7 +331,7 @@ static void __assign_resources_sorted(struct list_head *head,
/* Save original start, end, flags etc at first */
list_for_each_entry(dev_res, head, list) {
if (add_to_list(&save_head, dev_res->dev, dev_res->res, 0, 0)) {
free_list(pci_dev_resource, &save_head);
free_list(&save_head);
goto requested_and_reassign;
}
}
Expand All @@ -347,12 +349,12 @@ static void __assign_resources_sorted(struct list_head *head,
/* Remove head list from realloc_head list */
list_for_each_entry(dev_res, head, list)
remove_from_list(realloc_head, dev_res->res);
free_list(pci_dev_resource, &save_head);
free_list(pci_dev_resource, head);
free_list(&save_head);
free_list(head);
return;
}

free_list(pci_dev_resource, &local_fail_head);
free_list(&local_fail_head);
/* Release assigned resource */
list_for_each_entry(dev_res, head, list)
if (dev_res->res->parent)
Expand All @@ -365,7 +367,7 @@ static void __assign_resources_sorted(struct list_head *head,
res->end = save_res->end;
res->flags = save_res->flags;
}
free_list(pci_dev_resource, &save_head);
free_list(&save_head);

requested_and_reassign:
/* Satisfy the must-have resource requests */
Expand All @@ -375,7 +377,7 @@ static void __assign_resources_sorted(struct list_head *head,
requests */
if (realloc_head)
reassign_resources_sorted(realloc_head, head);
free_list(pci_dev_resource, head);
free_list(head);
}

static void pdev_assign_resources_sorted(struct pci_dev *dev,
Expand Down Expand Up @@ -1298,7 +1300,7 @@ pci_assign_unassigned_resources(void)
*/
failed_type &= type_mask;
if ((failed_type == IORESOURCE_IO) || (tried_times >= pci_try_num)) {
free_list(pci_dev_resource, &fail_head);
free_list(&fail_head);
goto enable_and_dump;
}

Expand Down Expand Up @@ -1329,7 +1331,7 @@ pci_assign_unassigned_resources(void)
if (fail_res->dev->subordinate)
res->flags = 0;
}
free_list(pci_dev_resource, &fail_head);
free_list(&fail_head);

goto again;

Expand Down Expand Up @@ -1366,7 +1368,7 @@ void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge)

if (tried_times >= 2) {
/* still fail, don't need to try more */
free_list(pci_dev_resource, &fail_head);
free_list(&fail_head);
goto enable_all;
}

Expand Down Expand Up @@ -1394,7 +1396,7 @@ void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge)
if (fail_res->dev->subordinate)
res->flags = 0;
}
free_list(pci_dev_resource, &fail_head);
free_list(&fail_head);

goto again;

Expand Down

0 comments on commit f1b4b80

Please sign in to comment.