linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/31] phy: Convert to platform remove callback returning void
@ 2023-03-07 11:58 Uwe Kleine-König
  2023-03-07 11:58 ` [PATCH 12/31] phy: qualcomm: phy-qcom-apq8064-sata: " Uwe Kleine-König
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2023-03-07 11:58 UTC (permalink / raw)
  To: Vinod Koul, Kishon Vijay Abraham I, Chen-Yu Tsai, Jernej Skrabec,
	Samuel Holland, Andre Przywara, Wolfram Sang, Icenowy Zheng,
	Justin Chen, Al Cooper, Pratyush Yadav, Rahul T R,
	Swapnil Jakhade, Lars-Peter Clausen, Shawn Guo, Sascha Hauer,
	Liu Ying, Yuan Can, Chun-Kuang Hu, Philipp Zabel, Chunfeng Yun,
	Matthias Brugger, Thomas Gleixner, Allison Randal,
	Greg Kroah-Hartman, Miaoqian Lin, Andy Gross, Bjorn Andersson,
	Yoshihiro Shimoda, Heiko Stuebner, Maxime Coquelin,
	Alexandre Torgue, Amelie Delaunay, Dan Carpenter,
	Fabrice Gasnier, JC Kuo, Thierry Reding, Jonathan Hunter,
	Roger Quadros, Matt Ranostay, Sinthu Raja, Vignesh Raghavendra,
	Tanmay Patil, Siddharth Vadapalli, Lv Ruyi
  Cc: linux-phy, linux-arm-kernel, linux-sunxi, kernel,
	Broadcom internal kernel review list, Fabio Estevam,
	NXP Linux Team, AngeloGioacchino Del Regno, dri-devel,
	linux-mediatek, Konrad Dybcio, linux-arm-msm, linux-renesas-soc,
	linux-rockchip, linux-stm32, linux-tegra

Hello,

this patch series adapts the platform drivers below drivers/phy to use the
.remove_new() callback. Compared to the traditional .remove() callback
.remove_new() returns no value. This is a good thing because the driver core
doesn't (and cannot) cope for errors during remove. The only effect of a
non-zero return value in .remove() is that the driver core emits a warning. The
device is removed anyhow and an early return from .remove() usually yields a
resource leak.

By changing the remove callback to return void driver authors cannot
reasonably assume any more that there is some kind of cleanup later.

All drivers in drivers/spmi returned zero unconditionally in their remove
callback, so they could all be converted trivially to .remove_new().

Note that this series depends on commit 5c5a7680e67b ("platform: Provide
a remove callback that returns no value") which is included in v6.3-rc1.

Best regards
Uwe

Uwe Kleine-König (31):
  phy: allwinner: phy-sun4i-usb: Convert to platform remove callback
    returning void
  phy: broadcom: phy-brcm-usb: Convert to platform remove callback
    returning void
  phy: cadence: cdns-dphy: Convert to platform remove callback returning
    void
  phy: cadence: phy-cadence-sierra: Convert to platform remove callback
    returning void
  phy: cadence: phy-cadence-torrent: Convert to platform remove callback
    returning void
  phy: freescale: phy-fsl-imx8qm-lvds-phy: Convert to platform remove
    callback returning void
  phy: intel: phy-intel-lgm-combo: Convert to platform remove callback
    returning void
  phy: mediatek: phy-mtk-mipi-dsi: Convert to platform remove callback
    returning void
  phy: motorola: phy-cpcap-usb: Convert to platform remove callback
    returning void
  phy: motorola: phy-mapphone-mdm6600: Convert to platform remove
    callback returning void
  phy: phy-lgm-usb: Convert to platform remove callback returning void
  phy: qualcomm: phy-qcom-apq8064-sata: Convert to platform remove
    callback returning void
  phy: qualcomm: phy-qcom-eusb2-repeater: Convert to platform remove
    callback returning void
  phy: qualcomm: phy-qcom-ipq806x-sata: Convert to platform remove
    callback returning void
  phy: renesas: phy-rcar-gen3-pcie: Convert to platform remove callback
    returning void
  phy: renesas: phy-rcar-gen3-usb2: Convert to platform remove callback
    returning void
  phy: renesas: phy-rcar-gen3-usb3: Convert to platform remove callback
    returning void
  phy: renesas: r8a779f0-ether-serdes: Convert to platform remove
    callback returning void
  phy: rockchip: phy-rockchip-inno-csidphy: Convert to platform remove
    callback returning void
  phy: rockchip: phy-rockchip-inno-dsidphy: Convert to platform remove
    callback returning void
  phy: rockchip: phy-rockchip-inno-hdmi: Convert to platform remove
    callback returning void
  phy: rockchip: phy-rockchip-typec: Convert to platform remove callback
    returning void
  phy: st: phy-stm32-usbphyc: Convert to platform remove callback
    returning void
  phy: tegra: xusb: Convert to platform remove callback returning void
  phy: ti: phy-am654-serdes: Convert to platform remove callback
    returning void
  phy: ti: phy-da8xx-usb: Convert to platform remove callback returning
    void
  phy: ti: phy-dm816x-usb: Convert to platform remove callback returning
    void
  phy: ti: phy-j721e-wiz: Convert to platform remove callback returning
    void
  phy: ti: phy-omap-usb2: Convert to platform remove callback returning
    void
  phy: ti: phy-ti-pipe3: Convert to platform remove callback returning
    void
  phy: ti: phy-twl4030-usb: Convert to platform remove callback
    returning void

 drivers/phy/allwinner/phy-sun4i-usb.c            | 6 ++----
 drivers/phy/broadcom/phy-brcm-usb.c              | 6 ++----
 drivers/phy/cadence/cdns-dphy.c                  | 6 ++----
 drivers/phy/cadence/phy-cadence-sierra.c         | 6 ++----
 drivers/phy/cadence/phy-cadence-torrent.c        | 6 ++----
 drivers/phy/freescale/phy-fsl-imx8qm-lvds-phy.c  | 6 ++----
 drivers/phy/intel/phy-intel-lgm-combo.c          | 5 ++---
 drivers/phy/mediatek/phy-mtk-mipi-dsi.c          | 5 ++---
 drivers/phy/motorola/phy-cpcap-usb.c             | 6 ++----
 drivers/phy/motorola/phy-mapphone-mdm6600.c      | 6 ++----
 drivers/phy/phy-lgm-usb.c                        | 6 ++----
 drivers/phy/qualcomm/phy-qcom-apq8064-sata.c     | 6 ++----
 drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c   | 8 +++-----
 drivers/phy/qualcomm/phy-qcom-ipq806x-sata.c     | 6 ++----
 drivers/phy/renesas/phy-rcar-gen3-pcie.c         | 6 ++----
 drivers/phy/renesas/phy-rcar-gen3-usb2.c         | 6 ++----
 drivers/phy/renesas/phy-rcar-gen3-usb3.c         | 6 ++----
 drivers/phy/renesas/r8a779f0-ether-serdes.c      | 6 ++----
 drivers/phy/rockchip/phy-rockchip-inno-csidphy.c | 6 ++----
 drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c | 6 ++----
 drivers/phy/rockchip/phy-rockchip-inno-hdmi.c    | 6 ++----
 drivers/phy/rockchip/phy-rockchip-typec.c        | 6 ++----
 drivers/phy/st/phy-stm32-usbphyc.c               | 6 ++----
 drivers/phy/tegra/xusb.c                         | 6 ++----
 drivers/phy/ti/phy-am654-serdes.c                | 6 ++----
 drivers/phy/ti/phy-da8xx-usb.c                   | 6 ++----
 drivers/phy/ti/phy-dm816x-usb.c                  | 6 ++----
 drivers/phy/ti/phy-j721e-wiz.c                   | 6 ++----
 drivers/phy/ti/phy-omap-usb2.c                   | 6 ++----
 drivers/phy/ti/phy-ti-pipe3.c                    | 6 ++----
 drivers/phy/ti/phy-twl4030-usb.c                 | 6 ++----
 31 files changed, 63 insertions(+), 123 deletions(-)

base-commit: fe15c26ee26efa11741a7b632e9f23b01aca4cc6
-- 
2.39.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 12/31] phy: qualcomm: phy-qcom-apq8064-sata: Convert to platform remove callback returning void
  2023-03-07 11:58 [PATCH 00/31] phy: Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-03-07 11:58 ` Uwe Kleine-König
  2023-03-07 11:58 ` [PATCH 13/31] phy: qualcomm: phy-qcom-eusb2-repeater: " Uwe Kleine-König
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2023-03-07 11:58 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Vinod Koul, Kishon Vijay Abraham I
  Cc: Konrad Dybcio, linux-arm-msm, linux-phy, kernel

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.

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/phy/qualcomm/phy-qcom-apq8064-sata.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/phy/qualcomm/phy-qcom-apq8064-sata.c b/drivers/phy/qualcomm/phy-qcom-apq8064-sata.c
index d437a249cd73..8814f4322adf 100644
--- a/drivers/phy/qualcomm/phy-qcom-apq8064-sata.c
+++ b/drivers/phy/qualcomm/phy-qcom-apq8064-sata.c
@@ -243,13 +243,11 @@ static int qcom_apq8064_sata_phy_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int qcom_apq8064_sata_phy_remove(struct platform_device *pdev)
+static void qcom_apq8064_sata_phy_remove(struct platform_device *pdev)
 {
 	struct qcom_apq8064_sata_phy *phy = platform_get_drvdata(pdev);
 
 	clk_disable_unprepare(phy->cfg_clk);
-
-	return 0;
 }
 
 static const struct of_device_id qcom_apq8064_sata_phy_of_match[] = {
@@ -260,7 +258,7 @@ MODULE_DEVICE_TABLE(of, qcom_apq8064_sata_phy_of_match);
 
 static struct platform_driver qcom_apq8064_sata_phy_driver = {
 	.probe	= qcom_apq8064_sata_phy_probe,
-	.remove	= qcom_apq8064_sata_phy_remove,
+	.remove_new = qcom_apq8064_sata_phy_remove,
 	.driver = {
 		.name	= "qcom-apq8064-sata-phy",
 		.of_match_table	= qcom_apq8064_sata_phy_of_match,
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 13/31] phy: qualcomm: phy-qcom-eusb2-repeater: Convert to platform remove callback returning void
  2023-03-07 11:58 [PATCH 00/31] phy: Convert to platform remove callback returning void Uwe Kleine-König
  2023-03-07 11:58 ` [PATCH 12/31] phy: qualcomm: phy-qcom-apq8064-sata: " Uwe Kleine-König
