aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/mfd/core.h13
-rw-r--r--include/linux/platform_device.h5
2 files changed, 16 insertions, 2 deletions
diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
index ad1b19aa650..aef23309a74 100644
--- a/include/linux/mfd/core.h
+++ b/include/linux/mfd/core.h
@@ -86,16 +86,25 @@ extern int mfd_clone_cell(const char *cell, const char **clones,
86 */ 86 */
87static inline const struct mfd_cell *mfd_get_cell(struct platform_device *pdev) 87static inline const struct mfd_cell *mfd_get_cell(struct platform_device *pdev)
88{ 88{
89 return pdev->dev.platform_data; 89 return pdev->mfd_cell;
90} 90}
91 91
92/* 92/*
93 * Given a platform device that's been created by mfd_add_devices(), fetch 93 * Given a platform device that's been created by mfd_add_devices(), fetch
94 * the .mfd_data entry from the mfd_cell that created it. 94 * the .mfd_data entry from the mfd_cell that created it.
95 * Otherwise just return the platform_data pointer.
96 * This maintains compatibility with platform drivers whose devices aren't
97 * created by the mfd layer, and expect platform_data to contain what would've
98 * otherwise been in mfd_data.
95 */ 99 */
96static inline void *mfd_get_data(struct platform_device *pdev) 100static inline void *mfd_get_data(struct platform_device *pdev)
97{ 101{
98 return mfd_get_cell(pdev)->mfd_data; 102 const struct mfd_cell *cell = mfd_get_cell(pdev);
103
104 if (cell)
105 return cell->mfd_data;
106 else
107 return pdev->dev.platform_data;
99} 108}
100 109
101extern int mfd_add_devices(struct device *parent, int id, 110extern int mfd_add_devices(struct device *parent, int id,
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index d96db982570..744942c95fe 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -14,6 +14,8 @@
14#include <linux/device.h> 14#include <linux/device.h>
15#include <linux/mod_devicetable.h> 15#include <linux/mod_devicetable.h>
16 16
17struct mfd_cell;
18
17struct platform_device { 19struct platform_device {
18 const char * name; 20 const char * name;
19 int id; 21 int id;
@@ -23,6 +25,9 @@ struct platform_device {
23 25
24 const struct platform_device_id *id_entry; 26 const struct platform_device_id *id_entry;
25 27
28 /* MFD cell pointer */
29 struct mfd_cell *mfd_cell;
30
26 /* arch specific additions */ 31 /* arch specific additions */
27 struct pdev_archdata archdata; 32 struct pdev_archdata archdata;
28}; 33};