All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Alain Volmat" <alain.volmat@foss.st.com>,
	"Ard Biesheuvel" <ardb@kernel.org>,
	"Baruch Siach" <baruch@tkos.co.il>,
	"Florian Fainelli" <f.fainelli@gmail.com>,
	"Heiko Stuebner" <heiko@sntech.de>,
	"Jarkko Nikula" <jarkko.nikula@linux.intel.com>,
	"Jernej Skrabec" <jernej.skrabec@gmail.com>,
	"Jochen Friedrich" <jochen@scram.de>,
	"Peter Rosin" <peda@axentia.se>,
	"Vadim Pasternak" <vadimp@nvidia.com>,
	"Asmaa Mnebhi" <asnaa@nvidia.com>,
	"Bartosz Golaszewski" <bartosz.golaszewski@linaro.org>,
	"Chris Packham" <chris.packham@alliedtelesis.co.nz>,
	"Chris Pringle" <chris.pringle@phabrix.com>,
	"Claudiu Beznea" <claudiu.beznea@microchip.com>,
	"Conor Dooley" <conor.dooley@microchip.com>,
	"Geert Uytterhoeven" <geert+renesas@glider.be>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Jean Delvare" <jdelvare@suse.de>,
	"Konrad Dybcio" <konrad.dybcio@linaro.org>,
	"Krzysztof Kozlowski" <krzysztof.kozlowski@linaro.org>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Martin Blumenstingl" <martin.blumenstingl@googlemail.com>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"Patrice Chotard" <patrice.chotard@foss.st.com>,
	"Tali Perry" <tali.perry@nuvoton.com>,
	"Vignesh Raghavendra" <vigneshr@ti.com>,
	"Wolfram Sang" <wsa@kernel.org>,
	"Sasha Levin" <sashal@kernel.org>
Subject: [PATCH 5.15.y 2/4] i2c: Convert to platform remove callback returning void
Date: Thu, 10 Sep 2026 15:11:00 -0400	[thread overview]
Message-ID: <20260910191102.1467479-2-sashal@kernel.org> (raw)
In-Reply-To: <20260910191102.1467479-1-sashal@kernel.org>

From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

[ 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.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Alain Volmat <alain.volmat@foss.st.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Baruch Siach <baruch@tkos.co.il>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Acked-by: Jochen Friedrich <jochen@scram.de>
Acked-by: Peter Rosin <peda@axentia.se>
Acked-by: Vadim Pasternak <vadimp@nvidia.com>
Reviewed-by: Asmaa Mnebhi <asnaa@nvidia.com>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Reviewed-by: Chris Pringle <chris.pringle@phabrix.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Tali Perry <tali.perry@nuvoton.com>
Reviewed-by: Vignesh Raghavendra <vigneshr@ti.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>

For this stable dependency, retain only the Qualcomm CCI conversion.
The GXP driver is absent from this tree, and the other I2C driver
conversions are unrelated to the target autosuspend fix.

Also adapt the probe/remove cleanup from upstream f0285c286bca5
("i2c: qcom-cci: Remove overcautious disable_irq() calls"). The IRQ is
already requested with devm_request_irq(), so devres releases it on
probe failure and removal. Route both the existing cci_reset() and
cci_init() failures to disable_clocks, and remove the redundant IRQ
disables and error label. This supplies the context expected by
f98d4986482151a835b521a734722fe8dc5ca37d without adding functions.

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.

[ 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: f98d49864821 ("i2c: qcom-cci: fix autosuspend cleanup")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/i2c/busses/i2c-qcom-cci.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/i2c/busses/i2c-qcom-cci.c b/drivers/i2c/busses/i2c-qcom-cci.c
index eae21899e0f3c..b3ccbea140e9d 100644
--- a/drivers/i2c/busses/i2c-qcom-cci.c
+++ b/drivers/i2c/busses/i2c-qcom-cci.c
@@ -632,11 +632,11 @@ static int cci_probe(struct platform_device *pdev)
 
 	ret = cci_reset(cci);
 	if (ret < 0)
-		goto error;
+		goto disable_clocks;
 
 	ret = cci_init(cci);
 	if (ret < 0)
-		goto error;
+		goto disable_clocks;
 
 	pm_runtime_set_autosuspend_delay(dev, MSEC_PER_SEC);
 	pm_runtime_use_autosuspend(dev);
@@ -666,15 +666,13 @@ static int cci_probe(struct platform_device *pdev)
 			of_node_put(cci->master[i].adap.dev.of_node);
 		}
 	}
-error:
-	disable_irq(cci->irq);
 disable_clocks:
 	cci_disable_clocks(cci);
 
 	return ret;
 }
 
-static int cci_remove(struct platform_device *pdev)
+static void cci_remove(struct platform_device *pdev)
 {
 	struct cci *cci = platform_get_drvdata(pdev);
 	int i;
@@ -687,11 +685,8 @@ static int cci_remove(struct platform_device *pdev)
 		}
 	}
 
-	disable_irq(cci->irq);
 	pm_runtime_disable(&pdev->dev);
 	pm_runtime_set_suspended(&pdev->dev);
-
-	return 0;
 }
 
 static const struct cci_data cci_v1_data = {
@@ -785,7 +780,7 @@ MODULE_DEVICE_TABLE(of, cci_dt_match);
 
 static struct platform_driver qcom_cci_driver = {
 	.probe  = cci_probe,
-	.remove = cci_remove,
+	.remove_new = cci_remove,
 	.driver = {
 		.name = "i2c-qcom-cci",
 		.of_match_table = cci_dt_match,
-- 
2.53.0


  reply	other threads:[~2026-09-10 19:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-09  9:41 FAILED: patch "[PATCH] i2c: qcom-cci: fix autosuspend cleanup" failed to apply to 5.15-stable tree gregkh
2026-09-10 19:10 ` [PATCH 5.15.y 1/4] i2c: omap: Improve error reporting for problems during .remove() Sasha Levin
2026-09-10 19:11   ` Sasha Levin [this message]
2026-09-10 19:11   ` [PATCH 5.15.y 3/4] i2c: qcom-cci: Do not check return value of cci_init() Sasha Levin
2026-09-10 19:11   ` [PATCH 5.15.y 4/4] i2c: qcom-cci: fix autosuspend cleanup Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260910191102.1467479-2-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=alain.volmat@foss.st.com \
    --cc=ardb@kernel.org \
    --cc=asnaa@nvidia.com \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=baruch@tkos.co.il \
    --cc=chris.packham@alliedtelesis.co.nz \
    --cc=chris.pringle@phabrix.com \
    --cc=claudiu.beznea@microchip.com \
    --cc=conor.dooley@microchip.com \
    --cc=f.fainelli@gmail.com \
    --cc=geert+renesas@glider.be \
    --cc=hdegoede@redhat.com \
    --cc=heiko@sntech.de \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=jdelvare@suse.de \
    --cc=jernej.skrabec@gmail.com \
    --cc=jochen@scram.de \
    --cc=konrad.dybcio@linaro.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=matthias.bgg@gmail.com \
    --cc=patrice.chotard@foss.st.com \
    --cc=peda@axentia.se \
    --cc=stable@vger.kernel.org \
    --cc=tali.perry@nuvoton.com \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=vadimp@nvidia.com \
    --cc=vigneshr@ti.com \
    --cc=wsa@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.