-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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>
- Loading branch information
Ben Dooks
authored and
Kukjin Kim
committed
Aug 5, 2010
1 parent
5db2bc8
commit 3911dab
Showing
3 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |