Skip to contentSkip to conversation

i2c: Mark adapter devices with pm_runtime_no_callbacks

PATCH Applied Charles Keepax 3 participants 4 messages Apr 16, 2015 – Apr 22, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 i2c: Mark adapter devices with pm_runtime_no_callbacks

Commit 523c5b89640e ("i2c: Remove support for legacy PM") removed the PM ops from the bus type, which causes the pm operations on the s3c2410 adapter device to fail (-ENOSUPP in rpm_callback). The adapter device doesn't get bound to a driver and as such can't have its own pm_runtime callbacks. Previously this was fine as the bus callbacks would have been used, but now this can cause devices which use PM runtime and are attached over I2C to fail to resume.

This commit fixes this issue by marking all adapter devices with pm_runtime_no_callbacks, since they can't have any.

---

Changes since v1:
- Simple mark all adapter devices with pm_runtime_no_callbacks in the i2c core

Thanks,
Charles

 drivers/i2c/i2c-core.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/i2c/i2c-core.c +2 -0
index 1672e6b..eac3331 100644
@@ -1410,6 +1410,8 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
 
 	dev_dbg(&adap->dev, "adapter [%s] registered\n", adap->name);
 
+	pm_runtime_no_callbacks(&adap->dev);
+
 #ifdef CONFIG_I2C_COMPAT
 	res = class_compat_create_link(i2c_adapter_compat_class, &adap->dev,
 				       adap->dev.parent);
Signature · 1 line
1.7.2.5
#1 lore raw
Quoted 29 lines · Charles Keepax

Commit 523c5b89640e ("i2c: Remove support for legacy PM") removed the PM ops from the bus type, which causes the pm operations on the s3c2410 adapter device to fail (-ENOSUPP in rpm_callback). The adapter device doesn't get bound to a driver and as such can't have its own pm_runtime callbacks. Previously this was fine as the bus callbacks would have been used, but now this can cause devices which use PM runtime and are attached over I2C to fail to resume.

This commit fixes this issue by marking all adapter devices with pm_runtime_no_callbacks, since they can't have any.

---

Changes since v1:
- Simple mark all adapter devices with pm_runtime_no_callbacks in the i2c core

Thanks,
Charles

 drivers/i2c/i2c-core.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/i2c/i2c-core.c +0 -0
index 1672e6b..eac3331 100644

drivers/i2c/i2c-core.c static int i2c_register_adapter(struct i2c_adapter *adap) · line 1417

Quoted 8 lines
drivers/i2c/i2c-core.c +2 -0
@@ -1410,6 +1410,8 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
 
 	dev_dbg(&adap->dev, "adapter [%s] registered\n", adap->name);
 
+	pm_runtime_no_callbacks(&adap->dev);
+
 #ifdef CONFIG_I2C_COMPAT
 	res = class_compat_create_link(i2c_adapter_compat_class, &adap->dev,
 				       adap->dev.parent);

Thereis at least one more casewhen an I2C device fails to resume due to bus callbacks being dropped(like fimc-is-i2c driver for exynos4-is, the same scenario), so I'm glad to see it's being handled in on place -it saves the trouble.

BR
Beata

#2 lore raw
Quoted 12 lines · Beata Michalska
Quoted 11 lines · Charles Keepax

Commit 523c5b89640e ("i2c: Remove support for legacy PM") removed the PM ops from the bus type, which causes the pm operations on the s3c2410 adapter device to fail (-ENOSUPP in rpm_callback). The adapter device doesn't get bound to a driver and as such can't have its own pm_runtime callbacks. Previously this was fine as the bus callbacks would have been used, but now this can cause devices which use PM runtime and are attached over I2C to fail to resume.

This commit fixes this issue by marking all adapter devices with pm_runtime_no_callbacks, since they can't have any.

Quoted 6 lines
Quoted 1 line

Thereis at least one more casewhen an I2C device fails to resume due to bus callbacks being dropped(like fimc-is-i2c driver for exynos4-is, the same scenario), so I'm glad to see it's being handled in on place -it saves the trouble.

Thanks for the confirmation! If you could also add a formal 'Acked-by' next time, this would help me because patchwork collects them for me automatically.

Applied
#3 lore raw
In reply to Charles Keepax
Quoted 8 lines · Charles Keepax

Commit 523c5b89640e ("i2c: Remove support for legacy PM") removed the PM ops from the bus type, which causes the pm operations on the s3c2410 adapter device to fail (-ENOSUPP in rpm_callback). The adapter device doesn't get bound to a driver and as such can't have its own pm_runtime callbacks. Previously this was fine as the bus callbacks would have been used, but now this can cause devices which use PM runtime and are attached over I2C to fail to resume.

Quoted 4 lines

This commit fixes this issue by marking all adapter devices with pm_runtime_no_callbacks, since they can't have any.

Applied to for-current, thanks!

Will push out somewhat later today. Lars-Peter, if you'd like to donate some ack/review tag until then, this would be much appreciated.