diff mbox

[1/2] mfd: mc13xxx: Do not use platform data with devicetree

Message ID 1398926883-21778-1-git-send-email-shc_work@mail.ru (mailing list archive)
State New, archived
Headers show

Commit Message

Alexander Shiyan May 1, 2014, 6:48 a.m. UTC
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>
---
 drivers/mfd/mc13xxx-core.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

Comments

Lee Jones May 9, 2014, 11:30 a.m. UTC | #1
> 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>
> ---
>  drivers/mfd/mc13xxx-core.c | 18 ++++++++++--------
>  1 file changed, 10 insertions(+), 8 deletions(-)

Applied, thanks.
Lee Jones May 9, 2014, 2:18 p.m. UTC | #2
On Fri, 09 May 2014, Alexander Shiyan wrote:

> Fri, 9 May 2014 12:30:30 +0100 ?? Lee Jones <lee.jones@linaro.org>:
> > > 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>
> > > ---
> > >  drivers/mfd/mc13xxx-core.c | 18 ++++++++++--------
> > >  1 file changed, 10 insertions(+), 8 deletions(-)
> > 
> > Applied, thanks.
> 
> This patch has been written as a way to separate MFD and ASoC changes of
> the patch: (ASoC: mc13783: Add devicetree support)
> https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/commit/?id=780aaeff96819ca58e0cad830bfbe6eee9aef82c
> 
> So, it should produce conflict.

Exactly.

Mark,

You need to revert (or remove) the original one and apply:

  "ASoC: mc13783: Add devicetree support"

... instead.
Mark Brown May 9, 2014, 2:30 p.m. UTC | #3
On Fri, May 09, 2014 at 03:18:40PM +0100, Lee Jones wrote:

> You need to revert (or remove) the original one and apply:

>   "ASoC: mc13783: Add devicetree support"

> ... instead.

Why not just pull the tag instead?  I haven't looked at the patch but
don't they need to go in together anyway.
Lee Jones May 9, 2014, 2:36 p.m. UTC | #4
> > You need to revert (or remove) the original one and apply:
> 
> >   "ASoC: mc13783: Add devicetree support"
> 
> > ... instead.
> 
> Why not just pull the tag instead?  I haven't looked at the patch but
> don't they need to go in together anyway.

Only functionally.  They are orthogonally buildable apparently.
Mark Brown May 9, 2014, 2:48 p.m. UTC | #5
On Fri, May 09, 2014 at 03:36:29PM +0100, Lee Jones wrote:

> > Why not just pull the tag instead?  I haven't looked at the patch but
> > don't they need to go in together anyway.

> Only functionally.  They are orthogonally buildable apparently.

Working code seems important to bisection too...
diff mbox

Patch

diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
index 06e64b6..2ed22d7 100644
--- a/drivers/mfd/mc13xxx-core.c
+++ b/drivers/mfd/mc13xxx-core.c
@@ -673,17 +673,9 @@  int mc13xxx_common_init(struct device *dev)
 	if (mc13xxx->flags & MC13XXX_USE_ADC)
 		mc13xxx_add_subdevice(mc13xxx, "%s-adc");
 
-	if (mc13xxx->flags & MC13XXX_USE_CODEC)
-		mc13xxx_add_subdevice_pdata(mc13xxx, "%s-codec",
-					pdata->codec, sizeof(*pdata->codec));
-
 	if (mc13xxx->flags & MC13XXX_USE_RTC)
 		mc13xxx_add_subdevice(mc13xxx, "%s-rtc");
 
-	if (mc13xxx->flags & MC13XXX_USE_TOUCHSCREEN)
-		mc13xxx_add_subdevice_pdata(mc13xxx, "%s-ts",
-				&pdata->touch, sizeof(pdata->touch));
-
 	if (pdata) {
 		mc13xxx_add_subdevice_pdata(mc13xxx, "%s-regulator",
 			&pdata->regulators, sizeof(pdata->regulators));
@@ -691,10 +683,20 @@  int mc13xxx_common_init(struct device *dev)
 				pdata->leds, sizeof(*pdata->leds));
 		mc13xxx_add_subdevice_pdata(mc13xxx, "%s-pwrbutton",
 				pdata->buttons, sizeof(*pdata->buttons));
+		if (mc13xxx->flags & MC13XXX_USE_CODEC)
+			mc13xxx_add_subdevice_pdata(mc13xxx, "%s-codec",
+				pdata->codec, sizeof(*pdata->codec));
+		if (mc13xxx->flags & MC13XXX_USE_TOUCHSCREEN)
+			mc13xxx_add_subdevice_pdata(mc13xxx, "%s-ts",
+				&pdata->touch, sizeof(pdata->touch));
 	} else {
 		mc13xxx_add_subdevice(mc13xxx, "%s-regulator");
 		mc13xxx_add_subdevice(mc13xxx, "%s-led");
 		mc13xxx_add_subdevice(mc13xxx, "%s-pwrbutton");
+		if (mc13xxx->flags & MC13XXX_USE_CODEC)
+			mc13xxx_add_subdevice(mc13xxx, "%s-codec");
+		if (mc13xxx->flags & MC13XXX_USE_TOUCHSCREEN)
+			mc13xxx_add_subdevice(mc13xxx, "%s-ts");
 	}
 
 	return 0;