linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] i2c: return probe deferred status on dev_pm_domain_attach
@ 2015-10-12 20:54 Kieran Bingham
  2015-10-12 21:01 ` Dmitry Torokhov
  2015-10-15 11:36 ` Wolfram Sang
  0 siblings, 2 replies; 3+ messages in thread
From: Kieran Bingham @ 2015-10-12 20:54 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

V3:
 Drop the if/else for cleaner code path

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

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 5f89f1e3c2f2..a59c3111f7fb 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -694,12 +694,12 @@ static int i2c_device_probe(struct device *dev)
 		goto err_clear_wakeup_irq;
 
 	status = dev_pm_domain_attach(&client->dev, true);
-	if (status != -EPROBE_DEFER) {
-		status = driver->probe(client, i2c_match_id(driver->id_table,
-					client));
-		if (status)
-			goto err_detach_pm_domain;
-	}
+	if (status == -EPROBE_DEFER)
+		goto err_clear_wakeup_irq;
+
+	status = driver->probe(client, i2c_match_id(driver->id_table, client));
+	if (status)
+		goto err_detach_pm_domain;
 
 	return 0;
 
-- 
2.1.4


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

* Re: [PATCH v3] i2c: return probe deferred status on dev_pm_domain_attach
  2015-10-12 20:54 [PATCH v3] i2c: return probe deferred status on dev_pm_domain_attach Kieran Bingham
@ 2015-10-12 21:01 ` Dmitry Torokhov
  2015-10-15 11:36 ` Wolfram Sang
  1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2015-10-12 21:01 UTC (permalink / raw)
  To: Kieran Bingham; +Cc: wsa, linux-i2c, linux-kernel

On Mon, Oct 12, 2015 at 09:54:43PM +0100, Kieran Bingham 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.
> 
> 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")

Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

> 
> ---
> V2:
>  Fall through the error path before returning -EPROBE_DEFER
> 
> V3:
>  Drop the if/else for cleaner code path
> 
>  drivers/i2c/i2c-core.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
> index 5f89f1e3c2f2..a59c3111f7fb 100644
> --- a/drivers/i2c/i2c-core.c
> +++ b/drivers/i2c/i2c-core.c
> @@ -694,12 +694,12 @@ static int i2c_device_probe(struct device *dev)
>  		goto err_clear_wakeup_irq;
>  
>  	status = dev_pm_domain_attach(&client->dev, true);
> -	if (status != -EPROBE_DEFER) {
> -		status = driver->probe(client, i2c_match_id(driver->id_table,
> -					client));
> -		if (status)
> -			goto err_detach_pm_domain;
> -	}
> +	if (status == -EPROBE_DEFER)
> +		goto err_clear_wakeup_irq;
> +
> +	status = driver->probe(client, i2c_match_id(driver->id_table, client));
> +	if (status)
> +		goto err_detach_pm_domain;
>  
>  	return 0;
>  
> -- 
> 2.1.4
> 

-- 
Dmitry

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

* Re: [PATCH v3] i2c: return probe deferred status on dev_pm_domain_attach
  2015-10-12 20:54 [PATCH v3] i2c: return probe deferred status on dev_pm_domain_attach Kieran Bingham
  2015-10-12 21:01 ` Dmitry Torokhov
@ 2015-10-15 11:36 ` Wolfram Sang
  1 sibling, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2015-10-15 11:36 UTC (permalink / raw)
  To: Kieran Bingham; +Cc: linux-i2c, dmitry.torokhov, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 604 bytes --]

On Mon, Oct 12, 2015 at 09:54:43PM +0100, Kieran Bingham 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.
> 
> 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")
> 

Applied to for-current, thanks!


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2015-10-15 11:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-12 20:54 [PATCH v3] i2c: return probe deferred status on dev_pm_domain_attach Kieran Bingham
2015-10-12 21:01 ` Dmitry Torokhov
2015-10-15 11:36 ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).