diff options
author | Lee Jones <lee.jones@linaro.org> | 2012-02-06 14:22:26 -0500 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2012-02-13 01:31:53 -0500 |
commit | 3510ec672319e09fe43bd623b19fcf539c0bd1fa (patch) | |
tree | 4c45a1f0d9791c7f9b7427f55df232473dd3ecf9 /arch | |
parent | b024a0c804356d90b13c072c8bbb444d9e745a66 (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.c | 53 | ||||
-rw-r--r-- | arch/arm/mach-ux500/devices-common.h | 46 | ||||
-rw-r--r-- | arch/arm/mach-ux500/devices-db8500.h | 10 |
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 | ||
61 | static struct platform_device * | 61 | static struct platform_device * |
62 | dbx500_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 | |||
87 | out_free: | ||
88 | platform_device_put(dev); | ||
89 | return ERR_PTR(ret); | ||
90 | } | ||
91 | |||
92 | struct platform_device * | ||
93 | dbx500_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 | |||
114 | static struct platform_device * | ||
115 | dbx500_add_gpio(struct device *parent, int id, resource_size_t addr, int irq, | 62 | dbx500_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 | ||
11 | extern struct amba_device * | 11 | #include <linux/platform_device.h> |
12 | dbx500_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 | ||
15 | extern struct platform_device * | 16 | extern struct amba_device * |
16 | dbx500_add_platform_device_4k1irq(const char *name, int id, | 17 | dbx500_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 | ||
20 | struct spi_master_cntlr; | 21 | struct spi_master_cntlr; |
21 | 22 | ||
@@ -60,20 +61,25 @@ struct nmk_i2c_controller; | |||
60 | 61 | ||
61 | static inline struct platform_device * | 62 | static inline struct platform_device * |
62 | dbx500_add_i2c(struct device *parent, int id, resource_size_t base, int irq, | 63 | dbx500_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 | |||
69 | struct msp_i2s_platform_data; | ||
70 | |||
71 | static inline struct platform_device * | ||
72 | dbx500_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 | ||
79 | static inline struct amba_device * | 85 | static 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 | ||
26 | static inline struct amba_device * | 30 | static inline struct amba_device * |