aboutsummaryrefslogtreecommitdiff
path: root/drivers/pcmcia
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2005-07-12 13:58:15 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-12 16:00:59 -0700
commit862104e56329babf0b9571281e9516fe6259dd17 (patch)
tree2364a2bfb91961a806606b47b7b53ab65c9e5f54 /drivers/pcmcia
parent8e2f3b70e60172f5ed7c0933b8d8a35654c1c031 (diff)
[PATCH] yenta: fix parent resource determination
If the CardBus windows were pre-configured and the CardBus bridge is behind a transparent PCI-PCI bridge, pci_find_parent_resource() might return a different resource than the real parent if it is called before the window is determined. Therefore, move that call around. Also fix return of value in void function. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r--drivers/pcmcia/yenta_socket.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
index 0e7aa8176692..5e0a9980d2fc 100644
--- a/drivers/pcmcia/yenta_socket.c
+++ b/drivers/pcmcia/yenta_socket.c
@@ -551,7 +551,7 @@ static void yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned typ
res = socket->dev->resource + PCI_BRIDGE_RESOURCES + nr;
/* Already allocated? */
if (res->parent)
- return 0;
+ return;
/* The granularity of the memory limit is 4kB, on IO it's 4 bytes */
mask = ~0xfff;
@@ -562,25 +562,23 @@ static void yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned typ
bus = socket->dev->subordinate;
res->name = bus->name;
res->flags = type;
- res->start = 0;
- res->end = 0;
- root = pci_find_parent_resource(socket->dev, res);
-
- if (!root)
- return;
start = config_readl(socket, offset) & mask;
end = config_readl(socket, offset+4) | ~mask;
if (start && end > start && !override_bios) {
res->start = start;
res->end = end;
- if (request_resource(root, res) == 0)
+ root = pci_find_parent_resource(socket->dev, res);
+ if (root && (request_resource(root, res) == 0))
return;
- printk(KERN_INFO "yenta %s: Preassigned resource %d busy, reconfiguring...\n",
+ printk(KERN_INFO "yenta %s: Preassigned resource %d busy or not available, reconfiguring...\n",
pci_name(socket->dev), nr);
- res->start = res->end = 0;
}
+ res->start = 0;
+ res->end = 0;
+ root = pci_find_parent_resource(socket->dev, res);
+
if (type & IORESOURCE_IO) {
align = 1024;
size = BRIDGE_IO_MAX;
@@ -629,7 +627,7 @@ static void yenta_allocate_resources(struct yenta_socket *socket)
yenta_allocate_res(socket, 0, IORESOURCE_MEM|IORESOURCE_PREFETCH);
yenta_allocate_res(socket, 1, IORESOURCE_MEM);
yenta_allocate_res(socket, 2, IORESOURCE_IO);
- yenta_allocate_res(socket, 3, IORESOURCE_IO); /* PCI isn't clever enough to use this one yet */
+ yenta_allocate_res(socket, 3, IORESOURCE_IO);
}