aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2011-04-07 19:55:01 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2011-05-26 13:45:07 -0400
commitc8a03c96b61bd03a3603bfe5381848c0b40e99be (patch)
tree1c0f4ca09f11b506b0b00ca651f5b4920c54e41e /drivers
parent9abd768a8d470d58071e30c57d1fa4a7090518bc (diff)
mfd: Use mfd cell platform_data for mc13xxx cells platform bits
With the addition of a platform device mfd_cell pointer, MFD drivers can go back to passing platform data back to their sub drivers. This allows for an mfd_cell->mfd_data removal and thus keep the sub drivers MFD agnostic. This is mostly needed for non MFD aware sub drivers. Cc: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: Liam Girdwood <lrg@slimlogic.co.uk> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/leds/leds-mc13783.c7
-rw-r--r--drivers/mfd/mc13xxx-core.c12
-rw-r--r--drivers/regulator/mc13783-regulator.c7
-rw-r--r--drivers/regulator/mc13892-regulator.c7
4 files changed, 18 insertions, 15 deletions
diff --git a/drivers/leds/leds-mc13783.c b/drivers/leds/leds-mc13783.c
index 126ca7955f6e..f369e56d6547 100644
--- a/drivers/leds/leds-mc13783.c
+++ b/drivers/leds/leds-mc13783.c
@@ -22,7 +22,6 @@
22#include <linux/leds.h> 22#include <linux/leds.h>
23#include <linux/workqueue.h> 23#include <linux/workqueue.h>
24#include <linux/mfd/mc13783.h> 24#include <linux/mfd/mc13783.h>
25#include <linux/mfd/core.h>
26#include <linux/slab.h> 25#include <linux/slab.h>
27 26
28struct mc13783_led { 27struct mc13783_led {
@@ -184,7 +183,7 @@ static int __devinit mc13783_led_setup(struct mc13783_led *led, int max_current)
184 183
185static int __devinit mc13783_leds_prepare(struct platform_device *pdev) 184static int __devinit mc13783_leds_prepare(struct platform_device *pdev)
186{ 185{
187 struct mc13783_leds_platform_data *pdata = mfd_get_data(pdev); 186 struct mc13783_leds_platform_data *pdata = dev_get_platdata(&pdev->dev);
188 struct mc13783 *dev = dev_get_drvdata(pdev->dev.parent); 187 struct mc13783 *dev = dev_get_drvdata(pdev->dev.parent);
189 int ret = 0; 188 int ret = 0;
190 int reg = 0; 189 int reg = 0;
@@ -265,7 +264,7 @@ out:
265 264
266static int __devinit mc13783_led_probe(struct platform_device *pdev) 265static int __devinit mc13783_led_probe(struct platform_device *pdev)
267{ 266{
268 struct mc13783_leds_platform_data *pdata = mfd_get_data(pdev); 267 struct mc13783_leds_platform_data *pdata = dev_get_platdata(&pdev->dev);
269 struct mc13783_led_platform_data *led_cur; 268 struct mc13783_led_platform_data *led_cur;
270 struct mc13783_led *led, *led_dat; 269 struct mc13783_led *led, *led_dat;
271 int ret, i; 270 int ret, i;
@@ -352,7 +351,7 @@ err_free:
352 351
353static int __devexit mc13783_led_remove(struct platform_device *pdev) 352static int __devexit mc13783_led_remove(struct platform_device *pdev)
354{ 353{
355 struct mc13783_leds_platform_data *pdata = mfd_get_data(pdev); 354 struct mc13783_leds_platform_data *pdata = dev_get_platdata(&pdev->dev);
356 struct mc13783_led *led = platform_get_drvdata(pdev); 355 struct mc13783_led *led = platform_get_drvdata(pdev);
357 struct mc13783 *dev = dev_get_drvdata(pdev->dev.parent); 356 struct mc13783 *dev = dev_get_drvdata(pdev->dev.parent);
358 int i; 357 int i;
diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
index 668634e89e81..7e4d44bf92ab 100644
--- a/drivers/mfd/mc13xxx-core.c
+++ b/drivers/mfd/mc13xxx-core.c
@@ -683,13 +683,14 @@ out:
683EXPORT_SYMBOL_GPL(mc13783_adc_do_conversion); 683EXPORT_SYMBOL_GPL(mc13783_adc_do_conversion);
684 684
685static int mc13xxx_add_subdevice_pdata(struct mc13xxx *mc13xxx, 685static int mc13xxx_add_subdevice_pdata(struct mc13xxx *mc13xxx,
686 const char *format, void *pdata) 686 const char *format, void *pdata, size_t pdata_size)
687{ 687{
688 char buf[30]; 688 char buf[30];
689 const char *name = mc13xxx_get_chipname(mc13xxx); 689 const char *name = mc13xxx_get_chipname(mc13xxx);
690 690
691 struct mfd_cell cell = { 691 struct mfd_cell cell = {
692 .mfd_data = pdata, 692 .platform_data = pdata,
693 .pdata_size = pdata_size,
693 }; 694 };
694 695
695 /* there is no asnprintf in the kernel :-( */ 696 /* there is no asnprintf in the kernel :-( */
@@ -705,7 +706,7 @@ static int mc13xxx_add_subdevice_pdata(struct mc13xxx *mc13xxx,
705 706
706static int mc13xxx_add_subdevice(struct mc13xxx *mc13xxx, const char *format) 707static int mc13xxx_add_subdevice(struct mc13xxx *mc13xxx, const char *format)
707{ 708{
708 return mc13xxx_add_subdevice_pdata(mc13xxx, format, NULL); 709 return mc13xxx_add_subdevice_pdata(mc13xxx, format, NULL, 0);
709} 710}
710 711
711static int mc13xxx_probe(struct spi_device *spi) 712static int mc13xxx_probe(struct spi_device *spi)
@@ -764,7 +765,7 @@ err_revision:
764 765
765 if (pdata->flags & MC13XXX_USE_REGULATOR) { 766 if (pdata->flags & MC13XXX_USE_REGULATOR) {
766 mc13xxx_add_subdevice_pdata(mc13xxx, "%s-regulator", 767 mc13xxx_add_subdevice_pdata(mc13xxx, "%s-regulator",
767 &pdata->regulators); 768 &pdata->regulators, sizeof(pdata->regulators));
768 } 769 }
769 770
770 if (pdata->flags & MC13XXX_USE_RTC) 771 if (pdata->flags & MC13XXX_USE_RTC)
@@ -774,7 +775,8 @@ err_revision:
774 mc13xxx_add_subdevice(mc13xxx, "%s-ts"); 775 mc13xxx_add_subdevice(mc13xxx, "%s-ts");
775 776
776 if (pdata->flags & MC13XXX_USE_LED) 777 if (pdata->flags & MC13XXX_USE_LED)
777 mc13xxx_add_subdevice_pdata(mc13xxx, "%s-led", pdata->leds); 778 mc13xxx_add_subdevice_pdata(mc13xxx, "%s-led",
779 pdata->leds, sizeof(*pdata->leds));
778 780
779 return 0; 781 return 0;
780} 782}
diff --git a/drivers/regulator/mc13783-regulator.c b/drivers/regulator/mc13783-regulator.c
index b8a00c7fa441..730f43ad415b 100644
--- a/drivers/regulator/mc13783-regulator.c
+++ b/drivers/regulator/mc13783-regulator.c
@@ -15,7 +15,6 @@
15#include <linux/regulator/driver.h> 15#include <linux/regulator/driver.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/mfd/core.h>
19#include <linux/slab.h> 18#include <linux/slab.h>
20#include <linux/init.h> 19#include <linux/init.h>
21#include <linux/err.h> 20#include <linux/err.h>
@@ -337,7 +336,8 @@ static int __devinit mc13783_regulator_probe(struct platform_device *pdev)
337{ 336{
338 struct mc13xxx_regulator_priv *priv; 337 struct mc13xxx_regulator_priv *priv;
339 struct mc13xxx *mc13783 = dev_get_drvdata(pdev->dev.parent); 338 struct mc13xxx *mc13783 = dev_get_drvdata(pdev->dev.parent);
340 struct mc13783_regulator_platform_data *pdata = mfd_get_data(pdev); 339 struct mc13783_regulator_platform_data *pdata =
340 dev_get_platdata(&pdev->dev);
341 struct mc13783_regulator_init_data *init_data; 341 struct mc13783_regulator_init_data *init_data;
342 int i, ret; 342 int i, ret;
343 343
@@ -381,7 +381,8 @@ err:
381static int __devexit mc13783_regulator_remove(struct platform_device *pdev) 381static int __devexit mc13783_regulator_remove(struct platform_device *pdev)
382{ 382{
383 struct mc13xxx_regulator_priv *priv = platform_get_drvdata(pdev); 383 struct mc13xxx_regulator_priv *priv = platform_get_drvdata(pdev);
384 struct mc13783_regulator_platform_data *pdata = mfd_get_data(pdev); 384 struct mc13783_regulator_platform_data *pdata =
385 dev_get_platdata(&pdev->dev);
385 int i; 386 int i;
386 387
387 platform_set_drvdata(pdev, NULL); 388 platform_set_drvdata(pdev, NULL);
diff --git a/drivers/regulator/mc13892-regulator.c b/drivers/regulator/mc13892-regulator.c
index 6f15168e5ed4..1b8f7398a4a8 100644
--- a/drivers/regulator/mc13892-regulator.c
+++ b/drivers/regulator/mc13892-regulator.c
@@ -15,7 +15,6 @@
15#include <linux/regulator/driver.h> 15#include <linux/regulator/driver.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/mfd/core.h>
19#include <linux/slab.h> 18#include <linux/slab.h>
20#include <linux/init.h> 19#include <linux/init.h>
21#include <linux/err.h> 20#include <linux/err.h>
@@ -521,7 +520,8 @@ static int __devinit mc13892_regulator_probe(struct platform_device *pdev)
521{ 520{
522 struct mc13xxx_regulator_priv *priv; 521 struct mc13xxx_regulator_priv *priv;
523 struct mc13xxx *mc13892 = dev_get_drvdata(pdev->dev.parent); 522 struct mc13xxx *mc13892 = dev_get_drvdata(pdev->dev.parent);
524 struct mc13xxx_regulator_platform_data *pdata = mfd_get_data(pdev); 523 struct mc13xxx_regulator_platform_data *pdata =
524 dev_get_platdata(&pdev->dev);
525 struct mc13xxx_regulator_init_data *init_data; 525 struct mc13xxx_regulator_init_data *init_data;
526 int i, ret; 526 int i, ret;
527 u32 val; 527 u32 val;
@@ -595,7 +595,8 @@ err_free:
595static int __devexit mc13892_regulator_remove(struct platform_device *pdev) 595static int __devexit mc13892_regulator_remove(struct platform_device *pdev)
596{ 596{
597 struct mc13xxx_regulator_priv *priv = platform_get_drvdata(pdev); 597 struct mc13xxx_regulator_priv *priv = platform_get_drvdata(pdev);
598 struct mc13xxx_regulator_platform_data *pdata = mfd_get_data(pdev); 598 struct mc13xxx_regulator_platform_data *pdata =
599 dev_get_platdata(&pdev->dev);
599 int i; 600 int i;
600 601
601 platform_set_drvdata(pdev, NULL); 602 platform_set_drvdata(pdev, NULL);