FAILED: patch "[PATCH] i2c: imx: disable autosuspend on remove" failed to apply to 5.10-stable tree
Subsystems (4)
[email protected]
maintainerThe patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x e0c3e9d76adbe522dd420a766ce42d03ce887c29
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026092239-arguable-reunion-62af@gregkh' --subject-prefix 'PATCH 5.10.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From e0c3e9d76adbe522dd420a766ce42d03ce887c29 Mon Sep 17 00:00:00 2001
From: Guangshuo Li <[email protected]>
Date: Mon, 14 Sep 2026 17:15:44 +0800
Subject: [PATCH] i2c: imx: disable autosuspend on remove
i2c_imx_probe() enables runtime PM autosuspend with pm_runtime_use_autosuspend(). The probe error path correctly undoes this setting with pm_runtime_dont_use_autosuspend(), but the normal remove path only disables runtime PM.
The runtime PM API requires pm_runtime_use_autosuspend() to be undone with pm_runtime_dont_use_autosuspend() at driver exit unless runtime PM was enabled with devm_pm_runtime_enable(). Leaving the autosuspend flag set therefore leaves the runtime PM state incompletely cleaned up after the driver is unbound.
Add the missing pm_runtime_dont_use_autosuspend() call to the remove path.
This issue was found by manual code inspection.
drivers/i2c/busses/i2c-imx.c +1 -0
@@ -1920,6 +1920,7 @@ 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)
Sasha Levin
maintainerPATCH 1/3 i2c: omap: Improve error reporting for problems during .remove()
From: Uwe Kleine-König <[email protected]>
[ Upstream commit 9496fffcb28f39e0352779a0199b6e61861c9221 ]
If pm_runtime_get() fails in .remove() the driver used to return the error to the driver core. The only effect of this (compared to returning zero) is a generic warning that the error value is ignored.
So emit a better warning and return zero to suppress the generic (and little helpful) message. Also disable runtime PM in the error case.
This prepares changing platform device remove callbacks to return void.
Stable-dep-of: e0c3e9d76adb ("i2c: imx: disable autosuspend on remove")
--- drivers/i2c/busses/i2c-omap.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/i2c/busses/i2c-omap.c +6 -3
@@ -1513,14 +1513,17 @@ static int omap_i2c_remove(struct platform_device *pdev)int ret;i2c_del_adapter (&omap->adapter); - ret =pm_runtime_resume_and_get (&pdev->dev); + + ret =pm_runtime_get_sync (&pdev->dev);if (ret <0 ) -return ret; +dev_err (omap->dev,"Failed to resume hardware, skip disable\n" ); +else +omap_i2c_write_reg (omap,OMAP_I2C_CON_REG ,0 ); -omap_i2c_write_reg (omap,OMAP_I2C_CON_REG ,0 );pm_runtime_dont_use_autosuspend (&pdev->dev);pm_runtime_put_sync (&pdev->dev);pm_runtime_disable (&pdev->dev); +return 0 ; }
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/3 i2c: Convert to platform remove callback returning void
From: Uwe Kleine-König <[email protected]>
[ Upstream commit e190a0c389e60178fba3d532abf936dcae223e7d ]
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void.
Stable adaptation for e0c3e9d76adb ("i2c: imx: disable autosuspend on remove"): retain only the i.MX remove callback conversion needed by the target. Drop the GXP conversion because this stable tree has no GXP I2C driver, and omit the other unrelated driver conversions. The platform core already supports .remove_new; no new functions are needed. Keep the existing runtime-PM annotations so configurations without CONFIG_PM remain supported.
[ sashal: Reduced backport -- upstream e190a0c389e60 touches 88 file(s), this
backport carries 1. Not backported here:
drivers/i2c/busses/i2c-altera.c drivers/i2c/busses/i2c-amd-mp2-plat.c drivers/i2c/busses/i2c-aspeed.c drivers/i2c/busses/i2c-at91-core.c drivers/i2c/busses/i2c-au1550.c
drivers/i2c/busses/i2c-axxia.c
drivers/i2c/busses/i2c-bcm2835.c drivers/i2c/busses/i2c-bcm-iproc.c
... and 79 more
This note is generated from the file lists only; see the resolution record for the reasoning. ]
Stable-dep-of: e0c3e9d76adb ("i2c: imx: disable autosuspend on remove")
--- drivers/i2c/busses/i2c-imx.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/i2c/busses/i2c-imx.c +2 -4
@@ -1323,7 +1323,7 @@ static int i2c_imx_probe(struct platform_device *pdev)return ret; } -static int i2c_imx_remove (struct platform_device *pdev) +static void i2c_imx_remove (struct platform_device *pdev) {struct imx_i2c_struct *i2c_imx =platform_get_drvdata (pdev);int irq, ret;
@@ -1355,8 +1355,6 @@ static int i2c_imx_remove(struct platform_device *pdev)pm_runtime_put_noidle (&pdev->dev);pm_runtime_disable (&pdev->dev); - -return 0 ; }static int __maybe_unused i2c_imx_runtime_suspend (struct device *dev)
@@ -1387,7 +1385,7 @@ static const struct dev_pm_ops i2c_imx_pm_ops = {static struct platform_driver i2c_imx_driver = { .probe = i2c_imx_probe, - .remove = i2c_imx_remove, + .remove_new = i2c_imx_remove, .driver = { .name =DRIVER_NAME , .pm = &i2c_imx_pm_ops,
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 3/3 i2c: imx: disable autosuspend on remove
In reply to Sasha LevinFrom: Guangshuo Li <[email protected]>
[ Upstream commit e0c3e9d76adbe522dd420a766ce42d03ce887c29 ]
i2c_imx_probe() enables runtime PM autosuspend with pm_runtime_use_autosuspend(). The probe error path correctly undoes this setting with pm_runtime_dont_use_autosuspend(), but the normal remove path only disables runtime PM.
The runtime PM API requires pm_runtime_use_autosuspend() to be undone with pm_runtime_dont_use_autosuspend() at driver exit unless runtime PM was enabled with devm_pm_runtime_enable(). Leaving the autosuspend flag set therefore leaves the runtime PM state incompletely cleaned up after the driver is unbound.
Add the missing pm_runtime_dont_use_autosuspend() call to the remove path.
This issue was found by manual code inspection.
--- drivers/i2c/busses/i2c-imx.c | 1 + 1 file changed, 1 insertion(+)
drivers/i2c/busses/i2c-imx.c +1 -0
@@ -1355,6 +1355,7 @@ 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 __maybe_unused i2c_imx_runtime_suspend (struct device *dev)
Signature · 1 line
2.53.0