aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-mxc/devices.c
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2010-06-30 06:16:24 -0400
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>2010-07-26 08:27:25 -0400
commit2dcf78c0eeae3bd07082821557014f25f02ca2e9 (patch)
tree8ca5c4c7f35c9a9ab07fcd9732124c905e609aa1 /arch/arm/plat-mxc/devices.c
parent6b6322676add0fa2713d0ec89a28390fd4d907f5 (diff)
parent5109a4597f7e758b8d20694392d0361a0b4c43b1 (diff)
Merge branch 'imx/for-2.6.36' of git://git.pengutronix.de/git/ukl/linux-2.6 into HEAD
There are some more conflicts than detected by git, namely support for the newly added cpuimx machines needed to be converted to dynamic device registration. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Conflicts: arch/arm/mach-imx/Makefile arch/arm/mach-imx/devices.c arch/arm/mach-imx/devices.h arch/arm/mach-imx/eukrea_mbimx27-baseboard.c arch/arm/mach-mx2/Kconfig arch/arm/mach-mx25/Makefile arch/arm/mach-mx25/devices.c arch/arm/plat-mxc/include/mach/mx25.h arch/arm/plat-mxc/include/mach/mxc_nand.h
Diffstat (limited to 'arch/arm/plat-mxc/devices.c')
-rw-r--r--arch/arm/plat-mxc/devices.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/arch/arm/plat-mxc/devices.c b/arch/arm/plat-mxc/devices.c
index 56f2fb5cc456..735776d84956 100644
--- a/arch/arm/plat-mxc/devices.c
+++ b/arch/arm/plat-mxc/devices.c
@@ -18,6 +18,7 @@
18 18
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/err.h>
21#include <linux/platform_device.h> 22#include <linux/platform_device.h>
22#include <mach/common.h> 23#include <mach/common.h>
23 24
@@ -35,3 +36,35 @@ int __init mxc_register_device(struct platform_device *pdev, void *data)
35 return ret; 36 return ret;
36} 37}
37 38
39struct platform_device *__init imx_add_platform_device(const char *name, int id,
40 const struct resource *res, unsigned int num_resources,
41 const void *data, size_t size_data)
42{
43 int ret = -ENOMEM;
44 struct platform_device *pdev;
45
46 pdev = platform_device_alloc(name, id);
47 if (!pdev)
48 goto err;
49
50 if (res) {
51 ret = platform_device_add_resources(pdev, res, num_resources);
52 if (ret)
53 goto err;
54 }
55
56 if (data) {
57 ret = platform_device_add_data(pdev, data, size_data);
58 if (ret)
59 goto err;
60 }
61
62 ret = platform_device_add(pdev);
63 if (ret) {
64err:
65 platform_device_put(pdev);
66 return ERR_PTR(ret);
67 }
68
69 return pdev;
70}