summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-04-12 14:25:10 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2011-04-12 14:25:10 -0700
commite328f05dd6c528fcc9eb6da157dd865dfe611352 (patch)
treec2bfbdada67dd80a8eed5aeafbe0d7322b1c1b2a /include
parent0d88f6e804c824454b5ed0d3034ed3dcf7467a87 (diff)
parente710d7d5a9cab1041b7a3cf9e655b75d92786857 (diff)
downloadlinux-3.10-e328f05dd6c528fcc9eb6da157dd865dfe611352.tar.gz
linux-3.10-e328f05dd6c528fcc9eb6da157dd865dfe611352.tar.bz2
linux-3.10-e328f05dd6c528fcc9eb6da157dd865dfe611352.zip
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.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,
*/
static inline const struct mfd_cell *mfd_get_cell(struct platform_device *pdev)
{
- return pdev->dev.platform_data;
+ return pdev->mfd_cell;
}
/*
* Given a platform device that's been created by mfd_add_devices(), fetch
* the .mfd_data entry from the mfd_cell that created it.
+ * Otherwise just return the platform_data pointer.
+ * This maintains compatibility with platform drivers whose devices aren't
+ * created by the mfd layer, and expect platform_data to contain what would've
+ * otherwise been in mfd_data.
*/
static inline void *mfd_get_data(struct platform_device *pdev)
{
- return mfd_get_cell(pdev)->mfd_data;
+ const struct mfd_cell *cell = mfd_get_cell(pdev);
+
+ if (cell)
+ return cell->mfd_data;
+ else
+ return pdev->dev.platform_data;
}
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 d96db982570..744942c95fe 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -14,6 +14,8 @@
#include <linux/device.h>
#include <linux/mod_devicetable.h>
+struct mfd_cell;
+
struct platform_device {
const char * name;
int id;
@@ -23,6 +25,9 @@ struct platform_device {
const struct platform_device_id *id_entry;
+ /* MFD cell pointer */
+ struct mfd_cell *mfd_cell;
+
/* arch specific additions */
struct pdev_archdata archdata;
};