Re: [PATCH] USB and Driver Core patches for 2.6.10

Greg KH
2005-01-08T07:54:00Z

ChangeSet 1.1938.439.49, 2005/01/06 17:28:25-08:00, david-b@pacbell.net

[PATCH] Driver Core: handle bridged platform bus segments

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@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>

drivers/base/platform.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)

diff -Nru a/drivers/base/platform.c b/drivers/base/platform.c
--- a/drivers/base/platform.c 2005-01-07 15:38:05 -08:00
+++ b/drivers/base/platform.c 2005-01-07 15:38:05 -08:00
@@ -141,11 +141,13 @@
if (r->name == NULL)
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