[PATCH 01/19] mfd: Add platform data pointer back

Samuel Ortiz
2011-05-09T11:21:32Z

Now that we have a way to pass MFD cells down to the sub drivers,
we can gradually get rid of mfd_data by putting the platform pointer
back in place.

Cc: Andres Salomon <dilinger@queued.net>
Cc: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: Dmitry Baryshkov <dbaryshkov@gmail.com>
Cc: Dmitry Torokhov <dtor@mail.ru>
Cc: Florian Fainelli <florian@openwrt.org>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: Haojian Zhuang <haojian.zhuang@marvell.com>
Cc: Ian Molton <spyro@f2s.com>
Cc: Ira W. Snyder <iws@ovro.caltech.edu>
Cc: Liam Girdwood <lrg@slimlogic.co.uk>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Matti Aaltonen <matti.j.aaltonen@nokia.com>
Cc: Matt Reimer <mreimer@vpop.net>
Cc: Miguel Aguilar <miguel.aguilar@ridgerun.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Cc: Philipp Zabel <philipp.zabel@gmail.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Richard Röjfors <richard.rojfors@pelagicore.com>
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Wim Van Sebroeck <wim@iguana.be>
Cc: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
---
drivers/mfd/mfd-core.c | 7 +++++++
include/linux/mfd/core.h | 4 ++++
2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
index f4c8c84..0902523 100644
--- a/drivers/mfd/mfd-core.c
+++ b/drivers/mfd/mfd-core.c
@@ -88,6 +88,13 @@ static int mfd_add_device(struct device *parent, int id,

pdev->dev.parent = parent;

+ if (cell->pdata_size) {
+ ret = platform_device_add_data(pdev,
+ cell->platform_data, cell->pdata_size);
+ if (ret)
+ goto fail_res;
+ }
+
ret = mfd_platform_add_cell(pdev, cell);
if (ret)
goto fail_res;
diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
index aef23309..68c13e5 100644
--- a/include/linux/mfd/core.h
+++ b/include/linux/mfd/core.h
@@ -36,6 +36,10 @@ struct mfd_cell {
/* mfd_data can be used to pass data to client drivers */
void *mfd_data;

+ /* platform data passed to the sub devices drivers */
+ void *platform_data;
+ size_t pdata_size;
+
/*
* These resources can be specified relative to the parent device.
* For accessing hardware you should use resources from the platform dev
--
1.7.2.3

--
Intel Open Source Technology Centre