From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de> To: Linus Walleij <linus.walleij@linaro.org>, Bartosz Golaszewski <brgl@bgdev.pl> Cc: Andy Shevchenko <andy@kernel.org>, Ray Jui <rjui@broadcom.com>, Scott Branden <sbranden@broadcom.com>, Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 21/23] gpio: xgs-iproc: Convert to platform remove callback returning void Date: Thu, 28 Sep 2023 09:07:04 +0200 [thread overview] Message-ID: <20230928070706.2290137-22-u.kleine-koenig@pengutronix.de> (raw) In-Reply-To: <20230928070706.2290137-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/gpio/gpio-xgs-iproc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpio-xgs-iproc.c b/drivers/gpio/gpio-xgs-iproc.c index 2d23b27d55af..d445eea03687 100644 --- a/drivers/gpio/gpio-xgs-iproc.c +++ b/drivers/gpio/gpio-xgs-iproc.c @@ -291,7 +291,7 @@ static int iproc_gpio_probe(struct platform_device *pdev) return 0; } -static int iproc_gpio_remove(struct platform_device *pdev) +static void iproc_gpio_remove(struct platform_device *pdev) { struct iproc_gpio_chip *chip = platform_get_drvdata(pdev); @@ -302,8 +302,6 @@ static int iproc_gpio_remove(struct platform_device *pdev) val &= ~IPROC_CCA_INT_F_GPIOINT; writel_relaxed(val, chip->intr + IPROC_CCA_INT_MASK); } - - return 0; } static const struct of_device_id bcm_iproc_gpio_of_match[] = { @@ -318,7 +316,7 @@ static struct platform_driver bcm_iproc_gpio_driver = { .of_match_table = bcm_iproc_gpio_of_match, }, .probe = iproc_gpio_probe, - .remove = iproc_gpio_remove, + .remove_new = iproc_gpio_remove, }; module_platform_driver(bcm_iproc_gpio_driver); -- 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>, Bartosz Golaszewski <brgl@bgdev.pl> Cc: Andy Shevchenko <andy@kernel.org>, Ray Jui <rjui@broadcom.com>, Scott Branden <sbranden@broadcom.com>, Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 21/23] gpio: xgs-iproc: Convert to platform remove callback returning void Date: Thu, 28 Sep 2023 09:07:04 +0200 [thread overview] Message-ID: <20230928070706.2290137-22-u.kleine-koenig@pengutronix.de> (raw) In-Reply-To: <20230928070706.2290137-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/gpio/gpio-xgs-iproc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpio-xgs-iproc.c b/drivers/gpio/gpio-xgs-iproc.c index 2d23b27d55af..d445eea03687 100644 --- a/drivers/gpio/gpio-xgs-iproc.c +++ b/drivers/gpio/gpio-xgs-iproc.c @@ -291,7 +291,7 @@ static int iproc_gpio_probe(struct platform_device *pdev) return 0; } -static int iproc_gpio_remove(struct platform_device *pdev) +static void iproc_gpio_remove(struct platform_device *pdev) { struct iproc_gpio_chip *chip = platform_get_drvdata(pdev); @@ -302,8 +302,6 @@ static int iproc_gpio_remove(struct platform_device *pdev) val &= ~IPROC_CCA_INT_F_GPIOINT; writel_relaxed(val, chip->intr + IPROC_CCA_INT_MASK); } - - return 0; } static const struct of_device_id bcm_iproc_gpio_of_match[] = { @@ -318,7 +316,7 @@ static struct platform_driver bcm_iproc_gpio_driver = { .of_match_table = bcm_iproc_gpio_of_match, }, .probe = iproc_gpio_probe, - .remove = iproc_gpio_remove, + .remove_new = iproc_gpio_remove, }; module_platform_driver(bcm_iproc_gpio_driver); -- 2.40.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-09-28 7:07 UTC|newest] Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-09-28 7:06 [PATCH 00/23] gpio: Convert to platform remove callback returning void Uwe Kleine-König 2023-09-28 7:06 ` Uwe Kleine-König 2023-09-28 7:06 ` Uwe Kleine-König 2023-09-28 7:06 ` [PATCH 01/23] gpio: altera: " Uwe Kleine-König 2023-09-28 7:06 ` [PATCH 02/23] gpio: amdpt: " Uwe Kleine-König 2023-09-28 7:06 ` [PATCH 03/23] gpio: brcmstb: " Uwe Kleine-König 2023-09-28 7:06 ` Uwe Kleine-König 2023-09-28 21:22 ` Florian Fainelli 2023-09-28 21:22 ` Florian Fainelli 2023-09-28 7:06 ` [PATCH 04/23] gpio: cadence: " Uwe Kleine-König 2023-09-28 7:06 ` [PATCH 05/23] gpio: dln2: " Uwe Kleine-König 2023-09-28 7:06 ` [PATCH 06/23] gpio: ftgpio010: " Uwe Kleine-König 2023-09-28 7:06 ` [PATCH 07/23] gpio: grgpio: " Uwe Kleine-König 2023-09-28 7:06 ` [PATCH 08/23] gpio: ljca: " Uwe Kleine-König 2023-09-28 7:06 ` [PATCH 09/23] gpio: lpc18xx: " Uwe Kleine-König 2023-09-28 7:06 ` Uwe Kleine-König 2023-09-28 7:06 ` [PATCH 10/23] gpio: mb86s7x: " Uwe Kleine-König 2023-09-28 7:06 ` [PATCH 11/23] gpio: mm-lantiq: " Uwe Kleine-König 2023-09-28 7:06 ` [PATCH 12/23] gpio: mpc5200: " Uwe Kleine-König 2023-09-28 7:06 ` [PATCH 13/23] gpio: mpc8xxx: " Uwe Kleine-König 2023-09-28 7:06 ` [PATCH 14/23] gpio: omap: " Uwe Kleine-König 2023-09-28 7:06 ` [PATCH 15/23] gpio: rcar: " Uwe Kleine-König 2023-09-28 7:06 ` [PATCH 16/23] gpio: rockchip: " Uwe Kleine-König 2023-09-28 7:06 ` Uwe Kleine-König 2023-09-28 7:06 ` Uwe Kleine-König 2023-10-01 22:45 ` Heiko Stuebner 2023-10-01 22:45 ` Heiko Stuebner 2023-10-01 22:45 ` Heiko Stuebner 2023-09-28 7:07 ` [PATCH 17/23] gpio: tb10x: " Uwe Kleine-König 2023-09-28 7:07 ` [PATCH 18/23] gpio: ts5500: " Uwe Kleine-König 2023-09-28 7:07 ` [PATCH 19/23] gpio: uniphier: " Uwe Kleine-König 2023-09-28 7:07 ` Uwe Kleine-König 2023-09-28 7:07 ` [PATCH 20/23] gpio: xgene-sb: " Uwe Kleine-König 2023-09-28 7:07 ` Uwe Kleine-König [this message] 2023-09-28 7:07 ` [PATCH 21/23] gpio: xgs-iproc: " Uwe Kleine-König 2023-09-28 21:22 ` Florian Fainelli 2023-09-28 21:22 ` Florian Fainelli 2023-09-28 7:07 ` [PATCH 22/23] gpio: xilinx: " Uwe Kleine-König 2023-09-28 7:07 ` Uwe Kleine-König 2023-09-28 8:32 ` Datta, Shubhrajyoti 2023-09-28 8:32 ` Datta, Shubhrajyoti 2023-09-28 7:07 ` [PATCH 23/23] gpio: zynq: " Uwe Kleine-König 2023-09-28 7:07 ` Uwe Kleine-König 2023-09-28 21:54 ` [PATCH 00/23] gpio: " Linus Walleij 2023-09-28 21:54 ` Linus Walleij 2023-09-28 21:54 ` Linus Walleij 2023-10-02 6:52 ` Bartosz Golaszewski 2023-10-02 6:52 ` Bartosz Golaszewski 2023-10-02 6:52 ` Bartosz Golaszewski
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=20230928070706.2290137-22-u.kleine-koenig@pengutronix.de \ --to=u.kleine-koenig@pengutronix.de \ --cc=andy@kernel.org \ --cc=bcm-kernel-feedback-list@broadcom.com \ --cc=brgl@bgdev.pl \ --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=rjui@broadcom.com \ --cc=sbranden@broadcom.com \ /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: linkBe 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.