ARM: ux500: remove intermediary add_platform_device* functions
authorLee Jones <lee.jones@linaro.org>
Mon, 6 Feb 2012 19:22:26 +0000 (11:22 -0800)
committerArnd Bergmann <arnd@arndb.de>
Mon, 13 Feb 2012 06:31:53 +0000 (06:31 +0000)
These are no longer required since a 'parent' pointer is now
passed to each registering device.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
arch/arm/mach-ux500/devices-common.c
arch/arm/mach-ux500/devices-common.h
arch/arm/mach-ux500/devices-db8500.h

index 96effbd..c3bc094 100644 (file)
@@ -58,59 +58,6 @@ dbx500_add_amba_device(struct device *parent, const char *name,
        return dev;
 }
 
-static struct platform_device *
-dbx500_add_platform_device(const char *name, int id, void *pdata,
-                          struct resource *res, int resnum)
-{
-       struct platform_device *dev;
-       int ret;
-
-       dev = platform_device_alloc(name, id);
-       if (!dev)
-               return ERR_PTR(-ENOMEM);
-
-       dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
-       dev->dev.dma_mask = &dev->dev.coherent_dma_mask;
-
-       ret = platform_device_add_resources(dev, res, resnum);
-       if (ret)
-               goto out_free;
-
-       dev->dev.platform_data = pdata;
-
-       ret = platform_device_add(dev);
-       if (ret)
-               goto out_free;
-
-       return dev;
-
-out_free:
-       platform_device_put(dev);
-       return ERR_PTR(ret);
-}
-
-struct platform_device *
-dbx500_add_platform_device_4k1irq(const char *name, int id,
-                                 resource_size_t base,
-                                 int irq, void *pdata)
-{
-       struct resource resources[] = {
-               [0] = {
-                       .start  = base,
-                       .end    = base + SZ_4K - 1,
-                       .flags  = IORESOURCE_MEM,
-               },
-               [1] = {
-                       .start  = irq,
-                       .end    = irq,
-                       .flags  = IORESOURCE_IRQ,
-               }
-       };
-
-       return dbx500_add_platform_device(name, id, pdata, resources,
-                                         ARRAY_SIZE(resources));
-}
-
 static struct platform_device *
 dbx500_add_gpio(struct device *parent, int id, resource_size_t addr, int irq,
                struct nmk_gpio_platform_data *pdata)
index f8adff8..39c74ec 100644 (file)
@@ -8,14 +8,15 @@
 #ifndef __DEVICES_COMMON_H
 #define __DEVICES_COMMON_H
 
-extern struct amba_device *
-dbx500_add_amba_device(struct device *parent, const char *name, resource_size_t base,
-                      int irq, void *pdata, unsigned int periphid);
+#include <linux/platform_device.h>
+#include <linux/dma-mapping.h>
+#include <linux/sys_soc.h>
+#include <plat/i2c.h>
 
-extern struct platform_device *
-dbx500_add_platform_device_4k1irq(const char *name, int id,
-                                 resource_size_t base,
-                                 int irq, void *pdata);
+extern struct amba_device *
+dbx500_add_amba_device(struct device *parent, const char *name,
+                      resource_size_t base, int irq, void *pdata,
+                      unsigned int periphid);
 
 struct spi_master_cntlr;
 
@@ -60,20 +61,25 @@ struct nmk_i2c_controller;
 
 static inline struct platform_device *
 dbx500_add_i2c(struct device *parent, int id, resource_size_t base, int irq,
-              struct nmk_i2c_controller *pdata)
-{
-       return dbx500_add_platform_device_4k1irq("nmk-i2c", id, base, irq,
-                                                pdata);
-}
-
-struct msp_i2s_platform_data;
-
-static inline struct platform_device *
-dbx500_add_msp_i2s(int id, resource_size_t base, int irq,
-                  struct msp_i2s_platform_data *pdata)
+              struct nmk_i2c_controller *data)
 {
-       return dbx500_add_platform_device_4k1irq("MSP_I2S", id, base, irq,
-                                                pdata);
+       struct resource res[] = {
+               DEFINE_RES_MEM(base, SZ_4K),
+               DEFINE_RES_IRQ(irq),
+       };
+
+       struct platform_device_info pdevinfo = {
+               .parent = parent,
+               .name = "nmk-i2c",
+               .id = id,
+               .res = res,
+               .num_res = ARRAY_SIZE(res),
+               .data = data,
+               .size_data = sizeof(*data),
+               .dma_mask = DMA_BIT_MASK(32),
+       };
+
+       return platform_device_register_full(&pdevinfo);
 }
 
 static inline struct amba_device *
index 9bd08ad..9fd93e9 100644 (file)
@@ -18,9 +18,13 @@ db8500_add_ske_keypad(struct device *parent,
                      struct ske_keypad_platform_data *pdata,
                      size_t size)
 {
-       return dbx500_add_platform_device_4k1irq("nmk-ske-keypad", -1,
-                                                U8500_SKE_BASE,
-                                                IRQ_DB8500_KB, pdata);
+       struct resource resources[] = {
+               DEFINE_RES_MEM(U8500_SKE_BASE, SZ_4K),
+               DEFINE_RES_IRQ(IRQ_DB8500_KB),
+       };
+
+       return platform_device_register_resndata(parent, "nmk-ske-keypad", -1,
+                                                resources, 2, pdata, size);
 }
 
 static inline struct amba_device *