aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/plat-samsung/platformdata.c
diff options
context:
space:
mode:
authorBen Dooks <ben-linux@fluff.org>2010-06-10 12:57:15 +0900
committerKukjin Kim <kgene.kim@samsung.com>2010-08-05 18:32:49 +0900
commit3911dab8ad582fd4db5e79eda5320c37c3dfb9bb (patch)
treec2a80e4b4814512d289f4e39fb489a4958067d39 /arch/arm/plat-samsung/platformdata.c
parent5db2bc8a114b866f351a510dab6945ab20567055 (diff)
ARM: SAMSUNG: Add helper to clone and set platform data
This is intended to replace a number of sites in the Samsung kernel where the same thing is being repeated in specific platform setting code. See next patches for replacements. Signed-off-by: Ben Dooks <ben-linux@fluff.org> [kgene.kim@samsung.com: This is for building test] Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Diffstat (limited to 'arch/arm/plat-samsung/platformdata.c')
-rw-r--r--arch/arm/plat-samsung/platformdata.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/arch/arm/plat-samsung/platformdata.c b/arch/arm/plat-samsung/platformdata.c
new file mode 100644
index 00000000000..7cf2e1e3b20
--- /dev/null
+++ b/arch/arm/plat-samsung/platformdata.c
@@ -0,0 +1,37 @@
+/* linux/arch/arm/plat-samsung/platformdata.c
+ *
+ * Copyright 2010 Ben Dooks <ben-linux <at> fluff.org>
+ *
+ * Helper for platform data setting
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/platform_device.h>
+
+#include <plat/devs.h>
+
+void __init *s3c_set_platdata(void *pd, size_t pdsize,
+ struct platform_device *pdev)
+{
+ void *npd;
+
+ if (!pd) {
+ /* too early to use dev_name(), may not be registered */
+ printk(KERN_ERR "%s: no platform data supplied\n", pdev->name);
+ return NULL;
+ }
+
+ npd = kmemdup(pd, pdsize, GFP_KERNEL);
+ if (!npd) {
+ printk(KERN_ERR "%s: cannot clone platform data\n", pdev->name);
+ return NULL;
+ }
+
+ pdev->dev.platform_data = npd;
+ return npd;
+}