2023-07-13 08:42:40

by 李扬韬

[permalink] [raw]
Subject: [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void

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.

Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/mmc/host/sunxi-mmc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
index 69dcb8805e05..d3bd0ac99ec4 100644
--- a/drivers/mmc/host/sunxi-mmc.c
+++ b/drivers/mmc/host/sunxi-mmc.c
@@ -1486,7 +1486,7 @@ static int sunxi_mmc_probe(struct platform_device *pdev)
return ret;
}

-static int sunxi_mmc_remove(struct platform_device *pdev)
+static void sunxi_mmc_remove(struct platform_device *pdev)
{
struct mmc_host *mmc = platform_get_drvdata(pdev);
struct sunxi_mmc_host *host = mmc_priv(mmc);
@@ -1499,8 +1499,6 @@ static int sunxi_mmc_remove(struct platform_device *pdev)
}
dma_free_coherent(&pdev->dev, PAGE_SIZE, host->sg_cpu, host->sg_dma);
mmc_free_host(mmc);
-
- return 0;
}

#ifdef CONFIG_PM
@@ -1556,7 +1554,7 @@ static struct platform_driver sunxi_mmc_driver = {
.pm = &sunxi_mmc_pm_ops,
},
.probe = sunxi_mmc_probe,
- .remove = sunxi_mmc_remove,
+ .remove_new = sunxi_mmc_remove,
};
module_platform_driver(sunxi_mmc_driver);

--
2.39.0



2023-07-13 08:42:50

by 李扬韬

[permalink] [raw]
Subject: [PATCH 39/58] mmc: sdhci-esdhc-imx: Convert to platform remove callback returning void

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.

Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/mmc/host/sdhci-esdhc-imx.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index eebf94604a7f..e882067366da 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -1802,7 +1802,7 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
return err;
}

-static int sdhci_esdhc_imx_remove(struct platform_device *pdev)
+static void sdhci_esdhc_imx_remove(struct platform_device *pdev)
{
struct sdhci_host *host = platform_get_drvdata(pdev);
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
@@ -1824,8 +1824,6 @@ static int sdhci_esdhc_imx_remove(struct platform_device *pdev)
cpu_latency_qos_remove_request(&imx_data->pm_qos_req);

sdhci_pltfm_free(pdev);
-
- return 0;
}

#ifdef CONFIG_PM_SLEEP
@@ -1986,7 +1984,7 @@ static struct platform_driver sdhci_esdhc_imx_driver = {
.pm = &sdhci_esdhc_pmops,
},
.probe = sdhci_esdhc_imx_probe,
- .remove = sdhci_esdhc_imx_remove,
+ .remove_new = sdhci_esdhc_imx_remove,
};

module_platform_driver(sdhci_esdhc_imx_driver);
--
2.39.0


2023-07-13 08:43:22

by 李扬韬

[permalink] [raw]
Subject: [PATCH 54/58] mmc: pwrseq_simple: Convert to platform remove callback returning void

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.

Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/mmc/core/pwrseq_simple.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c
index 3bac1e71411b..df9588503ad0 100644
--- a/drivers/mmc/core/pwrseq_simple.c
+++ b/drivers/mmc/core/pwrseq_simple.c
@@ -142,18 +142,16 @@ static int mmc_pwrseq_simple_probe(struct platform_device *pdev)
return mmc_pwrseq_register(&pwrseq->pwrseq);
}

-static int mmc_pwrseq_simple_remove(struct platform_device *pdev)
+static void mmc_pwrseq_simple_remove(struct platform_device *pdev)
{
struct mmc_pwrseq_simple *pwrseq = platform_get_drvdata(pdev);

mmc_pwrseq_unregister(&pwrseq->pwrseq);
-
- return 0;
}

static struct platform_driver mmc_pwrseq_simple_driver = {
.probe = mmc_pwrseq_simple_probe,
- .remove = mmc_pwrseq_simple_remove,
+ .remove_new = mmc_pwrseq_simple_remove,
.driver = {
.name = "pwrseq_simple",
.of_match_table = mmc_pwrseq_simple_of_match,
--
2.39.0


2023-07-13 08:43:26

by 李扬韬

[permalink] [raw]
Subject: [PATCH 34/58] mmc: sdhci-of-aspeed: Convert to platform remove callback returning void

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.

Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/mmc/host/sdhci-of-aspeed.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/mmc/host/sdhci-of-aspeed.c b/drivers/mmc/host/sdhci-of-aspeed.c
index 25b4073f698b..42d54532cabe 100644
--- a/drivers/mmc/host/sdhci-of-aspeed.c
+++ b/drivers/mmc/host/sdhci-of-aspeed.c
@@ -450,22 +450,19 @@ static int aspeed_sdhci_probe(struct platform_device *pdev)
return ret;
}

-static int aspeed_sdhci_remove(struct platform_device *pdev)
+static void aspeed_sdhci_remove(struct platform_device *pdev)
{
struct sdhci_pltfm_host *pltfm_host;
struct sdhci_host *host;
- int dead = 0;

host = platform_get_drvdata(pdev);
pltfm_host = sdhci_priv(host);

- sdhci_remove_host(host, dead);
+ sdhci_remove_host(host, 0);

clk_disable_unprepare(pltfm_host->clk);

sdhci_pltfm_free(pdev);
-
- return 0;
}

static const struct aspeed_sdhci_pdata ast2400_sdhci_pdata = {
@@ -521,7 +518,7 @@ static struct platform_driver aspeed_sdhci_driver = {
.of_match_table = aspeed_sdhci_of_match,
},
.probe = aspeed_sdhci_probe,
- .remove = aspeed_sdhci_remove,
+ .remove_new = aspeed_sdhci_remove,
};

static int aspeed_sdc_probe(struct platform_device *pdev)
@@ -574,13 +571,11 @@ static int aspeed_sdc_probe(struct platform_device *pdev)
return ret;
}

-static int aspeed_sdc_remove(struct platform_device *pdev)
+static void aspeed_sdc_remove(struct platform_device *pdev)
{
struct aspeed_sdc *sdc = dev_get_drvdata(&pdev->dev);

clk_disable_unprepare(sdc->clk);
-
- return 0;
}

static const struct of_device_id aspeed_sdc_of_match[] = {
@@ -600,7 +595,7 @@ static struct platform_driver aspeed_sdc_driver = {
.of_match_table = aspeed_sdc_of_match,
},
.probe = aspeed_sdc_probe,
- .remove = aspeed_sdc_remove,
+ .remove_new = aspeed_sdc_remove,
};

#if defined(CONFIG_MMC_SDHCI_OF_ASPEED_TEST)
--
2.39.0


2023-07-13 08:43:27

by 李扬韬

[permalink] [raw]
Subject: [PATCH 04/58] mmc: litex_mmc: Convert to platform remove callback returning void

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.

Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/mmc/host/litex_mmc.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/litex_mmc.c b/drivers/mmc/host/litex_mmc.c
index 9af6b0902efe..4ec8072dc60b 100644
--- a/drivers/mmc/host/litex_mmc.c
+++ b/drivers/mmc/host/litex_mmc.c
@@ -629,12 +629,11 @@ static int litex_mmc_probe(struct platform_device *pdev)
return 0;
}

-static int litex_mmc_remove(struct platform_device *pdev)
+static void litex_mmc_remove(struct platform_device *pdev)
{
struct litex_mmc_host *host = platform_get_drvdata(pdev);

mmc_remove_host(host->mmc);
- return 0;
}

