diff options
author | Ming Lei <tom.leiming@gmail.com> | 2009-03-13 11:06:59 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-03-24 19:38:26 -0400 |
commit | ce21c7bcd796fc4f45d48781b7e85f493cc55ee5 (patch) | |
tree | 7b2152db4af5f8ca42180166ef336596d52f8dc0 | |
parent | 006f4571a15fae3a0575f2a0f9e9b63b3d1012f8 (diff) |
driver core: fix passing platform_data
We will remove platform_data field from struct device until
all platform devices pass its specific data from platfom_device
and all platform drivers use platform specific data passed by
platform_device->platform_data. This kind of conversion will
need a long time, for thousands of files is affected.
To make the conversion easily, we allow platform specific data
passed by struct device or struct platform_device and platform
driver may use it from struct device or struct platform_device.
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/base/platform.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index c5ac81d22303..d2198f64ad4e 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
@@ -247,7 +247,20 @@ int platform_device_add(struct platform_device *pdev) | |||
247 | else | 247 | else |
248 | dev_set_name(&pdev->dev, pdev->name); | 248 | dev_set_name(&pdev->dev, pdev->name); |
249 | 249 | ||
250 | pdev->platform_data = pdev->dev.platform_data; | 250 | /* We will remove platform_data field from struct device |
251 | * if all platform devices pass its platform specific data | ||
252 | * from platform_device. The conversion is going to be a | ||
253 | * long time, so we allow the two cases coexist to make | ||
254 | * this kind of fix more easily*/ | ||
255 | if (pdev->platform_data && pdev->dev.platform_data) { | ||
256 | printk(KERN_ERR | ||
257 | "%s: use which platform_data?\n", | ||
258 | dev_name(&pdev->dev)); | ||
259 | } else if (pdev->platform_data) { | ||
260 | pdev->dev.platform_data = pdev->platform_data; | ||
261 | } else if (pdev->dev.platform_data) { | ||
262 | pdev->platform_data = pdev->dev.platform_data; | ||
263 | } | ||
251 | 264 | ||
252 | for (i = 0; i < pdev->num_resources; i++) { | 265 | for (i = 0; i < pdev->num_resources; i++) { |
253 | struct resource *p, *r = &pdev->resource[i]; | 266 | struct resource *p, *r = &pdev->resource[i]; |