Commit b9b0bba9 authored by Yinghai Lu's avatar Yinghai Lu Committed by Jesse Barnes

PCI: Rename dev_res_x to add_res or fail_res

Linus says don't use dev_res_x because it doesn't communicate anything
about usage.  Rename them to add_res or fail_res etc according to
context.
Suggested-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent 764242a0
...@@ -95,32 +95,32 @@ static void add_to_failed_list(struct list_head *head, ...@@ -95,32 +95,32 @@ static void add_to_failed_list(struct list_head *head,
0 /* dont care */); 0 /* dont care */);
} }
static void remove_from_list(struct list_head *realloc_head, static void remove_from_list(struct list_head *head,
struct resource *res) struct resource *res)
{ {
struct pci_dev_resource *dev_res_x, *tmp; struct pci_dev_resource *dev_res, *tmp;
list_for_each_entry_safe(dev_res_x, tmp, realloc_head, list) { list_for_each_entry_safe(dev_res, tmp, head, list) {
if (dev_res_x->res == res) { if (dev_res->res == res) {
list_del(&dev_res_x->list); list_del(&dev_res->list);
kfree(dev_res_x); kfree(dev_res);
break; break;
} }
} }
} }
static resource_size_t get_res_add_size(struct list_head *realloc_head, static resource_size_t get_res_add_size(struct list_head *head,
struct resource *res) struct resource *res)
{ {
struct pci_dev_resource *dev_res_x; struct pci_dev_resource *dev_res;
list_for_each_entry(dev_res_x, realloc_head, list) { list_for_each_entry(dev_res, head, list) {
if (dev_res_x->res == res) { if (dev_res->res == res) {
dev_printk(KERN_DEBUG, &dev_res_x->dev->dev, dev_printk(KERN_DEBUG, &dev_res->dev->dev,
"%pR get_res_add_size add_size %llx\n", "%pR get_res_add_size add_size %llx\n",
dev_res_x->res, dev_res->res,
(unsigned long long)dev_res_x->add_size); (unsigned long long)dev_res->add_size);
return dev_res_x->add_size; return dev_res->add_size;
} }
} }
...@@ -221,15 +221,15 @@ static void reassign_resources_sorted(struct list_head *realloc_head, ...@@ -221,15 +221,15 @@ static void reassign_resources_sorted(struct list_head *realloc_head,
struct list_head *head) struct list_head *head)
{ {
struct resource *res; struct resource *res;
struct pci_dev_resource *dev_res_x, *tmp; struct pci_dev_resource *add_res, *tmp;
struct pci_dev_resource *dev_res; struct pci_dev_resource *dev_res;
resource_size_t add_size; resource_size_t add_size;
int idx; int idx;
list_for_each_entry_safe(dev_res_x, tmp, realloc_head, list) { list_for_each_entry_safe(add_res, tmp, realloc_head, list) {
bool found_match = false; bool found_match = false;
res = dev_res_x->res; res = add_res->res;
/* skip resource that has been reset */ /* skip resource that has been reset */
if (!res->flags) if (!res->flags)
goto out; goto out;
...@@ -244,26 +244,26 @@ static void reassign_resources_sorted(struct list_head *realloc_head, ...@@ -244,26 +244,26 @@ static void reassign_resources_sorted(struct list_head *realloc_head,
if (!found_match)/* just skip */ if (!found_match)/* just skip */
continue; continue;
idx = res - &dev_res_x->dev->resource[0]; idx = res - &add_res->dev->resource[0];
add_size = dev_res_x->add_size; add_size = add_res->add_size;
if (!resource_size(res)) { if (!resource_size(res)) {
res->start = dev_res_x->start; res->start = add_res->start;
res->end = res->start + add_size - 1; res->end = res->start + add_size - 1;
if (pci_assign_resource(dev_res_x->dev, idx)) if (pci_assign_resource(add_res->dev, idx))
reset_resource(res); reset_resource(res);
} else { } else {
resource_size_t align = dev_res_x->min_align; resource_size_t align = add_res->min_align;
res->flags |= dev_res_x->flags & res->flags |= add_res->flags &
(IORESOURCE_STARTALIGN|IORESOURCE_SIZEALIGN); (IORESOURCE_STARTALIGN|IORESOURCE_SIZEALIGN);
if (pci_reassign_resource(dev_res_x->dev, idx, if (pci_reassign_resource(add_res->dev, idx,
add_size, align)) add_size, align))
dev_printk(KERN_DEBUG, &dev_res_x->dev->dev, dev_printk(KERN_DEBUG, &add_res->dev->dev,
"failed to add optional resources res=%pR\n", "failed to add optional resources res=%pR\n",
res); res);
} }
out: out:
list_del(&dev_res_x->list); list_del(&add_res->list);
kfree(dev_res_x); kfree(add_res);
} }
} }
...@@ -319,7 +319,7 @@ static void __assign_resources_sorted(struct list_head *head, ...@@ -319,7 +319,7 @@ static void __assign_resources_sorted(struct list_head *head,
*/ */
LIST_HEAD(save_head); LIST_HEAD(save_head);
LIST_HEAD(local_fail_head); LIST_HEAD(local_fail_head);
struct pci_dev_resource *dev_res_x; struct pci_dev_resource *save_res;
struct pci_dev_resource *dev_res; struct pci_dev_resource *dev_res;
/* Check if optional add_size is there */ /* Check if optional add_size is there */
...@@ -358,12 +358,12 @@ static void __assign_resources_sorted(struct list_head *head, ...@@ -358,12 +358,12 @@ static void __assign_resources_sorted(struct list_head *head,
if (dev_res->res->parent) if (dev_res->res->parent)
release_resource(dev_res->res); release_resource(dev_res->res);
/* Restore start/end/flags from saved list */ /* Restore start/end/flags from saved list */
list_for_each_entry(dev_res_x, &save_head, list) { list_for_each_entry(save_res, &save_head, list) {
struct resource *res = dev_res_x->res; struct resource *res = save_res->res;
res->start = dev_res_x->start; res->start = save_res->start;
res->end = dev_res_x->end; res->end = save_res->end;
res->flags = dev_res_x->flags; res->flags = save_res->flags;
} }
free_list(pci_dev_resource, &save_head); free_list(pci_dev_resource, &save_head);
...@@ -1250,7 +1250,7 @@ pci_assign_unassigned_resources(void) ...@@ -1250,7 +1250,7 @@ pci_assign_unassigned_resources(void)
int tried_times = 0; int tried_times = 0;
enum release_type rel_type = leaf_only; enum release_type rel_type = leaf_only;
LIST_HEAD(fail_head); LIST_HEAD(fail_head);
struct pci_dev_resource *dev_res_x; struct pci_dev_resource *fail_res;
unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM | unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM |
IORESOURCE_PREFETCH; IORESOURCE_PREFETCH;
unsigned long failed_type; unsigned long failed_type;
...@@ -1289,8 +1289,8 @@ pci_assign_unassigned_resources(void) ...@@ -1289,8 +1289,8 @@ pci_assign_unassigned_resources(void)
goto enable_and_dump; goto enable_and_dump;
failed_type = 0; failed_type = 0;
list_for_each_entry(dev_res_x, &fail_head, list) list_for_each_entry(fail_res, &fail_head, list)
failed_type |= dev_res_x->flags; failed_type |= fail_res->flags;
/* /*
* io port are tight, don't try extra * io port are tight, don't try extra
...@@ -1313,20 +1313,20 @@ pci_assign_unassigned_resources(void) ...@@ -1313,20 +1313,20 @@ pci_assign_unassigned_resources(void)
* Try to release leaf bridge's resources that doesn't fit resource of * Try to release leaf bridge's resources that doesn't fit resource of
* child device under that bridge * child device under that bridge
*/ */
list_for_each_entry(dev_res_x, &fail_head, list) { list_for_each_entry(fail_res, &fail_head, list) {
bus = dev_res_x->dev->bus; bus = fail_res->dev->bus;
pci_bus_release_bridge_resources(bus, pci_bus_release_bridge_resources(bus,
dev_res_x->flags & type_mask, fail_res->flags & type_mask,
rel_type); rel_type);
} }
/* restore size and flags */ /* restore size and flags */
list_for_each_entry(dev_res_x, &fail_head, list) { list_for_each_entry(fail_res, &fail_head, list) {
struct resource *res = dev_res_x->res; struct resource *res = fail_res->res;
res->start = dev_res_x->start; res->start = fail_res->start;
res->end = dev_res_x->end; res->end = fail_res->end;
res->flags = dev_res_x->flags; res->flags = fail_res->flags;
if (dev_res_x->dev->subordinate) if (fail_res->dev->subordinate)
res->flags = 0; res->flags = 0;
} }
free_list(pci_dev_resource, &fail_head); free_list(pci_dev_resource, &fail_head);
...@@ -1350,7 +1350,7 @@ void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge) ...@@ -1350,7 +1350,7 @@ void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge)
want additional resources */ want additional resources */
int tried_times = 0; int tried_times = 0;
LIST_HEAD(fail_head); LIST_HEAD(fail_head);
struct pci_dev_resource *dev_res_x; struct pci_dev_resource *fail_res;
int retval; int retval;
unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM | unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM |
IORESOURCE_PREFETCH; IORESOURCE_PREFETCH;
...@@ -1377,21 +1377,21 @@ void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge) ...@@ -1377,21 +1377,21 @@ void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge)
* Try to release leaf bridge's resources that doesn't fit resource of * Try to release leaf bridge's resources that doesn't fit resource of
* child device under that bridge * child device under that bridge
*/ */
list_for_each_entry(dev_res_x, &fail_head, list) { list_for_each_entry(fail_res, &fail_head, list) {
struct pci_bus *bus = dev_res_x->dev->bus; struct pci_bus *bus = fail_res->dev->bus;
unsigned long flags = dev_res_x->flags; unsigned long flags = fail_res->flags;
pci_bus_release_bridge_resources(bus, flags & type_mask, pci_bus_release_bridge_resources(bus, flags & type_mask,
whole_subtree); whole_subtree);
} }
/* restore size and flags */ /* restore size and flags */
list_for_each_entry(dev_res_x, &fail_head, list) { list_for_each_entry(fail_res, &fail_head, list) {
struct resource *res = dev_res_x->res; struct resource *res = fail_res->res;
res->start = dev_res_x->start; res->start = fail_res->start;
res->end = dev_res_x->end; res->end = fail_res->end;
res->flags = dev_res_x->flags; res->flags = fail_res->flags;
if (dev_res_x->dev->subordinate) if (fail_res->dev->subordinate)
res->flags = 0; res->flags = 0;
} }
free_list(pci_dev_resource, &fail_head); free_list(pci_dev_resource, &fail_head);
......
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