static const struct of_device_id litex_match[] = {
@@ -645,7 +644,7 @@ MODULE_DEVICE_TABLE(of, litex_match);

static struct platform_driver litex_mmc_driver = {
.probe = litex_mmc_probe,
- .remove = litex_mmc_remove,
+ .remove_new = litex_mmc_remove,
.driver = {
.name = "litex-mmc",
.of_match_table = litex_match,
--
2.39.0


2023-07-13 08:43:37

by 李扬韬

[permalink] [raw]
Subject: [PATCH 13/58] mmc: omap: Convert to platform remove callback returning void

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.

Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/mmc/host/omap.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index 6a259563690d..9fb8995b43a1 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -1506,7 +1506,7 @@ static int mmc_omap_probe(struct platform_device *pdev)
return ret;
}

-static int mmc_omap_remove(struct platform_device *pdev)
+static void mmc_omap_remove(struct platform_device *pdev)
{
struct mmc_omap_host *host = platform_get_drvdata(pdev);
int i;
@@ -1532,8 +1532,6 @@ static int mmc_omap_remove(struct platform_device *pdev)
dma_release_channel(host->dma_rx);

destroy_workqueue(host->mmc_omap_wq);
-
- return 0;
}

#if IS_BUILTIN(CONFIG_OF)
@@ -1546,7 +1544,7 @@ MODULE_DEVICE_TABLE(of, mmc_omap_match);

static struct platform_driver mmc_omap_driver = {
.probe = mmc_omap_probe,
- .remove = mmc_omap_remove,
+ .remove_new = mmc_omap_remove,
.driver = {
.name = DRIVER_NAME,
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
--
2.39.0


2023-07-13 08:44:00

by 李扬韬

[permalink] [raw]
Subject: [PATCH 40/58] mmc: sdhci-msm: Convert to platform remove callback returning void

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.

Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/mmc/host/sdhci-msm.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
index 1c935b5bafe1..80e376802ee0 100644
--- a/drivers/mmc/host/sdhci-msm.c
+++ b/drivers/mmc/host/sdhci-msm.c
@@ -2668,7 +2668,7 @@ static int sdhci_msm_probe(struct platform_device *pdev)
return ret;
}

-static int sdhci_msm_remove(struct platform_device *pdev)
+static void sdhci_msm_remove(struct platform_device *pdev)
{
struct sdhci_host *host = platform_get_drvdata(pdev);
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
@@ -2687,7 +2687,6 @@ static int sdhci_msm_remove(struct platform_device *pdev)
if (!IS_ERR(msm_host->bus_clk))
clk_disable_unprepare(msm_host->bus_clk);
sdhci_pltfm_free(pdev);
- return 0;
}

static __maybe_unused int sdhci_msm_runtime_suspend(struct device *dev)
@@ -2740,7 +2739,7 @@ static const struct dev_pm_ops sdhci_msm_pm_ops = {

static struct platform_driver sdhci_msm_driver = {
.probe = sdhci_msm_probe,
- .remove = sdhci_msm_remove,
+ .remove_new = sdhci_msm_remove,
.driver = {
.name = "sdhci_msm",
.of_match_table = sdhci_msm_dt_match,
--
2.39.0


2023-07-13 08:44:01

by 李扬韬

[permalink] [raw]
Subject: [PATCH 36/58] mmc: sdhci-sprd: Convert to platform remove callback returning void

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.

Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/mmc/host/sdhci-sprd.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/sdhci-sprd.c b/drivers/mmc/host/sdhci-sprd.c
index 7f4ee2e12735..379cb3892757 100644
--- a/drivers/mmc/host/sdhci-sprd.c
+++ b/drivers/mmc/host/sdhci-sprd.c
@@ -720,7 +720,7 @@ static int sdhci_sprd_probe(struct platform_device *pdev)
return ret;
}

-static int sdhci_sprd_remove(struct platform_device *pdev)
+static void sdhci_sprd_remove(struct platform_device *pdev)
{
struct sdhci_host *host = platform_get_drvdata(pdev);
struct sdhci_sprd_host *sprd_host = TO_SPRD_HOST(host);
@@ -732,8 +732,6 @@ static int sdhci_sprd_remove(struct platform_device *pdev)
clk_disable_unprepare(sprd_host->clk_2x_enable);

sdhci_pltfm_free(pdev);
-
- return 0;
}

static const struct of_device_id sdhci_sprd_of_match[] = {
@@ -800,7 +798,7 @@ static const struct dev_pm_ops sdhci_sprd_pm_ops = {

static struct platform_driver sdhci_sprd_driver = {
.probe = sdhci_sprd_probe,
- .remove = sdhci_sprd_remove,
+ .remove_new = sdhci_sprd_remove,
.driver = {
.name = "sdhci_sprd_r11",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
--
2.39.0


2023-07-13 08:44:12

by 李扬韬

[permalink] [raw]
Subject: [PATCH 26/58] mmc: f-sdh30: Convert to platform remove callback returning void

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.

Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/mmc/host/sdhci_f_sdh30.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/sdhci_f_sdh30.c b/drivers/mmc/host/sdhci_f_sdh30.c
index a202a69a4b08..6016e183c03c 100644
--- a/drivers/mmc/host/sdhci_f_sdh30.c
+++ b/drivers/mmc/host/sdhci_f_sdh30.c
@@ -208,7 +208,7 @@ static int sdhci_f_sdh30_probe(struct platform_device *pdev)
return ret;
}

-static int sdhci_f_sdh30_remove(struct platform_device *pdev)
+static void sdhci_f_sdh30_remove(struct platform_device *pdev)
{
struct sdhci_host *host = platform_get_drvdata(pdev);
struct f_sdhost_priv *priv = sdhci_priv(host);
@@ -222,8 +222,6 @@ static int sdhci_f_sdh30_remove(struct platform_device *pdev)

sdhci_free_host(host);
platform_set_drvdata(pdev, NULL);
-
- return 0;
}

#ifdef CONFIG_OF
@@ -252,7 +250,7 @@ static struct platform_driver sdhci_f_sdh30_driver = {
.pm = &sdhci_pltfm_pmops,
},
.probe = sdhci_f_sdh30_probe,
- .remove = sdhci_f_sdh30_remove,
+ .remove_new = sdhci_f_sdh30_remove,
};

module_platform_driver(sdhci_f_sdh30_driver);
--
2.39.0


2023-07-13 08:44:42

by 李扬韬

[permalink] [raw]
Subject: [PATCH 33/58] mmc: sdhci-omap: Convert to platform remove callback returning void

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.

Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/mmc/host/sdhci-omap.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c
index 8ed9256b83da..6aa77eb4a3fb 100644
--- a/drivers/mmc/host/sdhci-omap.c
+++ b/drivers/mmc/host/sdhci-omap.c
@@ -1394,7 +1394,7 @@ static int sdhci_omap_probe(struct platform_device *pdev)
return ret;
}

-static int sdhci_omap_remove(struct platform_device *pdev)
+static void sdhci_omap_remove(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct sdhci_host *host = platform_get_drvdata(pdev);
@@ -1408,8 +1408,6 @@ static int sdhci_omap_remove(struct platform_device *pdev)
/* Ensure device gets disabled despite userspace sysfs config */
pm_runtime_force_suspend(dev);
sdhci_pltfm_free(pdev);
-
- return 0;
}

#ifdef CONFIG_PM
@@ -1478,7 +1476,7 @@ static const struct dev_pm_ops sdhci_omap_dev_pm_ops = {

static struct platform_driver sdhci_omap_driver = {
.probe = sdhci_omap_probe,
- .remove = sdhci_omap_remove,
+ .remove_new = sdhci_omap_remove,
.driver = {
.name = "sdhci-omap",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
--
2.39.0


2023-07-13 08:44:45

by 李扬韬

[permalink] [raw]
Subject: [PATCH 32/58] mmc: moxart: Convert to platform remove callback returning void

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.

Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/mmc/host/moxart-mmc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/moxart-mmc.c b/drivers/mmc/host/moxart-mmc.c
index 2d002c81dcf3..7d35476c9ef4 100644
--- a/drivers/mmc/host/moxart-mmc.c
+++ b/drivers/mmc/host/moxart-mmc.c
@@ -693,7 +693,7 @@ static int moxart_probe(struct platform_device *pdev)
return ret;
}

-static int moxart_remove(struct platform_device *pdev)
+static void moxart_remove(struct platform_device *pdev)
{
struct mmc_host *mmc = dev_get_drvdata(&pdev->dev);
struct moxart_host *host = mmc_priv(mmc);
@@ -711,8 +711,6 @@ static int moxart_remove(struct platform_device *pdev)
writel(readl(host->base + REG_CLOCK_CONTROL) | CLK_OFF,
host->base + REG_CLOCK_CONTROL);
mmc_free_host(mmc);
-
- return 0;
}

static const struct of_device_id moxart_mmc_match[] = {
@@ -724,7 +722,7 @@ MODULE_DEVICE_TABLE(of, moxart_mmc_match);

static struct platform_driver moxart_mmc_driver = {
.probe = moxart_probe,
- .remove = moxart_remove,
+ .remove_new = moxart_remove,
.driver = {
.name = "mmc-moxart",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
--
2.39.0


2023-07-13 08:45:15

by 李扬韬

[permalink] [raw]
Subject: [PATCH 25/58] mmc: uniphier-sd: Convert to platform remove callback returning void

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.

Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/mmc/host/uniphier-sd.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/uniphier-sd.c b/drivers/mmc/host/uniphier-sd.c
index 61acd69fac0e..33a4d1c6ef04 100644
--- a/drivers/mmc/host/uniphier-sd.c
+++ b/drivers/mmc/host/uniphier-sd.c
@@ -727,15 +727,13 @@ static int uniphier_sd_probe(struct platform_device *pdev)
return ret;
}

-static int uniphier_sd_remove(struct platform_device *pdev)
+static void uniphier_sd_remove(struct platform_device *pdev)
{
struct tmio_mmc_host *host = platform_get_drvdata(pdev);

tmio_mmc_host_remove(host);
uniphier_sd_clk_disable(host);
tmio_mmc_host_free(host);
-
- return 0;
}

static const struct of_device_id uniphier_sd_match[] = {
@@ -757,7 +755,7 @@ MODULE_DEVICE_TABLE(of, uniphier_sd_match);

static struct platform_driver uniphier_sd_driver = {
.probe = uniphier_sd_probe,
- .remove = uniphier_sd_remove,
+ .remove_new = uniphier_sd_remove,
.driver = {
.name = "uniphier-sd",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
--
2.39.0


2023-07-13 08:45:15

by 李扬韬

[permalink] [raw]
Subject: [PATCH 28/58] mmc: sdhci-of-dwcmshc: Convert to platform remove callback returning void

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.

Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/mmc/host/sdhci-of-dwcmshc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c
index e68cd87998c8..5cfd24cd33fc 100644
--- a/drivers/mmc/host/sdhci-of-dwcmshc.c
+++ b/drivers/mmc/host/sdhci-of-dwcmshc.c
@@ -574,7 +574,7 @@ static int dwcmshc_probe(struct platform_device *pdev)
return err;
}

-static int dwcmshc_remove(struct platform_device *pdev)
+static void dwcmshc_remove(struct platform_device *pdev)
{
struct sdhci_host *host = platform_get_drvdata(pdev);
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
@@ -589,8 +589,6 @@ static int dwcmshc_remove(struct platform_device *pdev)
clk_bulk_disable_unprepare(RK35xx_MAX_CLKS,
rk_priv->rockchip_clks);
sdhci_pltfm_free(pdev);
-
- return 0;
}

#ifdef CONFIG_PM_SLEEP
@@ -657,7 +655,7 @@ static struct platform_driver sdhci_dwcmshc_driver = {
.pm = &dwcmshc_pmops,
},
.probe = dwcmshc_probe,
- .remove = dwcmshc_remove,
+ .remove_new = dwcmshc_remove,
};
module_platform_driver(sdhci_dwcmshc_driver);

--
2.39.0


2023-07-13 08:45:26

by 李扬韬

[permalink] [raw]
Subject: [PATCH 27/58] mmc: sdhci-of-arasan: Convert to platform remove callback returning void

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.

Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/mmc/host/sdhci-of-arasan.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
index 294dd605fd2b..160bab0c437c 100644
--- a/drivers/mmc/host/sdhci-of-arasan.c
+++ b/drivers/mmc/host/sdhci-of-arasan.c
@@ -2016,7 +2016,7 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
return ret;
}

-static int sdhci_arasan_remove(struct platform_device *pdev)
+static void sdhci_arasan_remove(struct platform_device *pdev)
{
struct sdhci_host *host = platform_get_drvdata(pdev);
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
@@ -2034,8 +2034,6 @@ static int sdhci_arasan_remove(struct platform_device *pdev)
sdhci_pltfm_unregister(pdev);

clk_disable_unprepare(clk_ahb);
-
- return 0;
}

static struct platform_driver sdhci_arasan_driver = {
@@ -2046,7 +2044,7 @@ static struct platform_driver sdhci_arasan_driver = {
.pm = &sdhci_arasan_dev_pm_ops,
},
.probe = sdhci_arasan_probe,
- .remove = sdhci_arasan_remove,
+ .remove_new = sdhci_arasan_remove,
};

module_platform_driver(sdhci_arasan_driver);
--
2.39.0


2023-07-13 08:45:30

by 李扬韬

[permalink] [raw]
Subject: [PATCH 18/58] mmc: meson-gx: Convert to platform remove callback returning void

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.

Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/mmc/host/meson-gx-mmc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
index ee9a25b900ae..106ebc1fd36f 100644
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -1297,7 +1297,7 @@ static int meson_mmc_probe(struct platform_device *pdev)
return ret;
}

-static int meson_mmc_remove(struct platform_device *pdev)
+static void meson_mmc_remove(struct platform_device *pdev)
{
struct meson_host *host = dev_get_drvdata(&pdev->dev);

@@ -1308,8 +1308,6 @@ static int meson_mmc_remove(struct platform_device *pdev)
free_irq(host->irq, host);

clk_disable_unprepare(host->mmc_clk);
-
- return 0;
}

static const struct meson_mmc_data meson_gx_data = {
@@ -1340,7 +1338,7 @@ MODULE_DEVICE_TABLE(of, meson_mmc_of_match);

static struct platform_driver meson_mmc_driver = {
.probe = meson_mmc_probe,
- .remove = meson_mmc_remove,
+ .remove_new = meson_mmc_remove,
.driver = {
.name = DRIVER_NAME,
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
--
2.39.0


2023-07-13 08:45:35

by 李扬韬

[permalink] [raw]
Subject: [PATCH 45/58] mmc: usdhi60rol0: Convert to platform remove callback returning void

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.

Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/mmc/host/usdhi6rol0.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/usdhi6rol0.c b/drivers/mmc/host/usdhi6rol0.c
index 2e17903658fc..6e421445d56c 100644
--- a/drivers/mmc/host/usdhi6rol0.c
+++ b/drivers/mmc/host/usdhi6rol0.c
@@ -1884,7 +1884,7 @@ static int usdhi6_probe(struct platform_device *pdev)
return ret;
}

-static int usdhi6_remove(struct platform_device *pdev)
+static void usdhi6_remove(struct platform_device *pdev)
{
struct usdhi6_host *host = platform_get_drvdata(pdev);

@@ -1895,13 +1895,11 @@ static int usdhi6_remove(struct platform_device *pdev)
usdhi6_dma_release(host);
clk_disable_unprepare(host->clk);
mmc_free_host(host->mmc);
-
- return 0;
}

static struct platform_driver usdhi6_driver = {
.probe = usdhi6_probe,
- .remove = usdhi6_remove,
+ .remove_new = usdhi6_remove,
.driver = {
.name = "usdhi6rol0",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
--
2.39.0


2023-07-13 08:46:26

by 李扬韬

[permalink] [raw]
Subject: [PATCH 29/58] mmc: au1xmmc: Convert to platform remove callback returning void

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.

Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/mmc/host/au1xmmc.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/au1xmmc.c b/drivers/mmc/host/au1xmmc.c
index 82dd0ae40305..b5a5c6a2fe8b 100644
--- a/drivers/mmc/host/au1xmmc.c
+++ b/drivers/mmc/host/au1xmmc.c
@@ -1114,7 +1114,7 @@ static int au1xmmc_probe(struct platform_device *pdev)
return ret;
}

-static int au1xmmc_remove(struct platform_device *pdev)
+static void au1xmmc_remove(struct platform_device *pdev)
{
struct au1xmmc_host *host = platform_get_drvdata(pdev);

@@ -1153,7 +1153,6 @@ static int au1xmmc_remove(struct platform_device *pdev)

mmc_free_host(host->mmc);
}
- return 0;
}

#ifdef CONFIG_PM
@@ -1185,7 +1184,7 @@ static int au1xmmc_resume(struct platform_device *pdev)

static struct platform_driver au1xmmc_driver = {
.probe = au1xmmc_probe,
- .remove = au1xmmc_remove,
+ .remove_new = au1xmmc_remove,
.suspend = au1xmmc_suspend,
.resume = au1xmmc_resume,
.driver = {
--
2.39.0


2023-07-13 09:01:13

by 李扬韬

[permalink] [raw]
Subject: [PATCH 56/58] mmc: pwrseq: Convert to platform remove callback returning void

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.

Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/mmc/core/pwrseq_emmc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/core/pwrseq_emmc.c b/drivers/mmc/core/pwrseq_emmc.c
index f6dde9edd7a3..3b6d69cefb4e 100644
--- a/drivers/mmc/core/pwrseq_emmc.c
+++ b/drivers/mmc/core/pwrseq_emmc.c
@@ -90,14 +90,12 @@ static int mmc_pwrseq_emmc_probe(struct platform_device *pdev)
return mmc_pwrseq_register(&pwrseq->pwrseq);
}

-static int mmc_pwrseq_emmc_remove(struct platform_device *pdev)
+static void mmc_pwrseq_emmc_remove(struct platform_device *pdev)
{
struct mmc_pwrseq_emmc *pwrseq = platform_get_drvdata(pdev);

unregister_restart_handler(&pwrseq->reset_nb);
mmc_pwrseq_unregister(&pwrseq->pwrseq);
-
- return 0;
}

static const struct of_device_id mmc_pwrseq_emmc_of_match[] = {
@@ -109,7 +107,7 @@ MODULE_DEVICE_TABLE(of, mmc_pwrseq_emmc_of_match);

static struct platform_driver mmc_pwrseq_emmc_driver = {
.probe = mmc_pwrseq_emmc_probe,
- .remove = mmc_pwrseq_emmc_remove,
+ .remove_new = mmc_pwrseq_emmc_remove,
.driver = {
.name = "pwrseq_emmc",
.of_match_table = mmc_pwrseq_emmc_of_match,
--
2.39.0


2023-07-13 09:01:23

by 李扬韬

[permalink] [raw]
Subject: [PATCH 57/58] mmc: renesas_sdhi: Convert to platform remove callback returning void

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.

Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/mmc/host/renesas_sdhi.h | 2 +-
drivers/mmc/host/renesas_sdhi_core.c | 4 +---
drivers/mmc/host/renesas_sdhi_internal_dmac.c | 2 +-
drivers/mmc/host/renesas_sdhi_sys_dmac.c | 2 +-
4 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/host/renesas_sdhi.h b/drivers/mmc/host/renesas_sdhi.h
index 68da3da9e2e5..c1fb9740eab0 100644
--- a/drivers/mmc/host/renesas_sdhi.h
+++ b/drivers/mmc/host/renesas_sdhi.h
@@ -101,5 +101,5 @@ int renesas_sdhi_probe(struct platform_device *pdev,
const struct tmio_mmc_dma_ops *dma_ops,
const struct renesas_sdhi_of_data *of_data,
const struct renesas_sdhi_quirks *quirks);
-int renesas_sdhi_remove(struct platform_device *pdev);
+void renesas_sdhi_remove(struct platform_device *pdev);
#endif
diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
index 345934e4f59e..5d3adef144d7 100644
--- a/drivers/mmc/host/renesas_sdhi_core.c
+++ b/drivers/mmc/host/renesas_sdhi_core.c
@@ -1145,15 +1145,13 @@ int renesas_sdhi_probe(struct platform_device *pdev,
}
EXPORT_SYMBOL_GPL(renesas_sdhi_probe);

-int renesas_sdhi_remove(struct platform_device *pdev)
+void renesas_sdhi_remove(struct platform_device *pdev)
{
struct tmio_mmc_host *host = platform_get_drvdata(pdev);

tmio_mmc_host_remove(host);
renesas_sdhi_clk_disable(host);
tmio_mmc_host_free(host);
-
- return 0;
}
EXPORT_SYMBOL_GPL(renesas_sdhi_remove);

diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
index 9ab813903b2c..d8efb8035b1f 100644
--- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c
+++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
@@ -609,7 +609,7 @@ static struct platform_driver renesas_internal_dmac_sdhi_driver = {
.of_match_table = renesas_sdhi_internal_dmac_of_match,
},
.probe = renesas_sdhi_internal_dmac_probe,
- .remove = renesas_sdhi_remove,
+ .remove_new = renesas_sdhi_remove,
};

module_platform_driver(renesas_internal_dmac_sdhi_driver);
diff --git a/drivers/mmc/host/renesas_sdhi_sys_dmac.c b/drivers/mmc/host/renesas_sdhi_sys_dmac.c
index b559ad38b667..248dfeef942a 100644
--- a/drivers/mmc/host/renesas_sdhi_sys_dmac.c
+++ b/drivers/mmc/host/renesas_sdhi_sys_dmac.c
@@ -470,7 +470,7 @@ static struct platform_driver renesas_sys_dmac_sdhi_driver = {
.of_match_table = renesas_sdhi_sys_dmac_of_match,
},
.probe = renesas_sdhi_sys_dmac_probe,
- .remove = renesas_sdhi_remove,
+ .remove_new = renesas_sdhi_remove,
};

module_platform_driver(renesas_sys_dmac_sdhi_driver);
--
2.39.0


2023-07-13 09:04:51

by 李扬韬

[permalink] [raw]
Subject: [PATCH 08/58] mmc: dw_mmc: hi3798cv200: Convert to platform remove callback returning void

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.

Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/mmc/host/dw_mmc-hi3798cv200.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc-hi3798cv200.c b/drivers/mmc/host/dw_mmc-hi3798cv200.c
index 6f22fe054087..e9470c50a348 100644
--- a/drivers/mmc/host/dw_mmc-hi3798cv200.c
+++ b/drivers/mmc/host/dw_mmc-hi3798cv200.c
@@ -171,7 +171,7 @@ static int dw_mci_hi3798cv200_probe(struct platform_device *pdev)
return dw_mci_pltfm_register(pdev, &hi3798cv200_data);
}

-static int dw_mci_hi3798cv200_remove(struct platform_device *pdev)
+static void dw_mci_hi3798cv200_remove(struct platform_device *pdev)
{
struct dw_mci *host = platform_get_drvdata(pdev);
struct hi3798cv200_priv *priv = host->priv;
@@ -180,8 +180,6 @@ static int dw_mci_hi3798cv200_remove(struct platform_device *pdev)
clk_disable_unprepare(priv->sample_clk);

dw_mci_pltfm_remove(pdev);
-
- return 0;
}

static const struct of_device_id dw_mci_hi3798cv200_match[] = {
@@ -192,7 +190,7 @@ static const struct of_device_id dw_mci_hi3798cv200_match[] = {
MODULE_DEVICE_TABLE(of, dw_mci_hi3798cv200_match);
static struct platform_driver dw_mci_hi3798cv200_driver = {
.probe = dw_mci_hi3798cv200_probe,
- .remove = dw_mci_hi3798cv200_remove,
+ .remove_new = dw_mci_hi3798cv200_remove,
.driver = {
.name = "dwmmc_hi3798cv200",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
--
2.39.0


2023-07-13 09:05:06

by 李扬韬

[permalink] [raw]
Subject: [PATCH 58/58] mmc: Convert to platform remove callback returning void

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.

Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/mmc/host/sdhci-bcm-kona.c | 2 +-
drivers/mmc/host/sdhci-brcmstb.c | 2 +-
drivers/mmc/host/sdhci-cadence.c | 2 +-
drivers/mmc/host/sdhci-dove.c | 2 +-
drivers/mmc/host/sdhci-iproc.c | 2 +-
drivers/mmc/host/sdhci-of-esdhc.c | 2 +-
drivers/mmc/host/sdhci-of-hlwd.c | 2 +-
drivers/mmc/host/sdhci-of-sparx5.c | 2 +-
drivers/mmc/host/sdhci-pltfm.c | 4 +---
drivers/mmc/host/sdhci-pltfm.h | 2 +-
drivers/mmc/host/sdhci-pxav2.c | 2 +-
11 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/drivers/mmc/host/sdhci-bcm-kona.c b/drivers/mmc/host/sdhci-bcm-kona.c
index 6a93a54fe067..2e3736603853 100644
--- a/drivers/mmc/host/sdhci-bcm-kona.c
+++ b/drivers/mmc/host/sdhci-bcm-kona.c
@@ -319,7 +319,7 @@ static struct platform_driver sdhci_bcm_kona_driver = {
.of_match_table = sdhci_bcm_kona_of_match,
},
.probe = sdhci_bcm_kona_probe,
- .remove = sdhci_pltfm_unregister,
+ .remove_new = sdhci_pltfm_unregister,
};
module_platform_driver(sdhci_bcm_kona_driver);

diff --git a/drivers/mmc/host/sdhci-brcmstb.c b/drivers/mmc/host/sdhci-brcmstb.c
index 4c22337199cf..a2b6d8f2eeb6 100644
--- a/drivers/mmc/host/sdhci-brcmstb.c
+++ b/drivers/mmc/host/sdhci-brcmstb.c
@@ -430,7 +430,7 @@ static struct platform_driver sdhci_brcmstb_driver = {
.of_match_table = of_match_ptr(sdhci_brcm_of_match),
},
.probe = sdhci_brcmstb_probe,
- .remove = sdhci_pltfm_unregister,
+ .remove_new = sdhci_pltfm_unregister,
.shutdown = sdhci_brcmstb_shutdown,
};

diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c
index d2f625054689..1702a499b36a 100644
--- a/drivers/mmc/host/sdhci-cadence.c
+++ b/drivers/mmc/host/sdhci-cadence.c
@@ -617,7 +617,7 @@ static struct platform_driver sdhci_cdns_driver = {
.of_match_table = sdhci_cdns_match,
},
.probe = sdhci_cdns_probe,
- .remove = sdhci_pltfm_unregister,
+ .remove_new = sdhci_pltfm_unregister,
};
module_platform_driver(sdhci_cdns_driver);

diff --git a/drivers/mmc/host/sdhci-dove.c b/drivers/mmc/host/sdhci-dove.c
index 5e5bf82e5976..75335dbf223c 100644
--- a/drivers/mmc/host/sdhci-dove.c
+++ b/drivers/mmc/host/sdhci-dove.c
@@ -110,7 +110,7 @@ static struct platform_driver sdhci_dove_driver = {
.of_match_table = sdhci_dove_of_match_table,
},
.probe = sdhci_dove_probe,
- .remove = sdhci_pltfm_unregister,
+ .remove_new = sdhci_pltfm_unregister,
};

module_platform_driver(sdhci_dove_driver);
diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c
index 86eb0045515e..0dbebcecd8fc 100644
--- a/drivers/mmc/host/sdhci-iproc.c
+++ b/drivers/mmc/host/sdhci-iproc.c
@@ -432,7 +432,7 @@ static struct platform_driver sdhci_iproc_driver = {
.pm = &sdhci_pltfm_pmops,
},
.probe = sdhci_iproc_probe,
- .remove = sdhci_pltfm_unregister,
+ .remove_new = sdhci_pltfm_unregister,
.shutdown = sdhci_iproc_shutdown,
};
module_platform_driver(sdhci_iproc_driver);
diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
index 48ca1cf15b19..5072b59f6165 100644
--- a/drivers/mmc/host/sdhci-of-esdhc.c
+++ b/drivers/mmc/host/sdhci-of-esdhc.c
@@ -1521,7 +1521,7 @@ static struct platform_driver sdhci_esdhc_driver = {
.pm = &esdhc_of_dev_pm_ops,
},
.probe = sdhci_esdhc_probe,
- .remove = sdhci_pltfm_unregister,
+ .remove_new = sdhci_pltfm_unregister,
};

module_platform_driver(sdhci_esdhc_driver);
diff --git a/drivers/mmc/host/sdhci-of-hlwd.c b/drivers/mmc/host/sdhci-of-hlwd.c
index 12675797b296..cba3ba48e9dc 100644
--- a/drivers/mmc/host/sdhci-of-hlwd.c
+++ b/drivers/mmc/host/sdhci-of-hlwd.c
@@ -85,7 +85,7 @@ static struct platform_driver sdhci_hlwd_driver = {
.pm = &sdhci_pltfm_pmops,
},
.probe = sdhci_hlwd_probe,
- .remove = sdhci_pltfm_unregister,
+ .remove_new = sdhci_pltfm_unregister,
};

module_platform_driver(sdhci_hlwd_driver);
diff --git a/drivers/mmc/host/sdhci-of-sparx5.c b/drivers/mmc/host/sdhci-of-sparx5.c
index 28e4ee69e100..26aaab068e00 100644
--- a/drivers/mmc/host/sdhci-of-sparx5.c
+++ b/drivers/mmc/host/sdhci-of-sparx5.c
@@ -260,7 +260,7 @@ static struct platform_driver sdhci_sparx5_driver = {
.pm = &sdhci_pltfm_pmops,
},
.probe = sdhci_sparx5_probe,
- .remove = sdhci_pltfm_unregister,
+ .remove_new = sdhci_pltfm_unregister,
};

module_platform_driver(sdhci_sparx5_driver);
diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
index 673e750a8490..72d07b49b0a3 100644
--- a/drivers/mmc/host/sdhci-pltfm.c
+++ b/drivers/mmc/host/sdhci-pltfm.c
@@ -187,7 +187,7 @@ int sdhci_pltfm_register(struct platform_device *pdev,
}
EXPORT_SYMBOL_GPL(sdhci_pltfm_register);

-int sdhci_pltfm_unregister(struct platform_device *pdev)
+void sdhci_pltfm_unregister(struct platform_device *pdev)
{
struct sdhci_host *host = platform_get_drvdata(pdev);
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
@@ -196,8 +196,6 @@ int sdhci_pltfm_unregister(struct platform_device *pdev)
sdhci_remove_host(host, dead);
clk_disable_unprepare(pltfm_host->clk);
sdhci_pltfm_free(pdev);
-
- return 0;
}
EXPORT_SYMBOL_GPL(sdhci_pltfm_unregister);

diff --git a/drivers/mmc/host/sdhci-pltfm.h b/drivers/mmc/host/sdhci-pltfm.h
index 9bd717ff784b..6e6a443dafd9 100644
--- a/drivers/mmc/host/sdhci-pltfm.h
+++ b/drivers/mmc/host/sdhci-pltfm.h
@@ -102,7 +102,7 @@ extern void sdhci_pltfm_free(struct platform_device *pdev);
extern int sdhci_pltfm_register(struct platform_device *pdev,
const struct sdhci_pltfm_data *pdata,
size_t priv_size);
-extern int sdhci_pltfm_unregister(struct platform_device *pdev);
+extern void sdhci_pltfm_unregister(struct platform_device *pdev);

extern unsigned int sdhci_pltfm_clk_get_max_clock(struct sdhci_host *host);

diff --git a/drivers/mmc/host/sdhci-pxav2.c b/drivers/mmc/host/sdhci-pxav2.c
index 91aca8f8d6ef..1c1e763ce209 100644
--- a/drivers/mmc/host/sdhci-pxav2.c
+++ b/drivers/mmc/host/sdhci-pxav2.c
@@ -359,7 +359,7 @@ static struct platform_driver sdhci_pxav2_driver = {
.pm = &sdhci_pltfm_pmops,
},
.probe = sdhci_pxav2_probe,
- .remove = sdhci_pltfm_unregister,
+ .remove_new = sdhci_pltfm_unregister,
};

module_platform_driver(sdhci_pxav2_driver);
--
2.39.0


2023-07-13 09:05:10

by 李扬韬

[permalink] [raw]
Subject: [PATCH 41/58] mmc: alcor: Convert to platform remove callback returning void

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.

Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/mmc/host/alcor.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/alcor.c b/drivers/mmc/host/alcor.c
index d01df01d4b4d..42aa43740ba8 100644
--- a/drivers/mmc/host/alcor.c
+++ b/drivers/mmc/host/alcor.c
@@ -1125,7 +1125,7 @@ static int alcor_pci_sdmmc_drv_probe(struct platform_device *pdev)
return ret;
}

-static int alcor_pci_sdmmc_drv_remove(struct platform_device *pdev)
+static void alcor_pci_sdmmc_drv_remove(struct platform_device *pdev)
{
struct alcor_sdmmc_host *host = dev_get_drvdata(&pdev->dev);
struct mmc_host *mmc = mmc_from_priv(host);
@@ -1136,8 +1136,6 @@ static int alcor_pci_sdmmc_drv_remove(struct platform_device *pdev)
alcor_hw_uninit(host);
mmc_remove_host(mmc);
mmc_free_host(mmc);
-
- return 0;
}

#ifdef CONFIG_PM_SLEEP
@@ -1177,7 +1175,7 @@ MODULE_DEVICE_TABLE(platform, alcor_pci_sdmmc_ids);

static struct platform_driver alcor_pci_sdmmc_driver = {
.probe = alcor_pci_sdmmc_drv_probe,
- .remove = alcor_pci_sdmmc_drv_remove,
+ .remove_new = alcor_pci_sdmmc_drv_remove,
.id_table = alcor_pci_sdmmc_ids,
.driver = {
.name = DRV_NAME_ALCOR_PCI_SDMMC,
--
2.39.0


2023-07-13 09:05:22

by 李扬韬

[permalink] [raw]
Subject: [PATCH 55/58] mmc: pwrseq: sd8787: Convert to platform remove callback returning void

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.

Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/mmc/core/pwrseq_sd8787.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/core/pwrseq_sd8787.c b/drivers/mmc/core/pwrseq_sd8787.c
index 0c5f5e371e1f..0c5808fc3206 100644
--- a/drivers/mmc/core/pwrseq_sd8787.c
+++ b/drivers/mmc/core/pwrseq_sd8787.c
@@ -113,18 +113,16 @@ static int mmc_pwrseq_sd8787_probe(struct platform_device *pdev)
return mmc_pwrseq_register(&pwrseq->pwrseq);
}

-static int mmc_pwrseq_sd8787_remove(struct platform_device *pdev)
+static void mmc_pwrseq_sd8787_remove(struct platform_device *pdev)
{
struct mmc_pwrseq_sd8787 *pwrseq = platform_get_drvdata(pdev);

mmc_pwrseq_unregister(&pwrseq->pwrseq);
-
- return 0;
}

static struct platform_driver mmc_pwrseq_sd8787_driver = {
.probe = mmc_pwrseq_sd8787_probe,
- .remove = mmc_pwrseq_sd8787_remove,
+ .remove_new = mmc_pwrseq_sd8787_remove,
.driver = {
.name = "pwrseq_sd8787",
.of_match_table = mmc_pwrseq_sd8787_of_match,
--
2.39.0


2023-07-13 09:07:03

by Konrad Dybcio

[permalink] [raw]
Subject: Re: [PATCH 40/58] mmc: sdhci-msm: Convert to platform remove callback returning void

On 13.07.2023 10:07, Yangtao Li wrote:
> 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.
>
> Cc: Uwe Kleine-König <[email protected]>
> Signed-off-by: Yangtao Li <[email protected]>
> ---
Acked-by: Konrad Dybcio <[email protected]>

Konrad

> drivers/mmc/host/sdhci-msm.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
> index 1c935b5bafe1..80e376802ee0 100644
> --- a/drivers/mmc/host/sdhci-msm.c
> +++ b/drivers/mmc/host/sdhci-msm.c
> @@ -2668,7 +2668,7 @@ static int sdhci_msm_probe(struct platform_device *pdev)
> return ret;
> }
>
> -static int sdhci_msm_remove(struct platform_device *pdev)
> +static void sdhci_msm_remove(struct platform_device *pdev)
> {
> struct sdhci_host *host = platform_get_drvdata(pdev);
> struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> @@ -2687,7 +2687,6 @@ static int sdhci_msm_remove(struct platform_device *pdev)
> if (!IS_ERR(msm_host->bus_clk))
> clk_disable_unprepare(msm_host->bus_clk);
> sdhci_pltfm_free(pdev);
> - return 0;
> }
>
> static __maybe_unused int sdhci_msm_runtime_suspend(struct device *dev)
> @@ -2740,7 +2739,7 @@ static const struct dev_pm_ops sdhci_msm_pm_ops = {
>
> static struct platform_driver sdhci_msm_driver = {
> .probe = sdhci_msm_probe,
> - .remove = sdhci_msm_remove,
> + .remove_new = sdhci_msm_remove,
> .driver = {
> .name = "sdhci_msm",
> .of_match_table = sdhci_msm_dt_match,

2023-07-13 09:07:21

by 李扬韬

[permalink] [raw]
Subject: [PATCH 50/58] mmc: sunplus-mmc: Convert to platform remove callback returning void

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.

Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/mmc/host/sunplus-mmc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/sunplus-mmc.c b/drivers/mmc/host/sunplus-mmc.c
index db5e0dcdfa7f..a15371e98fd9 100644
--- a/drivers/mmc/host/sunplus-mmc.c
+++ b/drivers/mmc/host/sunplus-mmc.c
@@ -938,7 +938,7 @@ static int spmmc_drv_probe(struct platform_device *pdev)
return ret;
}

-static int spmmc_drv_remove(struct platform_device *dev)
+static void spmmc_drv_remove(struct platform_device *dev)
{
struct spmmc_host *host = platform_get_drvdata(dev);

@@ -949,8 +949,6 @@ static int spmmc_drv_remove(struct platform_device *dev)
pm_runtime_disable(&dev->dev);
platform_set_drvdata(dev, NULL);
mmc_free_host(host->mmc);
-
- return 0;
}

static int spmmc_pm_runtime_suspend(struct device *dev)
@@ -985,7 +983,7 @@ MODULE_DEVICE_TABLE(of, spmmc_of_table);

static struct platform_driver spmmc_driver = {
.probe = spmmc_drv_probe,
- .remove = spmmc_drv_remove,
+ .remove_new = spmmc_drv_remove,
.driver = {
.name = "spmmc",
.pm = pm_ptr(&spmmc_pm_ops),
--
2.39.0


2023-07-13 09:08:50

by 李扬韬

[permalink] [raw]
Subject: [PATCH 46/58] mmc: atmel-mci: Convert to platform remove callback returning void

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.

Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/mmc/host/atmel-mci.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index dd18440a90c5..b4ae9aa939a5 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -2600,7 +2600,7 @@ static int atmci_probe(struct platform_device *pdev)
return ret;
}

-static int atmci_remove(struct platform_device *pdev)
+static void atmci_remove(struct platform_device *pdev)
{
struct atmel_mci *host = platform_get_drvdata(pdev);
unsigned int i;
@@ -2630,8 +2630,6 @@ static int atmci_remove(struct platform_device *pdev)

pm_runtime_disable(&pdev->dev);
pm_runtime_put_noidle(&pdev->dev);
-
- return 0;
}

#ifdef CONFIG_PM
@@ -2664,7 +2662,7 @@ static const struct dev_pm_ops atmci_dev_pm_ops = {

static struct platform_driver atmci_driver = {
.probe = atmci_probe,
- .remove = atmci_remove,
+ .remove_new = atmci_remove,
.driver = {
.name = "atmel_mci",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
--
2.39.0


2023-07-13 09:26:47

by Uwe Kleine-König

[permalink] [raw]
Subject: Re: [PATCH 26/58] mmc: f-sdh30: Convert to platform remove callback returning void

On Thu, Jul 13, 2023 at 04:07:35PM +0800, Yangtao Li wrote:
> 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.
>
> Cc: Uwe Kleine-K?nig <[email protected]>
> Signed-off-by: Yangtao Li <[email protected]>
> ---
> drivers/mmc/host/sdhci_f_sdh30.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci_f_sdh30.c b/drivers/mmc/host/sdhci_f_sdh30.c
> index a202a69a4b08..6016e183c03c 100644
> --- a/drivers/mmc/host/sdhci_f_sdh30.c
> +++ b/drivers/mmc/host/sdhci_f_sdh30.c
> @@ -208,7 +208,7 @@ static int sdhci_f_sdh30_probe(struct platform_device *pdev)
> return ret;
> }
>
> -static int sdhci_f_sdh30_remove(struct platform_device *pdev)
> +static void sdhci_f_sdh30_remove(struct platform_device *pdev)
> {
> struct sdhci_host *host = platform_get_drvdata(pdev);
> struct f_sdhost_priv *priv = sdhci_priv(host);
> @@ -222,8 +222,6 @@ static int sdhci_f_sdh30_remove(struct platform_device *pdev)
>
> sdhci_free_host(host);
> platform_set_drvdata(pdev, NULL);
> -
> - return 0;
> }
>
> #ifdef CONFIG_OF
> @@ -252,7 +250,7 @@ static struct platform_driver sdhci_f_sdh30_driver = {
> .pm = &sdhci_pltfm_pmops,
> },
> .probe = sdhci_f_sdh30_probe,
> - .remove = sdhci_f_sdh30_remove,
> + .remove_new = sdhci_f_sdh30_remove,

Given that the alignment of =s in sdhci_f_sdh30_driver is very
inconsistent, you might want to consider to do s/\t/ / in it for the two
remaining offenders while touching this anyhow.

With or without that adapted:

Acked-by: Uwe Kleine-K?nig <[email protected]>

Best regards
Uwe

--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | https://www.pengutronix.de/ |


Attachments:
(No filename) (2.29 kB)
signature.asc (499.00 B)
Download all attachments

2023-07-13 09:26:48

by 李扬韬

[permalink] [raw]
Subject: [PATCH 37/58] mmc: sdhci-tegra: Convert to platform remove callback returning void

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.

Cc: Uwe Kleine-König <[email protected]>
Signed-off-by: Yangtao Li <[email protected]>
---
drivers/mmc/host/sdhci-tegra.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
index bff084f178c9..6a50413afc8d 100644
--- a/drivers/mmc/host/sdhci-tegra.c
+++ b/drivers/mmc/host/sdhci-tegra.c
@@ -1818,7 +1818,7 @@ static int sdhci_tegra_probe(struct platform_device *pdev)
return rc;
}

-static int sdhci_tegra_remove(struct platform_device *pdev)
+static void sdhci_tegra_remove(struct platform_device *pdev)
{
struct sdhci_host *host = platform_get_drvdata(pdev);
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
@@ -1834,8 +1834,6 @@ static int sdhci_tegra_remove(struct platform_device *pdev)

clk_disable_unprepare(tegra_host->tmclk);
sdhci_pltfm_free(pdev);
-
- return 0;
}

static int __maybe_unused sdhci_tegra_runtime_suspend(struct device *dev)
@@ -1933,7 +1931,7 @@ static struct platform_driver sdhci_tegra_driver = {
.pm = &sdhci_tegra_dev_pm_ops,
},
.probe = sdhci_tegra_probe,
- .remove = sdhci_tegra_remove,
+ .remove_new = sdhci_tegra_remove,
};

module_platform_driver(sdhci_tegra_driver);
--
2.39.0


2023-07-13 09:30:32

by Uwe Kleine-König

[permalink] [raw]
Subject: Re: [PATCH 34/58] mmc: sdhci-of-aspeed: Convert to platform remove callback returning void

On Thu, Jul 13, 2023 at 04:07:43PM +0800, Yangtao Li wrote:
> 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.
>
> Cc: Uwe Kleine-K?nig <[email protected]>
> Signed-off-by: Yangtao Li <[email protected]>
> ---
> drivers/mmc/host/sdhci-of-aspeed.c | 15 +++++----------
> 1 file changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-of-aspeed.c b/drivers/mmc/host/sdhci-of-aspeed.c
> index 25b4073f698b..42d54532cabe 100644
> --- a/drivers/mmc/host/sdhci-of-aspeed.c
> +++ b/drivers/mmc/host/sdhci-of-aspeed.c
> @@ -450,22 +450,19 @@ static int aspeed_sdhci_probe(struct platform_device *pdev)
> return ret;
> }
>
> -static int aspeed_sdhci_remove(struct platform_device *pdev)
> +static void aspeed_sdhci_remove(struct platform_device *pdev)
> {
> struct sdhci_pltfm_host *pltfm_host;
> struct sdhci_host *host;
> - int dead = 0;
>
> host = platform_get_drvdata(pdev);
> pltfm_host = sdhci_priv(host);
>
> - sdhci_remove_host(host, dead);
> + sdhci_remove_host(host, 0);

Please mention additional cleanups in the commit log (or split them into
separate patches).

Best regards
Uwe

--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | https://www.pengutronix.de/ |


Attachments:
(No filename) (1.82 kB)
signature.asc (499.00 B)
Download all attachments

2023-07-13 09:34:33

by Uwe Kleine-König

[permalink] [raw]
Subject: Re: [PATCH 25/58] mmc: uniphier-sd: Convert to platform remove callback returning void

Hello,

$Subject ~= s/ / /

(maybe that's fixed automatically if picked up by git-am, but I'm not
sure and didn't test.)

Otherwise looks fine.

Best regards
Uwe

--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | https://www.pengutronix.de/ |


Attachments:
(No filename) (333.00 B)
signature.asc (499.00 B)
Download all attachments

2023-07-13 10:45:02

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH 57/58] mmc: renesas_sdhi: Convert to platform remove callback returning void

On Thu, Jul 13, 2023 at 10:32 AM Yangtao Li <[email protected]> wrote:
> 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.
>
> Cc: Uwe Kleine-König <[email protected]>
> Signed-off-by: Yangtao Li <[email protected]>

Reviewed-by: Geert Uytterhoeven <[email protected]>

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2023-07-13 11:57:38

by Jesper Nilsson

[permalink] [raw]
Subject: Re: [PATCH 45/58] mmc: usdhi60rol0: Convert to platform remove callback returning void

On Thu, Jul 13, 2023 at 04:07:54PM +0800, Yangtao Li wrote:
> 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.
>
> Cc: Uwe Kleine-K?nig <[email protected]>
> Signed-off-by: Yangtao Li <[email protected]>

Acked-by: Jesper Nilsson <[email protected]>

/^JN - Jesper Nilsson
--
Jesper Nilsson -- [email protected]

2023-07-13 16:03:03

by Jernej Škrabec

[permalink] [raw]
Subject: Re: [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void

Dne četrtek, 13. julij 2023 ob 10:07:10 CEST je Yangtao Li napisal(a):
> 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.
>
> Cc: Uwe Kleine-König <[email protected]>
> Signed-off-by: Yangtao Li <[email protected]>

Acked-by: Jernej Skrabec <[email protected]>

Best regards,
Jernej

> ---
> drivers/mmc/host/sunxi-mmc.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
> index 69dcb8805e05..d3bd0ac99ec4 100644
> --- a/drivers/mmc/host/sunxi-mmc.c
> +++ b/drivers/mmc/host/sunxi-mmc.c
> @@ -1486,7 +1486,7 @@ static int sunxi_mmc_probe(struct platform_device
> *pdev) return ret;
> }
>
> -static int sunxi_mmc_remove(struct platform_device *pdev)
> +static void sunxi_mmc_remove(struct platform_device *pdev)
> {
> struct mmc_host *mmc = platform_get_drvdata(pdev);
> struct sunxi_mmc_host *host = mmc_priv(mmc);
> @@ -1499,8 +1499,6 @@ static int sunxi_mmc_remove(struct platform_device
> *pdev) }
> dma_free_coherent(&pdev->dev, PAGE_SIZE, host->sg_cpu, host-
>sg_dma);
> mmc_free_host(mmc);
> -
> - return 0;
> }
>
> #ifdef CONFIG_PM
> @@ -1556,7 +1554,7 @@ static struct platform_driver sunxi_mmc_driver = {
> .pm = &sunxi_mmc_pm_ops,
> },
> .probe = sunxi_mmc_probe,
> - .remove = sunxi_mmc_remove,
> + .remove_new = sunxi_mmc_remove,
> };
> module_platform_driver(sunxi_mmc_driver);





2023-07-14 07:53:45

by Adrian Hunter

[permalink] [raw]
Subject: Re: [PATCH 58/58] mmc: Convert to platform remove callback returning void

On 13/07/23 11:08, Yangtao Li wrote:
> 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.
>
> Cc: Uwe Kleine-König <[email protected]>
> Signed-off-by: Yangtao Li <[email protected]>
> ---
> drivers/mmc/host/sdhci-bcm-kona.c | 2 +-
> drivers/mmc/host/sdhci-brcmstb.c | 2 +-
> drivers/mmc/host/sdhci-cadence.c | 2 +-
> drivers/mmc/host/sdhci-dove.c | 2 +-
> drivers/mmc/host/sdhci-iproc.c | 2 +-
> drivers/mmc/host/sdhci-of-esdhc.c | 2 +-
> drivers/mmc/host/sdhci-of-hlwd.c | 2 +-
> drivers/mmc/host/sdhci-of-sparx5.c | 2 +-
> drivers/mmc/host/sdhci-pltfm.c | 4 +---
> drivers/mmc/host/sdhci-pltfm.h | 2 +-
> drivers/mmc/host/sdhci-pxav2.c | 2 +-

Looks like drivers/mmc/host/sdhci-npcm.c was missed

> 11 files changed, 11 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-bcm-kona.c b/drivers/mmc/host/sdhci-bcm-kona.c
> index 6a93a54fe067..2e3736603853 100644
> --- a/drivers/mmc/host/sdhci-bcm-kona.c
> +++ b/drivers/mmc/host/sdhci-bcm-kona.c
> @@ -319,7 +319,7 @@ static struct platform_driver sdhci_bcm_kona_driver = {
> .of_match_table = sdhci_bcm_kona_of_match,
> },
> .probe = sdhci_bcm_kona_probe,
> - .remove = sdhci_pltfm_unregister,
> + .remove_new = sdhci_pltfm_unregister,
> };
> module_platform_driver(sdhci_bcm_kona_driver);
>
> diff --git a/drivers/mmc/host/sdhci-brcmstb.c b/drivers/mmc/host/sdhci-brcmstb.c
> index 4c22337199cf..a2b6d8f2eeb6 100644
> --- a/drivers/mmc/host/sdhci-brcmstb.c
> +++ b/drivers/mmc/host/sdhci-brcmstb.c
> @@ -430,7 +430,7 @@ static struct platform_driver sdhci_brcmstb_driver = {
> .of_match_table = of_match_ptr(sdhci_brcm_of_match),
> },
> .probe = sdhci_brcmstb_probe,
> - .remove = sdhci_pltfm_unregister,
> + .remove_new = sdhci_pltfm_unregister,
> .shutdown = sdhci_brcmstb_shutdown,
> };
>
> diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c
> index d2f625054689..1702a499b36a 100644
> --- a/drivers/mmc/host/sdhci-cadence.c
> +++ b/drivers/mmc/host/sdhci-cadence.c
> @@ -617,7 +617,7 @@ static struct platform_driver sdhci_cdns_driver = {
> .of_match_table = sdhci_cdns_match,
> },
> .probe = sdhci_cdns_probe,
> - .remove = sdhci_pltfm_unregister,
> + .remove_new = sdhci_pltfm_unregister,
> };
> module_platform_driver(sdhci_cdns_driver);
>
> diff --git a/drivers/mmc/host/sdhci-dove.c b/drivers/mmc/host/sdhci-dove.c
> index 5e5bf82e5976..75335dbf223c 100644
> --- a/drivers/mmc/host/sdhci-dove.c
> +++ b/drivers/mmc/host/sdhci-dove.c
> @@ -110,7 +110,7 @@ static struct platform_driver sdhci_dove_driver = {
> .of_match_table = sdhci_dove_of_match_table,
> },
> .probe = sdhci_dove_probe,
> - .remove = sdhci_pltfm_unregister,
> + .remove_new = sdhci_pltfm_unregister,
> };
>
> module_platform_driver(sdhci_dove_driver);
> diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c
> index 86eb0045515e..0dbebcecd8fc 100644
> --- a/drivers/mmc/host/sdhci-iproc.c
> +++ b/drivers/mmc/host/sdhci-iproc.c
> @@ -432,7 +432,7 @@ static struct platform_driver sdhci_iproc_driver = {
> .pm = &sdhci_pltfm_pmops,
> },
> .probe = sdhci_iproc_probe,
> - .remove = sdhci_pltfm_unregister,
> + .remove_new = sdhci_pltfm_unregister,
> .shutdown = sdhci_iproc_shutdown,
> };
> module_platform_driver(sdhci_iproc_driver);
> diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
> index 48ca1cf15b19..5072b59f6165 100644
> --- a/drivers/mmc/host/sdhci-of-esdhc.c
> +++ b/drivers/mmc/host/sdhci-of-esdhc.c
> @@ -1521,7 +1521,7 @@ static struct platform_driver sdhci_esdhc_driver = {
> .pm = &esdhc_of_dev_pm_ops,
> },
> .probe = sdhci_esdhc_probe,
> - .remove = sdhci_pltfm_unregister,
> + .remove_new = sdhci_pltfm_unregister,
> };
>
> module_platform_driver(sdhci_esdhc_driver);
> diff --git a/drivers/mmc/host/sdhci-of-hlwd.c b/drivers/mmc/host/sdhci-of-hlwd.c
> index 12675797b296..cba3ba48e9dc 100644
> --- a/drivers/mmc/host/sdhci-of-hlwd.c
> +++ b/drivers/mmc/host/sdhci-of-hlwd.c
> @@ -85,7 +85,7 @@ static struct platform_driver sdhci_hlwd_driver = {
> .pm = &sdhci_pltfm_pmops,
> },
> .probe = sdhci_hlwd_probe,
> - .remove = sdhci_pltfm_unregister,
> + .remove_new = sdhci_pltfm_unregister,
> };
>
> module_platform_driver(sdhci_hlwd_driver);
> diff --git a/drivers/mmc/host/sdhci-of-sparx5.c b/drivers/mmc/host/sdhci-of-sparx5.c
> index 28e4ee69e100..26aaab068e00 100644
> --- a/drivers/mmc/host/sdhci-of-sparx5.c
> +++ b/drivers/mmc/host/sdhci-of-sparx5.c
> @@ -260,7 +260,7 @@ static struct platform_driver sdhci_sparx5_driver = {
> .pm = &sdhci_pltfm_pmops,
> },
> .probe = sdhci_sparx5_probe,
> - .remove = sdhci_pltfm_unregister,
> + .remove_new = sdhci_pltfm_unregister,
> };
>
> module_platform_driver(sdhci_sparx5_driver);
> diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
> index 673e750a8490..72d07b49b0a3 100644
> --- a/drivers/mmc/host/sdhci-pltfm.c
> +++ b/drivers/mmc/host/sdhci-pltfm.c
> @@ -187,7 +187,7 @@ int sdhci_pltfm_register(struct platform_device *pdev,
> }
> EXPORT_SYMBOL_GPL(sdhci_pltfm_register);
>
> -int sdhci_pltfm_unregister(struct platform_device *pdev)
> +void sdhci_pltfm_unregister(struct platform_device *pdev)
> {
> struct sdhci_host *host = platform_get_drvdata(pdev);
> struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> @@ -196,8 +196,6 @@ int sdhci_pltfm_unregister(struct platform_device *pdev)
> sdhci_remove_host(host, dead);
> clk_disable_unprepare(pltfm_host->clk);
> sdhci_pltfm_free(pdev);
> -
> - return 0;
> }
> EXPORT_SYMBOL_GPL(sdhci_pltfm_unregister);
>
> diff --git a/drivers/mmc/host/sdhci-pltfm.h b/drivers/mmc/host/sdhci-pltfm.h
> index 9bd717ff784b..6e6a443dafd9 100644
> --- a/drivers/mmc/host/sdhci-pltfm.h
> +++ b/drivers/mmc/host/sdhci-pltfm.h
> @@ -102,7 +102,7 @@ extern void sdhci_pltfm_free(struct platform_device *pdev);
> extern int sdhci_pltfm_register(struct platform_device *pdev,
> const struct sdhci_pltfm_data *pdata,
> size_t priv_size);
> -extern int sdhci_pltfm_unregister(struct platform_device *pdev);
> +extern void sdhci_pltfm_unregister(struct platform_device *pdev);
>
> extern unsigned int sdhci_pltfm_clk_get_max_clock(struct sdhci_host *host);
>
> diff --git a/drivers/mmc/host/sdhci-pxav2.c b/drivers/mmc/host/sdhci-pxav2.c
> index 91aca8f8d6ef..1c1e763ce209 100644
> --- a/drivers/mmc/host/sdhci-pxav2.c
> +++ b/drivers/mmc/host/sdhci-pxav2.c
> @@ -359,7 +359,7 @@ static struct platform_driver sdhci_pxav2_driver = {
> .pm = &sdhci_pltfm_pmops,
> },
> .probe = sdhci_pxav2_probe,
> - .remove = sdhci_pltfm_unregister,
> + .remove_new = sdhci_pltfm_unregister,
> };
>
> module_platform_driver(sdhci_pxav2_driver);


