aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mn10300
diff options
context:
space:
mode:
authorDavid Howells <bywayofJesseBarnesjbarnes@virtuousgeek.org>2010-10-27 12:28:34 -0400
committerDavid Howells <dhowells@redhat.com>2010-10-27 12:28:34 -0400
commitdcd42ed3ea829aa99cf00d34c61e082ce575b193 (patch)
treed384057405d079ce23e21fdca07625caedf6458a /arch/mn10300
parente4acfcac0f3e3b575bb1819052b91b579988c59b (diff)
mn10300: 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: David Howells <dhowells@redhat.com>
Diffstat (limited to 'arch/mn10300')
-rw-r--r--arch/mn10300/unit-asb2305/pci-asb2305.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/arch/mn10300/unit-asb2305/pci-asb2305.c b/arch/mn10300/unit-asb2305/pci-asb2305.c
index 45b40ac6c464..8e6763e6f250 100644
--- a/arch/mn10300/unit-asb2305/pci-asb2305.c
+++ b/arch/mn10300/unit-asb2305/pci-asb2305.c
@@ -93,7 +93,7 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)
93 struct pci_bus *bus; 93 struct pci_bus *bus;
94 struct pci_dev *dev; 94 struct pci_dev *dev;
95 int idx; 95 int idx;
96 struct resource *r, *pr; 96 struct resource *r;
97 97
98 /* Depth-First Search on bus tree */ 98 /* Depth-First Search on bus tree */
99 list_for_each_entry(bus, bus_list, node) { 99 list_for_each_entry(bus, bus_list, node) {
@@ -105,10 +105,8 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)
105 r = &dev->resource[idx]; 105 r = &dev->resource[idx];
106 if (!r->flags) 106 if (!r->flags)
107 continue; 107 continue;
108 pr = pci_find_parent_resource(dev, r);
109 if (!r->start || 108 if (!r->start ||
110 !pr || 109 pci_claim_resource(dev, idx) < 0) {
111 request_resource(pr, r) < 0) {
112 printk(KERN_ERR "PCI:" 110 printk(KERN_ERR "PCI:"
113 " Cannot allocate resource" 111 " Cannot allocate resource"
114 " region %d of bridge %s\n", 112 " region %d of bridge %s\n",
@@ -131,7 +129,7 @@ static void __init pcibios_allocate_resources(int pass)
131 struct pci_dev *dev = NULL; 129 struct pci_dev *dev = NULL;
132 int idx, disabled; 130 int idx, disabled;
133 u16 command; 131 u16 command;
134 struct resource *r, *pr; 132 struct resource *r;
135 133
136 for_each_pci_dev(dev) { 134 for_each_pci_dev(dev) {
137 pci_read_config_word(dev, PCI_COMMAND, &command); 135 pci_read_config_word(dev, PCI_COMMAND, &command);
@@ -150,8 +148,7 @@ static void __init pcibios_allocate_resources(int pass)
150 " (f=%lx, d=%d, p=%d)\n", 148 " (f=%lx, d=%d, p=%d)\n",
151 pci_name(dev), r->start, r->end, r->flags, 149 pci_name(dev), r->start, r->end, r->flags,
152 disabled, pass); 150 disabled, pass);
153 pr = pci_find_parent_resource(dev, r); 151 if (pci_claim_resource(dev, idx) < 0) {
154 if (!pr || request_resource(pr, r) < 0) {
155 printk(KERN_ERR "PCI:" 152 printk(KERN_ERR "PCI:"
156 " Cannot allocate resource" 153 " Cannot allocate resource"
157 " region %d of device %s\n", 154 " region %d of device %s\n",
@@ -184,7 +181,7 @@ static void __init pcibios_allocate_resources(int pass)
184static int __init pcibios_assign_resources(void) 181static int __init pcibios_assign_resources(void)
185{ 182{
186 struct pci_dev *dev = NULL; 183 struct pci_dev *dev = NULL;
187 struct resource *r, *pr; 184 struct resource *r;
188 185
189 if (!(pci_probe & PCI_ASSIGN_ROMS)) { 186 if (!(pci_probe & PCI_ASSIGN_ROMS)) {
190 /* Try to use BIOS settings for ROMs, otherwise let 187 /* Try to use BIOS settings for ROMs, otherwise let
@@ -194,8 +191,7 @@ static int __init pcibios_assign_resources(void)
194 r = &dev->resource[PCI_ROM_RESOURCE]; 191 r = &dev->resource[PCI_ROM_RESOURCE];
195 if (!r->flags || !r->start) 192 if (!r->flags || !r->start)
196 continue; 193 continue;
197 pr = pci_find_parent_resource(dev, r); 194 if (pci_claim_resource(dev, PCI_ROM_RESOURCE) < 0) {
198 if (!pr || request_resource(pr, r) < 0) {
199 r->end -= r->start; 195 r->end -= r->start;
200 r->start = 0; 196 r->start = 0;
201 } 197 }