mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage
Subsystems (30)
cover mmc: Cleanup sdhci_pltfm_free()/sdhci_free_host() usage
Hi all:
After the first part of the cleanup[1], there are sdhci related drivers that need further cleanup.
This patchset is the second part of the cleanup series, and since sdhci has sdhci_alloc_host() as the general interface, our main job is to clean up sdhci_pltfm_free() and sdhci_free_host().
[1]:https://lore.kernel.org/all/[email protected]/
Thanks.
Binbin Zhou (34):
mmc: sdhci: Use devm_mmc_alloc_host() helper
mmc: sdhci-acpi: Drop the use of sdhci_free_host()
mmc: sdhci-milbeaut: Drop the use of sdhci_free_host()
mmc: sdhci-pci: Drop the use of sdhci_free_host()
mmc: sdhci-s3c: Drop the use of sdhci_free_host()
mmc: sdhci-spear: Drop the use of sdhci_free_host()
mmc: sdhci-pltfm: Drop the use of sdhci_pltfm_free()
mmc: sdhci-bcm-kona: Drop the use of sdhci_pltfm_free()
mmc: sdhci-brcmstb: Drop the use of sdhci_pltfm_free()
mmc: sdhci-cadence: Drop the use of sdhci_pltfm_free()
mmc: sdhci-dove: Drop the use of sdhci_pltfm_free()
mmc: sdhci-esdhc-imx: Drop the use of sdhci_pltfm_free()
mmc: sdhci-esdhc-mcf: Drop the use of sdhci_pltfm_free()
mmc: sdhci-iproc: Drop the use of sdhci_pltfm_free()
mmc: sdhci-msm: Drop the use of sdhci_pltfm_free()
mmc: sdhci-npcm: Drop the use of sdhci_pltfm_free()
mmc: sdhci-of-arasan: Drop the use of sdhci_pltfm_free()
mmc: sdhci-of-aspeed: Drop the use of sdhci_pltfm_free()
mmc: sdhci-of-at91: Drop the use of sdhci_pltfm_free()
mmc: sdhci-of-dwcmshc: Drop the use of sdhci_pltfm_free()
mmc: sdhci-of-esdhc: Drop the use of sdhci_pltfm_free()
mmc: sdhci-of-k1: Drop the use of sdhci_pltfm_free()
mmc: sdhci-of-ma35d1: Drop the use of sdhci_pltfm_free()
mmc: sdhci-of-sparx5: Drop the use of sdhci_pltfm_free()
mmc: sdhci-omap: Drop the use of sdhci_pltfm_free()
mmc: sdhci-pic32: Drop the use of sdhci_pltfm_free()
mmc: sdhci-pxav2: Drop the use of sdhci_pltfm_free()
mmc: sdhci-pxav3: Drop the use of sdhci_pltfm_free()
mmc: sdhci-sprd: Drop the use of sdhci_pltfm_free()
mmc: sdhci-st: Drop the use of sdhci_pltfm_free()
mmc: sdhci-tegra: Drop the use of sdhci_pltfm_free()
mmc: sdhci-xenon: Drop the use of sdhci_pltfm_free()
mmc: sdhci_am654: Drop the use of sdhci_pltfm_free()
mmc: sdhci_f_sdh30: Drop the use of sdhci_pltfm_free()
drivers/mmc/host/sdhci-acpi.c | 3 --- drivers/mmc/host/sdhci-bcm-kona.c | 2 -- drivers/mmc/host/sdhci-brcmstb.c | 1 - drivers/mmc/host/sdhci-cadence.c | 21 ++++++------------ drivers/mmc/host/sdhci-dove.c | 12 ++--------- drivers/mmc/host/sdhci-esdhc-imx.c | 3 --- drivers/mmc/host/sdhci-esdhc-mcf.c | 25 ++++++---------------- drivers/mmc/host/sdhci-iproc.c | 18 ++++------------ drivers/mmc/host/sdhci-milbeaut.c | 19 ++++++----------- drivers/mmc/host/sdhci-msm.c | 11 ++++------ drivers/mmc/host/sdhci-npcm.c | 15 +++---------- drivers/mmc/host/sdhci-of-arasan.c | 26 +++++++---------------- drivers/mmc/host/sdhci-of-aspeed.c | 10 ++------- drivers/mmc/host/sdhci-of-at91.c | 23 +++++++------------- drivers/mmc/host/sdhci-of-dwcmshc.c | 14 +++++------- drivers/mmc/host/sdhci-of-esdhc.c | 11 ++-------- drivers/mmc/host/sdhci-of-k1.c | 15 ++++--------- drivers/mmc/host/sdhci-of-ma35d1.c | 23 +++++++------------- drivers/mmc/host/sdhci-of-sparx5.c | 24 +++++++-------------- drivers/mmc/host/sdhci-omap.c | 21 ++++++------------ drivers/mmc/host/sdhci-pci-core.c | 9 ++------ drivers/mmc/host/sdhci-pic32.c | 9 +++----- drivers/mmc/host/sdhci-pltfm.c | 16 +------------- drivers/mmc/host/sdhci-pltfm.h | 1 - drivers/mmc/host/sdhci-pxav2.c | 26 ++++++----------------- drivers/mmc/host/sdhci-pxav3.c | 7 +----- drivers/mmc/host/sdhci-s3c.c | 16 ++++---------- drivers/mmc/host/sdhci-spear.c | 11 ++++------ drivers/mmc/host/sdhci-sprd.c | 33 +++++++++-------------------- drivers/mmc/host/sdhci-st.c | 6 ++---- drivers/mmc/host/sdhci-tegra.c | 9 +++----- drivers/mmc/host/sdhci-xenon.c | 9 ++------ drivers/mmc/host/sdhci.c | 9 +------- drivers/mmc/host/sdhci.h | 1 - drivers/mmc/host/sdhci_am654.c | 20 ++++++----------- drivers/mmc/host/sdhci_f_sdh30.c | 13 ++++-------- 36 files changed, 133 insertions(+), 359 deletions(-)
base-commit: aee11c5ac9a0949e1af7534e30dda4ffa122eb97
Signature · 1 line
2.47.1
PATCH 1/34 mmc: sdhci: Use devm_mmc_alloc_host() helper
Use new function devm_mmc_alloc_host() to simplify the code.
--- drivers/mmc/host/sdhci.c | 9 +-------- drivers/mmc/host/sdhci.h | 1 - 2 files changed, 1 insertion(+), 9 deletions(-)
drivers/mmc/host/sdhci.c +1 -8
@@ -4076,7 +4076,7 @@ struct sdhci_host *sdhci_alloc_host(struct device *dev,WARN_ON (dev ==NULL ); - mmc =mmc_alloc_host (sizeof (struct sdhci_host ) + priv_size, dev); + mmc =devm_mmc_alloc_host (dev,sizeof (struct sdhci_host ) + priv_size);if (!mmc)return ERR_PTR (-ENOMEM );
@@ -5000,13 +5000,6 @@ void sdhci_remove_host(struct sdhci_host *host, int dead)EXPORT_SYMBOL_GPL (sdhci_remove_host); -void sdhci_free_host (struct sdhci_host *host) -{ -mmc_free_host (host->mmc); -} - -EXPORT_SYMBOL_GPL (sdhci_free_host); -/*****************************************************************************\ * * * Driver init/exit *
drivers/mmc/host/sdhci.h +0 -1
@@ -811,7 +811,6 @@ static inline u8 sdhci_readb(struct sdhci_host *host, int reg)#endif /* CONFIG_MMC_SDHCI_IO_ACCESSORS */ struct sdhci_host *sdhci_alloc_host (struct device *dev,size_t priv_size); -void sdhci_free_host (struct sdhci_host *host);static inline void *sdhci_priv (struct sdhci_host *host) {
Signature · 1 line
2.47.1
PATCH 2/34 mmc: sdhci-acpi: Drop the use of sdhci_free_host()
In reply to Binbin ZhouSince the devm_mmc_alloc_host() helper is already in use, sdhci_free_host() is no longer needed.
--- drivers/mmc/host/sdhci-acpi.c | 3 --- 1 file changed, 3 deletions(-)
drivers/mmc/host/sdhci-acpi.c +0 -3
@@ -948,7 +948,6 @@ static int sdhci_acpi_probe(struct platform_device *pdev)if (c->slot && c->slot->free_slot) c->slot->free_slot (pdev); -sdhci_free_host (c->host);return err; }
@@ -972,8 +971,6 @@ static void sdhci_acpi_remove(struct platform_device *pdev)if (c->slot && c->slot->free_slot) c->slot->free_slot (pdev); - -sdhci_free_host (c->host); } static void __maybe_unused sdhci_acpi_reset_signal_voltage_if_needed(
Signature · 1 line
2.47.1
PATCH 3/34 mmc: sdhci-milbeaut: Drop the use of sdhci_free_host()
In reply to Binbin ZhouSince the devm_mmc_alloc_host() helper is already in use, sdhci_free_host() is no longer needed.
--- drivers/mmc/host/sdhci-milbeaut.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-)
drivers/mmc/host/sdhci-milbeaut.c +6 -13
@@ -258,7 +258,7 @@ static int sdhci_milbeaut_probe(struct platform_device *pdev) ret =mmc_of_parse (host->mmc);if (ret) - goto err; +return ret;platform_set_drvdata (pdev, host);
@@ -267,23 +267,19 @@ static int sdhci_milbeaut_probe(struct platform_device *pdev) host->irq = irq; host->ioaddr =devm_platform_ioremap_resource (pdev,0 ); -if (IS_ERR (host->ioaddr)) { - ret =PTR_ERR (host->ioaddr); - goto err; - } +if (IS_ERR (host->ioaddr)) +return PTR_ERR (host->ioaddr);if (dev_of_node (dev)) {sdhci_get_of_property (pdev); priv->clk_iface =devm_clk_get (&pdev->dev,"iface" ); -if (IS_ERR (priv->clk_iface)) { - ret =PTR_ERR (priv->clk_iface); - goto err; - } +if (IS_ERR (priv->clk_iface)) +return PTR_ERR (priv->clk_iface); ret =clk_prepare_enable (priv->clk_iface);if (ret) - goto err; +return ret; priv->clk =devm_clk_get (&pdev->dev,"core" );if (IS_ERR (priv->clk)) {
@@ -308,8 +304,6 @@ static int sdhci_milbeaut_probe(struct platform_device *pdev)clk_disable_unprepare (priv->clk); err_clk:clk_disable_unprepare (priv->clk_iface); -err: -sdhci_free_host (host);return ret; }
@@ -324,7 +318,6 @@ static void sdhci_milbeaut_remove(struct platform_device *pdev)clk_disable_unprepare (priv->clk_iface);clk_disable_unprepare (priv->clk); -sdhci_free_host (host);platform_set_drvdata (pdev,NULL ); }
Signature · 1 line
2.47.1
PATCH 4/34 mmc: sdhci-pci: Drop the use of sdhci_free_host()
In reply to Binbin ZhouSince the devm_mmc_alloc_host() helper is already in use, sdhci_free_host() is no longer needed.
--- drivers/mmc/host/sdhci-pci-core.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/mmc/host/sdhci-pci-core.c +2 -7
@@ -2173,7 +2173,7 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot( ret =pcim_iomap_regions (pdev,BIT (bar),mmc_hostname (host->mmc));if (ret) {dev_err (&pdev->dev,"cannot request region\n" ); - goto cleanup; +return ERR_PTR (ret); } host->ioaddr =pcim_iomap_table (pdev)[bar];
@@ -2181,7 +2181,7 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot(if (chip->fixes && chip->fixes->probe_slot) { ret = chip->fixes->probe_slot (slot);if (ret) - goto cleanup; +return ERR_PTR (ret); } host->mmc->pm_caps =MMC_PM_KEEP_POWER ;
@@ -2242,9 +2242,6 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot(if (chip->fixes && chip->fixes->remove_slot) chip->fixes->remove_slot (slot,0 ); -cleanup: -sdhci_free_host (host); -return ERR_PTR (ret); }
@@ -2265,8 +2262,6 @@ static void sdhci_pci_remove_slot(struct sdhci_pci_slot *slot)if (slot->chip->fixes && slot->chip->fixes->remove_slot) slot->chip->fixes->remove_slot (slot, dead); - -sdhci_free_host (slot->host); }int sdhci_pci_uhs2_add_host (struct sdhci_pci_slot *slot)
Signature · 1 line
2.47.1
PATCH 5/34 mmc: sdhci-s3c: Drop the use of sdhci_free_host()
In reply to Binbin ZhouSince the devm_mmc_alloc_host() helper is already in use, sdhci_free_host() is no longer needed.
--- drivers/mmc/host/sdhci-s3c.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)
drivers/mmc/host/sdhci-s3c.c +4 -12
@@ -507,15 +507,13 @@ static int sdhci_s3c_probe(struct platform_device *pdev) sc =sdhci_priv (host); pdata =devm_kzalloc (&pdev->dev,sizeof (*pdata),GFP_KERNEL ); -if (!pdata) { - ret = -ENOMEM ; - goto err_pdata_io_clk; - } +if (!pdata) +return -ENOMEM ;if (pdev->dev.of_node) { ret =sdhci_s3c_parse_dt (&pdev->dev, host, pdata);if (ret) - goto err_pdata_io_clk; +return ret; }else {memcpy (pdata, pdev->dev.platform_data,sizeof (*pdata)); }
@@ -532,8 +530,7 @@ static int sdhci_s3c_probe(struct platform_device *pdev) sc->clk_io =devm_clk_get (dev,"hsmmc" );if (IS_ERR (sc->clk_io)) {dev_err (dev,"failed to get io clock\n" ); - ret =PTR_ERR (sc->clk_io); - goto err_pdata_io_clk; +return PTR_ERR (sc->clk_io); }/* enable the local io clock and keep it running for the moment. */
@@ -661,9 +658,6 @@ static int sdhci_s3c_probe(struct platform_device *pdev) err_no_busclks:clk_disable_unprepare (sc->clk_io); - err_pdata_io_clk: -sdhci_free_host (host); -return ret; }
@@ -685,8 +679,6 @@ static void sdhci_s3c_remove(struct platform_device *pdev)pm_runtime_disable (&pdev->dev);clk_disable_unprepare (sc->clk_io); - -sdhci_free_host (host); }#ifdef CONFIG_PM_SLEEP
Signature · 1 line
2.47.1
PATCH 6/34 mmc: sdhci-spear: Drop the use of sdhci_free_host()
In reply to Binbin ZhouSince the devm_mmc_alloc_host() helper is already in use, sdhci_free_host() is no longer needed.
--- drivers/mmc/host/sdhci-spear.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/mmc/host/sdhci-spear.c +4 -7
@@ -59,7 +59,7 @@ static int sdhci_probe(struct platform_device *pdev)if (IS_ERR (host->ioaddr)) { ret =PTR_ERR (host->ioaddr);dev_dbg (&pdev->dev,"unable to map iomem: %d\n" , ret); - goto err_host; + goto err; } host->hw_name ="sdhci" ;
@@ -67,7 +67,7 @@ static int sdhci_probe(struct platform_device *pdev) host->irq =platform_get_irq (pdev,0 );if (host->irq <0 ) { ret = host->irq; - goto err_host; + goto err; } host->quirks =SDHCI_QUIRK_BROKEN_ADMA ;
@@ -78,13 +78,13 @@ static int sdhci_probe(struct platform_device *pdev)if (IS_ERR (sdhci->clk)) { ret =PTR_ERR (sdhci->clk);dev_dbg (&pdev->dev,"Error getting clock\n" ); - goto err_host; + goto err; } ret =clk_prepare_enable (sdhci->clk);if (ret) {dev_dbg (&pdev->dev,"Error enabling clock\n" ); - goto err_host; + goto err; } ret =clk_set_rate (sdhci->clk,50000000 );
@@ -110,8 +110,6 @@ static int sdhci_probe(struct platform_device *pdev) disable_clk:clk_disable_unprepare (sdhci->clk); -err_host: -sdhci_free_host (host); err:dev_err (&pdev->dev,"spear-sdhci probe failed: %d\n" , ret);return ret;
@@ -130,7 +128,6 @@ static void sdhci_remove(struct platform_device *pdev)sdhci_remove_host (host, dead);clk_disable_unprepare (sdhci->clk); -sdhci_free_host (host); }#ifdef CONFIG_PM_SLEEP
Signature · 1 line
2.47.1
PATCH 7/34 mmc: sdhci-pltfm: Drop the use of sdhci_pltfm_free()
In reply to Binbin ZhouSince the devm_mmc_alloc_host() helper is already in use, sdhci_pltfm_free() is no longer needed.
--- drivers/mmc/host/sdhci-pltfm.c | 16 +--------------- drivers/mmc/host/sdhci-pltfm.h | 1 - 2 files changed, 1 insertion(+), 16 deletions(-)
drivers/mmc/host/sdhci-pltfm.c +1 -15
@@ -146,20 +146,11 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev, }EXPORT_SYMBOL_GPL (sdhci_pltfm_init); -void sdhci_pltfm_free (struct platform_device *pdev) -{ -struct sdhci_host *host =platform_get_drvdata (pdev); - -sdhci_free_host (host); -} -EXPORT_SYMBOL_GPL (sdhci_pltfm_free); -int sdhci_pltfm_init_and_add_host (struct platform_device *pdev,const struct sdhci_pltfm_data *pdata,size_t priv_size) {struct sdhci_host *host; -int ret =0 ; host =sdhci_pltfm_init (pdev, pdata, priv_size);if (IS_ERR (host))
@@ -167,11 +158,7 @@ int sdhci_pltfm_init_and_add_host(struct platform_device *pdev,sdhci_get_property (pdev); - ret =sdhci_add_host (host); -if (ret) -sdhci_pltfm_free (pdev); - -return ret; +return sdhci_add_host (host); }EXPORT_SYMBOL_GPL (sdhci_pltfm_init_and_add_host);
@@ -181,7 +168,6 @@ void sdhci_pltfm_remove(struct platform_device *pdev)int dead = (readl (host->ioaddr +SDHCI_INT_STATUS ) ==0xffffffff );sdhci_remove_host (host, dead); -sdhci_pltfm_free (pdev); }EXPORT_SYMBOL_GPL (sdhci_pltfm_remove);
drivers/mmc/host/sdhci-pltfm.h +0 -1
@@ -97,7 +97,6 @@ static inline void sdhci_get_of_property(struct platform_device *pdev)extern struct sdhci_host *sdhci_pltfm_init (struct platform_device *pdev,const struct sdhci_pltfm_data *pdata,size_t priv_size); -extern void sdhci_pltfm_free (struct platform_device *pdev); extern int sdhci_pltfm_init_and_add_host(struct platform_device *pdev, const struct sdhci_pltfm_data *pdata,
Signature · 1 line
2.47.1
PATCH 8/34 mmc: sdhci-bcm-kona: Drop the use of sdhci_pltfm_free()
In reply to Binbin ZhouSince the devm_mmc_alloc_host() helper is already in use, sdhci_pltfm_free() is no longer needed.
--- drivers/mmc/host/sdhci-bcm-kona.c | 2 -- 1 file changed, 2 deletions(-)
drivers/mmc/host/sdhci-bcm-kona.c +0 -2
@@ -304,8 +304,6 @@ static int sdhci_bcm_kona_probe(struct platform_device *pdev)clk_disable_unprepare (pltfm_priv->clk); err_pltfm_free: -sdhci_pltfm_free (pdev); -dev_err (dev,"Probing of sdhci-pltfm failed: %d\n" , ret);return ret; }
Signature · 1 line
2.47.1
PATCH 9/34 mmc: sdhci-brcmstb: Drop the use of sdhci_pltfm_free()
In reply to Binbin ZhouSince the devm_mmc_alloc_host() helper is already in use, sdhci_pltfm_free() is no longer needed.
--- drivers/mmc/host/sdhci-brcmstb.c | 1 - 1 file changed, 1 deletion(-)
drivers/mmc/host/sdhci-brcmstb.c +0 -1
@@ -485,7 +485,6 @@ static int sdhci_brcmstb_probe(struct platform_device *pdev)return res; err: -sdhci_pltfm_free (pdev);clk_disable_unprepare (base_clk);return res; }
Signature · 1 line
2.47.1
PATCH 10/34 mmc: sdhci-cadence: Drop the use of sdhci_pltfm_free()
In reply to Binbin ZhouSince the devm_mmc_alloc_host() helper is already in use, sdhci_pltfm_free() is no longer needed.
--- drivers/mmc/host/sdhci-cadence.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-)
drivers/mmc/host/sdhci-cadence.c +6 -15
@@ -515,7 +515,7 @@ static int sdhci_cdns_probe(struct platform_device *pdev)if (data->init) { ret = data->init (pdev);if (ret) - goto free; +return ret; }sdhci_enable_v4_mode (host);__sdhci_read_caps (host, &version,NULL ,NULL );
@@ -524,33 +524,24 @@ static int sdhci_cdns_probe(struct platform_device *pdev) ret =mmc_of_parse (host->mmc);if (ret) - goto free; +return ret;sdhci_cdns_phy_param_parse (dev->of_node, priv); ret =sdhci_cdns_phy_init (priv);if (ret) - goto free; +return ret;if (host->mmc->caps &MMC_CAP_HW_RESET ) { priv->rst_hw =devm_reset_control_get_optional_exclusive (dev,NULL ); -if (IS_ERR (priv->rst_hw)) { - ret =dev_err_probe (mmc_dev (host->mmc),PTR_ERR (priv->rst_hw), +if (IS_ERR (priv->rst_hw)) +return dev_err_probe (mmc_dev (host->mmc),PTR_ERR (priv->rst_hw),"reset controller error\n" ); - goto free; - }if (priv->rst_hw) host->mmc_host_ops.card_hw_reset = sdhci_cdns_mmc_hw_reset; } - ret =sdhci_add_host (host); -if (ret) - goto free; - -return 0 ; -free: -sdhci_pltfm_free (pdev); -return ret; +return sdhci_add_host (host); }#ifdef CONFIG_PM_SLEEP
Signature · 1 line
2.47.1
PATCH 11/34 mmc: sdhci-dove: Drop the use of sdhci_pltfm_free()
In reply to Binbin ZhouSince the devm_mmc_alloc_host() helper is already in use, sdhci_pltfm_free() is no longer needed.
--- drivers/mmc/host/sdhci-dove.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
drivers/mmc/host/sdhci-dove.c +2 -10
@@ -79,17 +79,9 @@ static int sdhci_dove_probe(struct platform_device *pdev) ret =mmc_of_parse (host->mmc);if (ret) - goto err_sdhci_add; +return ret; - ret =sdhci_add_host (host); -if (ret) - goto err_sdhci_add; - -return 0 ; - -err_sdhci_add: -sdhci_pltfm_free (pdev); -return ret; +return sdhci_add_host (host); }static const struct of_device_id sdhci_dove_of_match_table[] = {
Signature · 1 line
2.47.1
PATCH 12/34 mmc: sdhci-esdhc-imx: Drop the use of sdhci_pltfm_free()
In reply to Binbin ZhouSince the devm_mmc_alloc_host() helper is already in use, sdhci_pltfm_free() is no longer needed.
--- drivers/mmc/host/sdhci-esdhc-imx.c | 3 --- 1 file changed, 3 deletions(-)
drivers/mmc/host/sdhci-esdhc-imx.c +0 -3
@@ -1973,7 +1973,6 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev) free_sdhci:if (imx_data->socdata->flags &ESDHC_FLAG_PMQOS )cpu_latency_qos_remove_request (&imx_data->pm_qos_req); -sdhci_pltfm_free (pdev);return err; }
@@ -1997,8 +1996,6 @@ static void sdhci_esdhc_imx_remove(struct platform_device *pdev)if (imx_data->socdata->flags &ESDHC_FLAG_PMQOS )cpu_latency_qos_remove_request (&imx_data->pm_qos_req); - -sdhci_pltfm_free (pdev); }#ifdef CONFIG_PM_SLEEP
Signature · 1 line
2.47.1
PATCH 13/34 mmc: sdhci-esdhc-mcf: Drop the use of sdhci_pltfm_free()
In reply to Binbin ZhouSince the devm_mmc_alloc_host() helper is already in use, sdhci_pltfm_free() is no longer needed.
--- drivers/mmc/host/sdhci-esdhc-mcf.c | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-)
drivers/mmc/host/sdhci-esdhc-mcf.c +7 -18
@@ -426,28 +426,22 @@ static int sdhci_esdhc_mcf_probe(struct platform_device *pdev) host->flags |=SDHCI_AUTO_CMD12 ; mcf_data->clk_ipg =devm_clk_get (&pdev->dev,"ipg" ); -if (IS_ERR (mcf_data->clk_ipg)) { - err =PTR_ERR (mcf_data->clk_ipg); - goto err_exit; - } +if (IS_ERR (mcf_data->clk_ipg)) +return PTR_ERR (mcf_data->clk_ipg); mcf_data->clk_ahb =devm_clk_get (&pdev->dev,"ahb" ); -if (IS_ERR (mcf_data->clk_ahb)) { - err =PTR_ERR (mcf_data->clk_ahb); - goto err_exit; - } +if (IS_ERR (mcf_data->clk_ahb)) +return PTR_ERR (mcf_data->clk_ahb); mcf_data->clk_per =devm_clk_get (&pdev->dev,"per" ); -if (IS_ERR (mcf_data->clk_per)) { - err =PTR_ERR (mcf_data->clk_per); - goto err_exit; - } +if (IS_ERR (mcf_data->clk_per)) +return PTR_ERR (mcf_data->clk_per); pltfm_host->clk = mcf_data->clk_per; pltfm_host->clock =clk_get_rate (pltfm_host->clk); err =clk_prepare_enable (mcf_data->clk_per);if (err) - goto err_exit; +return err; err =clk_prepare_enable (mcf_data->clk_ipg);if (err)
@@ -485,9 +479,6 @@ static int sdhci_esdhc_mcf_probe(struct platform_device *pdev)clk_disable_unprepare (mcf_data->clk_ipg); unprep_per:clk_disable_unprepare (mcf_data->clk_per); -err_exit: -sdhci_pltfm_free (pdev); -return err; }
@@ -502,8 +493,6 @@ static void sdhci_esdhc_mcf_remove(struct platform_device *pdev)clk_disable_unprepare (mcf_data->clk_ipg);clk_disable_unprepare (mcf_data->clk_ahb);clk_disable_unprepare (mcf_data->clk_per); - -sdhci_pltfm_free (pdev); }static struct platform_driver sdhci_esdhc_mcf_driver = {
Signature · 1 line
2.47.1
PATCH 14/34 mmc: sdhci-iproc: Drop the use of sdhci_pltfm_free()
In reply to Binbin ZhouSince the devm_mmc_alloc_host() helper is already in use, sdhci_pltfm_free() is no longer needed.
--- drivers/mmc/host/sdhci-iproc.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-)
drivers/mmc/host/sdhci-iproc.c +4 -14
@@ -379,7 +379,7 @@ static int sdhci_iproc_probe(struct platform_device *pdev) ret =mmc_of_parse (host->mmc);if (ret) - goto err; +return ret;sdhci_get_property (pdev);
@@ -387,10 +387,8 @@ static int sdhci_iproc_probe(struct platform_device *pdev)if (dev->of_node) { pltfm_host->clk =devm_clk_get_enabled (dev,NULL ); -if (IS_ERR (pltfm_host->clk)) { - ret =PTR_ERR (pltfm_host->clk); - goto err; - } +if (IS_ERR (pltfm_host->clk)) +return PTR_ERR (pltfm_host->clk); }if (iproc_host->data->missing_caps) {
@@ -399,15 +397,7 @@ static int sdhci_iproc_probe(struct platform_device *pdev) &iproc_host->data->caps1); } - ret =sdhci_add_host (host); -if (ret) - goto err; - -return 0 ; - -err: -sdhci_pltfm_free (pdev); -return ret; +return sdhci_add_host (host); }static void sdhci_iproc_shutdown (struct platform_device *pdev)
Signature · 1 line
2.47.1
PATCH 15/34 mmc: sdhci-msm: Drop the use of sdhci_pltfm_free()
In reply to Binbin ZhouSince the devm_mmc_alloc_host() helper is already in use, sdhci_pltfm_free() is no longer needed.
--- drivers/mmc/host/sdhci-msm.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/mmc/host/sdhci-msm.c +4 -7
@@ -2530,7 +2530,7 @@ static int sdhci_msm_probe(struct platform_device *pdev) ret =mmc_of_parse (host->mmc);if (ret) - goto pltfm_free; +return ret;/* * Based on the compatible string, load the required msm host info from
@@ -2552,7 +2552,7 @@ static int sdhci_msm_probe(struct platform_device *pdev) ret =sdhci_msm_gcc_reset (&pdev->dev, host);if (ret) - goto pltfm_free; +return ret;/* Setup SDCC bus voter clock. */ msm_host->bus_clk =devm_clk_get (&pdev->dev,"bus" );
@@ -2560,10 +2560,10 @@ static int sdhci_msm_probe(struct platform_device *pdev)/* Vote for max. clk rate for max. performance */ ret =clk_set_rate (msm_host->bus_clk,INT_MAX );if (ret) - goto pltfm_free; +return ret; ret =clk_prepare_enable (msm_host->bus_clk);if (ret) - goto pltfm_free; +return ret; }/* Setup main peripheral bus clock */
@@ -2769,8 +2769,6 @@ static int sdhci_msm_probe(struct platform_device *pdev) bus_clk_disable:if (!IS_ERR (msm_host->bus_clk))clk_disable_unprepare (msm_host->bus_clk); -pltfm_free: -sdhci_pltfm_free (pdev);return ret; }
@@ -2792,7 +2790,6 @@ static void sdhci_msm_remove(struct platform_device *pdev) msm_host->bulk_clks);if (!IS_ERR (msm_host->bus_clk))clk_disable_unprepare (msm_host->bus_clk); -sdhci_pltfm_free (pdev); }static __maybe_unused int sdhci_msm_runtime_suspend (struct device *dev)
Signature · 1 line
2.47.1
PATCH 16/34 mmc: sdhci-npcm: Drop the use of sdhci_pltfm_free()
In reply to Binbin ZhouSince the devm_mmc_alloc_host() helper is already in use, sdhci_pltfm_free() is no longer needed.
--- drivers/mmc/host/sdhci-npcm.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-)
drivers/mmc/host/sdhci-npcm.c +3 -12
@@ -48,8 +48,7 @@ static int npcm_sdhci_probe(struct platform_device *pdev) pltfm_host->clk =devm_clk_get_optional_enabled (dev,NULL );if (IS_ERR (pltfm_host->clk)) { - ret =PTR_ERR (pltfm_host->clk); - goto err_sdhci; +return PTR_ERR (pltfm_host->clk); } caps =sdhci_readl (host,SDHCI_CAPABILITIES );
@@ -58,17 +57,9 @@ static int npcm_sdhci_probe(struct platform_device *pdev) ret =mmc_of_parse (host->mmc);if (ret) - goto err_sdhci; +return ret; - ret =sdhci_add_host (host); -if (ret) - goto err_sdhci; - -return 0 ; - -err_sdhci: -sdhci_pltfm_free (pdev); -return ret; +return sdhci_add_host (host); }static const struct of_device_id npcm_sdhci_of_match[] = {
Signature · 1 line
2.47.1
PATCH 17/34 mmc: sdhci-of-arasan: Drop the use of sdhci_pltfm_free()
In reply to Binbin ZhouSince the devm_mmc_alloc_host() helper is already in use, sdhci_pltfm_free() is no longer needed.
--- drivers/mmc/host/sdhci-of-arasan.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-)
drivers/mmc/host/sdhci-of-arasan.c +8 -18
@@ -1883,34 +1883,26 @@ static int sdhci_arasan_probe(struct platform_device *pdev) sdhci_arasan->soc_ctl_base =syscon_node_to_regmap (node);of_node_put (node); -if (IS_ERR (sdhci_arasan->soc_ctl_base)) { - ret =dev_err_probe (dev, +if (IS_ERR (sdhci_arasan->soc_ctl_base)) +return dev_err_probe (dev,PTR_ERR (sdhci_arasan->soc_ctl_base),"Can't get syscon\n" ); - goto err_pltfm_free; - } }sdhci_get_of_property (pdev); sdhci_arasan->clk_ahb =devm_clk_get (dev,"clk_ahb" ); -if (IS_ERR (sdhci_arasan->clk_ahb)) { - ret =dev_err_probe (dev,PTR_ERR (sdhci_arasan->clk_ahb), +if (IS_ERR (sdhci_arasan->clk_ahb)) +return dev_err_probe (dev,PTR_ERR (sdhci_arasan->clk_ahb),"clk_ahb clock not found.\n" ); - goto err_pltfm_free; - } clk_xin =devm_clk_get (dev,"clk_xin" ); -if (IS_ERR (clk_xin)) { - ret =dev_err_probe (dev,PTR_ERR (clk_xin),"clk_xin clock not found.\n" ); - goto err_pltfm_free; - } +if (IS_ERR (clk_xin)) +return dev_err_probe (dev,PTR_ERR (clk_xin),"clk_xin clock not found.\n" ); ret =clk_prepare_enable (sdhci_arasan->clk_ahb); -if (ret) { -dev_err (dev,"Unable to enable AHB clock.\n" ); - goto err_pltfm_free; - } +if (ret) +return dev_err_probe (dev, ret,"Unable to enable AHB clock.\n" );/* If clock-frequency property is set, use the provided value */ if (pltfm_host->clock &&
@@ -2029,8 +2021,6 @@ static int sdhci_arasan_probe(struct platform_device *pdev)clk_disable_unprepare (clk_xin); clk_dis_ahb:clk_disable_unprepare (sdhci_arasan->clk_ahb); -err_pltfm_free: -sdhci_pltfm_free (pdev);return ret; }
Signature · 1 line
2.47.1
PATCH 18/34 mmc: sdhci-of-aspeed: Drop the use of sdhci_pltfm_free()
In reply to Binbin ZhouSince the devm_mmc_alloc_host() helper is already in use, sdhci_pltfm_free() is no longer needed.
--- drivers/mmc/host/sdhci-of-aspeed.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/mmc/host/sdhci-of-aspeed.c +2 -8
@@ -425,10 +425,8 @@ static int aspeed_sdhci_probe(struct platform_device *pdev)return PTR_ERR (pltfm_host->clk); ret =clk_prepare_enable (pltfm_host->clk); -if (ret) { -dev_err (&pdev->dev,"Unable to enable SDIO clock\n" ); - goto err_pltfm_free; - } +if (ret) +return dev_err_probe (&pdev->dev, ret,"Unable to enable SDIO clock\n" ); ret =mmc_of_parse (host->mmc);if (ret)
@@ -445,8 +443,6 @@ static int aspeed_sdhci_probe(struct platform_device *pdev) err_sdhci_add:clk_disable_unprepare (pltfm_host->clk); -err_pltfm_free: -sdhci_pltfm_free (pdev);return ret; }
@@ -461,8 +457,6 @@ static void aspeed_sdhci_remove(struct platform_device *pdev)sdhci_remove_host (host,0 );clk_disable_unprepare (pltfm_host->clk); - -sdhci_pltfm_free (pdev); }static const struct aspeed_sdhci_pdata ast2400_sdhci_pdata = {
Signature · 1 line
2.47.1
PATCH 19/34 mmc: sdhci-of-at91: Drop the use of sdhci_pltfm_free()
In reply to Binbin ZhouSince the devm_mmc_alloc_host() helper is already in use, sdhci_pltfm_free() is no longer needed.
--- drivers/mmc/host/sdhci-of-at91.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-)
drivers/mmc/host/sdhci-of-at91.c +8 -15
@@ -337,28 +337,23 @@ static int sdhci_at91_probe(struct platform_device *pdev) priv->mainck =NULL ; }else {dev_err (&pdev->dev,"failed to get baseclk\n" ); - ret =PTR_ERR (priv->mainck); - goto sdhci_pltfm_free; +return PTR_ERR (priv->mainck); } } priv->hclock =devm_clk_get (&pdev->dev,"hclock" ); -if (IS_ERR (priv->hclock)) { -dev_err (&pdev->dev,"failed to get hclock\n" ); - ret =PTR_ERR (priv->hclock); - goto sdhci_pltfm_free; - } +if (IS_ERR (priv->hclock)) +return dev_err_probe (&pdev->dev,PTR_ERR (priv->hclock), +"failed to get hclock\n" ); priv->gck =devm_clk_get (&pdev->dev,"multclk" ); -if (IS_ERR (priv->gck)) { -dev_err (&pdev->dev,"failed to get multclk\n" ); - ret =PTR_ERR (priv->gck); - goto sdhci_pltfm_free; - } +if (IS_ERR (priv->gck)) +return dev_err_probe (&pdev->dev,PTR_ERR (priv->gck), +"failed to get multclk\n" ); ret =sdhci_at91_set_clks_presets (&pdev->dev);if (ret) - goto sdhci_pltfm_free; +return ret; priv->restore_needed = false;
@@ -438,8 +433,6 @@ static int sdhci_at91_probe(struct platform_device *pdev)clk_disable_unprepare (priv->gck);clk_disable_unprepare (priv->mainck);clk_disable_unprepare (priv->hclock); -sdhci_pltfm_free: -sdhci_pltfm_free (pdev);return ret; }
Signature · 1 line
2.47.1
PATCH 20/34 mmc: sdhci-of-dwcmshc: Drop the use of sdhci_pltfm_free()
In reply to Binbin ZhouSince the devm_mmc_alloc_host() helper is already in use, sdhci_pltfm_free() is no longer needed.
--- drivers/mmc/host/sdhci-of-dwcmshc.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/mmc/host/sdhci-of-dwcmshc.c +5 -9
@@ -1387,14 +1387,13 @@ static int dwcmshc_probe(struct platform_device *pdev)if (dev->of_node) { pltfm_host->clk =devm_clk_get (dev,"core" ); -if (IS_ERR (pltfm_host->clk)) { - err =PTR_ERR (pltfm_host->clk); -dev_err (dev,"failed to get core clk: %d\n" , err); - goto free_pltfm; - } +if (IS_ERR (pltfm_host->clk)) +return dev_err_probe (dev,PTR_ERR (pltfm_host->clk), +"failed to get core clk\n" ); + err =clk_prepare_enable (pltfm_host->clk);if (err) - goto free_pltfm; +return err; priv->bus_clk =devm_clk_get (dev,"bus" );if (!IS_ERR (priv->bus_clk))
@@ -1467,8 +1466,6 @@ static int dwcmshc_probe(struct platform_device *pdev)clk_disable_unprepare (pltfm_host->clk);clk_disable_unprepare (priv->bus_clk);clk_bulk_disable_unprepare (priv->num_other_clks, priv->other_clks); -free_pltfm: -sdhci_pltfm_free (pdev);return err; }
@@ -1500,7 +1497,6 @@ static void dwcmshc_remove(struct platform_device *pdev)clk_disable_unprepare (pltfm_host->clk);clk_disable_unprepare (priv->bus_clk);clk_bulk_disable_unprepare (priv->num_other_clks, priv->other_clks); -sdhci_pltfm_free (pdev); }#ifdef CONFIG_PM_SLEEP
Signature · 1 line
2.47.1
PATCH 21/34 mmc: sdhci-of-esdhc: Drop the use of sdhci_pltfm_free()
In reply to Binbin ZhouSince the devm_mmc_alloc_host() helper is already in use, sdhci_pltfm_free() is no longer needed.
--- drivers/mmc/host/sdhci-of-esdhc.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
drivers/mmc/host/sdhci-of-esdhc.c +2 -9
@@ -1499,18 +1499,11 @@ static int sdhci_esdhc_probe(struct platform_device *pdev)/* call to generic mmc_of_parse to support additional capabilities */ ret =mmc_of_parse (host->mmc);if (ret) - goto err; +return ret;mmc_of_parse_voltage (host->mmc, &host->ocr_mask); - ret =sdhci_add_host (host); -if (ret) - goto err; - -return 0 ; - err: -sdhci_pltfm_free (pdev); -return ret; +return sdhci_add_host (host); }static struct platform_driver sdhci_esdhc_driver = {
Signature · 1 line
2.47.1
PATCH 22/34 mmc: sdhci-of-k1: Drop the use of sdhci_pltfm_free()
In reply to Binbin ZhouSince the devm_mmc_alloc_host() helper is already in use, sdhci_pltfm_free() is no longer needed.
--- drivers/mmc/host/sdhci-of-k1.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)
drivers/mmc/host/sdhci-of-k1.c +4 -11
@@ -262,7 +262,7 @@ static int spacemit_sdhci_probe(struct platform_device *pdev) ret =mmc_of_parse (host->mmc);if (ret) - goto err_pltfm; +return ret;sdhci_get_of_property (pdev);
@@ -276,18 +276,11 @@ static int spacemit_sdhci_probe(struct platform_device *pdev) host->mmc->caps |=MMC_CAP_NEED_RSP_BUSY ; -if (spacemit_sdhci_get_clocks (dev, pltfm_host)) - goto err_pltfm; - - ret =sdhci_add_host (host); + ret =spacemit_sdhci_get_clocks (dev, pltfm_host);if (ret) - goto err_pltfm; - -return 0 ; +return ret; -err_pltfm: -sdhci_pltfm_free (pdev); -return ret; +return sdhci_add_host (host); }static struct platform_driver spacemit_sdhci_driver = {
Signature · 1 line
2.47.1
PATCH 23/34 mmc: sdhci-of-ma35d1: Drop the use of sdhci_pltfm_free()
In reply to Binbin ZhouSince the devm_mmc_alloc_host() helper is already in use, sdhci_pltfm_free() is no longer needed.
--- drivers/mmc/host/sdhci-of-ma35d1.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-)
drivers/mmc/host/sdhci-of-ma35d1.c +8 -15
@@ -211,20 +211,18 @@ static int ma35_probe(struct platform_device *pdev) priv =sdhci_pltfm_priv (pltfm_host); pltfm_host->clk =devm_clk_get_optional_enabled (dev,NULL ); -if (IS_ERR (pltfm_host->clk)) { - err =dev_err_probe (dev,PTR_ERR (pltfm_host->clk),"failed to get clk\n" ); - goto err_sdhci; - } +if (IS_ERR (pltfm_host->clk)) +return dev_err_probe (dev,PTR_ERR (pltfm_host->clk), +"failed to get clk\n" ); err =mmc_of_parse (host->mmc);if (err) - goto err_sdhci; +return err; priv->rst =devm_reset_control_get_exclusive (dev,NULL ); -if (IS_ERR (priv->rst)) { - err =dev_err_probe (dev,PTR_ERR (priv->rst),"failed to get reset control\n" ); - goto err_sdhci; - } +if (IS_ERR (priv->rst)) +return dev_err_probe (dev,PTR_ERR (priv->rst), +"failed to get reset control\n" );sdhci_get_of_property (pdev);
@@ -255,7 +253,7 @@ static int ma35_probe(struct platform_device *pdev) err =sdhci_add_host (host);if (err) - goto err_sdhci; +return err;/* * Split data into chunks of 16 or 8 bytes for transmission.
@@ -268,10 +266,6 @@ static int ma35_probe(struct platform_device *pdev)sdhci_writew (host, ctl,MA35_SDHCI_MBIUCTL );return 0 ; - -err_sdhci: -sdhci_pltfm_free (pdev); -return err; }static void ma35_disable_card_clk (struct sdhci_host *host)
@@ -291,7 +285,6 @@ static void ma35_remove(struct platform_device *pdev)sdhci_remove_host (host,0 );ma35_disable_card_clk (host); -sdhci_pltfm_free (pdev); }static const struct of_device_id sdhci_ma35_dt_ids[] = {
Signature · 1 line
2.47.1
PATCH 24/34 mmc: sdhci-of-sparx5: Drop the use of sdhci_pltfm_free()
In reply to Binbin ZhouSince the devm_mmc_alloc_host() helper is already in use, sdhci_pltfm_free() is no longer needed.
--- drivers/mmc/host/sdhci-of-sparx5.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-)
drivers/mmc/host/sdhci-of-sparx5.c +8 -16
@@ -185,11 +185,9 @@ static int sdhci_sparx5_probe(struct platform_device *pdev) sdhci_sparx5->host = host; pltfm_host->clk =devm_clk_get_enabled (&pdev->dev,"core" ); -if (IS_ERR (pltfm_host->clk)) { - ret =PTR_ERR (pltfm_host->clk); -dev_err (&pdev->dev,"failed to get and enable core clk: %d\n" , ret); - goto free_pltfm; - } +if (IS_ERR (pltfm_host->clk)) +return dev_err_probe (&pdev->dev,PTR_ERR (pltfm_host->clk), +"failed to get and enable core clk\n" );if (!of_property_read_u32 (np,"microchip,clock-delay" , &value) && (value >0 && value <=MSHC_DLY_CC_MAX ))
@@ -199,14 +197,12 @@ static int sdhci_sparx5_probe(struct platform_device *pdev) ret =mmc_of_parse (host->mmc);if (ret) - goto free_pltfm; +return ret; sdhci_sparx5->cpu_ctrl =syscon_regmap_lookup_by_compatible (syscon); -if (IS_ERR (sdhci_sparx5->cpu_ctrl)) { -dev_err (&pdev->dev,"No CPU syscon regmap !\n" ); - ret =PTR_ERR (sdhci_sparx5->cpu_ctrl); - goto free_pltfm; - } +if (IS_ERR (sdhci_sparx5->cpu_ctrl)) +return dev_err_probe (&pdev->dev,PTR_ERR (sdhci_sparx5->cpu_ctrl), +"No CPU syscon regmap !\n" );if (sdhci_sparx5->delay_clock >=0 )sparx5_set_delay (host, sdhci_sparx5->delay_clock);
@@ -222,7 +218,7 @@ static int sdhci_sparx5_probe(struct platform_device *pdev) ret =sdhci_add_host (host);if (ret) - goto free_pltfm; +return ret;/* Set AXI bus master to use un-cached access (for DMA) */ if (host->flags & (SDHCI_USE_SDMA | SDHCI_USE_ADMA) &&
@@ -235,10 +231,6 @@ static int sdhci_sparx5_probe(struct platform_device *pdev) mmc_hostname(host->mmc), sdhci_readl(host, MSHC2_TYPE));return ret; - -free_pltfm: -sdhci_pltfm_free (pdev); -return ret; }static const struct of_device_id sdhci_sparx5_of_match[] = {
Signature · 1 line
2.47.1
PATCH 25/34 mmc: sdhci-omap: Drop the use of sdhci_pltfm_free()
In reply to Binbin ZhouSince the devm_mmc_alloc_host() helper is already in use, sdhci_pltfm_free() is no longer needed.
--- drivers/mmc/host/sdhci-omap.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-)
drivers/mmc/host/sdhci-omap.c +7 -14
@@ -1257,7 +1257,7 @@ static int sdhci_omap_probe(struct platform_device *pdev)sdhci_get_of_property (pdev); ret =mmc_of_parse (mmc);if (ret) - goto err_pltfm_free; +return ret; soc =soc_device_match (sdhci_omap_soc_devices);if (soc) {
@@ -1274,22 +1274,19 @@ static int sdhci_omap_probe(struct platform_device *pdev) mmc->caps2 |=MMC_CAP2_NO_WRITE_PROTECT ; pltfm_host->clk =devm_clk_get (dev,"fck" ); -if (IS_ERR (pltfm_host->clk)) { - ret =PTR_ERR (pltfm_host->clk); - goto err_pltfm_free; - } +if (IS_ERR (pltfm_host->clk)) +return PTR_ERR (pltfm_host->clk); ret =clk_set_rate (pltfm_host->clk, mmc->f_max); -if (ret) { -dev_err (dev,"failed to set clock to %d\n" , mmc->f_max); - goto err_pltfm_free; - } +if (ret) +return dev_err_probe (dev, ret, +"failed to set clock to %d\n" , mmc->f_max); omap_host->pbias =devm_regulator_get_optional (dev,"pbias" );if (IS_ERR (omap_host->pbias)) { ret =PTR_ERR (omap_host->pbias);if (ret != -ENODEV ) - goto err_pltfm_free; +return ret;dev_dbg (dev,"unable to get pbias regulator %d\n" , ret); } omap_host->pbias_enabled = false;
@@ -1387,9 +1384,6 @@ static int sdhci_omap_probe(struct platform_device *pdev) err_rpm_disable:pm_runtime_dont_use_autosuspend (dev);pm_runtime_disable (dev); - -err_pltfm_free: -sdhci_pltfm_free (pdev);return ret; }
@@ -1406,7 +1400,6 @@ static void sdhci_omap_remove(struct platform_device *pdev)pm_runtime_put_sync (dev);/* Ensure device gets disabled despite userspace sysfs config */ pm_runtime_force_suspend (dev); -sdhci_pltfm_free (pdev); }#ifdef CONFIG_PM
Signature · 1 line
2.47.1
PATCH 26/34 mmc: sdhci-pic32: Drop the use of sdhci_pltfm_free()
In reply to Binbin ZhouSince the devm_mmc_alloc_host() helper is already in use, sdhci_pltfm_free() is no longer needed.
--- drivers/mmc/host/sdhci-pic32.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/mmc/host/sdhci-pic32.c +3 -6
@@ -157,20 +157,20 @@ static int pic32_sdhci_probe(struct platform_device *pdev) ret = plat_data->setup_dma (ADMA_FIFO_RD_THSHLD ,ADMA_FIFO_WR_THSHLD );if (ret) - goto err_host; + goto err; } sdhci_pdata->sys_clk =devm_clk_get (&pdev->dev,"sys_clk" );if (IS_ERR (sdhci_pdata->sys_clk)) { ret =PTR_ERR (sdhci_pdata->sys_clk);dev_err (&pdev->dev,"Error getting clock\n" ); - goto err_host; + goto err; } ret =clk_prepare_enable (sdhci_pdata->sys_clk);if (ret) {dev_err (&pdev->dev,"Error enabling clock\n" ); - goto err_host; + goto err; } sdhci_pdata->base_clk =devm_clk_get (&pdev->dev,"base_clk" );
@@ -203,8 +203,6 @@ static int pic32_sdhci_probe(struct platform_device *pdev)clk_disable_unprepare (sdhci_pdata->base_clk); err_sys_clk:clk_disable_unprepare (sdhci_pdata->sys_clk); -err_host: -sdhci_pltfm_free (pdev); err:dev_err (&pdev->dev,"pic32-sdhci probe failed: %d\n" , ret);return ret;
@@ -220,7 +218,6 @@ static void pic32_sdhci_remove(struct platform_device *pdev)sdhci_remove_host (host, scratch == (u32 )~0 );clk_disable_unprepare (sdhci_pdata->base_clk);clk_disable_unprepare (sdhci_pdata->sys_clk); -sdhci_pltfm_free (pdev); }static const struct of_device_id pic32_sdhci_id_table[] = {
Signature · 1 line
2.47.1
PATCH 27/34 mmc: sdhci-pxav2: Drop the use of sdhci_pltfm_free()
In reply to Binbin ZhouSince the devm_mmc_alloc_host() helper is already in use, sdhci_pltfm_free() is no longer needed.
--- drivers/mmc/host/sdhci-pxav2.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-)
drivers/mmc/host/sdhci-pxav2.c +6 -20
@@ -258,7 +258,6 @@ static int sdhci_pxav2_probe(struct platform_device *pdev)struct sdhci_host *host =NULL ;const struct sdhci_pxa_variant *variant; -int ret;struct clk *clk, *clk_core; host =sdhci_pltfm_init (pdev,NULL ,sizeof (*pxav2_host));
@@ -271,19 +270,14 @@ static int sdhci_pxav2_probe(struct platform_device *pdev) clk =devm_clk_get_optional_enabled (dev,"io" );if (!clk) clk =devm_clk_get_enabled (dev,NULL ); -if (IS_ERR (clk)) { - ret =PTR_ERR (clk); -dev_err_probe (dev, ret,"failed to get io clock\n" ); - goto free; - } +if (IS_ERR (clk)) +return dev_err_probe (dev,PTR_ERR (clk),"failed to get io clock\n" ); pltfm_host->clk = clk; clk_core =devm_clk_get_optional_enabled (dev,"core" ); -if (IS_ERR (clk_core)) { - ret =PTR_ERR (clk_core); -dev_err_probe (dev, ret,"failed to enable core clock\n" ); - goto free; - } +if (IS_ERR (clk_core)) +return dev_err_probe (dev,PTR_ERR (clk_core), +"failed to enable core clock\n" ); host->quirks =SDHCI_QUIRK_BROKEN_ADMA |SDHCI_QUIRK_BROKEN_TIMEOUT_VAL
@@ -332,15 +326,7 @@ static int sdhci_pxav2_probe(struct platform_device *pdev) pxav2_host->pinctrl =NULL ; } - ret =sdhci_add_host (host); -if (ret) - goto free; - -return 0 ; - -free: -sdhci_pltfm_free (pdev); -return ret; +return sdhci_add_host (host); }static struct platform_driver sdhci_pxav2_driver = {
Signature · 1 line
2.47.1
PATCH 28/34 mmc: sdhci-pxav3: Drop the use of sdhci_pltfm_free()
In reply to Binbin ZhouSince the devm_mmc_alloc_host() helper is already in use, sdhci_pltfm_free() is no longer needed.
--- drivers/mmc/host/sdhci-pxav3.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/mmc/host/sdhci-pxav3.c +1 -6
@@ -389,8 +389,7 @@ static int sdhci_pxav3_probe(struct platform_device *pdev) pxa->clk_io =devm_clk_get (dev,NULL );if (IS_ERR (pxa->clk_io)) {dev_err (dev,"failed to get io clock\n" ); - ret =PTR_ERR (pxa->clk_io); - goto err_clk_get; +return PTR_ERR (pxa->clk_io); } pltfm_host->clk = pxa->clk_io;clk_prepare_enable (pxa->clk_io);
@@ -466,8 +465,6 @@ static int sdhci_pxav3_probe(struct platform_device *pdev) err_mbus_win:clk_disable_unprepare (pxa->clk_io);clk_disable_unprepare (pxa->clk_core); -err_clk_get: -sdhci_pltfm_free (pdev);return ret; }
@@ -485,8 +482,6 @@ static void sdhci_pxav3_remove(struct platform_device *pdev)clk_disable_unprepare (pxa->clk_io);clk_disable_unprepare (pxa->clk_core); - -sdhci_pltfm_free (pdev); }#ifdef CONFIG_PM_SLEEP
Signature · 1 line
2.47.1
PATCH 29/34 mmc: sdhci-sprd: Drop the use of sdhci_pltfm_free()
In reply to Binbin ZhouSince the devm_mmc_alloc_host() helper is already in use, sdhci_pltfm_free() is no longer needed.
--- drivers/mmc/host/sdhci-sprd.c | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-)
drivers/mmc/host/sdhci-sprd.c +10 -23
@@ -764,7 +764,7 @@ static int sdhci_sprd_probe(struct platform_device *pdev) ret =mmc_of_parse (host->mmc);if (ret) - goto pltfm_free; +return ret;if (!mmc_card_is_removable (host->mmc)) host->mmc_host_ops.request_atomic = sdhci_sprd_request_atomic;
@@ -778,34 +778,26 @@ static int sdhci_sprd_probe(struct platform_device *pdev)if (!IS_ERR (sprd_host->pinctrl)) { sprd_host->pins_uhs =pinctrl_lookup_state (sprd_host->pinctrl,"state_uhs" ); -if (IS_ERR (sprd_host->pins_uhs)) { - ret =PTR_ERR (sprd_host->pins_uhs); - goto pltfm_free; - } +if (IS_ERR (sprd_host->pins_uhs)) +return PTR_ERR (sprd_host->pins_uhs); sprd_host->pins_default =pinctrl_lookup_state (sprd_host->pinctrl,"default" ); -if (IS_ERR (sprd_host->pins_default)) { - ret =PTR_ERR (sprd_host->pins_default); - goto pltfm_free; - } +if (IS_ERR (sprd_host->pins_default)) +return PTR_ERR (sprd_host->pins_default); } clk =devm_clk_get (&pdev->dev,"sdio" ); -if (IS_ERR (clk)) { - ret =PTR_ERR (clk); - goto pltfm_free; - } +if (IS_ERR (clk)) +return PTR_ERR (clk); sprd_host->clk_sdio = clk; sprd_host->base_rate =clk_get_rate (sprd_host->clk_sdio);if (!sprd_host->base_rate) sprd_host->base_rate =SDHCI_SPRD_CLK_DEF_RATE ; clk =devm_clk_get (&pdev->dev,"enable" ); -if (IS_ERR (clk)) { - ret =PTR_ERR (clk); - goto pltfm_free; - } +if (IS_ERR (clk)) +return PTR_ERR (clk); sprd_host->clk_enable = clk; clk =devm_clk_get (&pdev->dev,"2x_enable" );
@@ -814,7 +806,7 @@ static int sdhci_sprd_probe(struct platform_device *pdev) ret =clk_prepare_enable (sprd_host->clk_sdio);if (ret) - goto pltfm_free; +return ret; ret =clk_prepare_enable (sprd_host->clk_enable);if (ret)
@@ -891,9 +883,6 @@ static int sdhci_sprd_probe(struct platform_device *pdev) clk_disable:clk_disable_unprepare (sprd_host->clk_sdio); - -pltfm_free: -sdhci_pltfm_free (pdev);return ret; }
@@ -907,8 +896,6 @@ static void sdhci_sprd_remove(struct platform_device *pdev)clk_disable_unprepare (sprd_host->clk_sdio);clk_disable_unprepare (sprd_host->clk_enable);clk_disable_unprepare (sprd_host->clk_2x_enable); - -sdhci_pltfm_free (pdev); }static const struct of_device_id sdhci_sprd_of_match[] = {
Signature · 1 line
2.47.1
PATCH 30/34 mmc: sdhci-st: Drop the use of sdhci_pltfm_free()
In reply to Binbin ZhouSince the devm_mmc_alloc_host() helper is already in use, sdhci_pltfm_free() is no longer needed.
--- drivers/mmc/host/sdhci-st.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/mmc/host/sdhci-st.c +2 -4
@@ -380,13 +380,13 @@ static int sdhci_st_probe(struct platform_device *pdev) ret =mmc_of_parse (host->mmc);if (ret) {dev_err (&pdev->dev,"Failed mmc_of_parse\n" ); - goto err_of; + goto err_pltfm_init; } ret =clk_prepare_enable (clk);if (ret) {dev_err (&pdev->dev,"Failed to prepare clock\n" ); - goto err_of; + goto err_pltfm_init; } ret =clk_prepare_enable (icnclk);
@@ -423,8 +423,6 @@ static int sdhci_st_probe(struct platform_device *pdev)clk_disable_unprepare (icnclk); err_icnclk:clk_disable_unprepare (clk); -err_of: -sdhci_pltfm_free (pdev); err_pltfm_init:reset_control_assert (rstc);
Signature · 1 line
2.47.1
PATCH 31/34 mmc: sdhci-tegra: Drop the use of sdhci_pltfm_free()
In reply to Binbin ZhouSince the devm_mmc_alloc_host() helper is already in use, sdhci_pltfm_free() is no longer needed.
--- drivers/mmc/host/sdhci-tegra.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/mmc/host/sdhci-tegra.c +3 -6
@@ -1693,7 +1693,7 @@ static int sdhci_tegra_probe(struct platform_device *pdev) rc =mmc_of_parse (host->mmc);if (rc) - goto err_parse_dt; +return rc;if (tegra_host->soc_data->nvquirks &NVQUIRK_ENABLE_DDR50 ) host->mmc->caps |=MMC_CAP_1_8V_DDR ;
@@ -1739,7 +1739,7 @@ static int sdhci_tegra_probe(struct platform_device *pdev)if (IS_ERR (clk)) { rc =PTR_ERR (clk);if (rc == -EPROBE_DEFER ) - goto err_power_req; +return rc;dev_warn (&pdev->dev,"failed to get tmclk: %d\n" , rc); clk =NULL ;
@@ -1750,7 +1750,7 @@ static int sdhci_tegra_probe(struct platform_device *pdev)if (rc) {dev_err (&pdev->dev,"failed to enable tmclk: %d\n" , rc); - goto err_power_req; +return rc; } tegra_host->tmclk = clk;
@@ -1811,8 +1811,6 @@ static int sdhci_tegra_probe(struct platform_device *pdev) err_clk_get:clk_disable_unprepare (tegra_host->tmclk); err_power_req: -err_parse_dt: -sdhci_pltfm_free (pdev);return rc; }
@@ -1831,7 +1829,6 @@ static void sdhci_tegra_remove(struct platform_device *pdev)pm_runtime_force_suspend (&pdev->dev);clk_disable_unprepare (tegra_host->tmclk); -sdhci_pltfm_free (pdev); }static int __maybe_unused sdhci_tegra_runtime_suspend (struct device *dev)
Signature · 1 line
2.47.1
PATCH 32/34 mmc: sdhci-xenon: Drop the use of sdhci_pltfm_free()
In reply to Binbin ZhouSince the devm_mmc_alloc_host() helper is already in use, sdhci_pltfm_free() is no longer needed.
--- drivers/mmc/host/sdhci-xenon.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/mmc/host/sdhci-xenon.c +2 -7
@@ -533,13 +533,12 @@ static int xenon_probe(struct platform_device *pdev)if (dev->of_node) { pltfm_host->clk =devm_clk_get (&pdev->dev,"core" );if (IS_ERR (pltfm_host->clk)) { - err =PTR_ERR (pltfm_host->clk);dev_err (&pdev->dev,"Failed to setup input clk: %d\n" , err); - goto free_pltfm; +return PTR_ERR (pltfm_host->clk); } err =clk_prepare_enable (pltfm_host->clk);if (err) - goto free_pltfm; +return err; priv->axi_clk =devm_clk_get (&pdev->dev,"axi" );if (IS_ERR (priv->axi_clk)) {
@@ -603,8 +602,6 @@ static int xenon_probe(struct platform_device *pdev)clk_disable_unprepare (priv->axi_clk); err_clk:clk_disable_unprepare (pltfm_host->clk); -free_pltfm: -sdhci_pltfm_free (pdev);return err; }
@@ -623,8 +620,6 @@ static void xenon_remove(struct platform_device *pdev)xenon_sdhc_unprepare (host);clk_disable_unprepare (priv->axi_clk);clk_disable_unprepare (pltfm_host->clk); - -sdhci_pltfm_free (pdev); }#ifdef CONFIG_PM_SLEEP
Signature · 1 line
2.47.1
PATCH 33/34 mmc: sdhci_am654: Drop the use of sdhci_pltfm_free()
In reply to Binbin ZhouSince the devm_mmc_alloc_host() helper is already in use, sdhci_pltfm_free() is no longer needed.
--- drivers/mmc/host/sdhci_am654.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-)
drivers/mmc/host/sdhci_am654.c +6 -14
@@ -942,35 +942,30 @@ static int sdhci_am654_probe(struct platform_device *pdev) clk_xin =devm_clk_get (dev,"clk_xin" );if (IS_ERR (clk_xin)) {dev_err (dev,"clk_xin clock not found.\n" ); - ret =PTR_ERR (clk_xin); - goto err_pltfm_free; +return PTR_ERR (clk_xin); } pltfm_host->clk = clk_xin; base =devm_platform_ioremap_resource (pdev,1 );if (IS_ERR (base)) { - ret =PTR_ERR (base); - goto err_pltfm_free; +return PTR_ERR (base); } sdhci_am654->base =devm_regmap_init_mmio (dev, base, &sdhci_am654_regmap_config);if (IS_ERR (sdhci_am654->base)) {dev_err (dev,"Failed to initialize regmap\n" ); - ret =PTR_ERR (sdhci_am654->base); - goto err_pltfm_free; +return PTR_ERR (sdhci_am654->base); } ret =sdhci_am654_get_of_property (pdev, sdhci_am654);if (ret) - goto err_pltfm_free; +return ret; ret =mmc_of_parse (host->mmc); -if (ret) { -dev_err_probe (dev, ret,"parsing dt failed\n" ); - goto err_pltfm_free; - } +if (ret) +return dev_err_probe (dev, ret,"parsing dt failed\n" ); host->mmc_host_ops.start_signal_voltage_switch = sdhci_am654_start_signal_voltage_switch; host->mmc_host_ops.execute_tuning = sdhci_am654_execute_tuning;
@@ -1001,8 +996,6 @@ static int sdhci_am654_probe(struct platform_device *pdev)pm_runtime_disable (dev); pm_put:pm_runtime_put_noidle (dev); -err_pltfm_free: -sdhci_pltfm_free (pdev);return ret; }
@@ -1021,7 +1014,6 @@ static void sdhci_am654_remove(struct platform_device *pdev)clk_disable_unprepare (pltfm_host->clk);pm_runtime_disable (dev);pm_runtime_put_noidle (dev); -sdhci_pltfm_free (pdev); }#ifdef CONFIG_PM
Signature · 1 line
2.47.1
Adrian Hunter
maintainerRe: [PATCH 01/34] mmc: sdhci: Use devm_mmc_alloc_host() helper
In reply to Binbin ZhouQuoted 22 lines · Binbin Zhou
Use new function
devm_mmc_alloc_host()to simplify the code.Signed-off-by Binbin Zhou <[email protected]>--- drivers/mmc/host/sdhci.c | 9 +-------- drivers/mmc/host/sdhci.h | 1 - 2 files changed, 1 insertion(+), 9 deletions(-)drivers/mmc/host/sdhci.c +1
-1@@ -4076,7 +4076,7 @@ struct sdhci_host *sdhci_alloc_host(struct device *dev,WARN_ON (dev ==NULL ); - mmc =mmc_alloc_host (sizeof (struct sdhci_host ) + priv_size, dev); + mmc =devm_mmc_alloc_host (dev,sizeof (struct sdhci_host ) + priv_size);if (!mmc)return ERR_PTR (-ENOMEM );
drivers/mmc/host/sdhci.c void sdhci_remove_host(struct sdhci_host *host, int dead) · line 5008
Quoted 9 lines
drivers/mmc/host/sdhci.c +0
-6@@ -5000,13 +5000,6 @@ void sdhci_remove_host(struct sdhci_host *host, int dead)EXPORT_SYMBOL_GPL (sdhci_remove_host); -void sdhci_free_host (struct sdhci_host *host) -{ -mmc_free_host (host->mmc); -} - -EXPORT_SYMBOL_GPL (sdhci_free_host);
Doesn't that break the compile for everything still using sdhci_free_host()?
You probably need to make it like this:
void sdhci_free_host(struct sdhci_host *host)
{
}
EXPORT_SYMBOL_GPL(sdhci_free_host);and then remove sdhci_free_host() at the end when there are no callers left.
Quoted 16 lines
drivers/mmc/host/sdhci.c +0
-1-/*****************************************************************************\ * * * Driver init/exit * drivers/mmc/host/sdhci.h +0
-1@@ -811,7 +811,6 @@ static inline u8 sdhci_readb(struct sdhci_host *host, int reg)#endif /* CONFIG_MMC_SDHCI_IO_ACCESSORS */ struct sdhci_host *sdhci_alloc_host (struct device *dev,size_t priv_size); -void sdhci_free_host (struct sdhci_host *host);static inline void *sdhci_priv (struct sdhci_host *host) {
Re: [PATCH 01/34] mmc: sdhci: Use devm_mmc_alloc_host() helper
Hi Adrian:
Thanks for your reply.
Quoted 38 lines · Adrian Hunter
Quoted 22 lines · Binbin Zhou
Use new function
devm_mmc_alloc_host()to simplify the code.Signed-off-by Binbin Zhou <[email protected]>--- drivers/mmc/host/sdhci.c | 9 +-------- drivers/mmc/host/sdhci.h | 1 - 2 files changed, 1 insertion(+), 9 deletions(-)drivers/mmc/host/sdhci.c +1
-1@@ -4076,7 +4076,7 @@ struct sdhci_host *sdhci_alloc_host(struct device *dev,WARN_ON (dev ==NULL ); - mmc =mmc_alloc_host (sizeof (struct sdhci_host ) + priv_size, dev); + mmc =devm_mmc_alloc_host (dev,sizeof (struct sdhci_host ) + priv_size);if (!mmc)return ERR_PTR (-ENOMEM );drivers/mmc/host/sdhci.c void sdhci_remove_host(struct sdhci_host *host, int dead) · line 5008
Quoted 9 lines
drivers/mmc/host/sdhci.c +0
-6@@ -5000,13 +5000,6 @@ void sdhci_remove_host(struct sdhci_host *host, int dead)EXPORT_SYMBOL_GPL (sdhci_remove_host); -void sdhci_free_host (struct sdhci_host *host) -{ -mmc_free_host (host->mmc); -} - -EXPORT_SYMBOL_GPL (sdhci_free_host);Doesn't that break the compile for everything still using
sdhci_free_host()?You probably need to make it like this:
Quoted 8 lines
void sdhci_free_host(struct sdhci_host *host) { } EXPORT_SYMBOL_GPL(sdhci_free_host);and then remove
sdhci_free_host()at the end when there are no callers left.
Yes, I didn't think it through and I will change it in the next version the way you said.
Patch-07 has the same problem, I'll fix it all together.
Quoted 18 lines
Quoted 17 lines
drivers/mmc/host/sdhci.c +0
-1-/*****************************************************************************\ * * * Driver init/exit * drivers/mmc/host/sdhci.h +0
-1@@ -811,7 +811,6 @@ static inline u8 sdhci_readb(struct sdhci_host *host, int reg)#endif /* CONFIG_MMC_SDHCI_IO_ACCESSORS */ struct sdhci_host *sdhci_alloc_host (struct device *dev,size_t priv_size); -void sdhci_free_host (struct sdhci_host *host);static inline void *sdhci_priv (struct sdhci_host *host) {
Signature · 2 lines
Thanks. Binbin
Michal Simek
maintainerRe: [PATCH 17/34] mmc: sdhci-of-arasan: Drop the use of sdhci_pltfm_free()
In reply to Binbin ZhouQuoted 57 lines · Binbin Zhou
Since the
devm_mmc_alloc_host()helper is already in use,sdhci_pltfm_free()is no longer needed.Cc Michal Simek <[email protected]>Signed-off-by Binbin Zhou <[email protected]>--- drivers/mmc/host/sdhci-of-arasan.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-)drivers/mmc/host/sdhci-of-arasan.c +8
-16@@ -1883,34 +1883,26 @@ static int sdhci_arasan_probe(struct platform_device *pdev) sdhci_arasan->soc_ctl_base =syscon_node_to_regmap (node);of_node_put (node); -if (IS_ERR (sdhci_arasan->soc_ctl_base)) { - ret =dev_err_probe (dev, +if (IS_ERR (sdhci_arasan->soc_ctl_base)) +return dev_err_probe (dev,PTR_ERR (sdhci_arasan->soc_ctl_base),"Can't get syscon\n" ); - goto err_pltfm_free; - } }sdhci_get_of_property (pdev); sdhci_arasan->clk_ahb =devm_clk_get (dev,"clk_ahb" ); -if (IS_ERR (sdhci_arasan->clk_ahb)) { - ret =dev_err_probe (dev,PTR_ERR (sdhci_arasan->clk_ahb), +if (IS_ERR (sdhci_arasan->clk_ahb)) +return dev_err_probe (dev,PTR_ERR (sdhci_arasan->clk_ahb),"clk_ahb clock not found.\n" ); - goto err_pltfm_free; - } clk_xin =devm_clk_get (dev,"clk_xin" ); -if (IS_ERR (clk_xin)) { - ret =dev_err_probe (dev,PTR_ERR (clk_xin),"clk_xin clock not found.\n" ); - goto err_pltfm_free; - } +if (IS_ERR (clk_xin)) +return dev_err_probe (dev,PTR_ERR (clk_xin),"clk_xin clock not found.\n" ); ret =clk_prepare_enable (sdhci_arasan->clk_ahb); -if (ret) { -dev_err (dev,"Unable to enable AHB clock.\n" ); - goto err_pltfm_free; - } +if (ret) +return dev_err_probe (dev, ret,"Unable to enable AHB clock.\n" );/* If clock-frequency property is set, use the provided value */ if (pltfm_host->clock &&
drivers/mmc/host/sdhci-of-arasan.c static int sdhci_arasan_probe(struct platform_device *pdev) · line 2026
Quoted 8 lines
drivers/mmc/host/sdhci-of-arasan.c +0
-2@@ -2029,8 +2021,6 @@ static int sdhci_arasan_probe(struct platform_device *pdev)clk_disable_unprepare (clk_xin); clk_dis_ahb:clk_disable_unprepare (sdhci_arasan->clk_ahb); -err_pltfm_free: -sdhci_pltfm_free (pdev);return ret; }
I don't have problem with this change but your series is just wrong. Because
"mmc: sdhci-pltfm: Drop the use of sdhci_pltfm_free()"
is just removing this function before you convert all drivers. It means you just break bisectability of tree which is clear NACK.
Thanks,
Michal
Re: [PATCH 17/34] mmc: sdhci-of-arasan: Drop the use of sdhci_pltfm_free()
Hi Michal:
Thanks for your reply.
Quoted 58 lines · Michal Simek
Quoted 54 lines · Binbin Zhou
Since the
devm_mmc_alloc_host()helper is already in use,sdhci_pltfm_free()is no longer needed.Cc Michal Simek <[email protected]>Signed-off-by Binbin Zhou <[email protected]>--- drivers/mmc/host/sdhci-of-arasan.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-)drivers/mmc/host/sdhci-of-arasan.c +8
-16@@ -1883,34 +1883,26 @@ static int sdhci_arasan_probe(struct platform_device *pdev) sdhci_arasan->soc_ctl_base =syscon_node_to_regmap (node);of_node_put (node); -if (IS_ERR (sdhci_arasan->soc_ctl_base)) { - ret =dev_err_probe (dev, +if (IS_ERR (sdhci_arasan->soc_ctl_base)) +return dev_err_probe (dev,PTR_ERR (sdhci_arasan->soc_ctl_base),"Can't get syscon\n" ); - goto err_pltfm_free; - } }sdhci_get_of_property (pdev); sdhci_arasan->clk_ahb =devm_clk_get (dev,"clk_ahb" ); -if (IS_ERR (sdhci_arasan->clk_ahb)) { - ret =dev_err_probe (dev,PTR_ERR (sdhci_arasan->clk_ahb), +if (IS_ERR (sdhci_arasan->clk_ahb)) +return dev_err_probe (dev,PTR_ERR (sdhci_arasan->clk_ahb),"clk_ahb clock not found.\n" ); - goto err_pltfm_free; - } clk_xin =devm_clk_get (dev,"clk_xin" ); -if (IS_ERR (clk_xin)) { - ret =dev_err_probe (dev,PTR_ERR (clk_xin),"clk_xin clock not found.\n" ); - goto err_pltfm_free; - } +if (IS_ERR (clk_xin)) +return dev_err_probe (dev,PTR_ERR (clk_xin),"clk_xin clock not found.\n" ); ret =clk_prepare_enable (sdhci_arasan->clk_ahb); -if (ret) { -dev_err (dev,"Unable to enable AHB clock.\n" ); - goto err_pltfm_free; - } +if (ret) +return dev_err_probe (dev, ret,"Unable to enable AHB clock.\n" );
Quoted 17 lines
drivers/mmc/host/sdhci-of-arasan.c static int sdhci_arasan_probe(struct platform_device *pdev) · line 2026
Quoted 11 lines
drivers/mmc/host/sdhci-of-arasan.c +0
-2/* If clock-frequency property is set, use the provided value */ if (pltfm_host->clock &&@@ -2029,8 +2021,6 @@ static int sdhci_arasan_probe(struct platform_device *pdev)clk_disable_unprepare (clk_xin); clk_dis_ahb:clk_disable_unprepare (sdhci_arasan->clk_ahb); -err_pltfm_free: -sdhci_pltfm_free (pdev);return ret; }I don't have problem with this change but your series is just wrong. Because "mmc: sdhci-pltfm: Drop the use of
sdhci_pltfm_free()"
is just removing this function before you convert all drivers. It means you just break bisectability of tree which is clear NACK.
Yes, that's my fault, I didn't think it through.
Adrian just pointed this out, and I'll rework this section to empty sdhci_pltfm_free() first, and then remove sdhci_pltfm_free() completely at the end of the patchset.
Quoted 3 lines
Thanks,
Michal
Signature · 2 lines
Thanks. Binbin
Re: [PATCH 22/34] mmc: sdhci-of-k1: Drop the use of sdhci_pltfm_free()
In reply to Binbin Zhouhi Binbin,
Quoted 35 lines · Binbin Zhou
Since the
devm_mmc_alloc_host()helper is already in use,sdhci_pltfm_free()is no longer needed.Cc Yixun Lan <[email protected]>Signed-off-by Binbin Zhou <[email protected]>--- drivers/mmc/host/sdhci-of-k1.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)drivers/mmc/host/sdhci-of-k1.c +2
-6@@ -262,7 +262,7 @@ static int spacemit_sdhci_probe(struct platform_device *pdev) ret =mmc_of_parse (host->mmc);if (ret) - goto err_pltfm; +return ret;sdhci_get_of_property (pdev);@@ -276,18 +276,11 @@ static int spacemit_sdhci_probe(struct platform_device *pdev) host->mmc->caps |=MMC_CAP_NEED_RSP_BUSY ; -if (spacemit_sdhci_get_clocks (dev, pltfm_host)) - goto err_pltfm; - - ret =sdhci_add_host (host); + ret =spacemit_sdhci_get_clocks (dev, pltfm_host);if (ret) - goto err_pltfm;
drivers/mmc/host/sdhci-of-k1.c static int spacemit_sdhci_probe(struct platform_device *pdev) · line 285
Quoted 10 lines
drivers/mmc/host/sdhci-of-k1.c +2
-5- -return 0 ; +return ret; -err_pltfm: -sdhci_pltfm_free (pdev); -return ret; +return sdhci_add_host (host); }
although this patch looks good, but can you preserve the goto scheme? we might add other error handlings as implement SD/SDIO in the future (it also keeps the change minimal and easy to review)
Signature · 1 line
Yixun Lan (dlan)
Andrew Jeffery
maintainerRe: [PATCH 18/34] mmc: sdhci-of-aspeed: Drop the use of sdhci_pltfm_free()
In reply to Binbin ZhouQuoted 2 lines · Binbin Zhou
Since the
devm_mmc_alloc_host()helper is already in use,
This doesn't appear to be true? aspeed_sdhci_probe() calls sdhci_pltfm_init(), and following that through eventually we call mmc_alloc_host() (the non-devm_ variant).
That said, there are some error paths in aspeed_sdhci_probe() where we leak the object. Improving the code would be helpful, but my understanding is this patch isn't right.
Andrew
Re: [PATCH 29/34] mmc: sdhci-sprd: Drop the use of sdhci_pltfm_free()
In reply to Binbin ZhouQuoted 8 lines · Binbin Zhou
Since the
devm_mmc_alloc_host()helper is already in use,sdhci_pltfm_free()is no longer needed.Cc Orson Zhai <[email protected]>Cc Baolin Wang <[email protected]>Cc Chunyan Zhang <[email protected]>Signed-off-by Binbin Zhou <[email protected]>
Thanks,
Chunyan
Quoted 91 lines
--- drivers/mmc/host/sdhci-sprd.c | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-)drivers/mmc/host/sdhci-sprd.c +10
-24@@ -764,7 +764,7 @@ static int sdhci_sprd_probe(struct platform_device *pdev) ret =mmc_of_parse (host->mmc);if (ret) - goto pltfm_free; +return ret;if (!mmc_card_is_removable (host->mmc)) host->mmc_host_ops.request_atomic = sdhci_sprd_request_atomic;@@ -778,34 +778,26 @@ static int sdhci_sprd_probe(struct platform_device *pdev)if (!IS_ERR (sprd_host->pinctrl)) { sprd_host->pins_uhs =pinctrl_lookup_state (sprd_host->pinctrl,"state_uhs" ); -if (IS_ERR (sprd_host->pins_uhs)) { - ret =PTR_ERR (sprd_host->pins_uhs); - goto pltfm_free; - } +if (IS_ERR (sprd_host->pins_uhs)) +return PTR_ERR (sprd_host->pins_uhs); sprd_host->pins_default =pinctrl_lookup_state (sprd_host->pinctrl,"default" ); -if (IS_ERR (sprd_host->pins_default)) { - ret =PTR_ERR (sprd_host->pins_default); - goto pltfm_free; - } +if (IS_ERR (sprd_host->pins_default)) +return PTR_ERR (sprd_host->pins_default); } clk =devm_clk_get (&pdev->dev,"sdio" ); -if (IS_ERR (clk)) { - ret =PTR_ERR (clk); - goto pltfm_free; - } +if (IS_ERR (clk)) +return PTR_ERR (clk); sprd_host->clk_sdio = clk; sprd_host->base_rate =clk_get_rate (sprd_host->clk_sdio);if (!sprd_host->base_rate) sprd_host->base_rate =SDHCI_SPRD_CLK_DEF_RATE ; clk =devm_clk_get (&pdev->dev,"enable" ); -if (IS_ERR (clk)) { - ret =PTR_ERR (clk); - goto pltfm_free; - } +if (IS_ERR (clk)) +return PTR_ERR (clk); sprd_host->clk_enable = clk; clk =devm_clk_get (&pdev->dev,"2x_enable" );@@ -814,7 +806,7 @@ static int sdhci_sprd_probe(struct platform_device *pdev) ret =clk_prepare_enable (sprd_host->clk_sdio);if (ret) - goto pltfm_free; +return ret; ret =clk_prepare_enable (sprd_host->clk_enable);if (ret)@@ -891,9 +883,6 @@ static int sdhci_sprd_probe(struct platform_device *pdev) clk_disable:clk_disable_unprepare (sprd_host->clk_sdio); - -pltfm_free: -sdhci_pltfm_free (pdev);return ret; }@@ -907,8 +896,6 @@ static void sdhci_sprd_remove(struct platform_device *pdev)clk_disable_unprepare (sprd_host->clk_sdio);clk_disable_unprepare (sprd_host->clk_enable);clk_disable_unprepare (sprd_host->clk_2x_enable); - -sdhci_pltfm_free (pdev); }static const struct of_device_id sdhci_sprd_of_match[] = { --2.47.1
Re: [PATCH 18/34] mmc: sdhci-of-aspeed: Drop the use of sdhci_pltfm_free()
In reply to Andrew JefferyHi Andrew:
Thanks for your reply.
Quoted 5 lines · Andrew Jeffery
Quoted 2 lines · Binbin Zhou
Since the
devm_mmc_alloc_host()helper is already in use,
Quoted 7 lines
This doesn't appear to be true?
aspeed_sdhci_probe()callssdhci_pltfm_init(), and following that through eventually we callmmc_alloc_host()(the non-devm_ variant).That said, there are some error paths in
aspeed_sdhci_probe()where we leak the object. Improving the code would be helpful, but my understanding is this patch isn't right.
Sorry, I have a different thought.
In the original code, there does seem to be a leakage of objects, for example:
pltfm_host->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(pltfm_host->clk))
return PTR_ERR(pltfm_host->clk);With this error path, we should goto err_pltfm_free;
Now, I have replaced mmc_alloc_host() with devm_mmc_alloc_host() in Patch-1[1], so I don't think there will be any error path leakage of objects.
Quoted 2 lines
Andrew
Signature · 2 lines
Thanks. Binbin
Angelo Dureghello
maintainerRe: [PATCH 13/34] mmc: sdhci-esdhc-mcf: Drop the use of sdhci_pltfm_free()
In reply to Binbin ZhouHi Binbin,
not sure to understand, where do you see devm_mmc_alloc_host() ("in use") called for this sd controller ?
thanks,
Regards,
angelo
Quoted 71 lines · Binbin Zhou
Since the
devm_mmc_alloc_host()helper is already in use,sdhci_pltfm_free()is no longer needed.Cc Angelo Dureghello <[email protected]>Signed-off-by Binbin Zhou <[email protected]>--- drivers/mmc/host/sdhci-esdhc-mcf.c | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-)drivers/mmc/host/sdhci-esdhc-mcf.c +7
-18@@ -426,28 +426,22 @@ static int sdhci_esdhc_mcf_probe(struct platform_device *pdev) host->flags |=SDHCI_AUTO_CMD12 ; mcf_data->clk_ipg =devm_clk_get (&pdev->dev,"ipg" ); -if (IS_ERR (mcf_data->clk_ipg)) { - err =PTR_ERR (mcf_data->clk_ipg); - goto err_exit; - } +if (IS_ERR (mcf_data->clk_ipg)) +return PTR_ERR (mcf_data->clk_ipg); mcf_data->clk_ahb =devm_clk_get (&pdev->dev,"ahb" ); -if (IS_ERR (mcf_data->clk_ahb)) { - err =PTR_ERR (mcf_data->clk_ahb); - goto err_exit; - } +if (IS_ERR (mcf_data->clk_ahb)) +return PTR_ERR (mcf_data->clk_ahb); mcf_data->clk_per =devm_clk_get (&pdev->dev,"per" ); -if (IS_ERR (mcf_data->clk_per)) { - err =PTR_ERR (mcf_data->clk_per); - goto err_exit; - } +if (IS_ERR (mcf_data->clk_per)) +return PTR_ERR (mcf_data->clk_per); pltfm_host->clk = mcf_data->clk_per; pltfm_host->clock =clk_get_rate (pltfm_host->clk); err =clk_prepare_enable (mcf_data->clk_per);if (err) - goto err_exit; +return err; err =clk_prepare_enable (mcf_data->clk_ipg);if (err)@@ -485,9 +479,6 @@ static int sdhci_esdhc_mcf_probe(struct platform_device *pdev)clk_disable_unprepare (mcf_data->clk_ipg); unprep_per:clk_disable_unprepare (mcf_data->clk_per); -err_exit: -sdhci_pltfm_free (pdev); -return err; }@@ -502,8 +493,6 @@ static void sdhci_esdhc_mcf_remove(struct platform_device *pdev)clk_disable_unprepare (mcf_data->clk_ipg);clk_disable_unprepare (mcf_data->clk_ahb);clk_disable_unprepare (mcf_data->clk_per); - -sdhci_pltfm_free (pdev); }static struct platform_driver sdhci_esdhc_mcf_driver = {Signature · 1 line
2.47.1
Re: [PATCH 13/34] mmc: sdhci-esdhc-mcf: Drop the use of sdhci_pltfm_free()
In reply to Binbin ZhouHi Binbin,
sorry, seen now it was invoked in 1/34.
Quoted 71 lines · Binbin Zhou
Since the
devm_mmc_alloc_host()helper is already in use,sdhci_pltfm_free()is no longer needed.Cc Angelo Dureghello <[email protected]>Signed-off-by Binbin Zhou <[email protected]>--- drivers/mmc/host/sdhci-esdhc-mcf.c | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-)drivers/mmc/host/sdhci-esdhc-mcf.c +7
-18@@ -426,28 +426,22 @@ static int sdhci_esdhc_mcf_probe(struct platform_device *pdev) host->flags |=SDHCI_AUTO_CMD12 ; mcf_data->clk_ipg =devm_clk_get (&pdev->dev,"ipg" ); -if (IS_ERR (mcf_data->clk_ipg)) { - err =PTR_ERR (mcf_data->clk_ipg); - goto err_exit; - } +if (IS_ERR (mcf_data->clk_ipg)) +return PTR_ERR (mcf_data->clk_ipg); mcf_data->clk_ahb =devm_clk_get (&pdev->dev,"ahb" ); -if (IS_ERR (mcf_data->clk_ahb)) { - err =PTR_ERR (mcf_data->clk_ahb); - goto err_exit; - } +if (IS_ERR (mcf_data->clk_ahb)) +return PTR_ERR (mcf_data->clk_ahb); mcf_data->clk_per =devm_clk_get (&pdev->dev,"per" ); -if (IS_ERR (mcf_data->clk_per)) { - err =PTR_ERR (mcf_data->clk_per); - goto err_exit; - } +if (IS_ERR (mcf_data->clk_per)) +return PTR_ERR (mcf_data->clk_per); pltfm_host->clk = mcf_data->clk_per; pltfm_host->clock =clk_get_rate (pltfm_host->clk); err =clk_prepare_enable (mcf_data->clk_per);if (err) - goto err_exit; +return err; err =clk_prepare_enable (mcf_data->clk_ipg);if (err)@@ -485,9 +479,6 @@ static int sdhci_esdhc_mcf_probe(struct platform_device *pdev)clk_disable_unprepare (mcf_data->clk_ipg); unprep_per:clk_disable_unprepare (mcf_data->clk_per); -err_exit: -sdhci_pltfm_free (pdev); -return err; }@@ -502,8 +493,6 @@ static void sdhci_esdhc_mcf_remove(struct platform_device *pdev)clk_disable_unprepare (mcf_data->clk_ipg);clk_disable_unprepare (mcf_data->clk_ahb);clk_disable_unprepare (mcf_data->clk_per); - -sdhci_pltfm_free (pdev); }static struct platform_driver sdhci_esdhc_mcf_driver = {Signature · 1 line
2.47.1
Andrew Jeffery
maintainerRe: [PATCH 18/34] mmc: sdhci-of-aspeed: Drop the use of sdhci_pltfm_free()
In reply to Binbin ZhouQuoted 26 lines · Binbin Zhou
Hi Andrew:
Thanks for your reply.
Quoted 5 lines · Andrew Jeffery
Quoted 2 lines · Binbin Zhou
Since the
devm_mmc_alloc_host()helper is already in use,Quoted 7 lines
This doesn't appear to be true?
aspeed_sdhci_probe()callssdhci_pltfm_init(), and following that through eventually we callmmc_alloc_host()(the non-devm_ variant).That said, there are some error paths in
aspeed_sdhci_probe()where we leak the object. Improving the code would be helpful, but my understanding is this patch isn't right.Sorry, I have a different thought.
In the original code, there does seem to be a leakage of objects, for example:
pltfm_host->clk=devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(pltfm_host->clk))
returnPTR_ERR(pltfm_host->clk);
Quoted 7 lines
With this error path, we should goto
err_pltfm_free;Now, I have replaced
mmc_alloc_host()withdevm_mmc_alloc_host()in Patch-1[1], so I don't think there will be any error path leakage of objects.
Okay, I didn't track down the rest of the series on lore. I don't personally mind if you send me the whole series, that would certainly have helped with the context in this case.
Andrew