2023-07-14 08:07:08

by Adrian Hunter

[permalink] [raw]
Subject: Re: [PATCH 26/58] mmc: f-sdh30: Convert to platform remove callback returning void

On 13/07/23 11:07, Yangtao Li wrote:
> 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.
>
> Cc: Uwe Kleine-König <[email protected]>
> Signed-off-by: Yangtao Li <[email protected]>

Doesn't apply anymore. You can check against the "next" branch in:

git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc.git

> ---
> drivers/mmc/host/sdhci_f_sdh30.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci_f_sdh30.c b/drivers/mmc/host/sdhci_f_sdh30.c
> index a202a69a4b08..6016e183c03c 100644
> --- a/drivers/mmc/host/sdhci_f_sdh30.c
> +++ b/drivers/mmc/host/sdhci_f_sdh30.c
> @@ -208,7 +208,7 @@ static int sdhci_f_sdh30_probe(struct platform_device *pdev)
> return ret;
> }
>
> -static int sdhci_f_sdh30_remove(struct platform_device *pdev)
> +static void sdhci_f_sdh30_remove(struct platform_device *pdev)
> {
> struct sdhci_host *host = platform_get_drvdata(pdev);
> struct f_sdhost_priv *priv = sdhci_priv(host);
> @@ -222,8 +222,6 @@ static int sdhci_f_sdh30_remove(struct platform_device *pdev)
>
> sdhci_free_host(host);
> platform_set_drvdata(pdev, NULL);
> -
> - return 0;
> }
>
> #ifdef CONFIG_OF
> @@ -252,7 +250,7 @@ static struct platform_driver sdhci_f_sdh30_driver = {
> .pm = &sdhci_pltfm_pmops,
> },
> .probe = sdhci_f_sdh30_probe,
> - .remove = sdhci_f_sdh30_remove,
> + .remove_new = sdhci_f_sdh30_remove,
> };
>
> module_platform_driver(sdhci_f_sdh30_driver);


