Skip to contentSkip to conversation

i2c: remove redundant pm_runtime_dont_use_autosuspend() calls

PATCH Applied Joshua Crofts 6 participants 14 messages Nov 9 – Dec 1

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

cover i2c: remove redundant pm_runtime_dont_use_autosuspend() calls

Since commit d1706f9da9f4 ("PM: runtime: call pm_runtime_dont_use_autosuspend() on reinit()"), driver core is now responsible for undoing any
pm_runtime_use_autosuspend() calls on driver exit.

Remove the redundant function calls.

NOTE: Some drivers in drivers/i2c/ still keep their calls because they either rely on pm_runtime_dont_use_autosuspend() before pm_runtime_disable() to flush pending autosuspend delays and trigger synchronous runtime suspension, or operate on a parent device rather than the platform device itself.

---
Joshua Crofts (6):
i2c: cadence: remove redundant pm_runtime_dont_use_autosuspend() call
i2c: img-scb: remove redundant pm_runtime_dont_use_autosuspend() call
i2c: imx: remove redundant pm_runtime_dont_use_autosuspend() calls
i2c: riic: remove redundant pm_runtime_dont_use_autosuspend() calls
i2c: stm32f7: remove redundant pm_runtime_dont_use_autosuspend() calls
i2c: xiic: remove redundant pm_runtime_dont_use_autosuspend() calls

 drivers/i2c/busses/i2c-cadence.c | 1 -
 drivers/i2c/busses/i2c-img-scb.c | 1 -
 drivers/i2c/busses/i2c-imx.c     | 2 --
 drivers/i2c/busses/i2c-riic.c    | 2 --
 drivers/i2c/busses/i2c-stm32f7.c | 2 --
 drivers/i2c/busses/i2c-xiic.c    | 2 --
 6 files changed, 10 deletions(-)

---
base-commit: 7475ea8b58616b33c04afb976cf0fbaad9dd63fb
change-id: 20261109-i2c-remove-dont-use-autosuspend-3c7e920fdd56

Best regards,

Signature · 1 line
Joshua Crofts
#1 lore raw

PATCH 1/6 i2c: cadence: remove redundant pm_runtime_dont_use_autosuspend() call

Since commit d1706f9da9f4 ("PM: runtime: call pm_runtime_dont_use_autosuspend() on reinit()"), driver core is now responsible for undoing any
pm_runtime_use_autosuspend() calls on driver exit.

Remove the redundant function call.

---
 drivers/i2c/busses/i2c-cadence.c | 1 -
 1 file changed, 1 deletion(-)
drivers/i2c/busses/i2c-cadence.c +0 -1
index 0c6887da47d1..8e65ea474a84 100644
@@ -1628,7 +1628,6 @@ static void cdns_i2c_remove(struct platform_device *pdev)
 
 	pm_runtime_disable(&pdev->dev);
 	pm_runtime_set_suspended(&pdev->dev);
-	pm_runtime_dont_use_autosuspend(&pdev->dev);
 
 	i2c_del_adapter(&id->adap);
 	clk_notifier_unregister(id->clk, &id->clk_rate_change_nb);
Signature · 1 line
2.56.0
#2 lore raw

PATCH 2/6 i2c: img-scb: remove redundant pm_runtime_dont_use_autosuspend() call

In reply to Joshua Crofts

Since commit d1706f9da9f4 ("PM: runtime: call pm_runtime_dont_use_autosuspend() on reinit()"), driver core is now responsible for undoing any
pm_runtime_use_autosuspend() calls on driver exit.

Remove the redundant function call.

---
 drivers/i2c/busses/i2c-img-scb.c | 1 -
 1 file changed, 1 deletion(-)
drivers/i2c/busses/i2c-img-scb.c +0 -1
index 9d2ee449a40b..9b7142bf0059 100644
@@ -1403,7 +1403,6 @@ static int img_i2c_probe(struct platform_device *pdev)
 	if (!pm_runtime_enabled(&pdev->dev))
 		img_i2c_runtime_suspend(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
-	pm_runtime_dont_use_autosuspend(&pdev->dev);
 	return ret;
 }
 
