diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2005-07-12 16:58:15 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-12 19:00:59 -0400 |
commit | 862104e56329babf0b9571281e9516fe6259dd17 (patch) | |
tree | 2364a2bfb91961a806606b47b7b53ab65c9e5f54 /drivers/pcmcia/yenta_socket.c | |
parent | 8e2f3b70e60172f5ed7c0933b8d8a35654c1c031 (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/yenta_socket.c')
-rw-r--r-- | drivers/pcmcia/yenta_socket.c | 20 |
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 | |||
551 | res = socket->dev->resource + PCI_BRIDGE_RESOURCES + nr; | 551 | res = socket->dev->resource + PCI_BRIDGE_RESOURCES + nr; |
552 | /* Already allocated? */ | 552 | /* Already allocated? */ |
553 | if (res->parent) | 553 | if (res->parent) |
554 | return 0; | 554 | return; |
555 | 555 | ||
556 | /* The granularity of the memory limit is 4kB, on IO it's 4 bytes */ | 556 | /* The granularity of the memory limit is 4kB, on IO it's 4 bytes */ |
557 | mask = ~0xfff; | 557 | mask = ~0xfff; |
@@ -562,25 +562,23 @@ static void yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned typ | |||
562 | bus = socket->dev->subordinate; | 562 | bus = socket->dev->subordinate; |
563 | res->name = bus->name; | 563 | res->name = bus->name; |
564 | res->flags = type; | 564 | res->flags = type; |
565 | res->start = 0; | ||
566 | res->end = 0; | ||
567 | root = pci_find_parent_resource(socket->dev, res); | ||
568 | |||
569 | if (!root) | ||
570 | return; | ||
571 | 565 | ||
572 | start = config_readl(socket, offset) & mask; | 566 | start = config_readl(socket, offset) & mask; |
573 | end = config_readl(socket, offset+4) | ~mask; | 567 | end = config_readl(socket, offset+4) | ~mask; |
574 | if (start && end > start && !override_bios) { | 568 | if (start && end > start && !override_bios) { |
575 | res->start = start; | 569 | res->start = start; |
576 | res->end = end; | 570 | res->end = end; |
577 | if (request_resource(root, res) == 0) | 571 | root = pci_find_parent_resource(socket->dev, res); |
572 | if (root && (request_resource(root, res) == 0)) | ||
578 | return; | 573 | return; |
579 | printk(KERN_INFO "yenta %s: Preassigned resource %d busy, reconfiguring...\n", | 574 | printk(KERN_INFO "yenta %s: Preassigned resource %d busy or not available, reconfiguring...\n", |
580 | pci_name(socket->dev), nr); | 575 | pci_name(socket->dev), nr); |
581 | res->start = res->end = 0; | ||
582 | } | 576 | } |
583 | 577 | ||
578 | res->start = 0; | ||
579 | res->end = 0; | ||
580 | root = pci_find_parent_resource(socket->dev, res); | ||
581 | |||
584 | if (type & IORESOURCE_IO) { | 582 | if (type & IORESOURCE_IO) { |
585 | align = 1024; | 583 | align = 1024; |
586 | size = BRIDGE_IO_MAX; | 584 | size = BRIDGE_IO_MAX; |
@@ -629,7 +627,7 @@ static void yenta_allocate_resources(struct yenta_socket *socket) | |||
629 | yenta_allocate_res(socket, 0, IORESOURCE_MEM|IORESOURCE_PREFETCH); | 627 | yenta_allocate_res(socket, 0, IORESOURCE_MEM|IORESOURCE_PREFETCH); |
630 | yenta_allocate_res(socket, 1, IORESOURCE_MEM); | 628 | yenta_allocate_res(socket, 1, IORESOURCE_MEM); |
631 | yenta_allocate_res(socket, 2, IORESOURCE_IO); | 629 | yenta_allocate_res(socket, 2, IORESOURCE_IO); |
632 | yenta_allocate_res(socket, 3, IORESOURCE_IO); /* PCI isn't clever enough to use this one yet */ | 630 | yenta_allocate_res(socket, 3, IORESOURCE_IO); |
633 | } | 631 | } |
634 | 632 | ||
635 | 633 | ||