Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+18 -15
+3 -4
drivers/leds/leds-mc13783.c
··· 22 22 #include <linux/leds.h> 23 23 #include <linux/workqueue.h> 24 24 #include <linux/mfd/mc13783.h> 25 - #include <linux/mfd/core.h> 26 25 #include <linux/slab.h> 27 26 28 27 struct mc13783_led { ··· 183 184 184 185 static int __devinit mc13783_leds_prepare(struct platform_device *pdev) 185 186 { 186 - struct mc13783_leds_platform_data *pdata = mfd_get_data(pdev); 187 + struct mc13783_leds_platform_data *pdata = dev_get_platdata(&pdev->dev); 187 188 struct mc13783 *dev = dev_get_drvdata(pdev->dev.parent); 188 189 int ret = 0; 189 190 int reg = 0; ··· 264 265 265 266 static int __devinit mc13783_led_probe(struct platform_device *pdev) 266 267 { 267 - struct mc13783_leds_platform_data *pdata = mfd_get_data(pdev); 268 + struct mc13783_leds_platform_data *pdata = dev_get_platdata(&pdev->dev); 268 269 struct mc13783_led_platform_data *led_cur; 269 270 struct mc13783_led *led, *led_dat; 270 271 int ret, i; ··· 351 352 352 353 static int __devexit mc13783_led_remove(struct platform_device *pdev) 353 354 { 354 - struct mc13783_leds_platform_data *pdata = mfd_get_data(pdev); 355 + struct mc13783_leds_platform_data *pdata = dev_get_platdata(&pdev->dev); 355 356 struct mc13783_led *led = platform_get_drvdata(pdev); 356 357 struct mc13783 *dev = dev_get_drvdata(pdev->dev.parent); 357 358 int i;
+7 -5
drivers/mfd/mc13xxx-core.c
··· 683 683 EXPORT_SYMBOL_GPL(mc13783_adc_do_conversion); 684 684 685 685 static 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 688 char buf[30]; 689 689 const char *name = mc13xxx_get_chipname(mc13xxx); 690 690 691 691 struct mfd_cell cell = { 692 - .mfd_data = pdata, 692 + .platform_data = pdata, 693 + .pdata_size = pdata_size, 693 694 }; 694 695 695 696 /* there is no asnprintf in the kernel :-( */ ··· 706 705 707 706 static int mc13xxx_add_subdevice(struct mc13xxx *mc13xxx, const char *format) 708 707 { 709 - return mc13xxx_add_subdevice_pdata(mc13xxx, format, NULL); 708 + return mc13xxx_add_subdevice_pdata(mc13xxx, format, NULL, 0); 710 709 } 711 710 712 711 static int mc13xxx_probe(struct spi_device *spi) ··· 765 764 766 765 if (pdata->flags & MC13XXX_USE_REGULATOR) { 767 766 mc13xxx_add_subdevice_pdata(mc13xxx, "%s-regulator", 768 - &pdata->regulators); 767 + &pdata->regulators, sizeof(pdata->regulators)); 769 768 } 770 769 771 770 if (pdata->flags & MC13XXX_USE_RTC) ··· 775 774 mc13xxx_add_subdevice(mc13xxx, "%s-ts"); 776 775 777 776 if (pdata->flags & MC13XXX_USE_LED) 778 - mc13xxx_add_subdevice_pdata(mc13xxx, "%s-led", pdata->leds); 777 + mc13xxx_add_subdevice_pdata(mc13xxx, "%s-led", 778 + pdata->leds, sizeof(*pdata->leds)); 779 779 780 780 return 0; 781 781 }
+4 -3
drivers/regulator/mc13783-regulator.c
··· 15 15 #include <linux/regulator/driver.h> 16 16 #include <linux/platform_device.h> 17 17 #include <linux/kernel.h> 18 - #include <linux/mfd/core.h> 19 18 #include <linux/slab.h> 20 19 #include <linux/init.h> 21 20 #include <linux/err.h> ··· 336 337 { 337 338 struct mc13xxx_regulator_priv *priv; 338 339 struct mc13xxx *mc13783 = dev_get_drvdata(pdev->dev.parent); 339 - struct mc13783_regulator_platform_data *pdata = mfd_get_data(pdev); 340 + struct mc13783_regulator_platform_data *pdata = 341 + dev_get_platdata(&pdev->dev); 340 342 struct mc13783_regulator_init_data *init_data; 341 343 int i, ret; 342 344 ··· 381 381 static int __devexit mc13783_regulator_remove(struct platform_device *pdev) 382 382 { 383 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 386 int i; 386 387 387 388 platform_set_drvdata(pdev, NULL);
+4 -3
drivers/regulator/mc13892-regulator.c
··· 15 15 #include <linux/regulator/driver.h> 16 16 #include <linux/platform_device.h> 17 17 #include <linux/kernel.h> 18 - #include <linux/mfd/core.h> 19 18 #include <linux/slab.h> 20 19 #include <linux/init.h> 21 20 #include <linux/err.h> ··· 520 521 { 521 522 struct mc13xxx_regulator_priv *priv; 522 523 struct mc13xxx *mc13892 = dev_get_drvdata(pdev->dev.parent); 523 - struct mc13xxx_regulator_platform_data *pdata = mfd_get_data(pdev); 524 + struct mc13xxx_regulator_platform_data *pdata = 525 + dev_get_platdata(&pdev->dev); 524 526 struct mc13xxx_regulator_init_data *init_data; 525 527 int i, ret; 526 528 u32 val; ··· 595 595 static int __devexit mc13892_regulator_remove(struct platform_device *pdev) 596 596 { 597 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 600 int i; 600 601 601 602 platform_set_drvdata(pdev, NULL);