diff options
author | Matthew Wilcox <willy@linux.intel.com> | 2009-06-19 09:36:15 -0400 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2009-09-09 16:29:19 -0400 |
commit | 852710d9fd9f2e59fcec65cc701867db4e801bc7 (patch) | |
tree | 51d5e63d6f8e8a7929b020411e70a502c1cce946 /drivers/pcmcia | |
parent | eae91c0215d99f7727b66e2928fb73bf86bc9668 (diff) |
yenta: Use pci_claim_resource
Instead of open-coding pci_find_parent_resource and request_resource,
just call pci_claim_resource.
Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r-- | drivers/pcmcia/yenta_socket.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c index 3ecd7c99d8eb..737fe5d87c40 100644 --- a/drivers/pcmcia/yenta_socket.c +++ b/drivers/pcmcia/yenta_socket.c | |||
@@ -622,11 +622,12 @@ static int yenta_search_res(struct yenta_socket *socket, struct resource *res, | |||
622 | 622 | ||
623 | static int yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned type, int addr_start, int addr_end) | 623 | static int yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned type, int addr_start, int addr_end) |
624 | { | 624 | { |
625 | struct resource *root, *res; | 625 | struct pci_dev *dev = socket->dev; |
626 | struct resource *res; | ||
626 | struct pci_bus_region region; | 627 | struct pci_bus_region region; |
627 | unsigned mask; | 628 | unsigned mask; |
628 | 629 | ||
629 | res = socket->dev->resource + PCI_BRIDGE_RESOURCES + nr; | 630 | res = dev->resource + PCI_BRIDGE_RESOURCES + nr; |
630 | /* Already allocated? */ | 631 | /* Already allocated? */ |
631 | if (res->parent) | 632 | if (res->parent) |
632 | return 0; | 633 | return 0; |
@@ -636,17 +637,16 @@ static int yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned type | |||
636 | if (type & IORESOURCE_IO) | 637 | if (type & IORESOURCE_IO) |
637 | mask = ~3; | 638 | mask = ~3; |
638 | 639 | ||
639 | res->name = socket->dev->subordinate->name; | 640 | res->name = dev->subordinate->name; |
640 | res->flags = type; | 641 | res->flags = type; |
641 | 642 | ||
642 | region.start = config_readl(socket, addr_start) & mask; | 643 | region.start = config_readl(socket, addr_start) & mask; |
643 | region.end = config_readl(socket, addr_end) | ~mask; | 644 | region.end = config_readl(socket, addr_end) | ~mask; |
644 | if (region.start && region.end > region.start && !override_bios) { | 645 | if (region.start && region.end > region.start && !override_bios) { |
645 | pcibios_bus_to_resource(socket->dev, res, ®ion); | 646 | pcibios_bus_to_resource(dev, res, ®ion); |
646 | root = pci_find_parent_resource(socket->dev, res); | 647 | if (pci_claim_resource(dev, PCI_BRIDGE_RESOURCES + nr) == 0) |
647 | if (root && (request_resource(root, res) == 0)) | ||
648 | return 0; | 648 | return 0; |
649 | dev_printk(KERN_INFO, &socket->dev->dev, | 649 | dev_printk(KERN_INFO, &dev->dev, |
650 | "Preassigned resource %d busy or not available, " | 650 | "Preassigned resource %d busy or not available, " |
651 | "reconfiguring...\n", | 651 | "reconfiguring...\n", |
652 | nr); | 652 | nr); |
@@ -672,7 +672,7 @@ static int yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned type | |||
672 | return 1; | 672 | return 1; |
673 | } | 673 | } |
674 | 674 | ||
675 | dev_printk(KERN_INFO, &socket->dev->dev, | 675 | dev_printk(KERN_INFO, &dev->dev, |
676 | "no resource of type %x available, trying to continue...\n", | 676 | "no resource of type %x available, trying to continue...\n", |
677 | type); | 677 | type); |
678 | res->start = res->end = res->flags = 0; | 678 | res->start = res->end = res->flags = 0; |