aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/base/platform.c3
-rw-r--r--include/linux/device.h9
-rw-r--r--include/linux/platform_device.h1
3 files changed, 11 insertions, 2 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index ec993aa6a2ca..c5ac81d22303 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -217,6 +217,7 @@ int platform_device_add_data(struct platform_device *pdev, const void *data,
217 if (d) { 217 if (d) {
218 memcpy(d, data, size); 218 memcpy(d, data, size);
219 pdev->dev.platform_data = d; 219 pdev->dev.platform_data = d;
220 pdev->platform_data = d;
220 } 221 }
221 return d ? 0 : -ENOMEM; 222 return d ? 0 : -ENOMEM;
222} 223}
@@ -246,6 +247,8 @@ int platform_device_add(struct platform_device *pdev)
246 else 247 else
247 dev_set_name(&pdev->dev, pdev->name); 248 dev_set_name(&pdev->dev, pdev->name);
248 249
250 pdev->platform_data = pdev->dev.platform_data;
251
249 for (i = 0; i < pdev->num_resources; i++) { 252 for (i = 0; i < pdev->num_resources; i++) {
250 struct resource *p, *r = &pdev->resource[i]; 253 struct resource *p, *r = &pdev->resource[i];
251 254
diff --git a/include/linux/device.h b/include/linux/device.h
index 5a64775e68e4..4bea53fe8f4c 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -385,8 +385,13 @@ struct device {
385 struct device_driver *driver; /* which driver has allocated this 385 struct device_driver *driver; /* which driver has allocated this
386 device */ 386 device */
387 void *driver_data; /* data private to the driver */ 387 void *driver_data; /* data private to the driver */
388 void *platform_data; /* Platform specific data, device 388
389 core doesn't touch it */ 389 void *platform_data; /* We will remove platform_data
390 field if all platform devices
391 pass its platform specific data
392 from platform_device->platform_data,
393 other kind of devices should not
394 use platform_data. */
390 struct dev_pm_info power; 395 struct dev_pm_info power;
391 396
392#ifdef CONFIG_NUMA 397#ifdef CONFIG_NUMA
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 76aef7be32ab..76e470a299bf 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -20,6 +20,7 @@ struct platform_device {
20 struct device dev; 20 struct device dev;
21 u32 num_resources; 21 u32 num_resources;
22 struct resource * resource; 22 struct resource * resource;
23 void *platform_data;
23 24
24 struct platform_device_id *id_entry; 25 struct platform_device_id *id_entry;
25}; 26};