Signature · 1 line
2.56.0
#3 lore raw

PATCH 3/6 i2c: imx: remove redundant pm_runtime_dont_use_autosuspend() calls

In reply to Joshua Crofts

Since commit d1706f9da9f4 ("PM: runtime: call pm_runtime_dont_use_autosuspend() on reinit()"), driver core is now responsible for undoing any
pm_runtime_use_autosuspend() calls on driver exit.

Remove the redundant function calls.

---
 drivers/i2c/busses/i2c-imx.c | 2 --
 1 file changed, 2 deletions(-)
drivers/i2c/busses/i2c-imx.c +0 -2
index 89f2b764bbc4..05906ddafbfa 100644
@@ -1964,7 +1964,6 @@ static int i2c_imx_probe(struct platform_device *pdev)
 	pm_runtime_put_noidle(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
 	pm_runtime_set_suspended(&pdev->dev);
-	pm_runtime_dont_use_autosuspend(&pdev->dev);
 	return ret;
 }
 
@@ -1999,7 +1998,6 @@ static void i2c_imx_remove(struct platform_device *pdev)
 
 	pm_runtime_put_noidle(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
-	pm_runtime_dont_use_autosuspend(&pdev->dev);
 }
 
 static int i2c_imx_runtime_suspend(struct device *dev)
Signature · 1 line
2.56.0
Reviewed-by on v1 3/6
#4 lore raw

Re: [PATCH 3/6] i2c: imx: remove redundant pm_runtime_dont_use_autosuspend() calls

Quoted 8 lines · Joshua Crofts

Since commit d1706f9da9f4 ("PM: runtime: call pm_runtime_dont_use_autosuspend() on reinit()"), driver core is now responsible for undoing any
pm_runtime_use_autosuspend() calls on driver exit.

Remove the redundant function calls.

---

Quoted 28 lines
 drivers/i2c/busses/i2c-imx.c | 2 --
 1 file changed, 2 deletions(-)
drivers/i2c/busses/i2c-imx.c +0 -3
index 89f2b764bbc4..05906ddafbfa 100644
@@ -1964,7 +1964,6 @@ static int i2c_imx_probe(struct platform_device *pdev)
 	pm_runtime_put_noidle(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
 	pm_runtime_set_suspended(&pdev->dev);
-	pm_runtime_dont_use_autosuspend(&pdev->dev);
 	return ret;
 }
 
@@ -1999,7 +1998,6 @@ static void i2c_imx_remove(struct platform_device *pdev)
 
 	pm_runtime_put_noidle(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
-	pm_runtime_dont_use_autosuspend(&pdev->dev);
 }
 
 static int i2c_imx_runtime_suspend(struct device *dev)
 
--

2.56.0

#5 lore raw

PATCH 4/6 i2c: riic: remove redundant pm_runtime_dont_use_autosuspend() calls

In reply to Joshua Crofts

Since commit d1706f9da9f4 ("PM: runtime: call pm_runtime_dont_use_autosuspend() on reinit()"), driver core is now responsible for undoing any
pm_runtime_use_autosuspend() calls on driver exit.

Remove the redundant function calls.

---
 drivers/i2c/busses/i2c-riic.c | 2 --
 1 file changed, 2 deletions(-)
drivers/i2c/busses/i2c-riic.c +0 -2
index 26b9d608fa28..57532dd2e3ea 100644
@@ -591,7 +591,6 @@ static int riic_i2c_probe(struct platform_device *pdev)
 
 out:
 	pm_runtime_disable(dev);
-	pm_runtime_dont_use_autosuspend(dev);
 	return ret;
 }
 
@@ -608,7 +607,6 @@ static void riic_i2c_remove(struct platform_device *pdev)
 	}
 	i2c_del_adapter(&riic->adapter);
 	pm_runtime_disable(dev);
