ARM: amba: of: convert to use amba_device_alloc
authorRussell King <rmk+kernel@arm.linux.org.uk>
Sun, 18 Dec 2011 11:45:17 +0000 (11:45 +0000)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Wed, 25 Jan 2012 11:02:01 +0000 (11:02 +0000)
Convert DT code to use the new amba_device_alloc APIs.

Acked-by: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
drivers/of/platform.c

index 63b3ec4..cae9477 100644 (file)
@@ -253,7 +253,7 @@ static struct amba_device *of_amba_device_create(struct device_node *node,
        if (!of_device_is_available(node))
                return NULL;
 
-       dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+       dev = amba_device_alloc(NULL, 0, 0);
        if (!dev)
                return NULL;
 
@@ -283,14 +283,14 @@ static struct amba_device *of_amba_device_create(struct device_node *node,
        if (ret)
                goto err_free;
 
-       ret = amba_device_register(dev, &iomem_resource);
+       ret = amba_device_add(dev, &iomem_resource);
        if (ret)
                goto err_free;
 
        return dev;
 
 err_free:
-       kfree(dev);
+       amba_device_put(dev);
        return NULL;
 }
 #else /* CONFIG_ARM_AMBA */