@ 2023-03-07 11:58 ` Uwe Kleine-König
  2023-03-07 11:58 ` [PATCH 14/31] phy: qualcomm: phy-qcom-ipq806x-sata: " Uwe Kleine-König
  2023-03-20 11:38 ` [PATCH 00/31] phy: " Vinod Koul
  3 siblings, 0 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2023-03-07 11:58 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Vinod Koul, Kishon Vijay Abraham I
  Cc: Konrad Dybcio, linux-arm-msm, linux-phy, kernel

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.

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/phy/qualcomm/phy-qcom-eusb2-repeater.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c b/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c
index 3f265ac2df20..90f8543ba265 100644
--- a/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c
+++ b/drivers/phy/qualcomm/phy-qcom-eusb2-repeater.c
@@ -223,16 +223,14 @@ static int eusb2_repeater_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int eusb2_repeater_remove(struct platform_device *pdev)
+static void eusb2_repeater_remove(struct platform_device *pdev)
 {
 	struct eusb2_repeater *rptr = platform_get_drvdata(pdev);
 
 	if (!rptr)
-		return 0;
+		return;
 
 	eusb2_repeater_exit(rptr->phy);
-
-	return 0;
 }
 
 static const struct of_device_id eusb2_repeater_of_match_table[] = {
@@ -246,7 +244,7 @@ MODULE_DEVICE_TABLE(of, eusb2_repeater_of_match_table);
 
 static struct platform_driver eusb2_repeater_driver = {
 	.probe		= eusb2_repeater_probe,
-	.remove		= eusb2_repeater_remove,
+	.remove_new	= eusb2_repeater_remove,
 	.driver = {
 		.name	= "qcom-eusb2-repeater",
 		.of_match_table = eusb2_repeater_of_match_table,
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 14/31] phy: qualcomm: phy-qcom-ipq806x-sata: Convert to platform remove callback returning void
  2023-03-07 11:58 [PATCH 00/31] phy: Convert to platform remove callback returning void Uwe Kleine-König
  2023-03-07 11:58 ` [PATCH 12/31] phy: qualcomm: phy-qcom-apq8064-sata: " Uwe Kleine-König
  2023-03-07 11:58 ` [PATCH 13/31] phy: qualcomm: phy-qcom-eusb2-repeater: " Uwe Kleine-König
@ 2023-03-07 11:58 ` Uwe Kleine-König
  2023-03-20 11:38 ` [PATCH 00/31] phy: " Vinod Koul
  3 siblings, 0 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2023-03-07 11:58 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Vinod Koul, Kishon Vijay Abraham I
  Cc: Konrad Dybcio, linux-arm-msm, linux-phy, kernel

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.

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/phy/qualcomm/phy-qcom-ipq806x-sata.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/phy/qualcomm/phy-qcom-ipq806x-sata.c b/drivers/phy/qualcomm/phy-qcom-ipq806x-sata.c
index 0fc2a1ed39b3..f0a72b82c770 100644
--- a/drivers/phy/qualcomm/phy-qcom-ipq806x-sata.c
+++ b/drivers/phy/qualcomm/phy-qcom-ipq806x-sata.c
@@ -170,13 +170,11 @@ static int qcom_ipq806x_sata_phy_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int qcom_ipq806x_sata_phy_remove(struct platform_device *pdev)
+static void qcom_ipq806x_sata_phy_remove(struct platform_device *pdev)
 {
 	struct qcom_ipq806x_sata_phy *phy = platform_get_drvdata(pdev);
 
 	clk_disable_unprepare(phy->cfg_clk);
-
-	return 0;
 }
 
 static const struct of_device_id qcom_ipq806x_sata_phy_of_match[] = {
@@ -187,7 +185,7 @@ MODULE_DEVICE_TABLE(of, qcom_ipq806x_sata_phy_of_match);
 
 static struct platform_driver qcom_ipq806x_sata_phy_driver = {
 	.probe	= qcom_ipq806x_sata_phy_probe,
-	.remove	= qcom_ipq806x_sata_phy_remove,
+	.remove_new = qcom_ipq806x_sata_phy_remove,
 	.driver = {
 		.name	= "qcom-ipq806x-sata-phy",
 		.of_match_table	= qcom_ipq806x_sata_phy_of_match,
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 00/31] phy: Convert to platform remove callback returning void
  2023-03-07 11:58 [PATCH 00/31] phy: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (2 preceding siblings ...)
  2023-03-07 11:58 ` [PATCH 14/31] phy: qualcomm: phy-qcom-ipq806x-sata: " Uwe Kleine-König