-	pm_runtime_dont_use_autosuspend(dev);
 }
 
 static const u8 riic_rz_a_regs[RIIC_REG_END] = {
Signature · 1 line
2.56.0
Reviewed-by on v1 4/6
#6 lore raw

Re: [PATCH 4/6] i2c: riic: remove redundant pm_runtime_dont_use_autosuspend() calls

Quoted 7 lines · Joshua Crofts

Since commit d1706f9da9f4 ("PM: runtime: call pm_runtime_dont_use_autosuspend() on reinit()"), driver core is now responsible for undoing any
pm_runtime_use_autosuspend() calls on driver exit.

Remove the redundant function calls.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#7 lore raw

PATCH 5/6 i2c: stm32f7: remove redundant pm_runtime_dont_use_autosuspend() calls

In reply to Joshua Crofts

Since commit d1706f9da9f4 ("PM: runtime: call pm_runtime_dont_use_autosuspend() on reinit()"), driver core is now responsible for undoing any
pm_runtime_use_autosuspend() calls on driver exit.

Remove the redundant function calls.

---
 drivers/i2c/busses/i2c-stm32f7.c | 2 --
 1 file changed, 2 deletions(-)
drivers/i2c/busses/i2c-stm32f7.c +0 -2
index 2e1cc6a92b81..7904d888550c 100644
@@ -2325,7 +2325,6 @@ static int stm32f7_i2c_probe(struct platform_device *pdev)
 	pm_runtime_put_noidle(i2c_dev->dev);
 	pm_runtime_disable(i2c_dev->dev);
 	pm_runtime_set_suspended(i2c_dev->dev);
-	pm_runtime_dont_use_autosuspend(i2c_dev->dev);
 
 	if (i2c_dev->wakeup_src)
 		dev_pm_clear_wake_irq(i2c_dev->dev);
@@ -2367,7 +2366,6 @@ static void stm32f7_i2c_remove(struct platform_device *pdev)
 	pm_runtime_put_noidle(i2c_dev->dev);
 	pm_runtime_disable(i2c_dev->dev);
 	pm_runtime_set_suspended(i2c_dev->dev);
-	pm_runtime_dont_use_autosuspend(i2c_dev->dev);
 
 	if (i2c_dev->dma) {
 		stm32_i2c_dma_free(i2c_dev->dma);
Signature · 1 line
2.56.0
maintainer Reviewed-by on v1 5/6
#8 lore raw

Re: [PATCH 5/6] i2c: stm32f7: remove redundant pm_runtime_dont_use_autosuspend() calls

Hi,

Quoted 25 lines · Joshua Crofts

Since commit d1706f9da9f4 ("PM: runtime: call pm_runtime_dont_use_autosuspend() on reinit()"), driver core is now responsible for undoing any
pm_runtime_use_autosuspend() calls on driver exit.

Remove the redundant function calls.

---
 drivers/i2c/busses/i2c-stm32f7.c | 2 --
 1 file changed, 2 deletions(-)
drivers/i2c/busses/i2c-stm32f7.c +0 -1
index 2e1cc6a92b81..7904d888550c 100644
@@ -2325,7 +2325,6 @@ static int stm32f7_i2c_probe(struct platform_device *pdev)
 	pm_runtime_put_noidle(i2c_dev->dev);
 	pm_runtime_disable(i2c_dev->dev);
 	pm_runtime_set_suspended(i2c_dev->dev);
-	pm_runtime_dont_use_autosuspend(i2c_dev->dev);
 
 	if (i2c_dev->wakeup_src)
 		dev_pm_clear_wake_irq(i2c_dev->dev);

drivers/i2c/busses/i2c-stm32f7.c static void stm32f7_i2c_remove(struct platform_device *pdev) · line 2371

Quoted 7 lines
drivers/i2c/busses/i2c-stm32f7.c +0 -1
@@ -2367,7 +2366,6 @@ static void stm32f7_i2c_remove(struct platform_device *pdev)
 	pm_runtime_put_noidle(i2c_dev->dev);
 	pm_runtime_disable(i2c_dev->dev);
 	pm_runtime_set_suspended(i2c_dev->dev);
-	pm_runtime_dont_use_autosuspend(i2c_dev->dev);
 
 	if (i2c_dev->dma) {
 		stm32_i2c_dma_free(i2c_dev->dma);

Regards,
Alain

Quoted 3 lines
Signature · 1 line
2.56.0
#9 lore raw

PATCH 6/6 i2c: xiic: remove redundant pm_runtime_dont_use_autosuspend() calls

In reply to Joshua Crofts

Since commit d1706f9da9f4 ("PM: runtime: call pm_runtime_dont_use_autosuspend() on reinit()"), driver core is now responsible for undoing any
pm_runtime_use_autosuspend() calls on driver exit.

Remove the redundant function calls.

---
 drivers/i2c/busses/i2c-xiic.c | 2 --
 1 file changed, 2 deletions(-)
drivers/i2c/busses/i2c-xiic.c +0 -2
index ab7916745ad3..4e06fa4f73d7 100644
@@ -1580,7 +1580,6 @@ static int xiic_i2c_probe(struct platform_device *pdev)
 err_pm_disable:
 	pm_runtime_disable(dev);
 	pm_runtime_set_suspended(dev);
-	pm_runtime_dont_use_autosuspend(dev);
 
 	return ret;
 }
@@ -1606,7 +1605,6 @@ static void xiic_i2c_remove(struct platform_device *pdev)
 	pm_runtime_disable(dev);
 	pm_runtime_put_noidle(dev);
 	pm_runtime_set_suspended(dev);
-	pm_runtime_dont_use_autosuspend(dev);
 }
 
 static const struct dev_pm_ops xiic_dev_pm_ops = {
Signature · 1 line
2.56.0
#10 lore raw

Re: [PATCH 6/6] i2c: xiic: remove redundant pm_runtime_dont_use_autosuspend() calls

Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce: - [High] i2c: xiic: premature IRQ registration…

Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce:
- [High] i2c: xiic: premature IRQ registration in xiic_i2c_probe() [1] --

commit 188337d85ab0ac1fad4560f785b36f1dce4f451f
Author: Joshua Crofts <[email protected]>

i2c: xiic: remove redundant pm_runtime_dont_use_autosuspend() calls

This commit removes redundant pm_runtime_dont_use_autosuspend() calls from the probe error path and remove callback in the xiic I2C driver.

drivers/i2c/busses/i2c-xiic.c static int xiic_i2c_probe(struct platform_device *pdev) · line 1585

Quoted 12 lines
drivers/i2c/busses/i2c-xiic.c +0 -1
index ab7916745ad39..4e06fa4f73d77 100644
@@ -1580,7 +1580,6 @@ static int xiic_i2c_probe(struct platform_device *pdev)
 err_pm_disable:
 	pm_runtime_disable(dev);
 	pm_runtime_set_suspended(dev);
-	pm_runtime_dont_use_autosuspend(dev);
 
 	return ret;
 }

[Severity: High]
This problem wasn't introduced by this patch, but can registering the IRQ in xiic_i2c_probe() before detecting hardware endianness cause an interrupt storm [1]?

drivers/i2c/busses/i2c-xiic.c:xiic_i2c_probe() {
    ...
	ret = request_threaded_irq(irq, NULL, xiic_process, IRQF_ONESHOT,
				   pdev->name, i2c);
	if (ret)
		goto err_pm_disable;

	i2c->singlemaster = device_property_read_bool(dev, "single-master");

	/*
	 * Detect endianness
	 * Try to reset the TX FIFO. Then check the EMPTY flag. If it is not
	 * set, assume that the endianness was wrong and swap.
	 */
	i2c->endianness = LITTLE;
	xiic_setreg32(i2c, XIIC_CR_REG_OFFSET, XIIC_CR_TX_FIFO_RESET_MASK);
	/* Reset is cleared in xiic_reinit */
	sr = xiic_getreg32(i2c, XIIC_SR_REG_OFFSET);
	if (!(sr & XIIC_SR_TX_FIFO_EMPTY_MASK))
		i2c->endianness = BIG;
    ...
}

If a pending interrupt remains from an earlier boot stage on a big-endian system, xiic_process() can fire immediately after request_threaded_irq() while i2c->endianness is still zero-initialized to LITTLE. xiic_getreg32() and xiic_setreg32() then use little-endian accessors, failing to clear the interrupt and hanging the system in an unhandled IRQ storm. Detecting endianness and running xiic_reinit() before requesting the IRQ would avoid this.

[1] https://sashiko.dev/#/bug/linux-6466439c-c62b-471e-ba38-0219e368df95

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/20261109-i2c-remove-dont-use-autosuspend-v1-0-49a08b8daf36@kernel.org?part=6
#11 lore raw
In reply to Joshua Crofts
Quoted 21 lines · Joshua Crofts

Since commit d1706f9da9f4 ("PM: runtime: call pm_runtime_dont_use_autosuspend() on reinit()"), driver core is now responsible for undoing any
pm_runtime_use_autosuspend() calls on driver exit.

Remove the redundant function calls.

NOTE: Some drivers in drivers/i2c/ still keep their calls because they either rely on pm_runtime_dont_use_autosuspend() before pm_runtime_disable() to flush pending autosuspend delays and trigger synchronous runtime suspension, or operate on a parent device rather than the platform device itself.

---
Joshua Crofts (6):
i2c: cadence: remove redundant pm_runtime_dont_use_autosuspend() call
i2c: img-scb: remove redundant pm_runtime_dont_use_autosuspend() call
i2c: imx: remove redundant pm_runtime_dont_use_autosuspend() calls
i2c: riic: remove redundant pm_runtime_dont_use_autosuspend() calls
i2c: stm32f7: remove redundant pm_runtime_dont_use_autosuspend() calls
i2c: xiic: remove redundant pm_runtime_dont_use_autosuspend() calls

Quoted 8 lines
 drivers/i2c/busses/i2c-cadence.c | 1 -
 drivers/i2c/busses/i2c-img-scb.c | 1 -
 drivers/i2c/busses/i2c-imx.c     | 2 --
 drivers/i2c/busses/i2c-riic.c    | 2 --
 drivers/i2c/busses/i2c-stm32f7.c | 2 --
 drivers/i2c/busses/i2c-xiic.c    | 2 --
 6 files changed, 10 deletions(-)

---

Hi, gentle ping on this series.

Signature · 2 lines
Kind regards,
Joshua Crofts
#12 lore raw
In reply to Joshua Crofts
Quoted 6 lines · Joshua Crofts

Since commit d1706f9da9f4 ("PM: runtime: call pm_runtime_dont_use_autosuspend() on reinit()"), driver core is now responsible for undoing any
pm_runtime_use_autosuspend() calls on driver exit.

Remove the redundant function calls.

Quoted 7 lines

NOTE: Some drivers in drivers/i2c/ still keep their calls because they either rely on pm_runtime_dont_use_autosuspend() before pm_runtime_disable() to flush pending autosuspend delays and trigger synchronous runtime suspension, or operate on a parent device rather than the platform device itself.

---

Hi, another ping on this series!

Thanks!

Signature · 2 lines
Kind regards,
Joshua Crofts
Applied
#13 lore raw
In reply to Joshua Crofts
Quoted 4 lines · Joshua Crofts

Since commit d1706f9da9f4 ("PM: runtime: call pm_runtime_dont_use_autosuspend() on reinit()"), driver core is now responsible for undoing any
pm_runtime_use_autosuspend() calls on driver exit.

Quoted 8 lines

Remove the redundant function calls.

NOTE: Some drivers in drivers/i2c/ still keep their calls because they either rely on pm_runtime_dont_use_autosuspend() before pm_runtime_disable() to flush pending autosuspend delays and trigger synchronous runtime suspension, or operate on a parent device rather than the platform device itself.

Applied to my for-andi branch, thanks!