Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 208780
b: refs/heads/master
c: 3911dab
h: refs/heads/master
v: v3
  • Loading branch information
Ben Dooks authored and Kukjin Kim committed Aug 5, 2010
1 parent 494d4ae commit 2948ae5
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5db2bc8a114b866f351a510dab6945ab20567055
refs/heads/master: 3911dab8ad582fd4db5e79eda5320c37c3dfb9bb
2 changes: 2 additions & 0 deletions trunk/arch/arm/plat-samsung/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ obj-$(CONFIG_S3C_ADC) += adc.o

# devices

obj-y += platformdata.o

obj-$(CONFIG_S3C_DEV_HSMMC) += dev-hsmmc.o
obj-$(CONFIG_S3C_DEV_HSMMC1) += dev-hsmmc1.o
obj-$(CONFIG_S3C_DEV_HSMMC2) += dev-hsmmc2.o
Expand Down
12 changes: 12 additions & 0 deletions trunk/arch/arm/plat-samsung/include/plat/devs.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,15 @@ extern struct platform_device s3c_device_camif;
extern struct platform_device s3c_device_ac97;

#endif

/**
* s3c_set_platdata() - helper for setting platform data
* @pd: The default platform data for this device.
* @pdsize: The size of the platform data.
* @pdev: Pointer to the device to fill in.
*
* This helper replaces a number of calls that copy and then set the
* platform data of the device.
*/
extern void *s3c_set_platdata(void *pd, size_t pdsize,
struct platform_device *pdev);
37 changes: 37 additions & 0 deletions trunk/arch/arm/plat-samsung/platformdata.c
Original file line number Diff line number Diff line change
@@ -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;
}

0 comments on commit 2948ae5

Please sign in to comment.