Skip to contentSkip to conversation

drivers: Account for different platform driver remove callback in 6.11

PATCH In review Jan Kiszka 2 participants 3 messages Aug 7, 2024 – Aug 8, 2024

Subsystems (5)
lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 drivers: Account for different platform driver remove callback in 6.11

From: Jan Kiszka <[email protected]>

Unfortunately, this requires a bit of #ifdef'ery.

The fec driver was the only one actually returning non-zero as well. Adjust it to what upstream does.

---
 .../drivers/can/c_can/rtcan_c_can_platform.c  |  6 +++++
 kernel/drivers/can/rtcan_flexcan.c            |  6 +++++
 kernel/drivers/net/drivers/at91_ether.c       |  6 +++++
 .../drivers/net/drivers/freescale/fec_main.c  | 22 ++++++++++++++-----
 kernel/drivers/net/drivers/macb.c             |  6 +++++
 kernel/drivers/serial/mpc52xx_uart.c          |  6 +++++
 kernel/drivers/serial/rt_imx_uart.c           |  6 +++++
 kernel/drivers/spi/spi-bcm2835.c              |  6 +++++
 kernel/drivers/spi/spi-omap2-mcspi-rt.c       |  6 +++++
 kernel/drivers/spi/spi-sun6i.c                |  6 +++++
 10 files changed, 71 insertions(+), 5 deletions(-)
kernel/drivers/can/c_can/rtcan_c_can_platform.c +6 -0
index 0d29d98771..aef6f8895c 100644
@@ -432,13 +432,19 @@ exit:
 	return ret;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 static int c_can_plat_remove(struct platform_device *pdev)
