All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Heiko Stuebner <heiko@sntech.de>,
	linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH 11/20] pinctrl: rockchip: Convert to platform remove callback returning void
Date: Mon,  9 Oct 2023 10:38:47 +0200	[thread overview]
Message-ID: <20231009083856.222030-12-u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <20231009083856.222030-1-u.kleine-koenig@pengutronix.de>

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 ignored (apart
from emitting a warning) 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. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pinctrl/pinctrl-rockchip.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index 45e416f68e74..3bedf36a0019 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -3429,7 +3429,7 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int rockchip_pinctrl_remove(struct platform_device *pdev)
+static void rockchip_pinctrl_remove(struct platform_device *pdev)
 {
 	struct rockchip_pinctrl *info = platform_get_drvdata(pdev);
 	struct rockchip_pin_bank *bank;
@@ -3450,8 +3450,6 @@ static int rockchip_pinctrl_remove(struct platform_device *pdev)
 		}
 		mutex_unlock(&bank->deferred_lock);
 	}
-
-	return 0;
 }
 
 static struct rockchip_pin_bank px30_pin_banks[] = {
@@ -3982,7 +3980,7 @@ static const struct of_device_id rockchip_pinctrl_dt_match[] = {
 
 static struct platform_driver rockchip_pinctrl_driver = {
 	.probe		= rockchip_pinctrl_probe,
-	.remove		= rockchip_pinctrl_remove,
+	.remove_new	= rockchip_pinctrl_remove,
 	.driver = {
 		.name	= "rockchip-pinctrl",
 		.pm = &rockchip_pinctrl_dev_pm_ops,
-- 
2.40.1


WARNING: multiple messages have this Message-ID (diff)
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Heiko Stuebner <heiko@sntech.de>,
	linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH 11/20] pinctrl: rockchip: Convert to platform remove callback returning void
Date: Mon,  9 Oct 2023 10:38:47 +0200	[thread overview]
Message-ID: <20231009083856.222030-12-u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <20231009083856.222030-1-u.kleine-koenig@pengutronix.de>

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 ignored (apart
from emitting a warning) 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. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pinctrl/pinctrl-rockchip.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index 45e416f68e74..3bedf36a0019 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -3429,7 +3429,7 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int rockchip_pinctrl_remove(struct platform_device *pdev)
+static void rockchip_pinctrl_remove(struct platform_device *pdev)
 {
 	struct rockchip_pinctrl *info = platform_get_drvdata(pdev);
 	struct rockchip_pin_bank *bank;
@@ -3450,8 +3450,6 @@ static int rockchip_pinctrl_remove(struct platform_device *pdev)
 		}
 		mutex_unlock(&bank->deferred_lock);
 	}
-
-	return 0;
 }
 
 static struct rockchip_pin_bank px30_pin_banks[] = {
@@ -3982,7 +3980,7 @@ static const struct of_device_id rockchip_pinctrl_dt_match[] = {
 
 static struct platform_driver rockchip_pinctrl_driver = {
 	.probe		= rockchip_pinctrl_probe,
-	.remove		= rockchip_pinctrl_remove,
+	.remove_new	= rockchip_pinctrl_remove,
 	.driver = {
 		.name	= "rockchip-pinctrl",
 		.pm = &rockchip_pinctrl_dev_pm_ops,
-- 
2.40.1


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

WARNING: multiple messages have this Message-ID (diff)
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Heiko Stuebner <heiko@sntech.de>,
	linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH 11/20] pinctrl: rockchip: Convert to platform remove callback returning void
Date: Mon,  9 Oct 2023 10:38:47 +0200	[thread overview]
Message-ID: <20231009083856.222030-12-u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <20231009083856.222030-1-u.kleine-koenig@pengutronix.de>

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 ignored (apart
from emitting a warning) 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. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pinctrl/pinctrl-rockchip.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index 45e416f68e74..3bedf36a0019 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -3429,7 +3429,7 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int rockchip_pinctrl_remove(struct platform_device *pdev)
+static void rockchip_pinctrl_remove(struct platform_device *pdev)
 {
 	struct rockchip_pinctrl *info = platform_get_drvdata(pdev);
 	struct rockchip_pin_bank *bank;
@@ -3450,8 +3450,6 @@ static int rockchip_pinctrl_remove(struct platform_device *pdev)
 		}
 		mutex_unlock(&bank->deferred_lock);
 	}
-
-	return 0;
 }
 
 static struct rockchip_pin_bank px30_pin_banks[] = {
@@ -3982,7 +3980,7 @@ static const struct of_device_id rockchip_pinctrl_dt_match[] = {
 
 static struct platform_driver rockchip_pinctrl_driver = {
 	.probe		= rockchip_pinctrl_probe,
-	.remove		= rockchip_pinctrl_remove,
+	.remove_new	= rockchip_pinctrl_remove,
 	.driver = {
 		.name	= "rockchip-pinctrl",
 		.pm = &rockchip_pinctrl_dev_pm_ops,
-- 
2.40.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2023-10-09  9:23 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-09  8:38 [PATCH 00/20] pinctrl: Convert to platform remove callback returning void Uwe Kleine-König
2023-10-09  8:38 ` Uwe Kleine-König
2023-10-09  8:38 ` Uwe Kleine-König
2023-10-09  8:38 ` [PATCH 01/20] pinctrl: stmfx: Improve error message in .remove()'s error path Uwe Kleine-König
2023-10-09  8:38   ` Uwe Kleine-König
2023-10-10 13:35   ` Linus Walleij
2023-10-10 13:35     ` Linus Walleij
2023-10-09  8:38 ` [PATCH 02/20] pinctrl: single: Drop if block with always false condition Uwe Kleine-König
2023-10-09  8:38   ` Uwe Kleine-König
2023-10-10 13:36   ` Linus Walleij
2023-10-10 13:36     ` Linus Walleij
2023-10-09  8:38 ` [PATCH 03/20] pinctrl: ti: ti-iodelay: " Uwe Kleine-König
2023-10-10 13:36   ` Linus Walleij
2023-10-09  8:38 ` [PATCH 04/20] pinctrl: cirrus: madera-core: Convert to platform remove callback returning void Uwe Kleine-König
2023-10-09 10:37   ` Charles Keepax
2023-10-10 13:37   ` Linus Walleij
2023-10-09  8:38 ` [PATCH 05/20] pinctrl: intel: cherryview: " Uwe Kleine-König
2023-10-09 11:10   ` Mika Westerberg
2023-10-10 13:18     ` Andy Shevchenko
2023-10-09  8:38 ` [PATCH 06/20] pinctrl: intel: lynxpoint: " Uwe Kleine-König
2023-10-09 11:10   ` Mika Westerberg
2023-10-10 13:18     ` Andy Shevchenko
2023-10-10 15:34     ` Andy Shevchenko
2023-10-09  8:38 ` [PATCH 07/20] pinctrl: nomadik: abx500: " Uwe Kleine-König
2023-10-09  8:38   ` Uwe Kleine-König
2023-10-10 13:38   ` Linus Walleij
2023-10-10 13:38     ` Linus Walleij
2023-10-09  8:38 ` [PATCH 08/20] pinctrl: amd: " Uwe Kleine-König
2023-10-10 13:38   ` Linus Walleij
2023-10-09  8:38 ` [PATCH 09/20] pinctrl: artpec6: " Uwe Kleine-König
2023-10-10  8:40   ` Jesper Nilsson
2023-10-10 13:39   ` Linus Walleij
2023-10-09  8:38 ` [PATCH 10/20] pinctrl: as3722: " Uwe Kleine-König
2023-10-10 13:39   ` Linus Walleij
2023-10-09  8:38 ` Uwe Kleine-König [this message]
2023-10-09  8:38   ` [PATCH 11/20] pinctrl: rockchip: " Uwe Kleine-König
2023-10-09  8:38   ` Uwe Kleine-König
2023-10-09 20:16   ` Heiko Stuebner
2023-10-09 20:16     ` Heiko Stuebner
2023-10-09 20:16     ` Heiko Stuebner
2023-10-10 13:40   ` Linus Walleij
2023-10-10 13:40     ` Linus Walleij
2023-10-10 13:40     ` Linus Walleij
2023-10-09  8:38 ` [PATCH 12/20] pinctrl: single: " Uwe Kleine-König
2023-10-09  8:38   ` Uwe Kleine-König
2023-10-10 13:41   ` Linus Walleij
2023-10-10 13:41     ` Linus Walleij
2023-10-09  8:38 ` [PATCH 13/20] pinctrl: stmfx: " Uwe Kleine-König
2023-10-09  8:38   ` Uwe Kleine-König
2023-10-10 13:41   ` Linus Walleij
2023-10-10 13:41     ` Linus Walleij
2023-10-09  8:38 ` [PATCH 14/20] pinctrl: tb10x: " Uwe Kleine-König
2023-10-10 13:42   ` Linus Walleij
2023-10-09  8:38 ` [PATCH 15/20] pinctrl: qcom: spmi-gpio: " Uwe Kleine-König
2023-10-10 13:42   ` Linus Walleij
2023-10-09  8:38 ` [PATCH 16/20] pinctrl: qcom: spmi-mpp: " Uwe Kleine-König
2023-10-10 13:43   ` Linus Walleij
2023-10-09  8:38 ` [PATCH 17/20] pinctrl: qcom: ssbi-gpio: " Uwe Kleine-König
2023-10-10 13:43   ` Linus Walleij
2023-10-09  8:38 ` [PATCH 18/20] pinctrl: qcom: ssbi-mpp: " Uwe Kleine-König
2023-10-10 13:44   ` Linus Walleij
2023-10-09  8:38 ` [PATCH 19/20] pinctrl: renesas: rzn1: " Uwe Kleine-König
2023-10-09  9:39   ` Geert Uytterhoeven
2023-10-10 13:45     ` Linus Walleij
2023-10-10 13:48       ` Geert Uytterhoeven
2023-10-09  8:38 ` [PATCH 20/20] pinctrl: ti: ti-iodelay: " Uwe Kleine-König
2023-10-10 13:45   ` Linus Walleij

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=20231009083856.222030-12-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=heiko@sntech.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.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.