Commit 852710d9 authored by Matthew Wilcox's avatar Matthew Wilcox Committed by Jesse Barnes

yenta: Use pci_claim_resource

Instead of open-coding pci_find_parent_resource and request_resource,
just call pci_claim_resource.
Signed-off-by: default avatarMatthew Wilcox <willy@linux.intel.com>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent eae91c02
...@@ -622,11 +622,12 @@ static int yenta_search_res(struct yenta_socket *socket, struct resource *res, ...@@ -622,11 +622,12 @@ static int yenta_search_res(struct yenta_socket *socket, struct resource *res,
static int yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned type, int addr_start, int addr_end) static int yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned type, int addr_start, int addr_end)
{ {
struct resource *root, *res; struct pci_dev *dev = socket->dev;
struct resource *res;
struct pci_bus_region region; struct pci_bus_region region;
unsigned mask; unsigned mask;
res = socket->dev->resource + PCI_BRIDGE_RESOURCES + nr; res = dev->resource + PCI_BRIDGE_RESOURCES + nr;
/* Already allocated? */ /* Already allocated? */
if (res->parent) if (res->parent)
return 0; return 0;
...@@ -636,17 +637,16 @@ static int yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned type ...@@ -636,17 +637,16 @@ static int yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned type
if (type & IORESOURCE_IO) if (type & IORESOURCE_IO)
mask = ~3; mask = ~3;
res->name = socket->dev->subordinate->name; res->name = dev->subordinate->name;
res->flags = type; res->flags = type;
region.start = config_readl(socket, addr_start) & mask; region.start = config_readl(socket, addr_start) & mask;
region.end = config_readl(socket, addr_end) | ~mask; region.end = config_readl(socket, addr_end) | ~mask;
if (region.start && region.end > region.start && !override_bios) { if (region.start && region.end > region.start && !override_bios) {
pcibios_bus_to_resource(socket->dev, res, &region); pcibios_bus_to_resource(dev, res, &region);
root = pci_find_parent_resource(socket->dev, res); if (pci_claim_resource(dev, PCI_BRIDGE_RESOURCES + nr) == 0)
if (root && (request_resource(root, res) == 0))
return 0; return 0;
dev_printk(KERN_INFO, &socket->dev->dev, dev_printk(KERN_INFO, &dev->dev,
"Preassigned resource %d busy or not available, " "Preassigned resource %d busy or not available, "
"reconfiguring...\n", "reconfiguring...\n",
nr); nr);
...@@ -672,7 +672,7 @@ static int yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned type ...@@ -672,7 +672,7 @@ static int yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned type
return 1; return 1;
} }
dev_printk(KERN_INFO, &socket->dev->dev, dev_printk(KERN_INFO, &dev->dev,
"no resource of type %x available, trying to continue...\n", "no resource of type %x available, trying to continue...\n",
type); type);
res->start = res->end = res->flags = 0; res->start = res->end = res->flags = 0;
......
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