+#else
+static void c_can_plat_remove(struct platform_device *pdev)
+#endif
 {
 	struct rtcan_device *dev = platform_get_drvdata(pdev);
 
 	rtcan_c_can_unregister(dev);
 	rtcan_c_can_dev_free(dev);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 	return 0;
+#endif
 }
 
 static struct platform_driver c_can_plat_driver = {
kernel/drivers/can/rtcan_flexcan.c +6 -0
index edaaad7031..1658599232 100644
@@ -1482,14 +1482,20 @@ static int flexcan_probe(struct platform_device *pdev)
 	return err;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 static int flexcan_remove(struct platform_device *pdev)
+#else
+static void flexcan_remove(struct platform_device *pdev)
+#endif
 {
 	struct rtcan_device *dev = platform_get_drvdata(pdev);
 
 	unregister_flexcandev(dev);
 	rtcan_dev_free(dev);
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 	return 0;
+#endif
 }
 
 static struct platform_driver flexcan_driver = {
kernel/drivers/net/drivers/at91_ether.c +6 -0
index f8223b0bc5..a5ef40c579 100644
@@ -421,7 +421,11 @@ err_free_dev:
 	return res;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 static int at91ether_remove(struct platform_device *pdev)
+#else
+static void at91ether_remove(struct platform_device *pdev)
+#endif
 {
 	struct rtnet_device *dev = platform_get_drvdata(pdev);
 	struct macb *lp = rtnetdev_priv(dev);
@@ -440,7 +444,9 @@ static int at91ether_remove(struct platform_device *pdev)
 	clk_disable(lp->pclk);
 	rtdev_free(dev);
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 	return 0;
+#endif
 }
 
 static struct platform_driver at91ether_driver = {
kernel/drivers/net/drivers/freescale/fec_main.c +17 -5
index d1b6fd166f..9561fbc589 100644
@@ -3522,8 +3522,11 @@ failed_rt_init:
 	return ret;
 }
 
-static int
-fec_drv_remove(struct platform_device *pdev)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
+static int fec_drv_remove(struct platform_device *pdev)
+#else
+static void fec_drv_remove(struct platform_device *pdev)
+#endif
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct fec_enet_private *fep = netdev_priv(ndev);
@@ -3532,7 +3535,9 @@ fec_drv_remove(struct platform_device *pdev)
 
 	ret = pm_runtime_resume_and_get(&pdev->dev);
 	if (ret < 0)
-		return ret;
+		dev_err(&pdev->dev,
+			"Failed to resume device in remove callback (%pe)\n",
+			ERR_PTR(ret));
 
 	cancel_work_sync(&fep->tx_timeout_work);
 	fec_ptp_stop(pdev);
@@ -3547,13 +3552,20 @@ fec_drv_remove(struct platform_device *pdev)
 		of_phy_deregister_fixed_link(np);
 	of_node_put(fep->phy_node);
 
-	clk_disable_unprepare(fep->clk_ahb);
-	clk_disable_unprepare(fep->clk_ipg);
+        /* After pm_runtime_get_sync() failed, the clks are still off, so skip
+         * disabling them again.
+         */
+	if (ret >= 0) {
+		clk_disable_unprepare(fep->clk_ahb);
+		clk_disable_unprepare(fep->clk_ipg);
+	}
 	pm_runtime_put_noidle(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
 
 	free_netdev(ndev);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 	return 0;
+#endif
 }
 
 static int __maybe_unused fec_suspend(struct device *dev)
kernel/drivers/net/drivers/macb.c +6 -0
index 77957d9062..6da5761479 100644
@@ -1769,7 +1769,11 @@ err_out:
 	return err;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 static int __exit macb_remove(struct platform_device *pdev)
+#else
+static void __exit macb_remove(struct platform_device *pdev)
+#endif
 {
 	struct rtnet_device *dev;
 	struct macb *bp;
@@ -1795,7 +1799,9 @@ static int __exit macb_remove(struct platform_device *pdev)
 		rtdev_free(dev);
 	}
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 	return 0;
+#endif
 }
 
 static struct platform_driver macb_driver = {
kernel/drivers/serial/mpc52xx_uart.c +6 -0
index 68d1a4cbda..1347ac0b38 100644
@@ -1360,7 +1360,11 @@ out_kfree_port:
 	return ret;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 static int rt_mpc52xx_uart_of_remove(struct platform_device *op)
+#else
+static void rt_mpc52xx_uart_of_remove(struct platform_device *op)
+#endif
 {
 	struct rtdm_device *dev = dev_get_drvdata(&op->dev);
 	struct rt_mpc52xx_uart_port *port = dev->device_data;
@@ -1376,7 +1380,9 @@ static int rt_mpc52xx_uart_of_remove(struct platform_device *op)
 	kfree(port);
 	kfree(dev);
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 	return 0;
+#endif
 }
 
 static struct of_device_id rt_mpc52xx_uart_of_match[] = {
kernel/drivers/serial/rt_imx_uart.c +6 -0
index 2b2dbeeb72..bc5f4a8ed7 100644
@@ -1597,7 +1597,11 @@ static int rt_imx_uart_probe(struct platform_device *pdev)
 	return 0;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 static int rt_imx_uart_remove(struct platform_device *pdev)
+#else
+static void rt_imx_uart_remove(struct platform_device *pdev)
+#endif
 {
 	struct imxuart_platform_data *pdata;
 	struct rt_imx_uart_port *port = platform_get_drvdata(pdev);
@@ -1610,7 +1614,9 @@ static int rt_imx_uart_remove(struct platform_device *pdev)
 	clk_disable_unprepare(port->clk_per);
 	rtdm_dev_unregister(dev);
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 	return 0;
+#endif
 }
 
 static struct platform_driver rt_imx_uart_driver = {
kernel/drivers/spi/spi-bcm2835.c +6 -0
index fabfd4a59c..4a1a6f201c 100644
@@ -670,7 +670,11 @@ fail:
 	return ret;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 static int bcm2835_spi_remove(struct platform_device *pdev)
+#else
+static void bcm2835_spi_remove(struct platform_device *pdev)
+#endif
 {
 	struct rtdm_spi_master *master = platform_get_drvdata(pdev);
 	struct spi_master_bcm2835 *spim;
@@ -689,7 +693,9 @@ static int bcm2835_spi_remove(struct platform_device *pdev)
 
 	rtdm_spi_remove_master(master);
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 	return 0;
+#endif
 }
 
 static const struct of_device_id bcm2835_spi_match[] = {
kernel/drivers/spi/spi-omap2-mcspi-rt.c +6 -0
index 976d28dc5d..6b5c11b71d 100644
@@ -993,7 +993,11 @@ fail:
 	return ret;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 static int omap2_mcspi_remove(struct platform_device *pdev)
+#else
+static void omap2_mcspi_remove(struct platform_device *pdev)
+#endif
 {
 	struct rtdm_spi_master *master = platform_get_drvdata(pdev);
 	struct spi_master_omap2_mcspi *spim;
@@ -1010,7 +1014,9 @@ static int omap2_mcspi_remove(struct platform_device *pdev)
 
 	rtdm_spi_remove_master(master);
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 	return 0;
+#endif
 }
 
 static struct platform_driver omap2_mcspi_spi_driver = {
kernel/drivers/spi/spi-sun6i.c +6 -0
index 72a4abd0d7..13dd325c91 100644
@@ -629,7 +629,11 @@ fail:
 	return ret;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 static int sun6i_spi_remove(struct platform_device *pdev)
+#else
+static void sun6i_spi_remove(struct platform_device *pdev)
+#endif
 {
 	struct rtdm_spi_master *master = platform_get_drvdata(pdev);
 	struct spi_master_sun6i *spim;
@@ -645,7 +649,9 @@ static int sun6i_spi_remove(struct platform_device *pdev)
 
 	rtdm_spi_remove_master(master);
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 	return 0;
+#endif
 }
 
 static const struct of_device_id sun6i_spi_match[] = {
Signature · 1 line
2.43.0
#1 lore raw
Quoted 115 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

Unfortunately, this requires a bit of #ifdef'ery.

The fec driver was the only one actually returning non-zero as well. Adjust it to what upstream does.

---
 .../drivers/can/c_can/rtcan_c_can_platform.c  |  6 +++++
 kernel/drivers/can/rtcan_flexcan.c            |  6 +++++
 kernel/drivers/net/drivers/at91_ether.c       |  6 +++++
 .../drivers/net/drivers/freescale/fec_main.c  | 22 ++++++++++++++-----
 kernel/drivers/net/drivers/macb.c             |  6 +++++
 kernel/drivers/serial/mpc52xx_uart.c          |  6 +++++
 kernel/drivers/serial/rt_imx_uart.c           |  6 +++++
 kernel/drivers/spi/spi-bcm2835.c              |  6 +++++
 kernel/drivers/spi/spi-omap2-mcspi-rt.c       |  6 +++++
 kernel/drivers/spi/spi-sun6i.c                |  6 +++++
 10 files changed, 71 insertions(+), 5 deletions(-)
kernel/drivers/can/c_can/rtcan_c_can_platform.c +6 -0
index 0d29d98771..aef6f8895c 100644
@@ -432,13 +432,19 @@ exit:
 	return ret;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 static int c_can_plat_remove(struct platform_device *pdev)
+#else
+static void c_can_plat_remove(struct platform_device *pdev)
+#endif
 {
 	struct rtcan_device *dev = platform_get_drvdata(pdev);
 
 	rtcan_c_can_unregister(dev);
 	rtcan_c_can_dev_free(dev);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 	return 0;
+#endif
 }
 
 static struct platform_driver c_can_plat_driver = {
kernel/drivers/can/rtcan_flexcan.c +6 -0
index edaaad7031..1658599232 100644
@@ -1482,14 +1482,20 @@ static int flexcan_probe(struct platform_device *pdev)
 	return err;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 static int flexcan_remove(struct platform_device *pdev)
+#else
+static void flexcan_remove(struct platform_device *pdev)
+#endif
 {
 	struct rtcan_device *dev = platform_get_drvdata(pdev);
 
 	unregister_flexcandev(dev);
 	rtcan_dev_free(dev);
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 	return 0;
+#endif
 }
 
 static struct platform_driver flexcan_driver = {
kernel/drivers/net/drivers/at91_ether.c +6 -0
index f8223b0bc5..a5ef40c579 100644
@@ -421,7 +421,11 @@ err_free_dev:
 	return res;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 static int at91ether_remove(struct platform_device *pdev)
+#else
+static void at91ether_remove(struct platform_device *pdev)
+#endif
 {
 	struct rtnet_device *dev = platform_get_drvdata(pdev);
 	struct macb *lp = rtnetdev_priv(dev);
@@ -440,7 +444,9 @@ static int at91ether_remove(struct platform_device *pdev)
 	clk_disable(lp->pclk);
 	rtdev_free(dev);
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 	return 0;
+#endif
 }
 
 static struct platform_driver at91ether_driver = {
kernel/drivers/net/drivers/freescale/fec_main.c +5 -2
index d1b6fd166f..9561fbc589 100644
@@ -3522,8 +3522,11 @@ failed_rt_init:
 	return ret;
 }
 
-static int
-fec_drv_remove(struct platform_device *pdev)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
+static int fec_drv_remove(struct platform_device *pdev)
+#else
+static void fec_drv_remove(struct platform_device *pdev)
+#endif
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct fec_enet_private *fep = netdev_priv(ndev);

kernel/drivers/net/drivers/freescale/fec_main.c fec_drv_remove(struct platform_device *pdev) · line 3540

Quoted 7 lines
kernel/drivers/net/drivers/freescale/fec_main.c +3 -1
@@ -3532,7 +3535,9 @@ fec_drv_remove(struct platform_device *pdev)
 
 	ret = pm_runtime_resume_and_get(&pdev->dev);
 	if (ret < 0)
-		return ret;
+		dev_err(&pdev->dev,
+			"Failed to resume device in remove callback (%pe)\n",
+			ERR_PTR(ret));

No bailout anymore?

Quoted 184 lines
kernel/drivers/net/drivers/freescale/fec_main.c +9 -2
 	cancel_work_sync(&fep->tx_timeout_work);
 	fec_ptp_stop(pdev);
@@ -3547,13 +3552,20 @@ fec_drv_remove(struct platform_device *pdev)
 		of_phy_deregister_fixed_link(np);
 	of_node_put(fep->phy_node);
 
-	clk_disable_unprepare(fep->clk_ahb);
-	clk_disable_unprepare(fep->clk_ipg);
+        /* After pm_runtime_get_sync() failed, the clks are still off, so skip
+         * disabling them again.
+         */
+	if (ret >= 0) {
+		clk_disable_unprepare(fep->clk_ahb);
+		clk_disable_unprepare(fep->clk_ipg);
+	}
 	pm_runtime_put_noidle(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
 
 	free_netdev(ndev);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 	return 0;
+#endif
 }
 
 static int __maybe_unused fec_suspend(struct device *dev)
kernel/drivers/net/drivers/macb.c +6 -0
index 77957d9062..6da5761479 100644
@@ -1769,7 +1769,11 @@ err_out:
 	return err;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 static int __exit macb_remove(struct platform_device *pdev)
+#else
+static void __exit macb_remove(struct platform_device *pdev)
+#endif
 {
 	struct rtnet_device *dev;
 	struct macb *bp;
@@ -1795,7 +1799,9 @@ static int __exit macb_remove(struct platform_device *pdev)
 		rtdev_free(dev);
 	}
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 	return 0;
+#endif
 }
 
 static struct platform_driver macb_driver = {
kernel/drivers/serial/mpc52xx_uart.c +6 -0
index 68d1a4cbda..1347ac0b38 100644
@@ -1360,7 +1360,11 @@ out_kfree_port:
 	return ret;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 static int rt_mpc52xx_uart_of_remove(struct platform_device *op)
+#else
+static void rt_mpc52xx_uart_of_remove(struct platform_device *op)
+#endif
 {
 	struct rtdm_device *dev = dev_get_drvdata(&op->dev);
 	struct rt_mpc52xx_uart_port *port = dev->device_data;
@@ -1376,7 +1380,9 @@ static int rt_mpc52xx_uart_of_remove(struct platform_device *op)
 	kfree(port);
 	kfree(dev);
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 	return 0;
+#endif
 }
 
 static struct of_device_id rt_mpc52xx_uart_of_match[] = {
kernel/drivers/serial/rt_imx_uart.c +6 -0
index 2b2dbeeb72..bc5f4a8ed7 100644
@@ -1597,7 +1597,11 @@ static int rt_imx_uart_probe(struct platform_device *pdev)
 	return 0;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 static int rt_imx_uart_remove(struct platform_device *pdev)
+#else
+static void rt_imx_uart_remove(struct platform_device *pdev)
+#endif
 {
 	struct imxuart_platform_data *pdata;
 	struct rt_imx_uart_port *port = platform_get_drvdata(pdev);
@@ -1610,7 +1614,9 @@ static int rt_imx_uart_remove(struct platform_device *pdev)
 	clk_disable_unprepare(port->clk_per);
 	rtdm_dev_unregister(dev);
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 	return 0;
+#endif
 }
 
 static struct platform_driver rt_imx_uart_driver = {
kernel/drivers/spi/spi-bcm2835.c +6 -0
index fabfd4a59c..4a1a6f201c 100644
@@ -670,7 +670,11 @@ fail:
 	return ret;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 static int bcm2835_spi_remove(struct platform_device *pdev)
+#else
+static void bcm2835_spi_remove(struct platform_device *pdev)
+#endif
 {
 	struct rtdm_spi_master *master = platform_get_drvdata(pdev);
 	struct spi_master_bcm2835 *spim;
@@ -689,7 +693,9 @@ static int bcm2835_spi_remove(struct platform_device *pdev)
 
 	rtdm_spi_remove_master(master);
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 	return 0;
+#endif
 }
 
 static const struct of_device_id bcm2835_spi_match[] = {
kernel/drivers/spi/spi-omap2-mcspi-rt.c +6 -0
index 976d28dc5d..6b5c11b71d 100644
@@ -993,7 +993,11 @@ fail:
 	return ret;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 static int omap2_mcspi_remove(struct platform_device *pdev)
+#else
+static void omap2_mcspi_remove(struct platform_device *pdev)
+#endif
 {
 	struct rtdm_spi_master *master = platform_get_drvdata(pdev);
 	struct spi_master_omap2_mcspi *spim;
@@ -1010,7 +1014,9 @@ static int omap2_mcspi_remove(struct platform_device *pdev)
 
 	rtdm_spi_remove_master(master);
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 	return 0;
+#endif
 }
 
 static struct platform_driver omap2_mcspi_spi_driver = {
kernel/drivers/spi/spi-sun6i.c +6 -0
index 72a4abd0d7..13dd325c91 100644
@@ -629,7 +629,11 @@ fail:
 	return ret;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 static int sun6i_spi_remove(struct platform_device *pdev)
+#else
+static void sun6i_spi_remove(struct platform_device *pdev)
+#endif
 {
 	struct rtdm_spi_master *master = platform_get_drvdata(pdev);
 	struct spi_master_sun6i *spim;
@@ -645,7 +649,9 @@ static int sun6i_spi_remove(struct platform_device *pdev)
 
 	rtdm_spi_remove_master(master);
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 	return 0;
+#endif
 }
 
 static const struct of_device_id sun6i_spi_match[] = {
Signature · 1 line
2.43.0
author
#2 lore raw
Quoted 117 lines · Florian Bezdeka
Quoted 116 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

Unfortunately, this requires a bit of #ifdef'ery.

The fec driver was the only one actually returning non-zero as well. Adjust it to what upstream does.

---
 .../drivers/can/c_can/rtcan_c_can_platform.c  |  6 +++++
 kernel/drivers/can/rtcan_flexcan.c            |  6 +++++
 kernel/drivers/net/drivers/at91_ether.c       |  6 +++++
 .../drivers/net/drivers/freescale/fec_main.c  | 22 ++++++++++++++-----
 kernel/drivers/net/drivers/macb.c             |  6 +++++
 kernel/drivers/serial/mpc52xx_uart.c          |  6 +++++
 kernel/drivers/serial/rt_imx_uart.c           |  6 +++++
 kernel/drivers/spi/spi-bcm2835.c              |  6 +++++
 kernel/drivers/spi/spi-omap2-mcspi-rt.c       |  6 +++++
 kernel/drivers/spi/spi-sun6i.c                |  6 +++++
 10 files changed, 71 insertions(+), 5 deletions(-)
kernel/drivers/can/c_can/rtcan_c_can_platform.c +6 -0
index 0d29d98771..aef6f8895c 100644
@@ -432,13 +432,19 @@ exit:
 	return ret;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 static int c_can_plat_remove(struct platform_device *pdev)
+#else
+static void c_can_plat_remove(struct platform_device *pdev)
+#endif
 {
 	struct rtcan_device *dev = platform_get_drvdata(pdev);
 
 	rtcan_c_can_unregister(dev);
 	rtcan_c_can_dev_free(dev);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 	return 0;
+#endif
 }
 
 static struct platform_driver c_can_plat_driver = {
kernel/drivers/can/rtcan_flexcan.c +6 -0
index edaaad7031..1658599232 100644
@@ -1482,14 +1482,20 @@ static int flexcan_probe(struct platform_device *pdev)
 	return err;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 static int flexcan_remove(struct platform_device *pdev)
+#else
+static void flexcan_remove(struct platform_device *pdev)
+#endif
 {
 	struct rtcan_device *dev = platform_get_drvdata(pdev);
 
 	unregister_flexcandev(dev);
 	rtcan_dev_free(dev);
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 	return 0;
+#endif
 }
 
 static struct platform_driver flexcan_driver = {
kernel/drivers/net/drivers/at91_ether.c +6 -0
index f8223b0bc5..a5ef40c579 100644
@@ -421,7 +421,11 @@ err_free_dev:
 	return res;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 static int at91ether_remove(struct platform_device *pdev)
+#else
+static void at91ether_remove(struct platform_device *pdev)
+#endif
 {
 	struct rtnet_device *dev = platform_get_drvdata(pdev);
 	struct macb *lp = rtnetdev_priv(dev);
@@ -440,7 +444,9 @@ static int at91ether_remove(struct platform_device *pdev)
 	clk_disable(lp->pclk);
 	rtdev_free(dev);
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 	return 0;
+#endif
 }
 
 static struct platform_driver at91ether_driver = {
kernel/drivers/net/drivers/freescale/fec_main.c +5 -2
index d1b6fd166f..9561fbc589 100644
@@ -3522,8 +3522,11 @@ failed_rt_init:
 	return ret;
 }
 
-static int
-fec_drv_remove(struct platform_device *pdev)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
+static int fec_drv_remove(struct platform_device *pdev)
+#else
+static void fec_drv_remove(struct platform_device *pdev)
+#endif
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct fec_enet_private *fep = netdev_priv(ndev);
@@ -3532,7 +3535,9 @@ fec_drv_remove(struct platform_device *pdev)
 
Quoted 8 lines

kernel/drivers/net/drivers/freescale/fec_main.c fec_drv_remove(struct platform_device *pdev) · line 3540

Quoted 6 lines
kernel/drivers/net/drivers/freescale/fec_main.c +3 -1
 	ret = pm_runtime_resume_and_get(&pdev->dev);
 	if (ret < 0)
-		return ret;
+		dev_err(&pdev->dev,
+			"Failed to resume device in remove callback (%pe)\n",
+			ERR_PTR(ret));

No bailout anymore?

Yes, see
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/ethernet/freescale/fec_main.c#n4571

Jan

Quoted 186 lines
Quoted 185 lines
kernel/drivers/net/drivers/freescale/fec_main.c +9 -2
 	cancel_work_sync(&fep->tx_timeout_work);
 	fec_ptp_stop(pdev);
@@ -3547,13 +3552,20 @@ fec_drv_remove(struct platform_device *pdev)
 		of_phy_deregister_fixed_link(np);
 	of_node_put(fep->phy_node);
 
-	clk_disable_unprepare(fep->clk_ahb);
-	clk_disable_unprepare(fep->clk_ipg);
+        /* After pm_runtime_get_sync() failed, the clks are still off, so skip
+         * disabling them again.
+         */
+	if (ret >= 0) {
+		clk_disable_unprepare(fep->clk_ahb);
+		clk_disable_unprepare(fep->clk_ipg);
+	}
 	pm_runtime_put_noidle(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
 
 	free_netdev(ndev);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 	return 0;
+#endif
 }
 
 static int __maybe_unused fec_suspend(struct device *dev)
kernel/drivers/net/drivers/macb.c +6 -0
index 77957d9062..6da5761479 100644
@@ -1769,7 +1769,11 @@ err_out:
 	return err;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 static int __exit macb_remove(struct platform_device *pdev)
+#else
+static void __exit macb_remove(struct platform_device *pdev)
+#endif
 {
 	struct rtnet_device *dev;
 	struct macb *bp;
@@ -1795,7 +1799,9 @@ static int __exit macb_remove(struct platform_device *pdev)
 		rtdev_free(dev);
 	}
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 	return 0;
+#endif
 }
 
 static struct platform_driver macb_driver = {
kernel/drivers/serial/mpc52xx_uart.c +6 -0
index 68d1a4cbda..1347ac0b38 100644
@@ -1360,7 +1360,11 @@ out_kfree_port:
 	return ret;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 static int rt_mpc52xx_uart_of_remove(struct platform_device *op)
+#else
+static void rt_mpc52xx_uart_of_remove(struct platform_device *op)
+#endif
 {
 	struct rtdm_device *dev = dev_get_drvdata(&op->dev);
 	struct rt_mpc52xx_uart_port *port = dev->device_data;
@@ -1376,7 +1380,9 @@ static int rt_mpc52xx_uart_of_remove(struct platform_device *op)
 	kfree(port);
 	kfree(dev);
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 	return 0;
+#endif
 }
 
 static struct of_device_id rt_mpc52xx_uart_of_match[] = {
kernel/drivers/serial/rt_imx_uart.c +6 -0
index 2b2dbeeb72..bc5f4a8ed7 100644
@@ -1597,7 +1597,11 @@ static int rt_imx_uart_probe(struct platform_device *pdev)
 	return 0;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 static int rt_imx_uart_remove(struct platform_device *pdev)
+#else
+static void rt_imx_uart_remove(struct platform_device *pdev)
+#endif
 {
 	struct imxuart_platform_data *pdata;
 	struct rt_imx_uart_port *port = platform_get_drvdata(pdev);
@@ -1610,7 +1614,9 @@ static int rt_imx_uart_remove(struct platform_device *pdev)
 	clk_disable_unprepare(port->clk_per);
 	rtdm_dev_unregister(dev);
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 	return 0;
+#endif
 }
 
 static struct platform_driver rt_imx_uart_driver = {
kernel/drivers/spi/spi-bcm2835.c +6 -0
index fabfd4a59c..4a1a6f201c 100644
@@ -670,7 +670,11 @@ fail:
 	return ret;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 static int bcm2835_spi_remove(struct platform_device *pdev)
+#else
+static void bcm2835_spi_remove(struct platform_device *pdev)
+#endif
 {
 	struct rtdm_spi_master *master = platform_get_drvdata(pdev);
 	struct spi_master_bcm2835 *spim;
@@ -689,7 +693,9 @@ static int bcm2835_spi_remove(struct platform_device *pdev)
 
 	rtdm_spi_remove_master(master);
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 	return 0;
+#endif
 }
 
 static const struct of_device_id bcm2835_spi_match[] = {
kernel/drivers/spi/spi-omap2-mcspi-rt.c +6 -0
index 976d28dc5d..6b5c11b71d 100644
@@ -993,7 +993,11 @@ fail:
 	return ret;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 static int omap2_mcspi_remove(struct platform_device *pdev)
+#else
+static void omap2_mcspi_remove(struct platform_device *pdev)
+#endif
 {
 	struct rtdm_spi_master *master = platform_get_drvdata(pdev);
 	struct spi_master_omap2_mcspi *spim;
@@ -1010,7 +1014,9 @@ static int omap2_mcspi_remove(struct platform_device *pdev)
 
 	rtdm_spi_remove_master(master);
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 	return 0;
+#endif
 }
 
 static struct platform_driver omap2_mcspi_spi_driver = {
kernel/drivers/spi/spi-sun6i.c +6 -0
index 72a4abd0d7..13dd325c91 100644
@@ -629,7 +629,11 @@ fail:
 	return ret;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 static int sun6i_spi_remove(struct platform_device *pdev)
+#else
+static void sun6i_spi_remove(struct platform_device *pdev)
+#endif
 {
 	struct rtdm_spi_master *master = platform_get_drvdata(pdev);
 	struct spi_master_sun6i *spim;
@@ -645,7 +649,9 @@ static int sun6i_spi_remove(struct platform_device *pdev)
 
 	rtdm_spi_remove_master(master);
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,11,0)
 	return 0;
+#endif
 }
 
 static const struct of_device_id sun6i_spi_match[] = {
Signature · 1 line
2.43.0
Signature · 2 lines
Siemens AG, Technology
Linux Expert Center