diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-04-12 17:25:10 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-04-12 17:25:10 -0400 |
commit | e328f05dd6c528fcc9eb6da157dd865dfe611352 (patch) | |
tree | c2bfbdada67dd80a8eed5aeafbe0d7322b1c1b2a /include | |
parent | 0d88f6e804c824454b5ed0d3034ed3dcf7467a87 (diff) | |
parent | e710d7d5a9cab1041b7a3cf9e655b75d92786857 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6:
mfd: Fetch cell pointer from platform_device->mfd_cell
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/mfd/core.h | 13 | ||||
-rw-r--r-- | include/linux/platform_device.h | 5 |
2 files changed, 16 insertions, 2 deletions
diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h index ad1b19aa6508..aef23309a742 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 | */ |
87 | static inline const struct mfd_cell *mfd_get_cell(struct platform_device *pdev) | 87 | static 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 | */ |
96 | static inline void *mfd_get_data(struct platform_device *pdev) | 100 | static 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 | ||
101 | extern int mfd_add_devices(struct device *parent, int id, | 110 | extern int mfd_add_devices(struct device *parent, int id, |
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index d96db9825708..744942c95fec 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 | ||
17 | struct mfd_cell; | ||
18 | |||
17 | struct platform_device { | 19 | struct 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 | }; |