diff options
author | Haojian Zhuang <haojian.zhuang@marvell.com> | 2011-05-06 05:21:21 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2011-05-26 13:45:35 -0400 |
commit | f5fb758de6d2ddae572ee39de54d60bf5593652a (patch) | |
tree | 21c42e354ff454b0c528c1884a8c3297b0a30697 /drivers/mfd | |
parent | 008b30408c40ede5985397e7daac45d30b375a01 (diff) |
mfd: Avoid to allocate 88pm860x static platform data
Maybe multiple PMIC devices are installed into one board. Static variable
can only make driver logic mess. So remove these variable, and use
platform data from platform driver instead.
Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd')
-rw-r--r-- | drivers/mfd/88pm860x-core.c | 45 |
1 files changed, 16 insertions, 29 deletions
diff --git a/drivers/mfd/88pm860x-core.c b/drivers/mfd/88pm860x-core.c index f2cac9287756..04ab50c1a6d4 100644 --- a/drivers/mfd/88pm860x-core.c +++ b/drivers/mfd/88pm860x-core.c | |||
@@ -151,11 +151,6 @@ static struct mfd_cell rtc_devs[] = { | |||
151 | {"88pm860x-rtc", -1,}, | 151 | {"88pm860x-rtc", -1,}, |
152 | }; | 152 | }; |
153 | 153 | ||
154 | static struct pm860x_backlight_pdata bk_pdata[ARRAY_SIZE(bk_devs)]; | ||
155 | static struct pm860x_led_pdata led_pdata[ARRAY_SIZE(led_devs)]; | ||
156 | static struct regulator_init_data regulator_pdata[ARRAY_SIZE(regulator_devs)]; | ||
157 | static struct pm860x_touch_pdata touch_pdata; | ||
158 | static struct pm860x_power_pdata power_pdata; | ||
159 | 154 | ||
160 | struct pm860x_irq_data { | 155 | struct pm860x_irq_data { |
161 | int reg; | 156 | int reg; |
@@ -522,14 +517,12 @@ static void __devinit device_bk_init(struct pm860x_chip *chip, | |||
522 | pdata->num_backlights = ARRAY_SIZE(bk_devs); | 517 | pdata->num_backlights = ARRAY_SIZE(bk_devs); |
523 | 518 | ||
524 | for (i = 0; i < pdata->num_backlights; i++) { | 519 | for (i = 0; i < pdata->num_backlights; i++) { |
525 | memcpy(&bk_pdata[i], &pdata->backlight[i], | 520 | bk_devs[i].platform_data = &pdata->backlight[i]; |
526 | sizeof(struct pm860x_backlight_pdata)); | 521 | bk_devs[i].pdata_size = sizeof(struct pm860x_backlight_pdata); |
527 | bk_devs[i].platform_data = &bk_pdata[i]; | ||
528 | bk_devs[i].pdata_size = sizeof(bk_pdata[i]); | ||
529 | 522 | ||
530 | for (j = 0; j < ARRAY_SIZE(bk_devs); j++) { | 523 | for (j = 0; j < ARRAY_SIZE(bk_devs); j++) { |
531 | id = bk_resources[j].start; | 524 | id = bk_resources[j].start; |
532 | if (bk_pdata[i].flags != id) | 525 | if (pdata->backlight[i].flags != id) |
533 | continue; | 526 | continue; |
534 | 527 | ||
535 | bk_devs[i].num_resources = 1; | 528 | bk_devs[i].num_resources = 1; |
@@ -560,14 +553,12 @@ static void __devinit device_led_init(struct pm860x_chip *chip, | |||
560 | pdata->num_leds = ARRAY_SIZE(led_devs); | 553 | pdata->num_leds = ARRAY_SIZE(led_devs); |
561 | 554 | ||
562 | for (i = 0; i < pdata->num_leds; i++) { | 555 | for (i = 0; i < pdata->num_leds; i++) { |
563 | memcpy(&led_pdata[i], &pdata->led[i], | 556 | led_devs[i].platform_data = &pdata->led[i]; |
564 | sizeof(struct pm860x_led_pdata)); | 557 | led_devs[i].pdata_size = sizeof(struct pm860x_led_pdata); |
565 | led_devs[i].platform_data = &led_pdata[i]; | ||
566 | led_devs[i].pdata_size = sizeof(led_pdata[i]); | ||
567 | 558 | ||
568 | for (j = 0; j < ARRAY_SIZE(led_devs); j++) { | 559 | for (j = 0; j < ARRAY_SIZE(led_devs); j++) { |
569 | id = led_resources[j].start; | 560 | id = led_resources[j].start; |
570 | if (led_pdata[i].flags != id) | 561 | if (pdata->led[i].flags != id) |
571 | continue; | 562 | continue; |
572 | 563 | ||
573 | led_devs[i].num_resources = 1; | 564 | led_devs[i].num_resources = 1; |
@@ -625,10 +616,8 @@ static void __devinit device_regulator_init(struct pm860x_chip *chip, | |||
625 | initdata->constraints.name); | 616 | initdata->constraints.name); |
626 | goto out; | 617 | goto out; |
627 | } | 618 | } |
628 | memcpy(®ulator_pdata[i], &pdata->regulator[i], | 619 | regulator_devs[i].platform_data = &pdata->regulator[i]; |
629 | sizeof(struct regulator_init_data)); | 620 | regulator_devs[i].pdata_size = sizeof(struct regulator_init_data); |
630 | regulator_devs[i].platform_data = ®ulator_pdata[i]; | ||
631 | regulator_devs[i].pdata_size = sizeof(regulator_pdata[i]); | ||
632 | regulator_devs[i].num_resources = 1; | 621 | regulator_devs[i].num_resources = 1; |
633 | regulator_devs[i].resources = ®ulator_resources[j]; | 622 | regulator_devs[i].resources = ®ulator_resources[j]; |
634 | 623 | ||
@@ -669,12 +658,11 @@ static void __devinit device_touch_init(struct pm860x_chip *chip, | |||
669 | { | 658 | { |
670 | int ret; | 659 | int ret; |
671 | 660 | ||
672 | if ((pdata == NULL) || (pdata->touch == NULL)) | 661 | if (pdata == NULL) |
673 | return; | 662 | return; |
674 | 663 | ||
675 | memcpy(&touch_pdata, pdata->touch, sizeof(struct pm860x_touch_pdata)); | 664 | touch_devs[0].platform_data = pdata->touch; |
676 | touch_devs[0].platform_data = &touch_pdata; | 665 | touch_devs[0].pdata_size = sizeof(struct pm860x_touch_pdata); |
677 | touch_devs[0].pdata_size = sizeof(touch_pdata); | ||
678 | touch_devs[0].num_resources = ARRAY_SIZE(touch_resources); | 666 | touch_devs[0].num_resources = ARRAY_SIZE(touch_resources); |
679 | touch_devs[0].resources = &touch_resources[0]; | 667 | touch_devs[0].resources = &touch_resources[0]; |
680 | ret = mfd_add_devices(chip->dev, 0, &touch_devs[0], | 668 | ret = mfd_add_devices(chip->dev, 0, &touch_devs[0], |
@@ -690,12 +678,11 @@ static void __devinit device_power_init(struct pm860x_chip *chip, | |||
690 | { | 678 | { |
691 | int ret; | 679 | int ret; |
692 | 680 | ||
693 | if ((pdata == NULL) || (pdata->power == NULL)) | 681 | if (pdata == NULL) |
694 | return; | 682 | return; |
695 | 683 | ||
696 | memcpy(&power_pdata, pdata->power, sizeof(struct pm860x_power_pdata)); | 684 | power_devs[0].platform_data = pdata->power; |
697 | power_devs[0].platform_data = &power_pdata; | 685 | power_devs[0].pdata_size = sizeof(struct pm860x_power_pdata); |
698 | power_devs[0].pdata_size = sizeof(power_pdata); | ||
699 | power_devs[0].num_resources = ARRAY_SIZE(battery_resources); | 686 | power_devs[0].num_resources = ARRAY_SIZE(battery_resources); |
700 | power_devs[0].resources = &battery_resources[0], | 687 | power_devs[0].resources = &battery_resources[0], |
701 | ret = mfd_add_devices(chip->dev, 0, &power_devs[0], 1, | 688 | ret = mfd_add_devices(chip->dev, 0, &power_devs[0], 1, |
@@ -703,8 +690,8 @@ static void __devinit device_power_init(struct pm860x_chip *chip, | |||
703 | if (ret < 0) | 690 | if (ret < 0) |
704 | dev_err(chip->dev, "Failed to add battery subdev\n"); | 691 | dev_err(chip->dev, "Failed to add battery subdev\n"); |
705 | 692 | ||
706 | power_devs[1].platform_data = &power_pdata; | 693 | power_devs[1].platform_data = pdata->power; |
707 | power_devs[0].pdata_size = sizeof(power_pdata); | 694 | power_devs[1].pdata_size = sizeof(struct pm860x_power_pdata); |
708 | power_devs[1].num_resources = ARRAY_SIZE(charger_resources); | 695 | power_devs[1].num_resources = ARRAY_SIZE(charger_resources); |
709 | power_devs[1].resources = &charger_resources[0], | 696 | power_devs[1].resources = &charger_resources[0], |
710 | ret = mfd_add_devices(chip->dev, 0, &power_devs[1], 1, | 697 | ret = mfd_add_devices(chip->dev, 0, &power_devs[1], 1, |