2023-07-14 10:27:33

by Florian Fainelli

[permalink] [raw]
Subject: Re: [PATCH 58/58] mmc: Convert to platform remove callback returning void



On 7/13/2023 10:08 AM, Yangtao Li wrote:
> 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.
>
> Cc: Uwe Kleine-König <[email protected]>
> Signed-off-by: Yangtao Li <[email protected]>
> ---
> drivers/mmc/host/sdhci-bcm-kona.c | 2 +-
> drivers/mmc/host/sdhci-brcmstb.c | 2 +-

Acked-by: Florian Fainelli <[email protected]> # Broadcom
drivers
--
Florian


Attachments:
smime.p7s (4.12 kB)
S/MIME Cryptographic Signature

2023-07-25 09:23:41

by 李扬韬

[permalink] [raw]
Subject: Re: [PATCH 58/58] mmc: Convert to platform remove callback returning void

Hi Adria,

On 2023/7/14 15:49, Adrian Hunter wrote:
> On 13/07/23 11:08, Yangtao Li wrote:
>> 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.
>>
>> Cc: Uwe Kleine-König <[email protected]>
>> Signed-off-by: Yangtao Li <[email protected]>
>> ---
>> drivers/mmc/host/sdhci-bcm-kona.c | 2 +-
>> drivers/mmc/host/sdhci-brcmstb.c | 2 +-
>> drivers/mmc/host/sdhci-cadence.c | 2 +-
>> drivers/mmc/host/sdhci-dove.c | 2 +-
>> drivers/mmc/host/sdhci-iproc.c | 2 +-
>> drivers/mmc/host/sdhci-of-esdhc.c | 2 +-
>> drivers/mmc/host/sdhci-of-hlwd.c | 2 +-
>> drivers/mmc/host/sdhci-of-sparx5.c | 2 +-
>> drivers/mmc/host/sdhci-pltfm.c | 4 +---
>> drivers/mmc/host/sdhci-pltfm.h | 2 +-
>> drivers/mmc/host/sdhci-pxav2.c | 2 +-
> Looks like drivers/mmc/host/sdhci-npcm.c was missed


