rapidio: remove mport resource reservation from common RIO code
authorAlexandre Bounine <alexandre.bounine@idt.com>
Wed, 23 Mar 2011 23:43:06 +0000 (16:43 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 24 Mar 2011 02:46:43 +0000 (19:46 -0700)
Removes resource reservation from the common sybsystem initialization code
and make it part of mport driver initialization.  This resolves conflict
with resource reservation by device specific mport drivers.

Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Li Yang <leoli@freescale.com>
Cc: Thomas Moll <thomas.moll@sysgo.com>
Cc: Micha Nelissen <micha@neli.hopto.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/powerpc/sysdev/fsl_rio.c
drivers/rapidio/rio.c

index 8d26533ba98e5ebf06ea6381c468080f10f9e0c5..14232d57369c4de4f373f76e095ec95bb559345e 100644 (file)
@@ -1432,6 +1432,14 @@ int fsl_rio_setup(struct platform_device *dev)
        port->iores.flags = IORESOURCE_MEM;
        port->iores.name = "rio_io_win";
 
+       if (request_resource(&iomem_resource, &port->iores) < 0) {
+               dev_err(&dev->dev, "RIO: Error requesting master port region"
+                       " 0x%016llx-0x%016llx\n",
+                       (u64)port->iores.start, (u64)port->iores.end);
+                       rc = -ENOMEM;
+                       goto err_res;
+       }
+
        priv->pwirq   = irq_of_parse_and_map(dev->dev.of_node, 0);
        priv->bellirq = irq_of_parse_and_map(dev->dev.of_node, 2);
        priv->txirq = irq_of_parse_and_map(dev->dev.of_node, 3);
@@ -1536,6 +1544,7 @@ int fsl_rio_setup(struct platform_device *dev)
        return 0;
 err:
        iounmap(priv->regs_win);
+err_res:
        kfree(priv);
 err_priv:
        kfree(port);
index 9a7b2168d1d569d5714ef4665a5730eac70b09bb..c29719cacbca00e108203361a25ee70cb5c8017f 100644 (file)
@@ -1137,20 +1137,9 @@ static int __devinit rio_init(void)
 
 int __devinit rio_init_mports(void)
 {
-       int rc = 0;
        struct rio_mport *port;
 
        list_for_each_entry(port, &rio_mports, node) {
-               if (!request_mem_region(port->iores.start,
-                                       resource_size(&port->iores),
-                                       port->name)) {
-                       printk(KERN_ERR
-                              "RIO: Error requesting master port region 0x%016llx-0x%016llx\n",
-                              (u64)port->iores.start, (u64)port->iores.end);
-                       rc = -ENOMEM;
-                       goto out;
-               }
-
                if (port->host_deviceid >= 0)
                        rio_enum_mport(port);
                else
@@ -1159,8 +1148,7 @@ int __devinit rio_init_mports(void)
 
        rio_init();
 
-      out:
-       return rc;
+       return 0;
 }
 
 device_initcall_sync(rio_init_mports);