[patch 2.6.10-rc3] handle bridged platform bus segments

From: David Brownell
Date: Sat Dec 18 2004 - 15:12:36 EST


There's an inappropriate assumption that platform_bus
has only one top-level segment; trivially fixed.

- Dave
During setup to access platform bus segments through bridges, the current
platform_device_register() ignores the resource parent specified by the
bridge. That means it'll always detect a (false) resource conflict with
the bridge, and fail the resource reservation step.

This patch makes that code use the specified parent resource, defaulting
to "iomem_resource" or "ioport_resource" only for a NULL parent (that is,
for devices that aren't accessed through a bridge).

Signed-off-by: David Brownell <dbrownell@xxxxxxxxxxxxxxxxxxxxx>

--- 1.23/drivers/base/platform.c 2004-09-24 11:46:18 -07:00
+++ edited/drivers/base/platform.c 2004-12-18 11:38:35 -08:00
@@ -105,11 +105,13 @@

r->name = pdev->dev.bus_id;

- p = NULL;
- if (r->flags & IORESOURCE_MEM)
- p = &iomem_resource;
- else if (r->flags & IORESOURCE_IO)
- p = &ioport_resource;
+ p = r->parent;
+ if (!p) {
+ if (r->flags & IORESOURCE_MEM)
+ p = &iomem_resource;
+ else if (r->flags & IORESOURCE_IO)
+ p = &ioport_resource;
+ }

if (p && request_resource(p, r)) {
printk(KERN_ERR