2018-02-18 17:20:51

by Pawel Dembicki

[permalink] [raw]
Subject: [PATCH] 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.

Signed-off-by: Pawel Dembicki <[email protected]>
---
drivers/w1/masters/w1-gpio.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/w1/masters/w1-gpio.c b/drivers/w1/masters/w1-gpio.c
index a90728ceec5a..7b80762941af 100644
--- a/drivers/w1/masters/w1-gpio.c
+++ b/drivers/w1/masters/w1-gpio.c
@@ -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;
--
2.14.1



2018-02-19 13:31:06

by Andrew Davis

[permalink] [raw]
Subject: Re: [PATCH] w1: gpio: fix problem with platfom data in w1-gpio

On 02/18/2018 11:19 AM, Pawel Dembicki wrote:
> 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.
>
> Signed-off-by: Pawel Dembicki <[email protected]>
> ---

Good catch,

Acked-by: Andrew F. Davis <[email protected]>

> drivers/w1/masters/w1-gpio.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/w1/masters/w1-gpio.c b/drivers/w1/masters/w1-gpio.c
> index a90728ceec5a..7b80762941af 100644
> --- a/drivers/w1/masters/w1-gpio.c
> +++ b/drivers/w1/masters/w1-gpio.c
> @@ -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;
>

2018-03-14 14:01:04

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] w1: gpio: fix problem with platfom data in w1-gpio

On Sun, Feb 18, 2018 at 06:19:26PM +0100, Pawel Dembicki wrote:
> 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.
>
> Signed-off-by: Pawel Dembicki <[email protected]>
> Acked-by: Andrew F. Davis <[email protected]>
> ---
> drivers/w1/masters/w1-gpio.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)

Patch does not apply at all to my tree :(

2018-03-17 10:40:46

by Pawel Dembicki

[permalink] [raw]
Subject: Re: [PATCH] w1: gpio: fix problem with platfom data in w1-gpio

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

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

2018-03-17 11:57:09

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] w1: gpio: fix problem with platfom data in w1-gpio

On Sat, Mar 17, 2018 at 11:39:11AM +0100, Paweł Dembicki wrote:
> 2018-03-14 14:59 GMT+01:00 Greg Kroah-Hartman <[email protected]>:
>
> >
> > 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

2018-03-29 09:50:14

by Pawel Dembicki

[permalink] [raw]
Subject: Re: [PATCH] w1: gpio: fix problem with platfom data in w1-gpio

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

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

>
> totally confused,
>

Sorry. This was my first patch.

> greg k-h

--
Pawel Dembicki

2018-03-29 10:03:11

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] w1: gpio: fix problem with platfom data in w1-gpio

On Thu, Mar 29, 2018 at 11:47:25AM +0200, Paweł Dembicki wrote:
> 2018-03-17 12:55 GMT+01:00 Greg Kroah-Hartman <[email protected]>:
>
> > 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.

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

> 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

2018-04-04 16:45:57

by Pawel Dembicki

[permalink] [raw]
Subject: Re: [PATCH] w1: gpio: fix problem with platfom data in w1-gpio

2018-03-29 12:01 GMT+02:00 Greg Kroah-Hartman <[email protected]>:
> On Thu, Mar 29, 2018 at 11:47:25AM +0200, Paweł Dembicki wrote:
>> 2018-03-17 12:55 GMT+01:00 Greg Kroah-Hartman <[email protected]>:
>>
>> > 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

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


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