aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/mc13xxx-core.c
diff options
context:
space:
mode:
authorAlexander Shiyan <shc_work@mail.ru>2014-05-01 02:48:03 -0400
committerLee Jones <lee.jones@linaro.org>2014-06-03 03:11:29 -0400
commita2ff8459f1f88283935e6bc3fb536820148c7d6a (patch)
treec57b60c95e1811df72403a39f4393525b47dd84e /drivers/mfd/mc13xxx-core.c
parentac8320c471e187d7fdc90f807199ff77c116a668 (diff)
mfd: mc13xxx: Do not use platform data with devicetree
This patch removes platform data usage for codec and touchscreen when driver is used with devicetree. This fixes possible "null pointer dereference" error if DTS uses "fsl,mc13xxx-uses-codec" or "fsl,mc13xxx-uses-touch" options. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd/mc13xxx-core.c')
-rw-r--r--drivers/mfd/mc13xxx-core.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
index ddabc8157eb0..acf5dd712eb2 100644
--- a/drivers/mfd/mc13xxx-core.c
+++ b/drivers/mfd/mc13xxx-core.c
@@ -673,21 +673,9 @@ int mc13xxx_common_init(struct device *dev)
673 if (mc13xxx->flags & MC13XXX_USE_ADC) 673 if (mc13xxx->flags & MC13XXX_USE_ADC)
674 mc13xxx_add_subdevice(mc13xxx, "%s-adc"); 674 mc13xxx_add_subdevice(mc13xxx, "%s-adc");
675 675
676 if (mc13xxx->flags & MC13XXX_USE_CODEC) {
677 if (pdata)
678 mc13xxx_add_subdevice_pdata(mc13xxx, "%s-codec",
679 pdata->codec, sizeof(*pdata->codec));
680 else
681 mc13xxx_add_subdevice(mc13xxx, "%s-codec");
682 }
683
684 if (mc13xxx->flags & MC13XXX_USE_RTC) 676 if (mc13xxx->flags & MC13XXX_USE_RTC)
685 mc13xxx_add_subdevice(mc13xxx, "%s-rtc"); 677 mc13xxx_add_subdevice(mc13xxx, "%s-rtc");
686 678
687 if (mc13xxx->flags & MC13XXX_USE_TOUCHSCREEN)
688 mc13xxx_add_subdevice_pdata(mc13xxx, "%s-ts",
689 &pdata->touch, sizeof(pdata->touch));
690
691 if (pdata) { 679 if (pdata) {
692 mc13xxx_add_subdevice_pdata(mc13xxx, "%s-regulator", 680 mc13xxx_add_subdevice_pdata(mc13xxx, "%s-regulator",
693 &pdata->regulators, sizeof(pdata->regulators)); 681 &pdata->regulators, sizeof(pdata->regulators));
@@ -695,10 +683,20 @@ int mc13xxx_common_init(struct device *dev)
695 pdata->leds, sizeof(*pdata->leds)); 683 pdata->leds, sizeof(*pdata->leds));
696 mc13xxx_add_subdevice_pdata(mc13xxx, "%s-pwrbutton", 684 mc13xxx_add_subdevice_pdata(mc13xxx, "%s-pwrbutton",
697 pdata->buttons, sizeof(*pdata->buttons)); 685 pdata->buttons, sizeof(*pdata->buttons));
686 if (mc13xxx->flags & MC13XXX_USE_CODEC)
687 mc13xxx_add_subdevice_pdata(mc13xxx, "%s-codec",
688 pdata->codec, sizeof(*pdata->codec));
689 if (mc13xxx->flags & MC13XXX_USE_TOUCHSCREEN)
690 mc13xxx_add_subdevice_pdata(mc13xxx, "%s-ts",
691 &pdata->touch, sizeof(pdata->touch));
698 } else { 692 } else {
699 mc13xxx_add_subdevice(mc13xxx, "%s-regulator"); 693 mc13xxx_add_subdevice(mc13xxx, "%s-regulator");
700 mc13xxx_add_subdevice(mc13xxx, "%s-led"); 694 mc13xxx_add_subdevice(mc13xxx, "%s-led");
701 mc13xxx_add_subdevice(mc13xxx, "%s-pwrbutton"); 695 mc13xxx_add_subdevice(mc13xxx, "%s-pwrbutton");
696 if (mc13xxx->flags & MC13XXX_USE_CODEC)
697 mc13xxx_add_subdevice(mc13xxx, "%s-codec");
698 if (mc13xxx->flags & MC13XXX_USE_TOUCHSCREEN)
699 mc13xxx_add_subdevice(mc13xxx, "%s-ts");
702 } 700 }
703 701
704 return 0; 702 return 0;