Neither [1] nor [2] can find this driver, what am I missing?

[1]

https://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc.git/tree/drivers/mmc/host?h=next

[2]

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/mmc/host


Thx,

Yangtao


>
>> 11 files changed, 11 insertions(+), 13 deletions(-)
>>
>> diff --git a/drivers/mmc/host/sdhci-bcm-kona.c b/drivers/mmc/host/sdhci-bcm-kona.c
>> index 6a93a54fe067..2e3736603853 100644
>> --- a/drivers/mmc/host/sdhci-bcm-kona.c
>> +++ b/drivers/mmc/host/sdhci-bcm-kona.c
>> @@ -319,7 +319,7 @@ static struct platform_driver sdhci_bcm_kona_driver = {
>> .of_match_table = sdhci_bcm_kona_of_match,
>> },
>> .probe = sdhci_bcm_kona_probe,
>> - .remove = sdhci_pltfm_unregister,
>> + .remove_new = sdhci_pltfm_unregister,
>> };
>> module_platform_driver(sdhci_bcm_kona_driver);
>>
>> diff --git a/drivers/mmc/host/sdhci-brcmstb.c b/drivers/mmc/host/sdhci-brcmstb.c
>> index 4c22337199cf..a2b6d8f2eeb6 100644
>> --- a/drivers/mmc/host/sdhci-brcmstb.c
>> +++ b/drivers/mmc/host/sdhci-brcmstb.c
>> @@ -430,7 +430,7 @@ static struct platform_driver sdhci_brcmstb_driver = {
>> .of_match_table = of_match_ptr(sdhci_brcm_of_match),
>> },
>> .probe = sdhci_brcmstb_probe,
>> - .remove = sdhci_pltfm_unregister,
>> + .remove_new = sdhci_pltfm_unregister,
>> .shutdown = sdhci_brcmstb_shutdown,
>> };
>>
>> diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c
>> index d2f625054689..1702a499b36a 100644
>> --- a/drivers/mmc/host/sdhci-cadence.c
>> +++ b/drivers/mmc/host/sdhci-cadence.c
>> @@ -617,7 +617,7 @@ static struct platform_driver sdhci_cdns_driver = {
>> .of_match_table = sdhci_cdns_match,
>> },
>> .probe = sdhci_cdns_probe,
>> - .remove = sdhci_pltfm_unregister,
>> + .remove_new = sdhci_pltfm_unregister,
>> };
>> module_platform_driver(sdhci_cdns_driver);
>>
>> diff --git a/drivers/mmc/host/sdhci-dove.c b/drivers/mmc/host/sdhci-dove.c
>> index 5e5bf82e5976..75335dbf223c 100644
>> --- a/drivers/mmc/host/sdhci-dove.c
>> +++ b/drivers/mmc/host/sdhci-dove.c
>> @@ -110,7 +110,7 @@ static struct platform_driver sdhci_dove_driver = {
>> .of_match_table = sdhci_dove_of_match_table,
>> },
>> .probe = sdhci_dove_probe,
>> - .remove = sdhci_pltfm_unregister,
>> + .remove_new = sdhci_pltfm_unregister,
>> };
>>
>> module_platform_driver(sdhci_dove_driver);
>> diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c
>> index 86eb0045515e..0dbebcecd8fc 100644
>> --- a/drivers/mmc/host/sdhci-iproc.c
>> +++ b/drivers/mmc/host/sdhci-iproc.c
>> @@ -432,7 +432,7 @@ static struct platform_driver sdhci_iproc_driver = {
>> .pm = &sdhci_pltfm_pmops,
>> },
>> .probe = sdhci_iproc_probe,
>> - .remove = sdhci_pltfm_unregister,
>> + .remove_new = sdhci_pltfm_unregister,
>> .shutdown = sdhci_iproc_shutdown,
>> };
>> module_platform_driver(sdhci_iproc_driver);
>> diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
>> index 48ca1cf15b19..5072b59f6165 100644
>> --- a/drivers/mmc/host/sdhci-of-esdhc.c
>> +++ b/drivers/mmc/host/sdhci-of-esdhc.c
>> @@ -1521,7 +1521,7 @@ static struct platform_driver sdhci_esdhc_driver = {
>> .pm = &esdhc_of_dev_pm_ops,
>> },
>> .probe = sdhci_esdhc_probe,
>> - .remove = sdhci_pltfm_unregister,
>> + .remove_new = sdhci_pltfm_unregister,
>> };
>>
>> module_platform_driver(sdhci_esdhc_driver);
>> diff --git a/drivers/mmc/host/sdhci-of-hlwd.c b/drivers/mmc/host/sdhci-of-hlwd.c
>> index 12675797b296..cba3ba48e9dc 100644
>> --- a/drivers/mmc/host/sdhci-of-hlwd.c
>> +++ b/drivers/mmc/host/sdhci-of-hlwd.c
>> @@ -85,7 +85,7 @@ static struct platform_driver sdhci_hlwd_driver = {
>> .pm = &sdhci_pltfm_pmops,
>> },
>> .probe = sdhci_hlwd_probe,
>> - .remove = sdhci_pltfm_unregister,
>> + .remove_new = sdhci_pltfm_unregister,
>> };
>>
>> module_platform_driver(sdhci_hlwd_driver);
>> diff --git a/drivers/mmc/host/sdhci-of-sparx5.c b/drivers/mmc/host/sdhci-of-sparx5.c
>> index 28e4ee69e100..26aaab068e00 100644
>> --- a/drivers/mmc/host/sdhci-of-sparx5.c
>> +++ b/drivers/mmc/host/sdhci-of-sparx5.c
>> @@ -260,7 +260,7 @@ static struct platform_driver sdhci_sparx5_driver = {
>> .pm = &sdhci_pltfm_pmops,
>> },
>> .probe = sdhci_sparx5_probe,
>> - .remove = sdhci_pltfm_unregister,
>> + .remove_new = sdhci_pltfm_unregister,
>> };
>>
>> module_platform_driver(sdhci_sparx5_driver);
>> diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
>> index 673e750a8490..72d07b49b0a3 100644
>> --- a/drivers/mmc/host/sdhci-pltfm.c
>> +++ b/drivers/mmc/host/sdhci-pltfm.c
>> @@ -187,7 +187,7 @@ int sdhci_pltfm_register(struct platform_device *pdev,
>> }
>> EXPORT_SYMBOL_GPL(sdhci_pltfm_register);
>>
>> -int sdhci_pltfm_unregister(struct platform_device *pdev)
>> +void sdhci_pltfm_unregister(struct platform_device *pdev)
>> {
>> struct sdhci_host *host = platform_get_drvdata(pdev);
>> struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
>> @@ -196,8 +196,6 @@ int sdhci_pltfm_unregister(struct platform_device *pdev)
>> sdhci_remove_host(host, dead);
>> clk_disable_unprepare(pltfm_host->clk);
>> sdhci_pltfm_free(pdev);
>> -
>> - return 0;
>> }
>> EXPORT_SYMBOL_GPL(sdhci_pltfm_unregister);
>>
>> diff --git a/drivers/mmc/host/sdhci-pltfm.h b/drivers/mmc/host/sdhci-pltfm.h
>> index 9bd717ff784b..6e6a443dafd9 100644
>> --- a/drivers/mmc/host/sdhci-pltfm.h
>> +++ b/drivers/mmc/host/sdhci-pltfm.h
>> @@ -102,7 +102,7 @@ extern void sdhci_pltfm_free(struct platform_device *pdev);
>> extern int sdhci_pltfm_register(struct platform_device *pdev,
>> const struct sdhci_pltfm_data *pdata,
>> size_t priv_size);
>> -extern int sdhci_pltfm_unregister(struct platform_device *pdev);
>> +extern void sdhci_pltfm_unregister(struct platform_device *pdev);
>>
>> extern unsigned int sdhci_pltfm_clk_get_max_clock(struct sdhci_host *host);
>>
>> diff --git a/drivers/mmc/host/sdhci-pxav2.c b/drivers/mmc/host/sdhci-pxav2.c
>> index 91aca8f8d6ef..1c1e763ce209 100644
>> --- a/drivers/mmc/host/sdhci-pxav2.c
>> +++ b/drivers/mmc/host/sdhci-pxav2.c
>> @@ -359,7 +359,7 @@ static struct platform_driver sdhci_pxav2_driver = {
>> .pm = &sdhci_pltfm_pmops,
>> },
>> .probe = sdhci_pxav2_probe,
>> - .remove = sdhci_pltfm_unregister,
>> + .remove_new = sdhci_pltfm_unregister,
>> };
>>
>> module_platform_driver(sdhci_pxav2_driver);

