Skip to contentSkip to conversation

w1: gpio: fix problem with platfom data in w1-gpio

PATCH In review Pawel Dembicki 3 participants 8 messages Feb 18, 2018 – Apr 4, 2018 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 w1: gpio: fix problem with platfom data in w1-gpio

In devices, where fdt is used, is impossible to apply platform data without proper fdt node.

This patch allow to use platform data in devices with fdt.

---
 drivers/w1/masters/w1-gpio.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/w1/masters/w1-gpio.c +3 -4
index a90728ceec5a..7b80762941af 100644
@@ -112,17 +112,16 @@ static int w1_gpio_probe_dt(struct platform_device *pdev)
 static int w1_gpio_probe(struct platform_device *pdev)
 {
 	struct w1_bus_master *master;
-	struct w1_gpio_platform_data *pdata;
+	struct w1_gpio_platform_data *pdata = dev_get_platdata(&pdev->dev);
 	int err;
 
-	if (of_have_populated_dt()) {
+	if (of_have_populated_dt() && !pdata) {
 		err = w1_gpio_probe_dt(pdev);
 		if (err < 0)
 			return err;
+		pdata = dev_get_platdata(&pdev->dev);
 	}
 
-	pdata = dev_get_platdata(&pdev->dev);
-
 	if (!pdata) {
 		dev_err(&pdev->dev, "No configuration data\n");
 		return -ENXIO;
Signature · 1 line
2.14.1
Acked-by on v1 1/1
#2 lore raw
Quoted 7 lines · Pawel Dembicki

In devices, where fdt is used, is impossible to apply platform data without proper fdt node.

This patch allow to use platform data in devices with fdt.

---

Good catch,

Quoted 29 lines
 drivers/w1/masters/w1-gpio.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/w1/masters/w1-gpio.c +3 -4
index a90728ceec5a..7b80762941af 100644
@@ -112,17 +112,16 @@ static int w1_gpio_probe_dt(struct platform_device *pdev)
 static int w1_gpio_probe(struct platform_device *pdev)
 {
 	struct w1_bus_master *master;
-	struct w1_gpio_platform_data *pdata;
+	struct w1_gpio_platform_data *pdata = dev_get_platdata(&pdev->dev);
 	int err;
 
-	if (of_have_populated_dt()) {
+	if (of_have_populated_dt() && !pdata) {
 		err = w1_gpio_probe_dt(pdev);
 		if (err < 0)
 			return err;
+		pdata = dev_get_platdata(&pdev->dev);
 	}
 
-	pdata = dev_get_platdata(&pdev->dev);
-
 	if (!pdata) {
 		dev_err(&pdev->dev, "No configuration data\n");
 		return -ENXIO;
#3 lore raw
In reply to Pawel Dembicki
Quoted 10 lines · Pawel Dembicki

In devices, where fdt is used, is impossible to apply platform data without proper fdt node.

This patch allow to use platform data in devices with fdt.

---
 drivers/w1/masters/w1-gpio.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Patch does not apply at all to my tree :(

#4 lore raw

2018-03-14 14:59 GMT+01:00 Greg Kroah-Hartman <[email protected]>:

Quoted 2 lines

Patch does not apply at all to my tree :(

Patch works with stable kernels (e.g 4.9 and 4.14). On which tip You test?

#5 lore raw
Quoted 7 lines · Paweł Dembicki

2018-03-14 14:59 GMT+01:00 Greg Kroah-Hartman <[email protected]>:

Quoted 2 lines

Patch does not apply at all to my tree :(

Patch works with stable kernels (e.g 4.9 and 4.14). On which tip You test?

Where is this patch supposed to go? Is this a stable backport patch, or something to go into Linus's tree?

totally confused,

greg k-h

#6 lore raw

2018-03-17 12:55 GMT+01:00 Greg Kroah-Hartman <[email protected]>:

Quoted 2 lines

Where is this patch supposed to go? Is this a stable backport patch, or something to go into Linus's tree?

I tested it in 4.9 and 4.14 kernels in OpenERT. So it is a stable backport patch.

In current release this bug is fixed because w1-gpio use gpiod.

Quoted 3 lines

totally confused,

Sorry. This was my first patch.

Quoted 1 line

greg k-h

Signature · 1 line
Pawel Dembicki
#7 lore raw
Quoted 7 lines · Paweł Dembicki

2018-03-17 12:55 GMT+01:00 Greg Kroah-Hartman <[email protected]>:

Quoted 2 lines

Where is this patch supposed to go? Is this a stable backport patch, or something to go into Linus's tree?

I tested it in 4.9 and 4.14 kernels in OpenERT. So it is a stable backport patch.

What commit is being backported.

Quoted 1 line

In current release this bug is fixed because w1-gpio use gpiod.

Then why can we not just use the actual patch that fixes this?

Quoted 1 line

Sorry. This was my first patch.

Please read:
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to submit a patch for the stable tree.

thanks,

greg k-h

#8 lore raw

2018-03-29 12:01 GMT+02:00 Greg Kroah-Hartman <[email protected]>:

Quoted 11 lines · Paweł Dembicki
Quoted 7 lines

2018-03-17 12:55 GMT+01:00 Greg Kroah-Hartman <[email protected]>:

Quoted 2 lines

Where is this patch supposed to go? Is this a stable backport patch, or something to go into Linus's tree?

I tested it in 4.9 and 4.14 kernels in OpenERT. So it is a stable backport patch.

What commit is being backported.

This commit resolve problem in mainline:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e0fc62a6552f3d9c21e73cc65844f9aad1892cf7

Quoted 3 lines
Quoted 1 line

In current release this bug is fixed because w1-gpio use gpiod.

Then why can we not just use the actual patch that fixes this?

I think, mainline commit is big change. My patch is answer for problem in stable kernels, which is resolved in mainline.

Quoted 10 lines
Quoted 2 lines

Sorry. This was my first patch.

Please read:
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to submit a patch for the stable tree.

thanks,

greg k-h

Pawel Dembicki