diff options
author | Samuel Ortiz <sameo@linux.intel.com> | 2011-04-08 00:43:01 +0200 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2011-04-12 11:13:00 +0200 |
commit | e710d7d5a9cab1041b7a3cf9e655b75d92786857 (patch) | |
tree | 916fc4d0e3e42e9fbd0e9051fe19c5bb082f4e8f /drivers/mfd | |
parent | a6360dd37e1a144ed11e6548371bade559a1e4df (diff) | |
download | op-kernel-dev-e710d7d5a9cab1041b7a3cf9e655b75d92786857.zip op-kernel-dev-e710d7d5a9cab1041b7a3cf9e655b75d92786857.tar.gz |
mfd: Fetch cell pointer from platform_device->mfd_cell
In order for MFD drivers to fetch their cell pointer but also their
platform data one, an mfd cell pointer is added to the platform_device
structure.
That allows all MFD sub devices drivers to be MFD agnostic, unless
they really need to access their MFD cell data. Most of them don't,
especially the ones for IPs used by both MFD and non MFD SoCs.
Cc: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Greg KH <gregkh@suse.de>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd')
-rw-r--r-- | drivers/mfd/mfd-core.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c index d01574d..f4c8c84 100644 --- a/drivers/mfd/mfd-core.c +++ b/drivers/mfd/mfd-core.c @@ -55,6 +55,19 @@ int mfd_cell_disable(struct platform_device *pdev) } EXPORT_SYMBOL(mfd_cell_disable); +static int mfd_platform_add_cell(struct platform_device *pdev, + const struct mfd_cell *cell) +{ + if (!cell) + return 0; + + pdev->mfd_cell = kmemdup(cell, sizeof(*cell), GFP_KERNEL); + if (!pdev->mfd_cell) + return -ENOMEM; + + return 0; +} + static int mfd_add_device(struct device *parent, int id, const struct mfd_cell *cell, struct resource *mem_base, @@ -75,7 +88,7 @@ static int mfd_add_device(struct device *parent, int id, pdev->dev.parent = parent; - ret = platform_device_add_data(pdev, cell, sizeof(*cell)); + ret = mfd_platform_add_cell(pdev, cell); if (ret) goto fail_res; @@ -123,7 +136,6 @@ static int mfd_add_device(struct device *parent, int id, return 0; -/* platform_device_del(pdev); */ fail_res: kfree(res); fail_device: |