2023-07-25 11:52:12

by Adrian Hunter

[permalink] [raw]
Subject: Re: [PATCH 58/58] mmc: Convert to platform remove callback returning void

On 25/07/23 11:13, Yangtao Li wrote:
> Hi Adria,
>
> On 2023/7/14 15:49, Adrian Hunter wrote:
>> On 13/07/23 11:08, Yangtao Li wrote:
>>> 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.
>>>
>>> Cc: Uwe Kleine-König <[email protected]>
>>> Signed-off-by: Yangtao Li <[email protected]>
>>> ---
>>>   drivers/mmc/host/sdhci-bcm-kona.c  | 2 +-
>>>   drivers/mmc/host/sdhci-brcmstb.c   | 2 +-
>>>   drivers/mmc/host/sdhci-cadence.c   | 2 +-
>>>   drivers/mmc/host/sdhci-dove.c      | 2 +-
>>>   drivers/mmc/host/sdhci-iproc.c     | 2 +-
>>>   drivers/mmc/host/sdhci-of-esdhc.c  | 2 +-
>>>   drivers/mmc/host/sdhci-of-hlwd.c   | 2 +-
>>>   drivers/mmc/host/sdhci-of-sparx5.c | 2 +-
>>>   drivers/mmc/host/sdhci-pltfm.c     | 4 +---
>>>   drivers/mmc/host/sdhci-pltfm.h     | 2 +-
>>>   drivers/mmc/host/sdhci-pxav2.c     | 2 +-
>> Looks like drivers/mmc/host/sdhci-npcm.c was missed
>
>
> Neither [1] nor [2] can find this driver, what am I missing?

