diff options
author | Andres Salomon <dilinger@queued.net> | 2011-02-17 22:07:23 -0500 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2011-03-23 05:41:54 -0400 |
commit | 4ec1b54c4d082d4bad19b55ca709da7e7138d542 (patch) | |
tree | c17db1ae92212ed1269d66965a0eaba583f1cd21 | |
parent | 8615e4cba1d3a0f15b9a4da9f32f8fbc3488fa54 (diff) |
mfd: mfd_cell is now implicitly available to mc13xxx drivers
The cell's platform_data is now accessed with a helper function;
change clients to use that, and remove the now-unused data_size.
Note that mfd-core no longer makes a copy of platform_data, but the
mc13xxx-core driver creates the pdata structures on the stack. In
order to get around that, the various ARM mach types that set the
pdata have been changed to hold the variable in static (global) memory.
Also note that __initdata references in aforementioned pdata structs
have been dropped.
Signed-off-by: Andres Salomon <dilinger@queued.net>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r-- | arch/arm/mach-imx/mach-mx27_3ds.c | 11 | ||||
-rw-r--r-- | arch/arm/mach-imx/mach-pcm038.c | 10 | ||||
-rw-r--r-- | arch/arm/mach-mx3/mach-mx31_3ds.c | 10 | ||||
-rw-r--r-- | arch/arm/mach-mx3/mach-mx31moboard.c | 6 | ||||
-rw-r--r-- | drivers/leds/leds-mc13783.c | 7 | ||||
-rw-r--r-- | drivers/mfd/mc13xxx-core.c | 18 | ||||
-rw-r--r-- | drivers/regulator/mc13783-regulator.c | 7 | ||||
-rw-r--r-- | drivers/regulator/mc13892-regulator.c | 7 | ||||
-rw-r--r-- | include/linux/mfd/mc13xxx.h | 3 |
9 files changed, 39 insertions, 40 deletions
diff --git a/arch/arm/mach-imx/mach-mx27_3ds.c b/arch/arm/mach-imx/mach-mx27_3ds.c index 614b3c00c4a0..6e1accf93f81 100644 --- a/arch/arm/mach-imx/mach-mx27_3ds.c +++ b/arch/arm/mach-imx/mach-mx27_3ds.c | |||
@@ -232,10 +232,13 @@ static struct mc13xxx_regulator_init_data mx27_3ds_regulators[] = { | |||
232 | }; | 232 | }; |
233 | 233 | ||
234 | /* MC13783 */ | 234 | /* MC13783 */ |
235 | static struct mc13xxx_platform_data mc13783_pdata __initdata = { | 235 | static struct mc13xxx_platform_data mc13783_pdata = { |
236 | .regulators = mx27_3ds_regulators, | 236 | .regulators = { |
237 | .num_regulators = ARRAY_SIZE(mx27_3ds_regulators), | 237 | .regulators = mx27_3ds_regulators, |
238 | .flags = MC13XXX_USE_REGULATOR, | 238 | .num_regulators = ARRAY_SIZE(mx27_3ds_regulators), |
239 | |||
240 | }, | ||
241 | .flags = MC13783_USE_REGULATOR, | ||
239 | }; | 242 | }; |
240 | 243 | ||
241 | /* SPI */ | 244 | /* SPI */ |
diff --git a/arch/arm/mach-imx/mach-pcm038.c b/arch/arm/mach-imx/mach-pcm038.c index 38c77084b615..4cbce6d0fef1 100644 --- a/arch/arm/mach-imx/mach-pcm038.c +++ b/arch/arm/mach-imx/mach-pcm038.c | |||
@@ -263,10 +263,12 @@ static struct mc13xxx_regulator_init_data pcm038_regulators[] = { | |||
263 | }; | 263 | }; |
264 | 264 | ||
265 | static struct mc13xxx_platform_data pcm038_pmic = { | 265 | static struct mc13xxx_platform_data pcm038_pmic = { |
266 | .regulators = pcm038_regulators, | 266 | .regulators = { |
267 | .num_regulators = ARRAY_SIZE(pcm038_regulators), | 267 | .regulators = pcm038_regulators, |
268 | .flags = MC13XXX_USE_ADC | MC13XXX_USE_REGULATOR | | 268 | .num_regulators = ARRAY_SIZE(pcm038_regulators), |
269 | MC13XXX_USE_TOUCHSCREEN, | 269 | }, |
270 | .flags = MC13783_USE_ADC | MC13783_USE_REGULATOR | | ||
271 | MC13783_USE_TOUCHSCREEN, | ||
270 | }; | 272 | }; |
271 | 273 | ||
272 | static struct spi_board_info pcm038_spi_board_info[] __initdata = { | 274 | static struct spi_board_info pcm038_spi_board_info[] __initdata = { |
diff --git a/arch/arm/mach-mx3/mach-mx31_3ds.c b/arch/arm/mach-mx3/mach-mx31_3ds.c index 544d3e414f58..034be624d35c 100644 --- a/arch/arm/mach-mx3/mach-mx31_3ds.c +++ b/arch/arm/mach-mx3/mach-mx31_3ds.c | |||
@@ -488,10 +488,12 @@ static struct mc13xxx_regulator_init_data mx31_3ds_regulators[] = { | |||
488 | }; | 488 | }; |
489 | 489 | ||
490 | /* MC13783 */ | 490 | /* MC13783 */ |
491 | static struct mc13xxx_platform_data mc13783_pdata __initdata = { | 491 | static struct mc13xxx_platform_data mc13783_pdata = { |
492 | .regulators = mx31_3ds_regulators, | 492 | .regulators = { |
493 | .num_regulators = ARRAY_SIZE(mx31_3ds_regulators), | 493 | .regulators = mx31_3ds_regulators, |
494 | .flags = MC13XXX_USE_REGULATOR | MC13XXX_USE_TOUCHSCREEN | 494 | .num_regulators = ARRAY_SIZE(mx31_3ds_regulators), |
495 | }, | ||
496 | .flags = MC13783_USE_REGULATOR | MC13783_USE_TOUCHSCREEN, | ||
495 | }; | 497 | }; |
496 | 498 | ||
497 | /* SPI */ | 499 | /* SPI */ |
diff --git a/arch/arm/mach-mx3/mach-mx31moboard.c b/arch/arm/mach-mx3/mach-mx31moboard.c index 6f3692bccb8a..3a021b01161d 100644 --- a/arch/arm/mach-mx3/mach-mx31moboard.c +++ b/arch/arm/mach-mx3/mach-mx31moboard.c | |||
@@ -268,8 +268,10 @@ static struct mc13783_leds_platform_data moboard_leds = { | |||
268 | }; | 268 | }; |
269 | 269 | ||
270 | static struct mc13xxx_platform_data moboard_pmic = { | 270 | static struct mc13xxx_platform_data moboard_pmic = { |
271 | .regulators = moboard_regulators, | 271 | .regulators = { |
272 | .num_regulators = ARRAY_SIZE(moboard_regulators), | 272 | .regulators = moboard_regulators, |
273 | .num_regulators = ARRAY_SIZE(moboard_regulators), | ||
274 | }, | ||
273 | .leds = &moboard_leds, | 275 | .leds = &moboard_leds, |
274 | .flags = MC13XXX_USE_REGULATOR | MC13XXX_USE_RTC | | 276 | .flags = MC13XXX_USE_REGULATOR | MC13XXX_USE_RTC | |
275 | MC13XXX_USE_ADC | MC13XXX_USE_LED, | 277 | MC13XXX_USE_ADC | MC13XXX_USE_LED, |
diff --git a/drivers/leds/leds-mc13783.c b/drivers/leds/leds-mc13783.c index f05bb08d0f09..06a5bb484707 100644 --- a/drivers/leds/leds-mc13783.c +++ b/drivers/leds/leds-mc13783.c | |||
@@ -22,6 +22,7 @@ | |||
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> | ||
25 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
26 | 27 | ||
27 | struct mc13783_led { | 28 | struct mc13783_led { |
@@ -183,7 +184,7 @@ static int __devinit mc13783_led_setup(struct mc13783_led *led, int max_current) | |||
183 | 184 | ||
184 | static int __devinit mc13783_leds_prepare(struct platform_device *pdev) | 185 | static int __devinit mc13783_leds_prepare(struct platform_device *pdev) |
185 | { | 186 | { |
186 | struct mc13783_leds_platform_data *pdata = dev_get_platdata(&pdev->dev); | 187 | struct mc13783_leds_platform_data *pdata = mfd_get_data(pdev); |
187 | struct mc13783 *dev = dev_get_drvdata(pdev->dev.parent); | 188 | struct mc13783 *dev = dev_get_drvdata(pdev->dev.parent); |
188 | int ret = 0; | 189 | int ret = 0; |
189 | int reg = 0; | 190 | int reg = 0; |
@@ -264,7 +265,7 @@ out: | |||
264 | 265 | ||
265 | static int __devinit mc13783_led_probe(struct platform_device *pdev) | 266 | static int __devinit mc13783_led_probe(struct platform_device *pdev) |
266 | { | 267 | { |
267 | struct mc13783_leds_platform_data *pdata = dev_get_platdata(&pdev->dev); | 268 | struct mc13783_leds_platform_data *pdata = mfd_get_data(pdev); |
268 | struct mc13783_led_platform_data *led_cur; | 269 | struct mc13783_led_platform_data *led_cur; |
269 | struct mc13783_led *led, *led_dat; | 270 | struct mc13783_led *led, *led_dat; |
270 | int ret, i; | 271 | int ret, i; |
@@ -351,7 +352,7 @@ err_free: | |||
351 | 352 | ||
352 | static int __devexit mc13783_led_remove(struct platform_device *pdev) | 353 | static int __devexit mc13783_led_remove(struct platform_device *pdev) |
353 | { | 354 | { |
354 | struct mc13783_leds_platform_data *pdata = dev_get_platdata(&pdev->dev); | 355 | struct mc13783_leds_platform_data *pdata = mfd_get_data(pdev); |
355 | struct mc13783_led *led = platform_get_drvdata(pdev); | 356 | struct mc13783_led *led = platform_get_drvdata(pdev); |
356 | struct mc13783 *dev = dev_get_drvdata(pdev->dev.parent); | 357 | struct mc13783 *dev = dev_get_drvdata(pdev->dev.parent); |
357 | int i; | 358 | int i; |
diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c index b9fcaf0004da..30807d3a6539 100644 --- a/drivers/mfd/mc13xxx-core.c +++ b/drivers/mfd/mc13xxx-core.c | |||
@@ -683,14 +683,13 @@ out: | |||
683 | EXPORT_SYMBOL_GPL(mc13783_adc_do_conversion); | 683 | EXPORT_SYMBOL_GPL(mc13783_adc_do_conversion); |
684 | 684 | ||
685 | static int mc13xxx_add_subdevice_pdata(struct mc13xxx *mc13xxx, | 685 | static int mc13xxx_add_subdevice_pdata(struct mc13xxx *mc13xxx, |
686 | const char *format, void *pdata, size_t pdata_size) | 686 | const char *format, void *pdata) |
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 | .platform_data = pdata, | 692 | .platform_data = pdata, |
693 | .data_size = pdata_size, | ||
694 | }; | 693 | }; |
695 | 694 | ||
696 | /* there is no asnprintf in the kernel :-( */ | 695 | /* there is no asnprintf in the kernel :-( */ |
@@ -706,7 +705,7 @@ static int mc13xxx_add_subdevice_pdata(struct mc13xxx *mc13xxx, | |||
706 | 705 | ||
707 | static int mc13xxx_add_subdevice(struct mc13xxx *mc13xxx, const char *format) | 706 | static int mc13xxx_add_subdevice(struct mc13xxx *mc13xxx, const char *format) |
708 | { | 707 | { |
709 | return mc13xxx_add_subdevice_pdata(mc13xxx, format, NULL, 0); | 708 | return mc13xxx_add_subdevice_pdata(mc13xxx, format, NULL); |
710 | } | 709 | } |
711 | 710 | ||
712 | static int mc13xxx_probe(struct spi_device *spi) | 711 | static int mc13xxx_probe(struct spi_device *spi) |
@@ -764,13 +763,8 @@ err_revision: | |||
764 | mc13xxx_add_subdevice(mc13xxx, "%s-codec"); | 763 | mc13xxx_add_subdevice(mc13xxx, "%s-codec"); |
765 | 764 | ||
766 | if (pdata->flags & MC13XXX_USE_REGULATOR) { | 765 | if (pdata->flags & MC13XXX_USE_REGULATOR) { |
767 | struct mc13xxx_regulator_platform_data regulator_pdata = { | ||
768 | .num_regulators = pdata->num_regulators, | ||
769 | .regulators = pdata->regulators, | ||
770 | }; | ||
771 | |||
772 | mc13xxx_add_subdevice_pdata(mc13xxx, "%s-regulator", | 766 | mc13xxx_add_subdevice_pdata(mc13xxx, "%s-regulator", |
773 | ®ulator_pdata, sizeof(regulator_pdata)); | 767 | &pdata->regulators); |
774 | } | 768 | } |
775 | 769 | ||
776 | if (pdata->flags & MC13XXX_USE_RTC) | 770 | if (pdata->flags & MC13XXX_USE_RTC) |
@@ -779,10 +773,8 @@ err_revision: | |||
779 | if (pdata->flags & MC13XXX_USE_TOUCHSCREEN) | 773 | if (pdata->flags & MC13XXX_USE_TOUCHSCREEN) |
780 | mc13xxx_add_subdevice(mc13xxx, "%s-ts"); | 774 | mc13xxx_add_subdevice(mc13xxx, "%s-ts"); |
781 | 775 | ||
782 | if (pdata->flags & MC13XXX_USE_LED) { | 776 | if (pdata->flags & MC13XXX_USE_LED) |
783 | mc13xxx_add_subdevice_pdata(mc13xxx, "%s-led", | 777 | mc13xxx_add_subdevice_pdata(mc13xxx, "%s-led", pdata->leds); |
784 | pdata->leds, sizeof(*pdata->leds)); | ||
785 | } | ||
786 | 778 | ||
787 | return 0; | 779 | return 0; |
788 | } | 780 | } |
diff --git a/drivers/regulator/mc13783-regulator.c b/drivers/regulator/mc13783-regulator.c index 3e5d0c3b4e53..23249cb0a8bd 100644 --- a/drivers/regulator/mc13783-regulator.c +++ b/drivers/regulator/mc13783-regulator.c | |||
@@ -15,6 +15,7 @@ | |||
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> | ||
18 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
19 | #include <linux/init.h> | 20 | #include <linux/init.h> |
20 | #include <linux/err.h> | 21 | #include <linux/err.h> |
@@ -336,8 +337,7 @@ static int __devinit mc13783_regulator_probe(struct platform_device *pdev) | |||
336 | { | 337 | { |
337 | struct mc13xxx_regulator_priv *priv; | 338 | struct mc13xxx_regulator_priv *priv; |
338 | struct mc13xxx *mc13783 = dev_get_drvdata(pdev->dev.parent); | 339 | struct mc13xxx *mc13783 = dev_get_drvdata(pdev->dev.parent); |
339 | struct mc13783_regulator_platform_data *pdata = | 340 | struct mc13783_regulator_platform_data *pdata = mfd_get_data(pdev); |
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,8 +381,7 @@ err: | |||
381 | static int __devexit mc13783_regulator_remove(struct platform_device *pdev) | 381 | static 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 = | 384 | struct mc13783_regulator_platform_data *pdata = mfd_get_data(pdev); |
385 | dev_get_platdata(&pdev->dev); | ||
386 | int i; | 385 | int i; |
387 | 386 | ||
388 | platform_set_drvdata(pdev, NULL); | 387 | platform_set_drvdata(pdev, NULL); |
diff --git a/drivers/regulator/mc13892-regulator.c b/drivers/regulator/mc13892-regulator.c index 1b8f7398a4a8..6f15168e5ed4 100644 --- a/drivers/regulator/mc13892-regulator.c +++ b/drivers/regulator/mc13892-regulator.c | |||
@@ -15,6 +15,7 @@ | |||
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> | ||
18 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
19 | #include <linux/init.h> | 20 | #include <linux/init.h> |
20 | #include <linux/err.h> | 21 | #include <linux/err.h> |
@@ -520,8 +521,7 @@ static int __devinit mc13892_regulator_probe(struct platform_device *pdev) | |||
520 | { | 521 | { |
521 | struct mc13xxx_regulator_priv *priv; | 522 | struct mc13xxx_regulator_priv *priv; |
522 | struct mc13xxx *mc13892 = dev_get_drvdata(pdev->dev.parent); | 523 | struct mc13xxx *mc13892 = dev_get_drvdata(pdev->dev.parent); |
523 | struct mc13xxx_regulator_platform_data *pdata = | 524 | struct mc13xxx_regulator_platform_data *pdata = mfd_get_data(pdev); |
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,8 +595,7 @@ err_free: | |||
595 | static int __devexit mc13892_regulator_remove(struct platform_device *pdev) | 595 | static 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 = | 598 | struct mc13xxx_regulator_platform_data *pdata = mfd_get_data(pdev); |
599 | dev_get_platdata(&pdev->dev); | ||
600 | int i; | 599 | int i; |
601 | 600 | ||
602 | platform_set_drvdata(pdev, NULL); | 601 | platform_set_drvdata(pdev, NULL); |
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h index a1d391b40e68..c064beaaccb7 100644 --- a/include/linux/mfd/mc13xxx.h +++ b/include/linux/mfd/mc13xxx.h | |||
@@ -146,8 +146,7 @@ struct mc13xxx_platform_data { | |||
146 | #define MC13XXX_USE_LED (1 << 5) | 146 | #define MC13XXX_USE_LED (1 << 5) |
147 | unsigned int flags; | 147 | unsigned int flags; |
148 | 148 | ||
149 | int num_regulators; | 149 | struct mc13xxx_regulator_platform_data regulators; |
150 | struct mc13xxx_regulator_init_data *regulators; | ||
151 | struct mc13xxx_leds_platform_data *leds; | 150 | struct mc13xxx_leds_platform_data *leds; |
152 | }; | 151 | }; |
153 | 152 | ||