@ 2023-03-20 11:38 ` Vinod Koul
  3 siblings, 0 replies; 5+ messages in thread
From: Vinod Koul @ 2023-03-20 11:38 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Kishon Vijay Abraham I, Chen-Yu Tsai, Jernej Skrabec,
	Samuel Holland, Andre Przywara, Wolfram Sang, Icenowy Zheng,
	Justin Chen, Al Cooper, Pratyush Yadav, Rahul T R,
	Swapnil Jakhade, Lars-Peter Clausen, Shawn Guo, Sascha Hauer,
	Liu Ying, Yuan Can, Chun-Kuang Hu, Philipp Zabel, Chunfeng Yun,
	Matthias Brugger, Thomas Gleixner, Allison Randal,
	Greg Kroah-Hartman, Miaoqian Lin, Andy Gross, Bjorn Andersson,
	Yoshihiro Shimoda, Heiko Stuebner, Maxime Coquelin,
	Alexandre Torgue, Amelie Delaunay, Dan Carpenter,
	Fabrice Gasnier, JC Kuo, Thierry Reding, Jonathan Hunter,
	Roger Quadros, Matt Ranostay, Sinthu Raja, Vignesh Raghavendra,
	Tanmay Patil, Siddharth Vadapalli, Lv Ruyi, linux-phy,
	linux-arm-kernel, linux-sunxi, kernel,
	Broadcom internal kernel review list, Fabio Estevam,
	NXP Linux Team, AngeloGioacchino Del Regno, dri-devel,
	linux-mediatek, Konrad Dybcio, linux-arm-msm, linux-renesas-soc,
	linux-rockchip, linux-stm32, linux-tegra

On 07-03-23, 12:58, Uwe Kleine-König wrote:
> Hello,
> 
> this patch series adapts the platform drivers below drivers/phy to use the
> .remove_new() callback. Compared to the traditional .remove() callback
> .remove_new() returns no value. This is a good thing because the driver core
> doesn't (and cannot) cope for errors during remove. The only effect of a
> non-zero return value in .remove() is that the driver core emits a warning. The
> device is removed anyhow and an early return from .remove() usually yields a
> resource leak.
> 
> By changing the remove callback to return void driver authors cannot
> reasonably assume any more that there is some kind of cleanup later.
> 
> All drivers in drivers/spmi returned zero unconditionally in their remove
> callback, so they could all be converted trivially to .remove_new().
> 
> Note that this series depends on commit 5c5a7680e67b ("platform: Provide
> a remove callback that returns no value") which is included in v6.3-rc1.

Applied, thanks

-- 
~Vinod

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-03-20 11:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-07 11:58 [PATCH 00/31] phy: Convert to platform remove callback returning void Uwe Kleine-König
2023-03-07 11:58 ` [PATCH 12/31] phy: qualcomm: phy-qcom-apq8064-sata: " Uwe Kleine-König
2023-03-07 11:58 ` [PATCH 13/31] phy: qualcomm: phy-qcom-eusb2-repeater: " Uwe Kleine-König
2023-03-07 11:58 ` [PATCH 14/31] phy: qualcomm: phy-qcom-ipq806x-sata: " Uwe Kleine-König
2023-03-20 11:38 ` [PATCH 00/31] phy: " Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).