All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] i2c: return probe deferred status on dev_pm_domain_attach
@ 2015-10-12 19:49 Kieran Bingham
  2015-10-12 20:17 ` Dmitry Torokhov
  0 siblings, 1 reply; 3+ messages in thread
From: Kieran Bingham @ 2015-10-12 19:49 UTC (permalink / raw)
  To: wsa, linux-i2c, dmitry.torokhov; +Cc: linux-kernel, Kieran Bingham

A change of return status was introduced in commit 3fffd1283927
("i2c: allow specifying separate wakeup interrupt in device tree")

The commit prevents the defer status being passed up the call stack
appropriately when dev_pm_domain_attach returns -EPROBE_DEFER.

Catch the PROBE_DEFER and clear up the IRQ wakeup status

Signed-off-by: Kieran Bingham <kieranbingham@gmail.com>
Fixes: 3fffd1283927 ("i2c: allow specifying separate wakeup
interrupt in device tree")

---
V2:
 Fall through the error path before returning -EPROBE_DEFER

 drivers/i2c/i2c-core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 5f89f1e3c2f2..51f20cce1732 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -699,6 +699,8 @@ static int i2c_device_probe(struct device *dev)
 					client));
 		if (status)
 			goto err_detach_pm_domain;
+	} else {
+		goto err_clear_wakeup_irq;
 	}
 
 	return 0;
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] i2c: return probe deferred status on dev_pm_domain_attach
  2015-10-12 19:49 [PATCH v2] i2c: return probe deferred status on dev_pm_domain_attach Kieran Bingham
@ 2015-10-12 20:17 ` Dmitry Torokhov
  2015-10-12 20:50   ` Kieran Bingham
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Torokhov @ 2015-10-12 20:17 UTC (permalink / raw)
  To: Kieran Bingham; +Cc: Wolfram Sang, Linux I2C, lkml

On Mon, Oct 12, 2015 at 12:49 PM, Kieran Bingham
<kieranbingham@gmail.com> wrote:
> A change of return status was introduced in commit 3fffd1283927
> ("i2c: allow specifying separate wakeup interrupt in device tree")
>
> The commit prevents the defer status being passed up the call stack
> appropriately when dev_pm_domain_attach returns -EPROBE_DEFER.

Ah, indeed, sorry about that.

>
> Catch the PROBE_DEFER and clear up the IRQ wakeup status
>
> Signed-off-by: Kieran Bingham <kieranbingham@gmail.com>
> Fixes: 3fffd1283927 ("i2c: allow specifying separate wakeup
> interrupt in device tree")
>
> ---
> V2:
>  Fall through the error path before returning -EPROBE_DEFER
>
>  drivers/i2c/i2c-core.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
> index 5f89f1e3c2f2..51f20cce1732 100644
> --- a/drivers/i2c/i2c-core.c
> +++ b/drivers/i2c/i2c-core.c
> @@ -699,6 +699,8 @@ static int i2c_device_probe(struct device *dev)
>                                         client));
>                 if (status)
>                         goto err_detach_pm_domain;
> +       } else {
> +               goto err_clear_wakeup_irq;
>         }

How about we do:

        status = dev_pm_domain_attach(&client->dev, true);
        if (status == -EPROBE_DEFER)
                goto err_clear_wakeup_irq;

        status = driver->probe(client, i2c_match_id(driver->id_table, client));
        ....

instead of doing "else"?

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] i2c: return probe deferred status on dev_pm_domain_attach
  2015-10-12 20:17 ` Dmitry Torokhov
@ 2015-10-12 20:50   ` Kieran Bingham
  0 siblings, 0 replies; 3+ messages in thread
From: Kieran Bingham @ 2015-10-12 20:50 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Wolfram Sang, Linux I2C, lkml

On 12 October 2015 at 21:17, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:
> On Mon, Oct 12, 2015 at 12:49 PM, Kieran Bingham
> <kieranbingham@gmail.com> wrote:
>> A change of return status was introduced in commit 3fffd1283927
>> ("i2c: allow specifying separate wakeup interrupt in device tree")
>>
>> The commit prevents the defer status being passed up the call stack
>> appropriately when dev_pm_domain_attach returns -EPROBE_DEFER.
>
> Ah, indeed, sorry about that.
>
>>
>> Catch the PROBE_DEFER and clear up the IRQ wakeup status
>>
>> Signed-off-by: Kieran Bingham <kieranbingham@gmail.com>
>> Fixes: 3fffd1283927 ("i2c: allow specifying separate wakeup
>> interrupt in device tree")
>>
>> ---
>> V2:
>>  Fall through the error path before returning -EPROBE_DEFER
>>
>>  drivers/i2c/i2c-core.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
>> index 5f89f1e3c2f2..51f20cce1732 100644
>> --- a/drivers/i2c/i2c-core.c
>> +++ b/drivers/i2c/i2c-core.c
>> @@ -699,6 +699,8 @@ static int i2c_device_probe(struct device *dev)
>>                                         client));
>>                 if (status)
>>                         goto err_detach_pm_domain;
>> +       } else {
>> +               goto err_clear_wakeup_irq;
>>         }
>
> How about we do:
>
>         status = dev_pm_domain_attach(&client->dev, true);
>         if (status == -EPROBE_DEFER)
>                 goto err_clear_wakeup_irq;
>
>         status = driver->probe(client, i2c_match_id(driver->id_table, client));
>         ....
>
> instead of doing "else"?

Well in fact - this is actually what I do in the next set of patches
I'm working on which led me to find this fault.
 (i2c: Provide a temporary .probe2() call-back type)

And so ... v3 ... so much for my quick one word bugfix patch :)

I'll send v3 with the if/else removed

--
Kieran


>
> Thanks.
>
> --
> Dmitry

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-10-12 20:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-12 19:49 [PATCH v2] i2c: return probe deferred status on dev_pm_domain_attach Kieran Bingham
2015-10-12 20:17 ` Dmitry Torokhov
2015-10-12 20:50   ` Kieran Bingham

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.