Skip to contentSkip to conversation

i2c: return probe deferred status on dev_pm_domain_attach

PATCH Superseded Kieran Bingham 2 participants 3 messages Oct 12, 2015

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 i2c: return probe deferred status on dev_pm_domain_attach

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

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(+)
drivers/i2c/i2c-core.c +2 -0
index 5f89f1e3c2f2..51f20cce1732 100644
@@ -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;
Signature · 1 line
2.1.4
#1 lore raw
Quoted 5 lines · 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.

Ah, indeed, sorry about that.

Quoted 19 lines

Catch the PROBE_DEFER and clear up the IRQ wakeup status

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(+)
drivers/i2c/i2c-core.c +0 -0
index 5f89f1e3c2f2..51f20cce1732 100644

drivers/i2c/i2c-core.c static int i2c_device_probe(struct device *dev) · line 704

Quoted 6 lines
drivers/i2c/i2c-core.c +2 -0
@@ -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.

Signature · 1 line
Dmitry
#2 lore raw
Quoted 38 lines · Dmitry Torokhov
Quoted 5 lines · 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.

Ah, indeed, sorry about that.

Quoted 19 lines

Catch the PROBE_DEFER and clear up the IRQ wakeup status

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(+)
drivers/i2c/i2c-core.c +0 -0
index 5f89f1e3c2f2..51f20cce1732 100644

drivers/i2c/i2c-core.c static int i2c_device_probe(struct device *dev) · line 704

Quoted 6 lines
drivers/i2c/i2c-core.c +2 -0
@@ -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:

Quoted 8 lines
        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

Quoted 5 lines

Thanks.

--
Dmitry