aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLee Jones <lee.jones@linaro.org>2012-02-06 14:22:26 -0500
committerArnd Bergmann <arnd@arndb.de>2012-02-13 01:31:53 -0500
commit3510ec672319e09fe43bd623b19fcf539c0bd1fa (patch)
tree4c45a1f0d9791c7f9b7427f55df232473dd3ecf9 /arch
parentb024a0c804356d90b13c072c8bbb444d9e745a66 (diff)
ARM: ux500: remove intermediary add_platform_device* functions
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>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-ux500/devices-common.c53
-rw-r--r--arch/arm/mach-ux500/devices-common.h46
-rw-r--r--arch/arm/mach-ux500/devices-db8500.h10
3 files changed, 33 insertions, 76 deletions
diff --git a/arch/arm/mach-ux500/devices-common.c b/arch/arm/mach-ux500/devices-common.c
index 96effbd8ceb5..c3bc094c27e5 100644
--- a/arch/arm/mach-ux500/devices-common.c
+++ b/arch/arm/mach-ux500/devices-common.c
@@ -59,59 +59,6 @@ dbx500_add_amba_device(struct device *parent, const char *name,
59} 59}
60 60
61static struct platform_device * 61static struct platform_device *
62dbx500_add_platform_device(const char *name, int id, void *pdata,
63 struct resource *res, int resnum)
64{
65 struct platform_device *dev;
66 int ret;
67
68 dev = platform_device_alloc(name, id);
69 if (!dev)
70 return ERR_PTR(-ENOMEM);
71
72 dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
73 dev->dev.dma_mask = &dev->dev.coherent_dma_mask;
74
75 ret = platform_device_add_resources(dev, res, resnum);
76 if (ret)
77 goto out_free;
78
79 dev->dev.platform_data = pdata;
80
81 ret = platform_device_add(dev);
82 if (ret)
83 goto out_free;
84
85 return dev;
86
87out_free:
88 platform_device_put(dev);
89 return ERR_PTR(ret);
90}
91
92struct platform_device *
93dbx500_add_platform_device_4k1irq(const char *name, int id,
94 resource_size_t base,
95 int irq, void *pdata)
96{
97 struct resource resources[] = {
98 [0] = {
99 .start = base,
100 .end = base + SZ_4K - 1,
101 .flags = IORESOURCE_MEM,
102 },
103 [1] = {
104 .start = irq,
105 .end = irq,
106 .flags = IORESOURCE_IRQ,
107 }
108 };
109
110 return dbx500_add_platform_device(name, id, pdata, resources,
111 ARRAY_SIZE(resources));
112}
113
114static struct platform_device *
115dbx500_add_gpio(struct device *parent, int id, resource_size_t addr, int irq, 62dbx500_add_gpio(struct device *parent, int id, resource_size_t addr, int irq,
116 struct nmk_gpio_platform_data *pdata) 63 struct nmk_gpio_platform_data *pdata)
117{ 64{
diff --git a/arch/arm/mach-ux500/devices-common.h b/arch/arm/mach-ux500/devices-common.h
index f8adff891a91..39c74ec82add 100644
--- a/arch/arm/mach-ux500/devices-common.h
+++ b/arch/arm/mach-ux500/devices-common.h
@@ -8,14 +8,15 @@
8#ifndef __DEVICES_COMMON_H 8#ifndef __DEVICES_COMMON_H
9#define __DEVICES_COMMON_H 9#define __DEVICES_COMMON_H
10 10
11extern struct amba_device * 11#include <linux/platform_device.h>
12dbx500_add_amba_device(struct device *parent, const char *name, resource_size_t base, 12#include <linux/dma-mapping.h>
13 int irq, void *pdata, unsigned int periphid); 13#include <linux/sys_soc.h>
14#include <plat/i2c.h>
14 15
15extern struct platform_device * 16extern struct amba_device *
16dbx500_add_platform_device_4k1irq(const char *name, int id, 17dbx500_add_amba_device(struct device *parent, const char *name,
17 resource_size_t base, 18 resource_size_t base, int irq, void *pdata,
18 int irq, void *pdata); 19 unsigned int periphid);
19 20
20struct spi_master_cntlr; 21struct spi_master_cntlr;
21 22
@@ -60,20 +61,25 @@ struct nmk_i2c_controller;
60 61
61static inline struct platform_device * 62static inline struct platform_device *
62dbx500_add_i2c(struct device *parent, int id, resource_size_t base, int irq, 63dbx500_add_i2c(struct device *parent, int id, resource_size_t base, int irq,
63 struct nmk_i2c_controller *pdata) 64 struct nmk_i2c_controller *data)
64{
65 return dbx500_add_platform_device_4k1irq("nmk-i2c", id, base, irq,
66 pdata);
67}
68
69struct msp_i2s_platform_data;
70
71static inline struct platform_device *
72dbx500_add_msp_i2s(int id, resource_size_t base, int irq,
73 struct msp_i2s_platform_data *pdata)
74{ 65{
75 return dbx500_add_platform_device_4k1irq("MSP_I2S", id, base, irq, 66 struct resource res[] = {
76 pdata); 67 DEFINE_RES_MEM(base, SZ_4K),
68 DEFINE_RES_IRQ(irq),
69 };
70
71 struct platform_device_info pdevinfo = {
72 .parent = parent,
73 .name = "nmk-i2c",
74 .id = id,
75 .res = res,
76 .num_res = ARRAY_SIZE(res),
77 .data = data,
78 .size_data = sizeof(*data),
79 .dma_mask = DMA_BIT_MASK(32),
80 };
81
82 return platform_device_register_full(&pdevinfo);
77} 83}
78 84
79static inline struct amba_device * 85static inline struct amba_device *
diff --git a/arch/arm/mach-ux500/devices-db8500.h b/arch/arm/mach-ux500/devices-db8500.h
index 9bd08ad70042..9fd93e9da529 100644
--- a/arch/arm/mach-ux500/devices-db8500.h
+++ b/arch/arm/mach-ux500/devices-db8500.h
@@ -18,9 +18,13 @@ db8500_add_ske_keypad(struct device *parent,
18 struct ske_keypad_platform_data *pdata, 18 struct ske_keypad_platform_data *pdata,
19 size_t size) 19 size_t size)
20{ 20{
21 return dbx500_add_platform_device_4k1irq("nmk-ske-keypad", -1, 21 struct resource resources[] = {
22 U8500_SKE_BASE, 22 DEFINE_RES_MEM(U8500_SKE_BASE, SZ_4K),
23 IRQ_DB8500_KB, pdata); 23 DEFINE_RES_IRQ(IRQ_DB8500_KB),
24 };
25
26 return platform_device_register_resndata(parent, "nmk-ske-keypad", -1,
27 resources, 2, pdata, size);
24} 28}
25 29
26static inline struct amba_device * 30static inline struct amba_device *