Sorry, it was some untracked rubbish left over in my tree.

In that case:

Acked-by: Adrian Hunter <[email protected]>


>
> [1]
>
> https://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc.git/tree/drivers/mmc/host?h=next
>
> [2]
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/mmc/host
>
>
> Thx,
>
> Yangtao
>
>
>>
>>>   11 files changed, 11 insertions(+), 13 deletions(-)
>>>
>>> diff --git a/drivers/mmc/host/sdhci-bcm-kona.c b/drivers/mmc/host/sdhci-bcm-kona.c
>>> index 6a93a54fe067..2e3736603853 100644
>>> --- a/drivers/mmc/host/sdhci-bcm-kona.c
>>> +++ b/drivers/mmc/host/sdhci-bcm-kona.c
>>> @@ -319,7 +319,7 @@ static struct platform_driver sdhci_bcm_kona_driver = {
>>>           .of_match_table = sdhci_bcm_kona_of_match,
>>>       },
>>>       .probe        = sdhci_bcm_kona_probe,
>>> -    .remove        = sdhci_pltfm_unregister,
>>> +    .remove_new    = sdhci_pltfm_unregister,
>>>   };
>>>   module_platform_driver(sdhci_bcm_kona_driver);
>>>   diff --git a/drivers/mmc/host/sdhci-brcmstb.c b/drivers/mmc/host/sdhci-brcmstb.c
>>> index 4c22337199cf..a2b6d8f2eeb6 100644
>>> --- a/drivers/mmc/host/sdhci-brcmstb.c
>>> +++ b/drivers/mmc/host/sdhci-brcmstb.c
>>> @@ -430,7 +430,7 @@ static struct platform_driver sdhci_brcmstb_driver = {
>>>           .of_match_table = of_match_ptr(sdhci_brcm_of_match),
>>>       },
>>>       .probe        = sdhci_brcmstb_probe,
>>> -    .remove        = sdhci_pltfm_unregister,
>>> +    .remove_new    = sdhci_pltfm_unregister,
>>>       .shutdown    = sdhci_brcmstb_shutdown,
>>>   };
>>>   diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c
>>> index d2f625054689..1702a499b36a 100644
>>> --- a/drivers/mmc/host/sdhci-cadence.c
>>> +++ b/drivers/mmc/host/sdhci-cadence.c
>>> @@ -617,7 +617,7 @@ static struct platform_driver sdhci_cdns_driver = {
>>>           .of_match_table = sdhci_cdns_match,
>>>       },
>>>       .probe = sdhci_cdns_probe,
>>> -    .remove = sdhci_pltfm_unregister,
>>> +    .remove_new = sdhci_pltfm_unregister,
>>>   };
>>>   module_platform_driver(sdhci_cdns_driver);
>>>   diff --git a/drivers/mmc/host/sdhci-dove.c b/drivers/mmc/host/sdhci-dove.c
>>> index 5e5bf82e5976..75335dbf223c 100644
>>> --- a/drivers/mmc/host/sdhci-dove.c
>>> +++ b/drivers/mmc/host/sdhci-dove.c
>>> @@ -110,7 +110,7 @@ static struct platform_driver sdhci_dove_driver = {
>>>           .of_match_table = sdhci_dove_of_match_table,
>>>       },
>>>       .probe        = sdhci_dove_probe,
>>> -    .remove        = sdhci_pltfm_unregister,
>>> +    .remove_new    = sdhci_pltfm_unregister,
>>>   };
>>>     module_platform_driver(sdhci_dove_driver);
>>> diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c
>>> index 86eb0045515e..0dbebcecd8fc 100644
>>> --- a/drivers/mmc/host/sdhci-iproc.c
>>> +++ b/drivers/mmc/host/sdhci-iproc.c
>>> @@ -432,7 +432,7 @@ static struct platform_driver sdhci_iproc_driver = {
>>>           .pm = &sdhci_pltfm_pmops,
>>>       },
>>>       .probe = sdhci_iproc_probe,
>>> -    .remove = sdhci_pltfm_unregister,
>>> +    .remove_new = sdhci_pltfm_unregister,
>>>       .shutdown = sdhci_iproc_shutdown,
>>>   };
>>>   module_platform_driver(sdhci_iproc_driver);
>>> diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
>>> index 48ca1cf15b19..5072b59f6165 100644
>>> --- a/drivers/mmc/host/sdhci-of-esdhc.c
>>> +++ b/drivers/mmc/host/sdhci-of-esdhc.c
>>> @@ -1521,7 +1521,7 @@ static struct platform_driver sdhci_esdhc_driver = {
>>>           .pm = &esdhc_of_dev_pm_ops,
>>>       },
>>>       .probe = sdhci_esdhc_probe,
>>> -    .remove = sdhci_pltfm_unregister,
>>> +    .remove_new = sdhci_pltfm_unregister,
>>>   };
>>>     module_platform_driver(sdhci_esdhc_driver);
>>> diff --git a/drivers/mmc/host/sdhci-of-hlwd.c b/drivers/mmc/host/sdhci-of-hlwd.c
>>> index 12675797b296..cba3ba48e9dc 100644
>>> --- a/drivers/mmc/host/sdhci-of-hlwd.c
>>> +++ b/drivers/mmc/host/sdhci-of-hlwd.c
>>> @@ -85,7 +85,7 @@ static struct platform_driver sdhci_hlwd_driver = {
>>>           .pm = &sdhci_pltfm_pmops,
>>>       },
>>>       .probe = sdhci_hlwd_probe,
>>> -    .remove = sdhci_pltfm_unregister,
>>> +    .remove_new = sdhci_pltfm_unregister,
>>>   };
>>>     module_platform_driver(sdhci_hlwd_driver);
>>> diff --git a/drivers/mmc/host/sdhci-of-sparx5.c b/drivers/mmc/host/sdhci-of-sparx5.c
>>> index 28e4ee69e100..26aaab068e00 100644
>>> --- a/drivers/mmc/host/sdhci-of-sparx5.c
>>> +++ b/drivers/mmc/host/sdhci-of-sparx5.c
>>> @@ -260,7 +260,7 @@ static struct platform_driver sdhci_sparx5_driver = {
>>>           .pm = &sdhci_pltfm_pmops,
>>>       },
>>>       .probe = sdhci_sparx5_probe,
>>> -    .remove = sdhci_pltfm_unregister,
>>> +    .remove_new = sdhci_pltfm_unregister,
>>>   };
>>>     module_platform_driver(sdhci_sparx5_driver);
>>> diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
>>> index 673e750a8490..72d07b49b0a3 100644
>>> --- a/drivers/mmc/host/sdhci-pltfm.c
>>> +++ b/drivers/mmc/host/sdhci-pltfm.c
>>> @@ -187,7 +187,7 @@ int sdhci_pltfm_register(struct platform_device *pdev,
>>>   }
>>>   EXPORT_SYMBOL_GPL(sdhci_pltfm_register);
>>>   -int sdhci_pltfm_unregister(struct platform_device *pdev)
>>> +void sdhci_pltfm_unregister(struct platform_device *pdev)
>>>   {
>>>       struct sdhci_host *host = platform_get_drvdata(pdev);
>>>       struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
>>> @@ -196,8 +196,6 @@ int sdhci_pltfm_unregister(struct platform_device *pdev)
>>>       sdhci_remove_host(host, dead);
>>>       clk_disable_unprepare(pltfm_host->clk);
>>>       sdhci_pltfm_free(pdev);
>>> -
>>> -    return 0;
>>>   }
>>>   EXPORT_SYMBOL_GPL(sdhci_pltfm_unregister);
>>>   diff --git a/drivers/mmc/host/sdhci-pltfm.h b/drivers/mmc/host/sdhci-pltfm.h
>>> index 9bd717ff784b..6e6a443dafd9 100644
>>> --- a/drivers/mmc/host/sdhci-pltfm.h
>>> +++ b/drivers/mmc/host/sdhci-pltfm.h
>>> @@ -102,7 +102,7 @@ extern void sdhci_pltfm_free(struct platform_device *pdev);
>>>   extern int sdhci_pltfm_register(struct platform_device *pdev,
>>>                   const struct sdhci_pltfm_data *pdata,
>>>                   size_t priv_size);
>>> -extern int sdhci_pltfm_unregister(struct platform_device *pdev);
>>> +extern void sdhci_pltfm_unregister(struct platform_device *pdev);
>>>     extern unsigned int sdhci_pltfm_clk_get_max_clock(struct sdhci_host *host);
>>>   diff --git a/drivers/mmc/host/sdhci-pxav2.c b/drivers/mmc/host/sdhci-pxav2.c
>>> index 91aca8f8d6ef..1c1e763ce209 100644
>>> --- a/drivers/mmc/host/sdhci-pxav2.c
>>> +++ b/drivers/mmc/host/sdhci-pxav2.c
>>> @@ -359,7 +359,7 @@ static struct platform_driver sdhci_pxav2_driver = {
>>>           .pm    = &sdhci_pltfm_pmops,
>>>       },
>>>       .probe        = sdhci_pxav2_probe,
>>> -    .remove        = sdhci_pltfm_unregister,
>>> +    .remove_new    = sdhci_pltfm_unregister,
>>>   };
>>>     module_platform_driver(sdhci_pxav2_driver);