Skip to contentSkip to conversation

mfd: mc13xxx: Do not use platform data with devicetree

PATCH Applied Alexander Shiyan 3 participants 7 messages May 1, 2014 – May 9, 2014 Multifunction devices (MFD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 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.

---
 drivers/mfd/mc13xxx-core.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
drivers/mfd/mc13xxx-core.c +10 -8
index 06e64b6..2ed22d7 100644
@@ -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;
Signature · 1 line
1.8.3.2
Applied
#1 lore raw
Quoted 9 lines

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.

---
 drivers/mfd/mc13xxx-core.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

Applied, thanks.

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#2 lore raw

Fri, 9 May 2014 12:30:30 +0100 от Lee Jones <[email protected]>:

Quoted 11 lines
Quoted 9 lines

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.

---
 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.

---

#3 lore raw
Quoted 11 lines · Alexander Shiyan

Fri, 9 May 2014 12:30:30 +0100 от Lee Jones <[email protected]>:

Quoted 10 lines
Quoted 9 lines

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.

---
 drivers/mfd/mc13xxx-core.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
Quoted 7 lines
Quoted 1 line

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.

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#4 lore raw
Quoted 5 lines · Lee Jones

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.

#5 lore raw
Quoted 8 lines
Quoted 5 lines

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.

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#6 lore raw
Quoted 4 lines · Lee Jones
Quoted 2 lines

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...