From patchwork Fri Nov 24 08:06:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 747067 Authentication-Results: smtp.subspace.kernel.org; dkim=none Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C88210D9 for ; Fri, 24 Nov 2023 00:10:47 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r6RGo-0005I2-Tj; Fri, 24 Nov 2023 09:10:38 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r6RGo-00BDaI-6L; Fri, 24 Nov 2023 09:10:38 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1r6RGn-007HhX-TE; Fri, 24 Nov 2023 09:10:37 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Ulf Hansson , Shawn Guo , Sascha Hauer , Linus Walleij , Arnd Bergmann , Pengfei Li , Rob Herring Cc: Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/9] pmdomain: imx-pgc: Convert to platform remove callback returning void Date: Fri, 24 Nov 2023 09:06:25 +0100 Message-ID: <20231124080623.564924-2-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0.586.gbc5204569f7d.dirty In-Reply-To: <20231124080623.564924-1-u.kleine-koenig@pengutronix.de> References: <20231124080623.564924-1-u.kleine-koenig@pengutronix.de> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1955; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=ScaChVC/V9kVu3ZY1XlqRdIWQ3sKRhQOvuoS/CziQJU=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlYFmAFDn11bRSgO85PzcCVt2SoWj1zdCIam3kP t2Snn8JSo6JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZWBZgAAKCRCPgPtYfRL+ Tkp8B/9Tx4X4wh7sDEPlA886O2ZvTcoAutxUdtAa4igcSK1DgiV1/SMjlRM+68oat+kQZ+sehYI 14cRqC4w3vSHdxdAKv3VKlXpFLmpRrZGinarZgDTQxSgi6ur4sQVVmPRqc2O+xf/kxh9WKYjFQB bk8kX0HgCDmBKP7nuzWj3Vn7hKE8E0ob/hp+072bVPY3/XNcaaIbK7OG4O1o+stSn9MlX4JHmkm dCm0DNJzxdHTaOwDv28IeNWRg1WRnf5krEw69AH8AzmPXzU70tq9iZ9x2xGhDzwZkcv4Wa4xTdi gBICvRhNgbImtt26BoT6IMKbZlPwFZtYJdHuNbeYNrkl2bwD X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-pm@vger.kernel.org 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 --- drivers/pmdomain/imx/gpc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/pmdomain/imx/gpc.c b/drivers/pmdomain/imx/gpc.c index 7d81e3171d39..d6cf3759570b 100644 --- a/drivers/pmdomain/imx/gpc.c +++ b/drivers/pmdomain/imx/gpc.c @@ -212,7 +212,7 @@ static int imx_pgc_power_domain_probe(struct platform_device *pdev) return ret; } -static int imx_pgc_power_domain_remove(struct platform_device *pdev) +static void imx_pgc_power_domain_remove(struct platform_device *pdev) { struct imx_pm_domain *domain = pdev->dev.platform_data; @@ -221,8 +221,6 @@ static int imx_pgc_power_domain_remove(struct platform_device *pdev) pm_genpd_remove(&domain->base); imx_pgc_put_clocks(domain); } - - return 0; } static const struct platform_device_id imx_pgc_power_domain_id[] = { @@ -235,7 +233,7 @@ static struct platform_driver imx_pgc_power_domain_driver = { .name = "imx-pgc-pd", }, .probe = imx_pgc_power_domain_probe, - .remove = imx_pgc_power_domain_remove, + .remove_new = imx_pgc_power_domain_remove, .id_table = imx_pgc_power_domain_id, }; builtin_platform_driver(imx_pgc_power_domain_driver) From patchwork Fri Nov 24 08:06:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 747396 Authentication-Results: smtp.subspace.kernel.org; dkim=none Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BC4A10E3 for ; Fri, 24 Nov 2023 00:10:48 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r6RGo-0005I3-U5; Fri, 24 Nov 2023 09:10:38 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r6RGo-00BDaL-GZ; Fri, 24 Nov 2023 09:10:38 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1r6RGo-007Hha-6y; Fri, 24 Nov 2023 09:10:38 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Ulf Hansson , Shawn Guo , Sascha Hauer , Linus Walleij , "Rafael J. Wysocki" , Pengfei Li , Rob Herring Cc: Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/9] pmdomain: imx-gpc: Convert to platform remove callback returning void Date: Fri, 24 Nov 2023 09:06:26 +0100 Message-ID: <20231124080623.564924-3-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0.586.gbc5204569f7d.dirty In-Reply-To: <20231124080623.564924-1-u.kleine-koenig@pengutronix.de> References: <20231124080623.564924-1-u.kleine-koenig@pengutronix.de> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2675; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=mKChXHMFVY1JJWqUlD+w8FECqRJL7ZasmTNw0fEjF3w=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlYFmBSON/a7bIBde/yMEceSyMp/wrEkc+FhAy5 8ivySAIsjKJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZWBZgQAKCRCPgPtYfRL+ TgbNCACYvUoW7hCPSuRRyrdtoNDgvF6/cS23DTEHBUfHrVAmGKxXuDWmluQrw8l4+Y4GFyeKwGh 2r0eO8u699EDCGVIbwQHz0VUfL0OspFhPRawwJ0iFTO8jqS+07YvwZEJF5PKMzJ/w4c3chBenHZ VcM3/ny6LOX+5mcg4IRO4lk6BLrnoN0BkKav4MozA5wPfOoK+3Gu/QtksmYH2ody5CVulJxYxQR caDhN8EQEfQ3+iqJzCGhnOgxze1Z4SiiKP2Zq7hKhoa/PfmiN6rzJFk/pbTDW+gFwTRvIaaa/MZ KrtIWSpLDmdNlWMtgRCzxAF/qiXeCMmT2dv2PgJHQ3WhCh1m X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-pm@vger.kernel.org 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(). In the error path emit an error message replacing the (less useful) message by the core. Apart from the improved error message there is no change in behaviour. Signed-off-by: Uwe Kleine-König --- drivers/pmdomain/imx/gpc.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/pmdomain/imx/gpc.c b/drivers/pmdomain/imx/gpc.c index d6cf3759570b..9517cce93d8a 100644 --- a/drivers/pmdomain/imx/gpc.c +++ b/drivers/pmdomain/imx/gpc.c @@ -509,7 +509,7 @@ static int imx_gpc_probe(struct platform_device *pdev) return 0; } -static int imx_gpc_remove(struct platform_device *pdev) +static void imx_gpc_remove(struct platform_device *pdev) { struct device_node *pgc_node; int ret; @@ -519,7 +519,7 @@ static int imx_gpc_remove(struct platform_device *pdev) /* bail out if DT too old and doesn't provide the necessary info */ if (!of_property_read_bool(pdev->dev.of_node, "#power-domain-cells") && !pgc_node) - return 0; + return; /* * If the old DT binding is used the toplevel driver needs to @@ -529,16 +529,20 @@ static int imx_gpc_remove(struct platform_device *pdev) of_genpd_del_provider(pdev->dev.of_node); ret = pm_genpd_remove(&imx_gpc_domains[GPC_PGC_DOMAIN_PU].base); - if (ret) - return ret; + if (ret) { + dev_err(&pdev->dev, "Failed to remove PU power domain (%pe)\n", + ERR_PTR(ret)); + return; + } imx_pgc_put_clocks(&imx_gpc_domains[GPC_PGC_DOMAIN_PU]); ret = pm_genpd_remove(&imx_gpc_domains[GPC_PGC_DOMAIN_ARM].base); - if (ret) - return ret; + if (ret) { + dev_err(&pdev->dev, "Failed to remove ARM power domain (%pe)\n", + ERR_PTR(ret)); + return; + } } - - return 0; } static struct platform_driver imx_gpc_driver = { @@ -547,6 +551,6 @@ static struct platform_driver imx_gpc_driver = { .of_match_table = imx_gpc_dt_ids, }, .probe = imx_gpc_probe, - .remove = imx_gpc_remove, + .remove_new = imx_gpc_remove, }; builtin_platform_driver(imx_gpc_driver) From patchwork Fri Nov 24 08:06:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 747398 Authentication-Results: smtp.subspace.kernel.org; dkim=none Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D2ADD73 for ; Fri, 24 Nov 2023 00:10:47 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r6RGp-0005I5-4I; Fri, 24 Nov 2023 09:10:39 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r6RGo-00BDaO-Md; Fri, 24 Nov 2023 09:10:38 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1r6RGo-007Hhf-D8; Fri, 24 Nov 2023 09:10:38 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Ulf Hansson , Shawn Guo , Sascha Hauer , "Rafael J. Wysocki" , Saravana Kannan , Linus Walleij Cc: Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 3/9] pmdomain: imx-gpcv2: Convert to platform remove callback returning void Date: Fri, 24 Nov 2023 09:06:27 +0100 Message-ID: <20231124080623.564924-4-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0.586.gbc5204569f7d.dirty In-Reply-To: <20231124080623.564924-1-u.kleine-koenig@pengutronix.de> References: <20231124080623.564924-1-u.kleine-koenig@pengutronix.de> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1876; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=dAOeMNKhHCDwwE6c9MHcnFhpVgfSNdxWzXiPKY4g5es=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlYFmCxVLnSZhIslltbQeBloQtDxcEOXHqj2Ect XaTJfQr2QWJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZWBZggAKCRCPgPtYfRL+ To7aCACxQixfrha80IEqSOawYFwgFgpRh9dJZ71jLo1QwPOabpWx1Z+l5jZwFlMl+pU3oIvTn5K nChatBkTRO4OvdUmibLzlAEiTOtGu/fwVqdyCHSJU+sciUt5vVYUlkK7CdY3g7GwE9wvE40pvX7 8y+ArkCekecKI0kF+svonV5OhF7LCfgxg63JPS+fNTFQaT4xq2OrpK0HyyybeNfiAqT4bjd0ky8 dIl62oLQERa+w3IppMAZvTHT8Oz7VLAb+NULjxikA8V11QnQC5zzjmzNzBMdkQ57/lhz6UlthL1 7dSxFMpwO4ArArTJCyZ2Ngm7DodNLy+/bfczN5Xb9buZMMap X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-pm@vger.kernel.org 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 --- drivers/pmdomain/imx/gpcv2.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/pmdomain/imx/gpcv2.c b/drivers/pmdomain/imx/gpcv2.c index fbd3d92f8cd8..4b828d74a606 100644 --- a/drivers/pmdomain/imx/gpcv2.c +++ b/drivers/pmdomain/imx/gpcv2.c @@ -1373,7 +1373,7 @@ static int imx_pgc_domain_probe(struct platform_device *pdev) return ret; } -static int imx_pgc_domain_remove(struct platform_device *pdev) +static void imx_pgc_domain_remove(struct platform_device *pdev) { struct imx_pgc_domain *domain = pdev->dev.platform_data; @@ -1385,8 +1385,6 @@ static int imx_pgc_domain_remove(struct platform_device *pdev) domain->bits.map, 0); pm_runtime_disable(domain->dev); - - return 0; } #ifdef CONFIG_PM_SLEEP @@ -1430,7 +1428,7 @@ static struct platform_driver imx_pgc_domain_driver = { .pm = &imx_pgc_domain_pm_ops, }, .probe = imx_pgc_domain_probe, - .remove = imx_pgc_domain_remove, + .remove_new = imx_pgc_domain_remove, .id_table = imx_pgc_domain_id, }; builtin_platform_driver(imx_pgc_domain_driver) From patchwork Fri Nov 24 08:06:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 747070 Authentication-Results: smtp.subspace.kernel.org; dkim=none Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5706B130 for ; Fri, 24 Nov 2023 00:10:46 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r6RGp-0005J9-EQ; Fri, 24 Nov 2023 09:10:39 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r6RGo-00BDaR-W2; Fri, 24 Nov 2023 09:10:39 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1r6RGo-007Hhj-MB; Fri, 24 Nov 2023 09:10:38 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Ulf Hansson , Shawn Guo , Sascha Hauer , Marco Felsch , Peng Fan , Jindong Yue , Lucas Stach , Marek Vasut Cc: Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 4/9] pmdomain: imx8m-blk-ctrl: Convert to platform remove callback returning void Date: Fri, 24 Nov 2023 09:06:28 +0100 Message-ID: <20231124080623.564924-5-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0.586.gbc5204569f7d.dirty In-Reply-To: <20231124080623.564924-1-u.kleine-koenig@pengutronix.de> References: <20231124080623.564924-1-u.kleine-koenig@pengutronix.de> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1958; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=9RtY4MHRyMFr8MKYXUlCW/f4TJPgb2MyEcC0qhlYUuE=; b=owGbwMvMwMXY3/A7olbonx/jabUkhtSEyBbrjUsy1uf8mHO5wpqvUeyEb0uxuuCBBvVTf7Nkq 80V3tZ1MhqzMDByMciKKbLYN67JtKqSi+xc++8yzCBWJpApDFycAjARxznsf0WcPF+7xL21Z9sV X8CQnrfNfuv2xx43he8+Dl04JXBt3e6dl+p+LC33i9+bl5selqu1tqsnfNf/3H6HrNSDIgyCDm/ /fr2/bX2RUrTwU7bskrW5s6vdfl6Y43rMyNZLuDje8ER3x3GbY9+56/ha/j2MLtZiTph77nDsBf ajs9t3LxVn3q35re1B7LbLOnr7OoUsZT0lP5YGd78PvPorPZDncLuj4GZ+9vIlD9Nnaqqxvav/P jPef9G7w5G/jgtNcEqfXxhffFHgelJmlYvfwaT5a8ot2QPDrGaYlZz6tPHH3pA4wa5s60tfJB8v ZpGSznYQuvM6jEvr/3TRDUl+hqskf+tJZJkyPdqoVfUBAA== X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-pm@vger.kernel.org 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 --- drivers/pmdomain/imx/imx8m-blk-ctrl.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/pmdomain/imx/imx8m-blk-ctrl.c b/drivers/pmdomain/imx/imx8m-blk-ctrl.c index cc5ef6e2f0a8..1341a707f61b 100644 --- a/drivers/pmdomain/imx/imx8m-blk-ctrl.c +++ b/drivers/pmdomain/imx/imx8m-blk-ctrl.c @@ -330,7 +330,7 @@ static int imx8m_blk_ctrl_probe(struct platform_device *pdev) return ret; } -static int imx8m_blk_ctrl_remove(struct platform_device *pdev) +static void imx8m_blk_ctrl_remove(struct platform_device *pdev) { struct imx8m_blk_ctrl *bc = dev_get_drvdata(&pdev->dev); int i; @@ -347,8 +347,6 @@ static int imx8m_blk_ctrl_remove(struct platform_device *pdev) dev_pm_genpd_remove_notifier(bc->bus_power_dev); dev_pm_domain_detach(bc->bus_power_dev, true); - - return 0; } #ifdef CONFIG_PM_SLEEP @@ -888,7 +886,7 @@ MODULE_DEVICE_TABLE(of, imx8m_blk_ctrl_of_match); static struct platform_driver imx8m_blk_ctrl_driver = { .probe = imx8m_blk_ctrl_probe, - .remove = imx8m_blk_ctrl_remove, + .remove_new = imx8m_blk_ctrl_remove, .driver = { .name = "imx8m-blk-ctrl", .pm = &imx8m_blk_ctrl_pm_ops, From patchwork Fri Nov 24 08:06:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 747399 Authentication-Results: smtp.subspace.kernel.org; dkim=none Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C949ED44 for ; Fri, 24 Nov 2023 00:10:45 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r6RGp-0005Jn-KJ; Fri, 24 Nov 2023 09:10:39 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r6RGp-00BDaX-65; Fri, 24 Nov 2023 09:10:39 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1r6RGo-007Hhn-T3; Fri, 24 Nov 2023 09:10:38 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Ulf Hansson , Shawn Guo , Sascha Hauer , Lucas Stach , Peng Fan , Jindong Yue , Marco Felsch Cc: Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 5/9] pmdomain: imx8mp-blk-ctrl: Convert to platform remove callback returning void Date: Fri, 24 Nov 2023 09:06:29 +0100 Message-ID: <20231124080623.564924-6-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0.586.gbc5204569f7d.dirty In-Reply-To: <20231124080623.564924-1-u.kleine-koenig@pengutronix.de> References: <20231124080623.564924-1-u.kleine-koenig@pengutronix.de> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1975; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=J5TKZe9XLCtZo13dKntrQAhmrW1hBWN7ep3GErxGSb4=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlYFmFzRQ+zF7AayhzjkInvefSsyDYQVsRWydC2 ExeqteDVgaJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZWBZhQAKCRCPgPtYfRL+ TuerCACjUkhJOMTAWU5F7ffBVTR02zxyGwXwDjPmTyAB7JwraU26/yU8U0fMz8Nw6fqdo7i636Q uCTzHklNV/XddZcv5JET/PNz9mdO8KS7shoVHBxjQKd59/Cgrn+uBRpXbq2AFrkFyl50fUdQedS SFUwf8L8/Zk96wOmqvK+bHbU6/M/eXv2b6V1naO6QM29/9JeJko9Q6zOzm0m+qJX/a9+7vmVZfW OZdYexRy5xmhAh1U50TH8ZRQg7s1RwCwlbODRIW7SOsBCH3v/lOzrUwdp8ixUIlf2dLs/Cz/swe W22tBXxsSzXq4KaxBXaouzEdebmasB9SxvFfhxtY84/IFsYD X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-pm@vger.kernel.org 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 --- drivers/pmdomain/imx/imx8mp-blk-ctrl.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/pmdomain/imx/imx8mp-blk-ctrl.c b/drivers/pmdomain/imx/imx8mp-blk-ctrl.c index c6ac32c1a8c1..e3203eb6a022 100644 --- a/drivers/pmdomain/imx/imx8mp-blk-ctrl.c +++ b/drivers/pmdomain/imx/imx8mp-blk-ctrl.c @@ -760,7 +760,7 @@ static int imx8mp_blk_ctrl_probe(struct platform_device *pdev) return ret; } -static int imx8mp_blk_ctrl_remove(struct platform_device *pdev) +static void imx8mp_blk_ctrl_remove(struct platform_device *pdev) { struct imx8mp_blk_ctrl *bc = dev_get_drvdata(&pdev->dev); int i; @@ -777,8 +777,6 @@ static int imx8mp_blk_ctrl_remove(struct platform_device *pdev) dev_pm_genpd_remove_notifier(bc->bus_power_dev); dev_pm_domain_detach(bc->bus_power_dev, true); - - return 0; } #ifdef CONFIG_PM_SLEEP @@ -856,7 +854,7 @@ MODULE_DEVICE_TABLE(of, imx8mp_blk_ctrl_of_match); static struct platform_driver imx8mp_blk_ctrl_driver = { .probe = imx8mp_blk_ctrl_probe, - .remove = imx8mp_blk_ctrl_remove, + .remove_new = imx8mp_blk_ctrl_remove, .driver = { .name = "imx8mp-blk-ctrl", .pm = &imx8mp_blk_ctrl_pm_ops, From patchwork Fri Nov 24 08:06:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 747397 Authentication-Results: smtp.subspace.kernel.org; dkim=none Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02EC811F for ; Fri, 24 Nov 2023 00:10:48 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r6RGp-0005Ko-Tt; Fri, 24 Nov 2023 09:10:39 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r6RGp-00BDab-Fu; Fri, 24 Nov 2023 09:10:39 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1r6RGp-007Hhq-5q; Fri, 24 Nov 2023 09:10:39 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Ulf Hansson , Shawn Guo , Sascha Hauer , Linus Walleij , Arnd Bergmann , "Rafael J. Wysocki" Cc: Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 6/9] pmdomain: imx93-blk-ctrl: Convert to platform remove callback returning void Date: Fri, 24 Nov 2023 09:06:30 +0100 Message-ID: <20231124080623.564924-7-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0.586.gbc5204569f7d.dirty In-Reply-To: <20231124080623.564924-1-u.kleine-koenig@pengutronix.de> References: <20231124080623.564924-1-u.kleine-koenig@pengutronix.de> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1973; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=qlTqRAkHlYmqKK29fATW8unizLMrfP09jkrBAih35fw=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlYFmG/UN8qYgG4O1CAZiiL7Pgwp2kRFh2lpG9c rcJb5XPWPKJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZWBZhgAKCRCPgPtYfRL+ TjhvCACxH0KfYKXiutfgoinNuzIIxkpnBLcXyGmmDksEkYt1HQdGYhuc0HveuhkcvNn7q6HkxRH XgWShZ1hyUiXNTUKxMrrvhXcUzBLQnMDaZ8WChtpvDUwNKk///wHYIH7V2ltNnKMLMO6WmF1IV1 6nkoZ49n765pD0YoVemRbtyniNnL8f3GwntkOmoepA8hCVF5e7JaXDpQ6yt/n3Lbnf0Daq3QesD HDDy5dc5bjqiP3KF+mNDd449hONfGmujz1/IBm5r976ZL7bz+n/uzwg/uo9joL8q2r20JI1EKHT 8T+0dX/70a8IQsg91ItxYEj5ZZt14QXMFI5QhKzYYmVc9mJo X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-pm@vger.kernel.org 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 --- drivers/pmdomain/imx/imx93-blk-ctrl.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/pmdomain/imx/imx93-blk-ctrl.c b/drivers/pmdomain/imx/imx93-blk-ctrl.c index 40bd90f8b977..904ffa55b8f4 100644 --- a/drivers/pmdomain/imx/imx93-blk-ctrl.c +++ b/drivers/pmdomain/imx/imx93-blk-ctrl.c @@ -306,7 +306,7 @@ static int imx93_blk_ctrl_probe(struct platform_device *pdev) return ret; } -static int imx93_blk_ctrl_remove(struct platform_device *pdev) +static void imx93_blk_ctrl_remove(struct platform_device *pdev) { struct imx93_blk_ctrl *bc = dev_get_drvdata(&pdev->dev); int i; @@ -318,8 +318,6 @@ static int imx93_blk_ctrl_remove(struct platform_device *pdev) pm_genpd_remove(&domain->genpd); } - - return 0; } static const struct imx93_blk_ctrl_domain_data imx93_media_blk_ctl_domain_data[] = { @@ -438,7 +436,7 @@ MODULE_DEVICE_TABLE(of, imx93_blk_ctrl_of_match); static struct platform_driver imx93_blk_ctrl_driver = { .probe = imx93_blk_ctrl_probe, - .remove = imx93_blk_ctrl_remove, + .remove_new = imx93_blk_ctrl_remove, .driver = { .name = "imx93-blk-ctrl", .of_match_table = imx93_blk_ctrl_of_match, From patchwork Fri Nov 24 08:06:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 747069 Authentication-Results: smtp.subspace.kernel.org; dkim=none Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48C2210C9 for ; Fri, 24 Nov 2023 00:10:47 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r6RGq-0005Lb-5P; Fri, 24 Nov 2023 09:10:40 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r6RGp-00BDaf-M7; Fri, 24 Nov 2023 09:10:39 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1r6RGp-007Hhv-Ch; Fri, 24 Nov 2023 09:10:39 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Ulf Hansson , Shawn Guo , Sascha Hauer , Linus Walleij , Arnd Bergmann , Deepak R Varma Cc: Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 7/9] pmdomain: imx93-pd: Convert to platform remove callback returning void Date: Fri, 24 Nov 2023 09:06:31 +0100 Message-ID: <20231124080623.564924-8-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0.586.gbc5204569f7d.dirty In-Reply-To: <20231124080623.564924-1-u.kleine-koenig@pengutronix.de> References: <20231124080623.564924-1-u.kleine-koenig@pengutronix.de> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1885; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=yy9gFuFNpTLc/Pe0aEdJde7KOwn/xDLMN/UNcrEXH34=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlYFmHUZpLEUUV3mYdabWBwU87kR9TLyLhza+Y3 uwAWZ5Z02SJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZWBZhwAKCRCPgPtYfRL+ Tr99CACMuZoZzrgU6ld8SXN7idj3I7cjJlqRT+NB/oqr57VuP6FBd0hGfuP4ksBeH7dykRJbie2 jw+cBZBfz4zAln7CTVPyqO0vtWzGgbUyoc+WLz0VUmC5rzZLlMrVLkNP1KJ4ra4kpk0zviJAxiy m3MnC7ayg00mfxqZWl8aXzOKJ0WANucH+pllNr58S9EOi7uh/jPYwmN3WnWhtl4yI2Ythdizaru xCUqQ28kqu6PsGR0NpM84/Dvtizl83mgTFRq5D29QO5PygHm979i2MKbv6uSrPLTFxykWEzNb3x L2mxIhjwppFERbtNBV8a2DBmVhI2IJvzRA3cKnIL4IlRuPLr X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-pm@vger.kernel.org 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 --- drivers/pmdomain/imx/imx93-pd.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/pmdomain/imx/imx93-pd.c b/drivers/pmdomain/imx/imx93-pd.c index b9e60d136875..1e94b499c19b 100644 --- a/drivers/pmdomain/imx/imx93-pd.c +++ b/drivers/pmdomain/imx/imx93-pd.c @@ -83,7 +83,7 @@ static int imx93_pd_off(struct generic_pm_domain *genpd) return 0; }; -static int imx93_pd_remove(struct platform_device *pdev) +static void imx93_pd_remove(struct platform_device *pdev) { struct imx93_power_domain *domain = platform_get_drvdata(pdev); struct device *dev = &pdev->dev; @@ -94,8 +94,6 @@ static int imx93_pd_remove(struct platform_device *pdev) of_genpd_del_provider(np); pm_genpd_remove(&domain->genpd); - - return 0; } static int imx93_pd_probe(struct platform_device *pdev) @@ -167,7 +165,7 @@ static struct platform_driver imx93_power_domain_driver = { .of_match_table = imx93_pd_ids, }, .probe = imx93_pd_probe, - .remove = imx93_pd_remove, + .remove_new = imx93_pd_remove, }; module_platform_driver(imx93_power_domain_driver); From patchwork Fri Nov 24 08:06:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 747068 Authentication-Results: smtp.subspace.kernel.org; dkim=none Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEB56DD for ; Fri, 24 Nov 2023 00:10:47 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r6RGq-0005NC-BY; Fri, 24 Nov 2023 09:10:40 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r6RGp-00BDaj-Rb; Fri, 24 Nov 2023 09:10:39 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1r6RGp-007Hhy-If; Fri, 24 Nov 2023 09:10:39 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Bjorn Andersson , Konrad Dybcio , Andy Gross , Ulf Hansson Cc: linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, Pengutronix Kernel Team Subject: [PATCH 8/9] pmdomain: qcom-cpr: Convert to platform remove callback returning void Date: Fri, 24 Nov 2023 09:06:32 +0100 Message-ID: <20231124080623.564924-9-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0.586.gbc5204569f7d.dirty In-Reply-To: <20231124080623.564924-1-u.kleine-koenig@pengutronix.de> References: <20231124080623.564924-1-u.kleine-koenig@pengutronix.de> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1809; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=TvkOctt3AvlLAkuA7GxL6uPUOFK92fQI8cfQjr4qIY4=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlYFmIBeEvg/DyHJK/ahO9lV4PP34uEyctNMj+E cvI46N0asaJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZWBZiAAKCRCPgPtYfRL+ TlbdB/4qFE6/+10hVsz5J3BFePCqlF3xG9CFjV2dCmRPIfeL04RQZck3uHBTNMAWUKaoR+M++um Ncmq54V7xeWL3fIZ87Tukz3BHf8ZWQTJpyVZRWYP2tJknmIoBP5UXR1OjSzNX7pljM1Ke9nal8S Zn7Ql113eqKA/9um2mvKOmA/L4wxLqUsrjJw6krM3bW6UCgXhqOasyYGRFdB7AbS9og1Zq2wqzn ddk1auq9SU6A6ofhsTaKFYB3vX5yykuxbzGis6+GI2QmGOxkJ36wMVddwzmUcI2SrV0MNXV4C+U RInXtGrSPiRXSqCTXLAa1ioghWI9nsvV6FubE8nfuO5VO3Fp X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-pm@vger.kernel.org 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 --- drivers/pmdomain/qcom/cpr.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/pmdomain/qcom/cpr.c b/drivers/pmdomain/qcom/cpr.c index e9dd42bded6f..c64e84a27cc7 100644 --- a/drivers/pmdomain/qcom/cpr.c +++ b/drivers/pmdomain/qcom/cpr.c @@ -1712,7 +1712,7 @@ static int cpr_probe(struct platform_device *pdev) return ret; } -static int cpr_remove(struct platform_device *pdev) +static void cpr_remove(struct platform_device *pdev) { struct cpr_drv *drv = platform_get_drvdata(pdev); @@ -1725,8 +1725,6 @@ static int cpr_remove(struct platform_device *pdev) pm_genpd_remove(&drv->pd); debugfs_remove_recursive(drv->debugfs); - - return 0; } static const struct of_device_id cpr_match_table[] = { @@ -1737,7 +1735,7 @@ MODULE_DEVICE_TABLE(of, cpr_match_table); static struct platform_driver cpr_driver = { .probe = cpr_probe, - .remove = cpr_remove, + .remove_new = cpr_remove, .driver = { .name = "qcom-cpr", .of_match_table = cpr_match_table, From patchwork Fri Nov 24 08:06:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 747071 Authentication-Results: smtp.subspace.kernel.org; dkim=none Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C91F61BD for ; Fri, 24 Nov 2023 00:10:45 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r6RGq-0005Ot-H0; Fri, 24 Nov 2023 09:10:40 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r6RGq-00BDan-1e; Fri, 24 Nov 2023 09:10:40 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1r6RGp-007Hi2-Ob; Fri, 24 Nov 2023 09:10:39 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Ulf Hansson , Michal Simek , Linus Walleij , Heiko Stuebner , Arnd Bergmann , "Rafael J. Wysocki" Cc: linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Pengutronix Kernel Team Subject: [PATCH 9/9] pmdomain: xilinx/zynqmp: Convert to platform remove callback returning void Date: Fri, 24 Nov 2023 09:06:33 +0100 Message-ID: <20231124080623.564924-10-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0.586.gbc5204569f7d.dirty In-Reply-To: <20231124080623.564924-1-u.kleine-koenig@pengutronix.de> References: <20231124080623.564924-1-u.kleine-koenig@pengutronix.de> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1768; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=C8Pg2Nx+J98OmOxnB4V+j482CtteM/2CgjpQBglZCAU=; b=owGbwMvMwMXY3/A7olbonx/jabUkhtSEyE67lfUdNpIzRaQVM7MdueOOZMoW12vXii+v0l3qy Jwgo9PJaMzCwMjFICumyGLfuCbTqkousnPtv8swg1iZQKYwcHEKwEQ8znIwrJZpU23POnS9I1aA jzFi0bQWwdvn7zOvX3/w/OE/134yr57xVdfCwIvRbe7P1OZTO2es+Ln1jbCxQ7OT0uyG5v5Ve4L aN80ofSylso5zQpbzba/DIf/8Wio7Pi18+InVcY531GyfVG7Nbxbzf+0IX/GuaTOX5dq43NcOws 5zIpZ0ZorcEnEWY5K9WigmbB/uVOjbfU7KfHJqp9X/uV1yWpfCVoQfPjd3PedZXpmo99ku95v3O DxI8sub1ZTyTNYv+76vqd8NzrMdr7ZGKf/9Oc/O/lxdw9eZWzat7GJaFP/IsObH/H1mcmoxfKkC byXKo/YpBc78dNJ+wiGFori7GhM/OT9kirT3VF59bEIJAA== X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-pm@vger.kernel.org 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 --- drivers/pmdomain/xilinx/zynqmp-pm-domains.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/pmdomain/xilinx/zynqmp-pm-domains.c b/drivers/pmdomain/xilinx/zynqmp-pm-domains.c index 69d03ad4cf1e..6fd514286d82 100644 --- a/drivers/pmdomain/xilinx/zynqmp-pm-domains.c +++ b/drivers/pmdomain/xilinx/zynqmp-pm-domains.c @@ -293,11 +293,9 @@ static int zynqmp_gpd_probe(struct platform_device *pdev) return 0; } -static int zynqmp_gpd_remove(struct platform_device *pdev) +static void zynqmp_gpd_remove(struct platform_device *pdev) { of_genpd_del_provider(pdev->dev.parent->of_node); - - return 0; } static void zynqmp_gpd_sync_state(struct device *dev) @@ -315,7 +313,7 @@ static struct platform_driver zynqmp_power_domain_driver = { .sync_state = zynqmp_gpd_sync_state, }, .probe = zynqmp_gpd_probe, - .remove = zynqmp_gpd_remove, + .remove_new = zynqmp_gpd_remove, }; module_platform_driver(zynqmp_power_domain_driver);