mmc: Cleanup mmc_alloc_host() usage
Subsystems (27)
v2 cover mmc: Cleanup mmc_alloc_host() usage
Hi all:
First of all, I'm very sorry for the compilation failure issue due to my cheap mistake in v1 patchset.
The patch series was tested by using lkp and cross compiling with different architectures (arm/mips/x86_64 etc architectures) and enabling COMPILE_TEST=y to ensure that each driver was compiled and tested.
Since the devm_mmc_alloc_host() helper was already available, I tried to start cleaning up the use of mmc_alloc_host().
To make it easier to review the patchset, I decided to split it into two parts. As the first part, this patchset contains cleanup for drivers other than sdhci.
Of course, the sdhci part I have ready in my repository.
Thanks.
-----
V2:
- Collect Reviewed-by and Acked-by tags.
Patch-24
- Correct subject title: ish_mmicf -> sh_mmicf.
Patch-34
- Fix cheap build error.
Link to V1:
https://lore.kernel.org/all/[email protected]/
Binbin Zhou (36):
mmc: alcor: Use devm_mmc_alloc_host() helper
mmc: atmel: Use devm_mmc_alloc_host() helper
mmc: au1xmmc: Use devm_mmc_alloc_host() helper
mmc: bcm2835: Use devm_mmc_alloc_host() helper
mmc: cavium: Use devm_mmc_alloc_host() helper
mmc: cb710: Use devm_mmc_alloc_host() helper
mmc: davinci_mmc: Use devm_mmc_alloc_host() helper
mmc: dw_mmc: Use devm_mmc_alloc_host() helper
mmc: jz4740: Use devm_mmc_alloc_host() helper
mmc: litex_mmc: Use devm_mmc_alloc_host() helper
mmc: meson-mx-sdhc: Use devm_mmc_alloc_host() helper
mmc: mmci: Use devm_mmc_alloc_host() helper
mmc: moxart-mmc: Use devm_mmc_alloc_host() helper
mmc: mvsdio: Use devm_mmc_alloc_host() helper
mmc: mxcmmc: Use devm_mmc_alloc_host() helper
mmc: mxs-mmc: Use devm_mmc_alloc_host() helper
mmc: omap: Use devm_mmc_alloc_host() helper
mmc: omap_hsmmc: Use devm_mmc_alloc_host() helper
mmc: owl-mmc: Use devm_mmc_alloc_host() helper
mmc: pxamci: Use devm_mmc_alloc_host() helper
mmc: rtsx_pci: Use devm_mmc_alloc_host() helper
mmc: rtsx_usb_sdmmc: Use devm_mmc_alloc_host() helper
mmc: sdricoh_cs: Use devm_mmc_alloc_host() helper
mmc: sh_mmicf: Use devm_mmc_alloc_host() helper
mmc: tifm_sd: Use devm_mmc_alloc_host() helper
mmc: toshsd: Use devm_mmc_alloc_host() helper
mmc: usdhi6ro10: Use devm_mmc_alloc_host() helper
mmc: ushc: Use devm_mmc_alloc_host() helper
mmc: via-sdmmc: Use devm_mmc_alloc_host() helper
mmc: vub300: Use devm_mmc_alloc_host() helper
mmc: wbsd: Use devm_mmc_alloc_host() helper
mmc: wmt-sdmmc: Use devm_mmc_alloc_host() helper
mmc: tmio: Use devm_mmc_alloc_host() helper
mmc: sunxi: Use devm_mmc_alloc_host() helper
mmc: mmc_spi: Use devm_mmc_alloc_host() helper
mmc: meson-mx-sdio: Use devm_mmc_alloc_host() helper
drivers/mmc/host/alcor.c | 20 ++++--------- drivers/mmc/host/atmel-mci.c | 7 ++--- drivers/mmc/host/au1xmmc.c | 14 +++------- drivers/mmc/host/bcm2835.c | 5 +--- drivers/mmc/host/cavium.c | 10 ++----- drivers/mmc/host/cb710-mmc.c | 5 +--- drivers/mmc/host/davinci_mmc.c | 22 +++++---------- drivers/mmc/host/dw_mmc.c | 15 ++++------ drivers/mmc/host/jz4740_mmc.c | 40 +++++++++----------------- drivers/mmc/host/litex_mmc.c | 12 +------- drivers/mmc/host/meson-mx-sdhc-mmc.c | 13 +-------- drivers/mmc/host/meson-mx-sdio.c | 20 ++++++------- drivers/mmc/host/mmc_spi.c | 4 +-- drivers/mmc/host/mmci.c | 31 ++++++++------------ drivers/mmc/host/moxart-mmc.c | 40 ++++++++++---------------- drivers/mmc/host/mvsdio.c | 24 +++++----------- drivers/mmc/host/mxcmmc.c | 31 +++++++------------- drivers/mmc/host/mxs-mmc.c | 31 ++++++++------------ drivers/mmc/host/omap.c | 25 ++++++----------- drivers/mmc/host/omap_hsmmc.c | 18 ++++-------- drivers/mmc/host/owl-mmc.c | 37 +++++++++--------------- drivers/mmc/host/pxamci.c | 42 ++++++++++------------------ drivers/mmc/host/renesas_sdhi_core.c | 6 +--- drivers/mmc/host/rtsx_pci_sdmmc.c | 5 +--- drivers/mmc/host/rtsx_usb_sdmmc.c | 4 +-- drivers/mmc/host/sdricoh_cs.c | 10 ++----- drivers/mmc/host/sh_mmcif.c | 17 ++++------- drivers/mmc/host/sunxi-mmc.c | 22 ++++++--------- drivers/mmc/host/tifm_sd.c | 7 +---- drivers/mmc/host/tmio_mmc.h | 1 - drivers/mmc/host/tmio_mmc_core.c | 18 ++---------- drivers/mmc/host/toshsd.c | 4 +-- drivers/mmc/host/uniphier-sd.c | 8 ++---- drivers/mmc/host/usdhi6rol0.c | 30 +++++++------------- drivers/mmc/host/ushc.c | 4 +-- drivers/mmc/host/via-sdmmc.c | 7 ++--- drivers/mmc/host/vub300.c | 16 ++++------- drivers/mmc/host/wbsd.c | 4 +-- drivers/mmc/host/wmt-sdmmc.c | 8 ++---- 39 files changed, 195 insertions(+), 442 deletions(-)
base-commit: 61bd8e76021e779f7ba3c761919b533fb3f6f584
Signature · 1 line
2.47.1
PATCH v2 1/36 mmc: alcor: Use devm_mmc_alloc_host() helper
Use new function devm_mmc_alloc_host() to simplify the code.
--- drivers/mmc/host/alcor.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-)
drivers/mmc/host/alcor.c +5 -15
@@ -1084,7 +1084,7 @@ static int alcor_pci_sdmmc_drv_probe(struct platform_device *pdev)struct alcor_sdmmc_host *host;int ret; - mmc =mmc_alloc_host (sizeof (*host), &pdev->dev); + mmc =devm_mmc_alloc_host (&pdev->dev,sizeof (*host));if (!mmc) {dev_err (&pdev->dev,"Can't allocate MMC\n" );return -ENOMEM ;
@@ -1102,11 +1102,9 @@ static int alcor_pci_sdmmc_drv_probe(struct platform_device *pdev) ret =devm_request_threaded_irq (&pdev->dev, priv->irq, alcor_irq, alcor_irq_thread,IRQF_SHARED ,DRV_NAME_ALCOR_PCI_SDMMC , host); - -if (ret) { -dev_err (&pdev->dev,"Failed to get irq for data line\n" ); - goto free_host; - } +if (ret) +return dev_err_probe (&pdev->dev, ret, +"Failed to get irq for data line\n" );mutex_init (&host->cmd_mutex);INIT_DELAYED_WORK (&host->timeout_work, alcor_timeout_timer);
@@ -1115,15 +1113,8 @@ static int alcor_pci_sdmmc_drv_probe(struct platform_device *pdev)alcor_hw_init (host);dev_set_drvdata (&pdev->dev, host); - ret =mmc_add_host (mmc); -if (ret) - goto free_host; -return 0 ; - -free_host: -mmc_free_host (mmc); -return ret; +return mmc_add_host (mmc); }static void alcor_pci_sdmmc_drv_remove (struct platform_device *pdev)
@@ -1136,7 +1127,6 @@ static void alcor_pci_sdmmc_drv_remove(struct platform_device *pdev)alcor_hw_uninit (host);mmc_remove_host (mmc); -mmc_free_host (mmc); }#ifdef CONFIG_PM_SLEEP
Signature · 1 line
2.47.1
PATCH v2 2/36 mmc: atmel: Use devm_mmc_alloc_host() helper
In reply to Binbin ZhouUse new function devm_mmc_alloc_host() to simplify the code.
--- drivers/mmc/host/atmel-mci.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/mmc/host/atmel-mci.c +2 -5
@@ -2247,7 +2247,7 @@ static int atmci_init_slot(struct atmel_mci *host,struct atmel_mci_slot *slot;int ret; - mmc =mmc_alloc_host (sizeof (struct atmel_mci_slot ), dev); + mmc =devm_mmc_alloc_host (dev,sizeof (*slot));if (!mmc)return -ENOMEM ;
@@ -2320,10 +2320,8 @@ static int atmci_init_slot(struct atmel_mci *host, host->slot[id] = slot;mmc_regulator_get_supply (mmc); ret =mmc_add_host (mmc); -if (ret) { -mmc_free_host (mmc); +if (ret)return ret; - }if (slot->detect_pin) {timer_setup (&slot->detect_timer, atmci_detect_change,0 );
@@ -2361,7 +2359,6 @@ static void atmci_cleanup_slot(struct atmel_mci_slot *slot, } slot->host->slot[id] =NULL ; -mmc_free_host (slot->mmc); }static int atmci_configure_dma (struct atmel_mci *host)
Signature · 1 line
2.47.1
PATCH v2 3/36 mmc: au1xmmc: Use devm_mmc_alloc_host() helper
In reply to Binbin ZhouUse new function devm_mmc_alloc_host() to simplify the code.
--- drivers/mmc/host/au1xmmc.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
drivers/mmc/host/au1xmmc.c +4 -10
@@ -937,11 +937,10 @@ static int au1xmmc_probe(struct platform_device *pdev)struct resource *r;int ret, iflag; - mmc =mmc_alloc_host (sizeof (struct au1xmmc_host ), &pdev->dev); + mmc =devm_mmc_alloc_host (&pdev->dev,sizeof (*host));if (!mmc) {dev_err (&pdev->dev,"no memory for mmc_host\n" ); - ret = -ENOMEM ; - goto out0; +return -ENOMEM ; } host =mmc_priv (mmc);
@@ -953,14 +952,14 @@ static int au1xmmc_probe(struct platform_device *pdev) r =platform_get_resource (pdev,IORESOURCE_MEM ,0 );if (!r) {dev_err (&pdev->dev,"no mmio defined\n" ); - goto out1; +return ret; } host->ioarea =request_mem_region (r->start,resource_size (r), pdev->name);if (!host->ioarea) {dev_err (&pdev->dev,"mmio already in use\n" ); - goto out1; +return ret; } host->iobase =ioremap (r->start,0x3c );
@@ -1109,9 +1108,6 @@ static int au1xmmc_probe(struct platform_device *pdev) out2:release_resource (host->ioarea);kfree (host->ioarea); -out1: -mmc_free_host (mmc); -out0:return ret; }
@@ -1151,8 +1147,6 @@ static void au1xmmc_remove(struct platform_device *pdev)iounmap ((void *)host->iobase);release_resource (host->ioarea);kfree (host->ioarea); - -mmc_free_host (host->mmc); } }
Signature · 1 line
2.47.1
PATCH v2 4/36 mmc: bcm2835: Use devm_mmc_alloc_host() helper
In reply to Binbin ZhouUse new function devm_mmc_alloc_host() to simplify the code.
--- drivers/mmc/host/bcm2835.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/mmc/host/bcm2835.c +1 -4
@@ -1371,7 +1371,7 @@ static int bcm2835_probe(struct platform_device *pdev)int ret;dev_dbg (dev,"%s\n" , __func__); - mmc =mmc_alloc_host (sizeof (*host), dev); + mmc =devm_mmc_alloc_host (dev,sizeof (*host));if (!mmc)return -ENOMEM ;
@@ -1450,7 +1450,6 @@ static int bcm2835_probe(struct platform_device *pdev)dev_dbg (dev,"%s -> err %d\n" , __func__, ret);if (host->dma_chan_rxtx)dma_release_channel (host->dma_chan_rxtx); -mmc_free_host (mmc);return ret; }
@@ -1473,8 +1472,6 @@ static void bcm2835_remove(struct platform_device *pdev)if (host->dma_chan_rxtx)dma_release_channel (host->dma_chan_rxtx); - -mmc_free_host (mmc); }static const struct of_device_id bcm2835_match[] = {
Signature · 1 line
2.47.1
PATCH v2 5/36 mmc: cavium: Use devm_mmc_alloc_host() helper
In reply to Binbin ZhouUse new function devm_mmc_alloc_host() to simplify the code.
--- drivers/mmc/host/cavium.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/mmc/host/cavium.c +2 -8
@@ -1012,7 +1012,7 @@ int cvm_mmc_of_slot_probe(struct device *dev, struct cvm_mmc_host *host)struct mmc_host *mmc;int ret, id; - mmc =mmc_alloc_host (sizeof (struct cvm_mmc_slot ), dev); + mmc =devm_mmc_alloc_host (dev,sizeof (*slot));if (!mmc)return -ENOMEM ;
@@ -1022,7 +1022,7 @@ int cvm_mmc_of_slot_probe(struct device *dev, struct cvm_mmc_host *host) ret =cvm_mmc_of_parse (dev, slot);if (ret <0 ) - goto error; +return ret; id = ret;/* Set up host parameters */
@@ -1066,12 +1066,7 @@ int cvm_mmc_of_slot_probe(struct device *dev, struct cvm_mmc_host *host)if (ret) {dev_err (dev,"mmc_add_host() returned %d\n" , ret); slot->host->slot[id] =NULL ; - goto error; } -return 0 ; - -error: -mmc_free_host (slot->mmc);return ret; }
@@ -1079,6 +1074,5 @@ int cvm_mmc_of_slot_remove(struct cvm_mmc_slot *slot) {mmc_remove_host (slot->mmc); slot->host->slot[slot->bus_id] =NULL ; -mmc_free_host (slot->mmc);return 0 ; }
Signature · 1 line
2.47.1
PATCH v2 6/36 mmc: cb710: Use devm_mmc_alloc_host() helper
In reply to Binbin ZhouUse new function devm_mmc_alloc_host() to simplify the code.
--- drivers/mmc/host/cb710-mmc.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/mmc/host/cb710-mmc.c +1 -4
@@ -692,7 +692,7 @@ static int cb710_mmc_init(struct platform_device *pdev)int err;u32 val; - mmc =mmc_alloc_host (sizeof (*reader),cb710_slot_dev (slot)); + mmc =devm_mmc_alloc_host (cb710_slot_dev (slot),sizeof (*reader));if (!mmc)return -ENOMEM ;
@@ -741,7 +741,6 @@ static int cb710_mmc_init(struct platform_device *pdev)dev_dbg (cb710_slot_dev (slot),"mmc_add_host() failed: %d\n" , err);cb710_set_irq_handler (slot,NULL ); -mmc_free_host (mmc);return err; }
@@ -764,8 +763,6 @@ static void cb710_mmc_exit(struct platform_device *pdev)cb710_write_port_16 (slot,CB710_MMC_CONFIGB_PORT ,0 );cancel_work_sync (&reader->finish_req_bh_work); - -mmc_free_host (mmc); }static struct platform_driver cb710_mmc_driver = {
Signature · 1 line
2.47.1
PATCH v2 7/36 mmc: davinci_mmc: Use devm_mmc_alloc_host() helper
In reply to Binbin ZhouUse new function devm_mmc_alloc_host() to simplify the code.
--- drivers/mmc/host/davinci_mmc.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-)
drivers/mmc/host/davinci_mmc.c +7 -15
@@ -1203,7 +1203,7 @@ static int davinci_mmcsd_probe(struct platform_device *pdev)if (!mem)return -EBUSY ; - mmc =mmc_alloc_host (sizeof (struct mmc_davinci_host ), &pdev->dev); + mmc =devm_mmc_alloc_host (&pdev->dev,sizeof (*host));if (!mmc)return -ENOMEM ;
@@ -1212,19 +1212,16 @@ static int davinci_mmcsd_probe(struct platform_device *pdev) host->mem_res = mem; host->base =devm_ioremap (&pdev->dev, mem->start, mem_size); -if (!host->base) { - ret = -ENOMEM ; - goto ioremap_fail; - } +if (!host->base) +return -ENOMEM ; host->clk =devm_clk_get (&pdev->dev,NULL ); -if (IS_ERR (host->clk)) { - ret =PTR_ERR (host->clk); - goto clk_get_fail; - } +if (IS_ERR (host->clk)) +return PTR_ERR (host->clk); + ret =clk_prepare_enable (host->clk);if (ret) - goto clk_prepare_enable_fail; +return ret; host->mmc_input_clk =clk_get_rate (host->clk);
@@ -1336,10 +1333,6 @@ static int davinci_mmcsd_probe(struct platform_device *pdev) parse_fail: dma_probe_defer:clk_disable_unprepare (host->clk); -clk_prepare_enable_fail: -clk_get_fail: -ioremap_fail: -mmc_free_host (mmc);return ret; }
@@ -1352,7 +1345,6 @@ static void davinci_mmcsd_remove(struct platform_device *pdev)mmc_davinci_cpufreq_deregister (host);davinci_release_dma_channels (host);clk_disable_unprepare (host->clk); -mmc_free_host (host->mmc); }#ifdef CONFIG_PM
Signature · 1 line
2.47.1
PATCH v2 8/36 mmc: dw_mmc: Use devm_mmc_alloc_host() helper
In reply to Binbin ZhouUse new function devm_mmc_alloc_host() to simplify the code.
--- drivers/mmc/host/dw_mmc.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)
drivers/mmc/host/dw_mmc.c +5 -10
@@ -3008,7 +3008,7 @@ static int dw_mci_init_slot(struct dw_mci *host)struct dw_mci_slot *slot;int ret; - mmc =mmc_alloc_host (sizeof (struct dw_mci_slot ), host->dev); + mmc =devm_mmc_alloc_host (host->dev,sizeof (*slot));if (!mmc)return -ENOMEM ;
@@ -3024,18 +3024,18 @@ static int dw_mci_init_slot(struct dw_mci *host)/*if there are external regulators, get them*/ ret =mmc_regulator_get_supply (mmc);if (ret) - goto err_host_allocated; +return ret;if (!mmc->ocr_avail) mmc->ocr_avail =MMC_VDD_32_33 |MMC_VDD_33_34 ; ret =mmc_of_parse (mmc);if (ret) - goto err_host_allocated; +return ret; ret =dw_mci_init_slot_caps (slot);if (ret) - goto err_host_allocated; +return ret;/* Useful defaults if platform data is unset. */ if (host->use_dma ==TRANS_MODE_IDMAC ) {
@@ -3065,17 +3065,13 @@ static int dw_mci_init_slot(struct dw_mci *host) ret =mmc_add_host (mmc);if (ret) - goto err_host_allocated; +return ret;#if defined(CONFIG_DEBUG_FS )dw_mci_init_debugfs (slot);#endif return 0 ; - -err_host_allocated: -mmc_free_host (mmc); -return ret; }static void dw_mci_cleanup_slot (struct dw_mci_slot *slot)
@@ -3083,7 +3079,6 @@ static void dw_mci_cleanup_slot(struct dw_mci_slot *slot)/* Debugfs stuff is cleaned up by mmc core */ mmc_remove_host (slot->mmc); slot->host->slot =NULL ; -mmc_free_host (slot->mmc); }static void dw_mci_init_dma (struct dw_mci *host)
Signature · 1 line
2.47.1
PATCH v2 9/36 mmc: jz4740: Use devm_mmc_alloc_host() helper
In reply to Binbin ZhouUse new function devm_mmc_alloc_host() to simplify the code.
--- drivers/mmc/host/jz4740_mmc.c | 40 ++++++++++++----------------------- 1 file changed, 13 insertions(+), 27 deletions(-)
drivers/mmc/host/jz4740_mmc.c +13 -27
@@ -1042,7 +1042,7 @@ static int jz4740_mmc_probe(struct platform_device* pdev)struct mmc_host *mmc;struct jz4740_mmc_host *host; - mmc =mmc_alloc_host (sizeof (struct jz4740_mmc_host ), &pdev->dev); + mmc =devm_mmc_alloc_host (&pdev->dev,sizeof (*host));if (!mmc) {dev_err (&pdev->dev,"Failed to alloc mmc host structure\n" );return -ENOMEM ;
@@ -1054,31 +1054,24 @@ static int jz4740_mmc_probe(struct platform_device* pdev) host->version = (enum jz4740_mmc_version )device_get_match_data (&pdev->dev); ret =mmc_of_parse (mmc); -if (ret) { -dev_err_probe (&pdev->dev, ret,"could not parse device properties\n" ); - goto err_free_host; - } +if (ret) +return dev_err_probe (&pdev->dev, ret, +"could not parse device properties\n" );mmc_regulator_get_supply (mmc); host->irq =platform_get_irq (pdev,0 ); -if (host->irq <0 ) { - ret = host->irq; - goto err_free_host; - } +if (host->irq <0 ) +return host->irq; host->clk =devm_clk_get (&pdev->dev,"mmc" ); -if (IS_ERR (host->clk)) { - ret =PTR_ERR (host->clk); -dev_err (&pdev->dev,"Failed to get mmc clock\n" ); - goto err_free_host; - } +if (IS_ERR (host->clk)) +return dev_err_probe (&pdev->dev,PTR_ERR (host->clk), +"Failed to get mmc clock\n" ); host->base =devm_platform_get_and_ioremap_resource (pdev,0 , &host->mem_res); -if (IS_ERR (host->base)) { - ret =PTR_ERR (host->base); - goto err_free_host; - } +if (IS_ERR (host->base)) +return PTR_ERR (host->base); mmc->ops = &jz4740_mmc_ops;if (!mmc->f_max)
@@ -1118,10 +1111,8 @@ static int jz4740_mmc_probe(struct platform_device* pdev) ret =request_threaded_irq (host->irq, jz_mmc_irq, jz_mmc_irq_worker,0 ,dev_name (&pdev->dev), host); -if (ret) { -dev_err (&pdev->dev,"Failed to request irq: %d\n" , ret); - goto err_free_host; - } +if (ret) +return dev_err_probe (&pdev->dev, ret,"Failed to request irq\n" );jz4740_mmc_clock_disable (host);timer_setup (&host->timeout_timer, jz4740_mmc_timeout,0 );
@@ -1152,9 +1143,6 @@ static int jz4740_mmc_probe(struct platform_device* pdev)jz4740_mmc_release_dma_channels (host); err_free_irq:free_irq (host->irq, host); -err_free_host: -mmc_free_host (mmc); -return ret; }
@@ -1172,8 +1160,6 @@ static void jz4740_mmc_remove(struct platform_device *pdev)if (host->use_dma)jz4740_mmc_release_dma_channels (host); - -mmc_free_host (host->mmc); }static int jz4740_mmc_suspend (struct device *dev)
Signature · 1 line
2.47.1
PATCH v2 10/36 mmc: litex_mmc: Use devm_mmc_alloc_host() helper
In reply to Binbin ZhouUse new function devm_mmc_alloc_host() to simplify the code.
--- drivers/mmc/host/litex_mmc.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/mmc/host/litex_mmc.c +1 -11
@@ -506,11 +506,6 @@ static int litex_mmc_irq_init(struct platform_device *pdev,return 0 ; } -static void litex_mmc_free_host_wrapper (void *mmc) -{ -mmc_free_host (mmc); -} -static int litex_mmc_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;
@@ -525,15 +520,10 @@ static int litex_mmc_probe(struct platform_device *pdev)* If for some reason we need to modify max_blk_count, we must also * re-calculate `max_[req,seg]_size = max_blk_size * max_blk_count;` */ - mmc =mmc_alloc_host (sizeof (struct litex_mmc_host ), dev); + mmc =devm_mmc_alloc_host (dev,sizeof (*host));if (!mmc)return -ENOMEM ; - ret =devm_add_action_or_reset (dev, litex_mmc_free_host_wrapper, mmc); -if (ret) -return dev_err_probe (dev, ret, -"Can't register mmc_free_host action\n" ); - host =mmc_priv (mmc); host->mmc = mmc;
Signature · 1 line
2.47.1
PATCH v2 11/36 mmc: meson-mx-sdhc: Use devm_mmc_alloc_host() helper
In reply to Binbin ZhouUse new function devm_mmc_alloc_host() to simplify the code.
--- drivers/mmc/host/meson-mx-sdhc-mmc.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/mmc/host/meson-mx-sdhc-mmc.c +1 -12
@@ -757,11 +757,6 @@ static void meson_mx_sdhc_init_hw(struct mmc_host *mmc)regmap_write (host->regmap,MESON_SDHC_ISTA ,MESON_SDHC_ISTA_ALL_IRQS ); } -static void meason_mx_mmc_free_host (void *data) -{ -mmc_free_host (data); -} -static int meson_mx_sdhc_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;
@@ -770,16 +765,10 @@ static int meson_mx_sdhc_probe(struct platform_device *pdev)void __iomem *base;int ret, irq; - mmc =mmc_alloc_host (sizeof (*host), dev); + mmc =devm_mmc_alloc_host (dev,sizeof (*host));if (!mmc)return -ENOMEM ; - ret =devm_add_action_or_reset (dev, meason_mx_mmc_free_host, mmc); -if (ret) { -dev_err (dev,"Failed to register mmc_free_host action\n" ); -return ret; - } - host =mmc_priv (mmc); host->mmc = mmc;
Signature · 1 line
2.47.1
PATCH v2 13/36 mmc: moxart-mmc: Use devm_mmc_alloc_host() helper
In reply to Binbin ZhouUse new function devm_mmc_alloc_host() to simplify the code.
--- drivers/mmc/host/moxart-mmc.c | 40 ++++++++++++----------------------- 1 file changed, 14 insertions(+), 26 deletions(-)
drivers/mmc/host/moxart-mmc.c +14 -26
@@ -558,41 +558,33 @@ static int moxart_probe(struct platform_device *pdev)int irq, ret;u32 i; - mmc =mmc_alloc_host (sizeof (struct moxart_host ), dev); + mmc =devm_mmc_alloc_host (dev,sizeof (*host));if (!mmc) { -dev_err (dev,"mmc_alloc_host failed\n" ); - ret = -ENOMEM ; - goto out_mmc; +dev_err (dev,"devm_mmc_alloc_host failed\n" ); +return -ENOMEM ; } ret =of_address_to_resource (node,0 , &res_mmc); -if (ret) { -dev_err (dev,"of_address_to_resource failed\n" ); - goto out_mmc; - } +if (ret) +return dev_err_probe (dev, ret, +"of_address_to_resource failed\n" ); irq =irq_of_parse_and_map (node,0 ); -if (irq <=0 ) { -dev_err (dev,"irq_of_parse_and_map failed\n" ); - ret = -EINVAL ; - goto out_mmc; - } +if (irq <=0 ) +return dev_err_probe (dev, -EINVAL , +"irq_of_parse_and_map failed\n" ); clk =devm_clk_get (dev,NULL ); -if (IS_ERR (clk)) { - ret =PTR_ERR (clk); - goto out_mmc; - } +if (IS_ERR (clk)) +return PTR_ERR (clk); reg_mmc =devm_ioremap_resource (dev, &res_mmc); -if (IS_ERR (reg_mmc)) { - ret =PTR_ERR (reg_mmc); - goto out_mmc; - } +if (IS_ERR (reg_mmc)) +return PTR_ERR (reg_mmc); ret =mmc_of_parse (mmc);if (ret) - goto out_mmc; +return ret; host =mmc_priv (mmc); host->mmc = mmc;
@@ -686,9 +678,6 @@ static int moxart_probe(struct platform_device *pdev)dma_release_channel (host->dma_chan_tx);if (!IS_ERR_OR_NULL (host->dma_chan_rx))dma_release_channel (host->dma_chan_rx); -out_mmc: -if (mmc) -mmc_free_host (mmc);return ret; }
@@ -707,7 +696,6 @@ static void moxart_remove(struct platform_device *pdev)writel (0 , host->base +REG_POWER_CONTROL );writel (readl (host->base +REG_CLOCK_CONTROL ) |CLK_OFF , host->base +REG_CLOCK_CONTROL ); -mmc_free_host (mmc); }static const struct of_device_id moxart_mmc_match[] = {
Signature · 1 line
2.47.1
PATCH v2 12/36 mmc: mmci: Use devm_mmc_alloc_host() helper
In reply to Binbin ZhouUse new function devm_mmc_alloc_host() to simplify the code.
--- drivers/mmc/host/mmci.c | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-)
drivers/mmc/host/mmci.c +11 -20
@@ -2223,7 +2223,7 @@ static int mmci_probe(struct amba_device *dev,return -ENOMEM ; } - mmc =mmc_alloc_host (sizeof (struct mmci_host ), &dev->dev); + mmc =devm_mmc_alloc_host (&dev->dev,sizeof (*host));if (!mmc)return -ENOMEM ;
@@ -2234,7 +2234,7 @@ static int mmci_probe(struct amba_device *dev, ret =mmci_of_parse (np, mmc);if (ret) - goto host_free; +return ret;/* * Some variant (STM32) doesn't have opendrain bit, nevertheless
@@ -2242,19 +2242,15 @@ static int mmci_probe(struct amba_device *dev,*/ if (!variant->opendrain) { host->pinctrl =devm_pinctrl_get (&dev->dev); -if (IS_ERR (host->pinctrl)) { -dev_err (&dev->dev,"failed to get pinctrl" ); - ret =PTR_ERR (host->pinctrl); - goto host_free; - } +if (IS_ERR (host->pinctrl)) +return dev_err_probe (&dev->dev,PTR_ERR (host->pinctrl), +"failed to get pinctrl\n" ); host->pins_opendrain =pinctrl_lookup_state (host->pinctrl,MMCI_PINCTRL_STATE_OPENDRAIN ); -if (IS_ERR (host->pins_opendrain)) { -dev_err (mmc_dev (mmc),"Can't select opendrain pins\n" ); - ret =PTR_ERR (host->pins_opendrain); - goto host_free; - } +if (IS_ERR (host->pins_opendrain)) +return dev_err_probe (&dev->dev,PTR_ERR (host->pins_opendrain), +"Can't select opendrain pins\n" ); } host->hw_designer =amba_manf (dev);
@@ -2263,14 +2259,12 @@ static int mmci_probe(struct amba_device *dev,dev_dbg (mmc_dev (mmc),"revision = 0x%01x\n" , host->hw_revision); host->clk =devm_clk_get (&dev->dev,NULL ); -if (IS_ERR (host->clk)) { - ret =PTR_ERR (host->clk); - goto host_free; - } +if (IS_ERR (host->clk)) +return PTR_ERR (host->clk); ret =clk_prepare_enable (host->clk);if (ret) - goto host_free; +return ret;if (variant->qcom_fifo) host->get_rx_fifocnt = mmci_qcom_get_rx_fifocnt;
@@ -2491,8 +2485,6 @@ static int mmci_probe(struct amba_device *dev, clk_disable:clk_disable_unprepare (host->clk); - host_free: -mmc_free_host (mmc);return ret; }
@@ -2522,7 +2514,6 @@ static void mmci_remove(struct amba_device *dev)mmci_dma_release (host);clk_disable_unprepare (host->clk); -mmc_free_host (mmc); } }
Signature · 1 line
2.47.1
PATCH v2 14/36 mmc: mvsdio: Use devm_mmc_alloc_host() helper
In reply to Binbin ZhouUse new function devm_mmc_alloc_host() to simplify the code.
--- drivers/mmc/host/mvsdio.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-)
drivers/mmc/host/mvsdio.c +7 -17
@@ -706,11 +706,9 @@ static int mvsd_probe(struct platform_device *pdev)if (irq <0 )return irq; - mmc =mmc_alloc_host (sizeof (struct mvsd_host ), &pdev->dev); -if (!mmc) { - ret = -ENOMEM ; - goto out; - } + mmc =devm_mmc_alloc_host (&pdev->dev,sizeof (*host)); +if (!mmc) +return -ENOMEM ; host =mmc_priv (mmc); host->mmc = mmc;
@@ -724,11 +722,9 @@ static int mvsd_probe(struct platform_device *pdev)* fixed rate clock). */ host->clk =devm_clk_get (&pdev->dev,NULL ); -if (IS_ERR (host->clk)) { -dev_err (&pdev->dev,"no clock associated\n" ); - ret = -EINVAL ; - goto out; - } +if (IS_ERR (host->clk)) +return dev_err_probe (&pdev->dev, -EINVAL ,"no clock associated\n" ); +clk_prepare_enable (host->clk); mmc->ops = &mvsd_ops;
@@ -787,12 +783,7 @@ static int mvsd_probe(struct platform_device *pdev)return 0 ; out: -if (mmc) { -if (!IS_ERR (host->clk)) -clk_disable_unprepare (host->clk); -mmc_free_host (mmc); - } - +clk_disable_unprepare (host->clk);return ret; }
@@ -808,7 +799,6 @@ static void mvsd_remove(struct platform_device *pdev)if (!IS_ERR (host->clk))clk_disable_unprepare (host->clk); -mmc_free_host (mmc); }static const struct of_device_id mvsdio_dt_ids[] = {
Signature · 1 line
2.47.1
PATCH v2 15/36 mmc: mxcmmc: Use devm_mmc_alloc_host() helper
In reply to Binbin ZhouUse new function devm_mmc_alloc_host() to simplify the code.
--- drivers/mmc/host/mxcmmc.c | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-)
drivers/mmc/host/mxcmmc.c +10 -21
@@ -1005,23 +1005,21 @@ static int mxcmci_probe(struct platform_device *pdev)if (irq <0 )return irq; - mmc =mmc_alloc_host (sizeof (*host), &pdev->dev); + mmc =devm_mmc_alloc_host (&pdev->dev,sizeof (*host));if (!mmc)return -ENOMEM ; host =mmc_priv (mmc); host->base =devm_platform_get_and_ioremap_resource (pdev,0 , &res); -if (IS_ERR (host->base)) { - ret =PTR_ERR (host->base); - goto out_free; - } +if (IS_ERR (host->base)) +return PTR_ERR (host->base); host->phys_base = res->start; ret =mmc_of_parse (mmc);if (ret) - goto out_free; +return ret; mmc->ops = &mxcmci_ops;/* For devicetree parsing, the bus width is read from devicetree */
@@ -1054,7 +1052,7 @@ static int mxcmci_probe(struct platform_device *pdev) ret =mmc_regulator_get_supply (mmc);if (ret) - goto out_free; +return ret;if (!mmc->ocr_avail) {if (pdata && pdata->ocr_avail)
@@ -1070,20 +1068,16 @@ static int mxcmci_probe(struct platform_device *pdev) host->default_irq_mask =0 ; host->clk_ipg =devm_clk_get (&pdev->dev,"ipg" ); -if (IS_ERR (host->clk_ipg)) { - ret =PTR_ERR (host->clk_ipg); - goto out_free; - } +if (IS_ERR (host->clk_ipg)) +return PTR_ERR (host->clk_ipg); host->clk_per =devm_clk_get (&pdev->dev,"per" ); -if (IS_ERR (host->clk_per)) { - ret =PTR_ERR (host->clk_per); - goto out_free; - } +if (IS_ERR (host->clk_per)) +return PTR_ERR (host->clk_per); ret =clk_prepare_enable (host->clk_per);if (ret) - goto out_free; +return ret; ret =clk_prepare_enable (host->clk_ipg);if (ret)
@@ -1169,9 +1163,6 @@ static int mxcmci_probe(struct platform_device *pdev) out_clk_per_put:clk_disable_unprepare (host->clk_per); -out_free: -mmc_free_host (mmc); -return ret; }
@@ -1190,8 +1181,6 @@ static void mxcmci_remove(struct platform_device *pdev)clk_disable_unprepare (host->clk_per);clk_disable_unprepare (host->clk_ipg); - -mmc_free_host (mmc); }static int mxcmci_suspend (struct device *dev)
Signature · 1 line
2.47.1
PATCH v2 16/36 mmc: mxs-mmc: Use devm_mmc_alloc_host() helper
In reply to Binbin ZhouUse new function devm_mmc_alloc_host() to simplify the code.
--- drivers/mmc/host/mxs-mmc.c | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-)
drivers/mmc/host/mxs-mmc.c +11 -20
@@ -569,7 +569,7 @@ static int mxs_mmc_probe(struct platform_device *pdev)if (irq_err <0 )return irq_err; - mmc =mmc_alloc_host (sizeof (struct mxs_mmc_host ), &pdev->dev); + mmc =devm_mmc_alloc_host (&pdev->dev,sizeof (*host));if (!mmc)return -ENOMEM ;
@@ -577,10 +577,8 @@ static int mxs_mmc_probe(struct platform_device *pdev) ssp = &host->ssp; ssp->dev = &pdev->dev; ssp->base =devm_platform_ioremap_resource (pdev,0 ); -if (IS_ERR (ssp->base)) { - ret =PTR_ERR (ssp->base); - goto out_mmc_free; - } +if (IS_ERR (ssp->base)) +return PTR_ERR (ssp->base); ssp->devid = (enum mxs_ssp_id )of_device_get_match_data (&pdev->dev);
@@ -590,26 +588,23 @@ static int mxs_mmc_probe(struct platform_device *pdev) reg_vmmc =devm_regulator_get (&pdev->dev,"vmmc" );if (!IS_ERR (reg_vmmc)) { ret =regulator_enable (reg_vmmc); -if (ret) { -dev_err (&pdev->dev, -"Failed to enable vmmc regulator: %d\n" , ret); - goto out_mmc_free; - } +if (ret) +return dev_err_probe (&pdev->dev, ret, +"Failed to enable vmmc regulator\n" ); ret =devm_add_action_or_reset (&pdev->dev, mxs_mmc_regulator_disable, reg_vmmc);if (ret) - goto out_mmc_free; +return ret; } ssp->clk =devm_clk_get (&pdev->dev,NULL ); -if (IS_ERR (ssp->clk)) { - ret =PTR_ERR (ssp->clk); - goto out_mmc_free; - } +if (IS_ERR (ssp->clk)) +return PTR_ERR (ssp->clk); + ret =clk_prepare_enable (ssp->clk);if (ret) - goto out_mmc_free; +return ret; ret =mxs_mmc_reset (host);if (ret) {
@@ -668,8 +663,6 @@ static int mxs_mmc_probe(struct platform_device *pdev)dma_release_channel (ssp->dmach); out_clk_disable:clk_disable_unprepare (ssp->clk); -out_mmc_free: -mmc_free_host (mmc);return ret; }
@@ -685,8 +678,6 @@ static void mxs_mmc_remove(struct platform_device *pdev)dma_release_channel (ssp->dmach);clk_disable_unprepare (ssp->clk); - -mmc_free_host (mmc); }#ifdef CONFIG_PM_SLEEP
Signature · 1 line
2.47.1
PATCH v2 17/36 mmc: omap: Use devm_mmc_alloc_host() helper
In reply to Binbin ZhouUse new function devm_mmc_alloc_host() to simplify the code.
--- drivers/mmc/host/omap.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-)
drivers/mmc/host/omap.c +9 -16
@@ -1258,7 +1258,7 @@ static int mmc_omap_new_slot(struct mmc_omap_host *host, int id)struct mmc_host *mmc;int r; - mmc =mmc_alloc_host (sizeof (struct mmc_omap_slot ), host->dev); + mmc =devm_mmc_alloc_host (host->dev,sizeof (*slot));if (mmc ==NULL )return -ENOMEM ;
@@ -1272,25 +1272,21 @@ static int mmc_omap_new_slot(struct mmc_omap_host *host, int id)/* Check for some optional GPIO controls */ slot->vsd =devm_gpiod_get_index_optional (host->dev,"vsd" , id,GPIOD_OUT_LOW ); -if (IS_ERR (slot->vsd)) { - r =dev_err_probe (host->dev,PTR_ERR (slot->vsd), +if (IS_ERR (slot->vsd)) +return dev_err_probe (host->dev,PTR_ERR (slot->vsd),"error looking up VSD GPIO\n" ); - goto err_free_host; - } + slot->vio =devm_gpiod_get_index_optional (host->dev,"vio" , id,GPIOD_OUT_LOW ); -if (IS_ERR (slot->vio)) { - r =dev_err_probe (host->dev,PTR_ERR (slot->vio), +if (IS_ERR (slot->vio)) +return dev_err_probe (host->dev,PTR_ERR (slot->vio),"error looking up VIO GPIO\n" ); - goto err_free_host; - } + slot->cover =devm_gpiod_get_index_optional (host->dev,"cover" , id,GPIOD_IN ); -if (IS_ERR (slot->cover)) { - r =dev_err_probe (host->dev,PTR_ERR (slot->cover), +if (IS_ERR (slot->cover)) +return dev_err_probe (host->dev,PTR_ERR (slot->cover),"error looking up cover switch GPIO\n" ); - goto err_free_host; - } host->slots[id] = slot;
@@ -1350,8 +1346,6 @@ static int mmc_omap_new_slot(struct mmc_omap_host *host, int id)device_remove_file (&mmc->class_dev, &dev_attr_slot_name); err_remove_host:mmc_remove_host (mmc); -err_free_host: -mmc_free_host (mmc);return r; }
@@ -1369,7 +1363,6 @@ static void mmc_omap_remove_slot(struct mmc_omap_slot *slot)flush_workqueue (slot->host->mmc_omap_wq);mmc_remove_host (mmc); -mmc_free_host (mmc); }static int mmc_omap_probe (struct platform_device *pdev)
Signature · 1 line
2.47.1
PATCH v2 18/36 mmc: omap_hsmmc: Use devm_mmc_alloc_host() helper
In reply to Binbin ZhouUse new function devm_mmc_alloc_host() to simplify the code.
--- drivers/mmc/host/omap_hsmmc.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-)
drivers/mmc/host/omap_hsmmc.c +5 -13
@@ -1798,15 +1798,13 @@ static int omap_hsmmc_probe(struct platform_device *pdev)if (IS_ERR (base))return PTR_ERR (base); - mmc =mmc_alloc_host (sizeof (struct omap_hsmmc_host ), &pdev->dev); -if (!mmc) { - ret = -ENOMEM ; - goto err; - } + mmc =devm_mmc_alloc_host (&pdev->dev,sizeof (*host)); +if (!mmc) +return -ENOMEM ; ret =mmc_of_parse (mmc);if (ret) - goto err1; +return ret; host =mmc_priv (mmc); host->mmc = mmc;
@@ -1840,9 +1838,8 @@ static int omap_hsmmc_probe(struct platform_device *pdev) host->fclk =devm_clk_get (&pdev->dev,"fck" );if (IS_ERR (host->fclk)) { - ret =PTR_ERR (host->fclk); host->fclk =NULL ; - goto err1; +return PTR_ERR (host->fclk); }if (host->pdata->controller_flags &OMAP_HSMMC_BROKEN_MULTIBLOCK_READ ) {
@@ -1973,9 +1970,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev)pm_runtime_put_sync (host->dev);pm_runtime_disable (host->dev);clk_disable_unprepare (host->dbclk); -err1: -mmc_free_host (mmc); -err:return ret; }
@@ -1995,8 +1989,6 @@ static void omap_hsmmc_remove(struct platform_device *pdev)pm_runtime_disable (host->dev);device_init_wakeup (&pdev->dev, false);clk_disable_unprepare (host->dbclk); - -mmc_free_host (host->mmc); }#ifdef CONFIG_PM_SLEEP
Signature · 1 line
2.47.1
PATCH v2 19/36 mmc: owl-mmc: Use devm_mmc_alloc_host() helper
In reply to Binbin ZhouUse new function devm_mmc_alloc_host() to simplify the code.
--- drivers/mmc/host/owl-mmc.c | 37 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 24 deletions(-)
drivers/mmc/host/owl-mmc.c +13 -24
@@ -567,7 +567,7 @@ static int owl_mmc_probe(struct platform_device *pdev)struct resource *res;int ret; - mmc =mmc_alloc_host (sizeof (struct owl_mmc_host ), &pdev->dev); + mmc =devm_mmc_alloc_host (&pdev->dev,sizeof (*owl_host));if (!mmc) {dev_err (&pdev->dev,"mmc alloc host failed\n" );return -ENOMEM ;
@@ -580,24 +580,18 @@ static int owl_mmc_probe(struct platform_device *pdev)spin_lock_init (&owl_host->lock); owl_host->base =devm_platform_get_and_ioremap_resource (pdev,0 , &res); -if (IS_ERR (owl_host->base)) { - ret =PTR_ERR (owl_host->base); - goto err_free_host; - } +if (IS_ERR (owl_host->base)) +return PTR_ERR (owl_host->base); owl_host->clk =devm_clk_get (&pdev->dev,NULL ); -if (IS_ERR (owl_host->clk)) { -dev_err (&pdev->dev,"No clock defined\n" ); - ret =PTR_ERR (owl_host->clk); - goto err_free_host; - } +if (IS_ERR (owl_host->clk)) +return dev_err_probe (&pdev->dev,PTR_ERR (owl_host->clk), +"No clock defined\n" ); owl_host->reset =devm_reset_control_get_exclusive (&pdev->dev,NULL ); -if (IS_ERR (owl_host->reset)) { -dev_err (&pdev->dev,"Could not get reset control\n" ); - ret =PTR_ERR (owl_host->reset); - goto err_free_host; - } +if (IS_ERR (owl_host->reset)) +return dev_err_probe (&pdev->dev,PTR_ERR (owl_host->reset), +"Could not get reset control\n" ); mmc->ops = &owl_mmc_ops; mmc->max_blk_count =512 ;
@@ -616,16 +610,14 @@ static int owl_mmc_probe(struct platform_device *pdev) ret =mmc_of_parse (mmc);if (ret) - goto err_free_host; +return ret; pdev->dev.coherent_dma_mask =DMA_BIT_MASK (32 ); pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; owl_host->dma =dma_request_chan (&pdev->dev,"mmc" ); -if (IS_ERR (owl_host->dma)) { -dev_err (owl_host->dev,"Failed to get external DMA channel.\n" ); - ret =PTR_ERR (owl_host->dma); - goto err_free_host; - } +if (IS_ERR (owl_host->dma)) +return dev_err_probe (&pdev->dev,PTR_ERR (owl_host->dma), +"Failed to get external DMA channel.\n" );dev_info (&pdev->dev,"Using %s for DMA transfers\n" ,dma_chan_name (owl_host->dma));
@@ -662,8 +654,6 @@ static int owl_mmc_probe(struct platform_device *pdev) err_release_channel:dma_release_channel (owl_host->dma); -err_free_host: -mmc_free_host (mmc);return ret; }
@@ -676,7 +666,6 @@ static void owl_mmc_remove(struct platform_device *pdev)mmc_remove_host (mmc);disable_irq (owl_host->irq);dma_release_channel (owl_host->dma); -mmc_free_host (mmc); }static const struct of_device_id owl_mmc_of_match[] = {
Signature · 1 line
2.47.1
PATCH v2 20/36 mmc: pxamci: Use devm_mmc_alloc_host() helper
In reply to Binbin ZhouUse new function devm_mmc_alloc_host() to simplify the code.
--- drivers/mmc/host/pxamci.c | 42 ++++++++++++++------------------------- 1 file changed, 15 insertions(+), 27 deletions(-)
drivers/mmc/host/pxamci.c +15 -27
@@ -615,11 +615,9 @@ static int pxamci_probe(struct platform_device *pdev)if (irq <0 )return irq; - mmc =mmc_alloc_host (sizeof (struct pxamci_host ), dev); -if (!mmc) { - ret = -ENOMEM ; - goto out; - } + mmc =devm_mmc_alloc_host (dev,sizeof (*host)); +if (!mmc) +return -ENOMEM ; mmc->ops = &pxamci_ops;
@@ -646,7 +644,7 @@ static int pxamci_probe(struct platform_device *pdev) ret =pxamci_of_init (pdev, mmc);if (ret) - goto out; +return ret; host =mmc_priv (mmc); host->mmc = mmc;
@@ -655,9 +653,8 @@ static int pxamci_probe(struct platform_device *pdev) host->clk =devm_clk_get (dev,NULL );if (IS_ERR (host->clk)) { - ret =PTR_ERR (host->clk); host->clk =NULL ; - goto out; +return PTR_ERR (host->clk); } host->clkrate =clk_get_rate (host->clk);
@@ -670,7 +667,7 @@ static int pxamci_probe(struct platform_device *pdev) ret =pxamci_init_ocr (host);if (ret <0 ) - goto out; +return ret; mmc->caps =0 ; host->cmdat =0 ;
@@ -686,10 +683,8 @@ static int pxamci_probe(struct platform_device *pdev) host->imask =MMC_I_MASK_ALL ; host->base =devm_platform_get_and_ioremap_resource (pdev,0 , &r); -if (IS_ERR (host->base)) { - ret =PTR_ERR (host->base); - goto out; - } +if (IS_ERR (host->base)) +return PTR_ERR (host->base); host->res = r;/*
@@ -704,16 +699,15 @@ static int pxamci_probe(struct platform_device *pdev) ret =devm_request_irq (dev, irq, pxamci_irq,0 ,DRIVER_NAME , host);if (ret) - goto out; +return ret;platform_set_drvdata (pdev, mmc); host->dma_chan_rx =dma_request_chan (dev,"rx" );if (IS_ERR (host->dma_chan_rx)) { -dev_err (dev,"unable to request rx dma channel\n" ); - ret =PTR_ERR (host->dma_chan_rx); host->dma_chan_rx =NULL ; - goto out; +return dev_err_probe (dev,PTR_ERR (host->dma_chan_rx), +"unable to request rx dma channel\n" ); } host->dma_chan_tx =dma_request_chan (dev,"tx" );
@@ -771,14 +765,10 @@ static int pxamci_probe(struct platform_device *pdev)return 0 ; out: -if (host) { -if (host->dma_chan_rx) -dma_release_channel (host->dma_chan_rx); -if (host->dma_chan_tx) -dma_release_channel (host->dma_chan_tx); - } -if (mmc) -mmc_free_host (mmc); +if (host->dma_chan_rx) +dma_release_channel (host->dma_chan_rx); +if (host->dma_chan_tx) +dma_release_channel (host->dma_chan_tx);return ret; }
@@ -803,8 +793,6 @@ static void pxamci_remove(struct platform_device *pdev)dmaengine_terminate_all (host->dma_chan_tx);dma_release_channel (host->dma_chan_rx);dma_release_channel (host->dma_chan_tx); - -mmc_free_host (mmc); } }
Signature · 1 line
2.47.1
PATCH v2 21/36 mmc: rtsx_pci: Use devm_mmc_alloc_host() helper
In reply to Binbin ZhouUse new function devm_mmc_alloc_host() to simplify the code.
--- drivers/mmc/host/rtsx_pci_sdmmc.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/mmc/host/rtsx_pci_sdmmc.c +1 -4
@@ -1498,7 +1498,7 @@ static int rtsx_pci_sdmmc_drv_probe(struct platform_device *pdev)dev_dbg (&(pdev->dev),": Realtek PCI-E SDMMC controller found\n" ); - mmc =mmc_alloc_host (sizeof (*host), &pdev->dev); + mmc =devm_mmc_alloc_host (&pdev->dev,sizeof (*host));if (!mmc)return -ENOMEM ;
@@ -1529,7 +1529,6 @@ static int rtsx_pci_sdmmc_drv_probe(struct platform_device *pdev)if (ret) {pm_runtime_dont_use_autosuspend (&pdev->dev);pm_runtime_disable (&pdev->dev); -mmc_free_host (mmc);return ret; }
@@ -1572,8 +1571,6 @@ static void rtsx_pci_sdmmc_drv_remove(struct platform_device *pdev)pm_runtime_dont_use_autosuspend (&pdev->dev);pm_runtime_disable (&pdev->dev); -mmc_free_host (mmc); -dev_dbg (&(pdev->dev),": Realtek PCI-E SDMMC controller has been removed\n" ); }
Signature · 1 line
2.47.1
PATCH v2 22/36 mmc: rtsx_usb_sdmmc: Use devm_mmc_alloc_host() helper
In reply to Binbin ZhouUse new function devm_mmc_alloc_host() to simplify the code.
--- drivers/mmc/host/rtsx_usb_sdmmc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mmc/host/rtsx_usb_sdmmc.c +1 -3
@@ -1334,7 +1334,7 @@ static int rtsx_usb_sdmmc_drv_probe(struct platform_device *pdev)dev_dbg (&(pdev->dev),": Realtek USB SD/MMC controller found\n" ); - mmc =mmc_alloc_host (sizeof (*host), &pdev->dev); + mmc =devm_mmc_alloc_host (&pdev->dev,sizeof (*host));if (!mmc)return -ENOMEM ;
@@ -1368,7 +1368,6 @@ static int rtsx_usb_sdmmc_drv_probe(struct platform_device *pdev)#ifdef RTSX_USB_USE_LEDS_CLASS led_classdev_unregister (&host->led);#endif -mmc_free_host (mmc);pm_runtime_disable (&pdev->dev);return ret; }
@@ -1406,7 +1405,6 @@ static void rtsx_usb_sdmmc_drv_remove(struct platform_device *pdev)led_classdev_unregister (&host->led);#endif -mmc_free_host (mmc);pm_runtime_disable (&pdev->dev);platform_set_drvdata (pdev,NULL );
Signature · 1 line
2.47.1
PATCH v2 23/36 mmc: sdricoh_cs: Use devm_mmc_alloc_host() helper
In reply to Binbin ZhouUse new function devm_mmc_alloc_host() to simplify the code.
--- drivers/mmc/host/sdricoh_cs.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/mmc/host/sdricoh_cs.c +3 -7
@@ -403,9 +403,9 @@ static int sdricoh_init_mmc(struct pci_dev *pci_dev, }/* allocate privdata */ mmc = pcmcia_dev->priv = -mmc_alloc_host (sizeof (struct sdricoh_host ), &pcmcia_dev->dev); +devm_mmc_alloc_host (&pcmcia_dev->dev,sizeof (*host));if (!mmc) { -dev_err (dev,"mmc_alloc_host failed\n" ); +dev_err (dev,"devm_mmc_alloc_host failed\n" ); result = -ENOMEM ; goto unmap_io; }
@@ -431,7 +431,7 @@ static int sdricoh_init_mmc(struct pci_dev *pci_dev,if (sdricoh_reset (host)) {dev_dbg (dev,"could not reset\n" ); result = -EIO ; - goto free_host; + goto unmap_io; } result =mmc_add_host (mmc);
@@ -440,8 +440,6 @@ static int sdricoh_init_mmc(struct pci_dev *pci_dev,dev_dbg (dev,"mmc host registered\n" );return 0 ; } -free_host: -mmc_free_host (mmc); unmap_io:pci_iounmap (pci_dev, iobase);return result;
@@ -483,10 +481,8 @@ static void sdricoh_pcmcia_detach(struct pcmcia_device *link)mmc_remove_host (mmc);pci_iounmap (host->pci_dev, host->iobase);pci_dev_put (host->pci_dev); -mmc_free_host (mmc); }pcmcia_disable_device (link); - }#ifdef CONFIG_PM
Signature · 1 line
2.47.1
PATCH v2 24/36 mmc: sh_mmicf: Use devm_mmc_alloc_host() helper
In reply to Binbin ZhouUse new function devm_mmc_alloc_host() to simplify the code.
--- drivers/mmc/host/sh_mmcif.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)
drivers/mmc/host/sh_mmcif.c +6 -11
@@ -1444,13 +1444,13 @@ static int sh_mmcif_probe(struct platform_device *pdev)if (IS_ERR (reg))return PTR_ERR (reg); - mmc =mmc_alloc_host (sizeof (struct sh_mmcif_host ), dev); + mmc =devm_mmc_alloc_host (dev,sizeof (*host));if (!mmc)return -ENOMEM ; ret =mmc_of_parse (mmc);if (ret <0 ) - goto err_host; +return ret; host =mmc_priv (mmc); host->mmc = mmc;
@@ -1481,15 +1481,13 @@ static int sh_mmcif_probe(struct platform_device *pdev)platform_set_drvdata (pdev, host); host->clk =devm_clk_get (dev,NULL ); -if (IS_ERR (host->clk)) { - ret =PTR_ERR (host->clk); -dev_err (dev,"cannot get clock: %d\n" , ret); - goto err_host; - } +if (IS_ERR (host->clk)) +return dev_err_probe (dev,PTR_ERR (host->clk), +"cannot get clock\n" ); ret =clk_prepare_enable (host->clk);if (ret <0 ) - goto err_host; +return ret;sh_mmcif_clk_setup (host);
@@ -1542,8 +1540,6 @@ static int sh_mmcif_probe(struct platform_device *pdev)clk_disable_unprepare (host->clk);pm_runtime_put_sync (dev);pm_runtime_disable (dev); -err_host: -mmc_free_host (mmc);return ret; }
@@ -1568,7 +1564,6 @@ static void sh_mmcif_remove(struct platform_device *pdev)cancel_delayed_work_sync (&host->timeout_work);clk_disable_unprepare (host->clk); -mmc_free_host (host->mmc);pm_runtime_put_sync (&pdev->dev);pm_runtime_disable (&pdev->dev); }
Signature · 1 line
2.47.1
PATCH v2 25/36 mmc: tifm_sd: Use devm_mmc_alloc_host() helper
In reply to Binbin ZhouUse new function devm_mmc_alloc_host() to simplify the code.
--- drivers/mmc/host/tifm_sd.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/mmc/host/tifm_sd.c +1 -6
@@ -947,7 +947,7 @@ static int tifm_sd_probe(struct tifm_dev *sock)return rc; } - mmc =mmc_alloc_host (sizeof (struct tifm_sd ), &sock->dev); + mmc =devm_mmc_alloc_host (&sock->dev,sizeof (*host));if (!mmc)return -ENOMEM ;
@@ -982,10 +982,7 @@ static int tifm_sd_probe(struct tifm_dev *sock)if (!rc) rc =mmc_add_host (mmc); -if (!rc) -return 0 ; -mmc_free_host (mmc);return rc; }
@@ -1015,8 +1012,6 @@ static void tifm_sd_remove(struct tifm_dev *sock)spin_unlock_irqrestore (&sock->lock, flags);mmc_remove_host (mmc);dev_dbg (&sock->dev,"after remove\n" ); - -mmc_free_host (mmc); }#ifdef CONFIG_PM
Signature · 1 line
2.47.1
PATCH v2 26/36 mmc: toshsd: Use devm_mmc_alloc_host() helper
In reply to Binbin ZhouUse new function devm_mmc_alloc_host() to simplify the code.
--- drivers/mmc/host/toshsd.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mmc/host/toshsd.c +1 -3
@@ -612,7 +612,7 @@ static int toshsd_probe(struct pci_dev *pdev, const struct pci_device_id *ent)if (ret)return ret; - mmc =mmc_alloc_host (sizeof (struct toshsd_host ), &pdev->dev); + mmc =devm_mmc_alloc_host (&pdev->dev,sizeof (*host));if (!mmc) { ret = -ENOMEM ; goto err;
@@ -669,7 +669,6 @@ static int toshsd_probe(struct pci_dev *pdev, const struct pci_device_id *ent) release:pci_release_regions (pdev); free: -mmc_free_host (mmc);pci_set_drvdata (pdev,NULL ); err:pci_disable_device (pdev);
@@ -685,7 +684,6 @@ static void toshsd_remove(struct pci_dev *pdev)free_irq (pdev->irq, host);pci_iounmap (pdev, host->ioaddr);pci_release_regions (pdev); -mmc_free_host (host->mmc);pci_set_drvdata (pdev,NULL );pci_disable_device (pdev); }
Signature · 1 line
2.47.1
PATCH v2 27/36 mmc: usdhi6ro10: Use devm_mmc_alloc_host() helper
In reply to Binbin ZhouUse new function devm_mmc_alloc_host() to simplify the code.
--- drivers/mmc/host/usdhi6rol0.c | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-)
drivers/mmc/host/usdhi6rol0.c +10 -20
@@ -1762,17 +1762,17 @@ static int usdhi6_probe(struct platform_device *pdev)if (irq_sdio <0 )return irq_sdio; - mmc =mmc_alloc_host (sizeof (struct usdhi6_host ), dev); + mmc =devm_mmc_alloc_host (dev,sizeof (*host));if (!mmc)return -ENOMEM ; ret =mmc_regulator_get_supply (mmc);if (ret) - goto e_free_mmc; +return ret; ret =mmc_of_parse (mmc);if (ret <0 ) - goto e_free_mmc; +return ret; host =mmc_priv (mmc); host->mmc = mmc;
@@ -1785,30 +1785,24 @@ static int usdhi6_probe(struct platform_device *pdev) mmc->max_busy_timeout =USDHI6_REQ_TIMEOUT_MS ; host->pinctrl =devm_pinctrl_get (&pdev->dev); -if (IS_ERR (host->pinctrl)) { - ret =PTR_ERR (host->pinctrl); - goto e_free_mmc; - } +if (IS_ERR (host->pinctrl)) +return PTR_ERR (host->pinctrl); host->pins_uhs =pinctrl_lookup_state (host->pinctrl,"state_uhs" ); host->base =devm_platform_get_and_ioremap_resource (pdev,0 , &res); -if (IS_ERR (host->base)) { - ret =PTR_ERR (host->base); - goto e_free_mmc; - } +if (IS_ERR (host->base)) +return PTR_ERR (host->base); host->clk =devm_clk_get (dev,NULL ); -if (IS_ERR (host->clk)) { - ret =PTR_ERR (host->clk); - goto e_free_mmc; - } +if (IS_ERR (host->clk)) +return PTR_ERR (host->clk); host->imclk =clk_get_rate (host->clk); ret =clk_prepare_enable (host->clk);if (ret <0 ) - goto e_free_mmc; +return ret; version =usdhi6_read (host,USDHI6_VERSION );if ((version &0xfff ) !=0xa0d ) {
@@ -1878,9 +1872,6 @@ static int usdhi6_probe(struct platform_device *pdev)usdhi6_dma_release (host); e_clk_off:clk_disable_unprepare (host->clk); -e_free_mmc: -mmc_free_host (mmc); -return ret; }
@@ -1894,7 +1885,6 @@ static void usdhi6_remove(struct platform_device *pdev)cancel_delayed_work_sync (&host->timeout_work);usdhi6_dma_release (host);clk_disable_unprepare (host->clk); -mmc_free_host (host->mmc); }static struct platform_driver usdhi6_driver = {
Signature · 1 line
2.47.1
PATCH v2 28/36 mmc: ushc: Use devm_mmc_alloc_host() helper
In reply to Binbin ZhouUse new function devm_mmc_alloc_host() to simplify the code.
--- drivers/mmc/host/ushc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mmc/host/ushc.c +1 -3
@@ -404,8 +404,6 @@ static void ushc_clean_up(struct ushc_data *ushc)kfree (ushc->int_data);kfree (ushc->cbw);kfree (ushc->csw); - -mmc_free_host (ushc->mmc); }static const struct mmc_host_ops ushc_ops = {
@@ -425,7 +423,7 @@ static int ushc_probe(struct usb_interface *intf, const struct usb_device_id *idif (intf->cur_altsetting->desc.bNumEndpoints <1 )return -ENODEV ; - mmc =mmc_alloc_host (sizeof (struct ushc_data ), &intf->dev); + mmc =devm_mmc_alloc_host (&intf->dev,sizeof (*ushc));if (mmc ==NULL )return -ENOMEM ; ushc =mmc_priv (mmc);
Signature · 1 line
2.47.1
PATCH v2 29/36 mmc: via-sdmmc: Use devm_mmc_alloc_host() helper
In reply to Binbin ZhouUse new function devm_mmc_alloc_host() to simplify the code.
--- drivers/mmc/host/via-sdmmc.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/mmc/host/via-sdmmc.c +2 -5
@@ -1100,7 +1100,7 @@ static int via_sd_probe(struct pci_dev *pcidev,pci_write_config_byte (pcidev,VIA_CRDR_PCI_WORK_MODE ,0 );pci_write_config_byte (pcidev,VIA_CRDR_PCI_DBG_MODE ,0 ); - mmc =mmc_alloc_host (sizeof (struct via_crdr_mmc_host ), &pcidev->dev); + mmc =devm_mmc_alloc_host (&pcidev->dev,sizeof (*sdhost));if (!mmc) { ret = -ENOMEM ; goto release;
@@ -1115,7 +1115,7 @@ static int via_sd_probe(struct pci_dev *pcidev, sdhost->mmiobase =ioremap (base, len);if (!sdhost->mmiobase) { ret = -ENOMEM ; - goto free_mmc_host; + goto release; } sdhost->sdhc_mmiobase =
@@ -1160,8 +1160,6 @@ static int via_sd_probe(struct pci_dev *pcidev, unmap:iounmap (sdhost->mmiobase); -free_mmc_host: -mmc_free_host (mmc); release:pci_release_regions (pcidev); disable:
@@ -1212,7 +1210,6 @@ static void via_sd_remove(struct pci_dev *pcidev)writeb (gatt, sdhost->pcictrl_mmiobase +VIA_CRDR_PCICLKGATT );iounmap (sdhost->mmiobase); -mmc_free_host (sdhost->mmc);pci_release_regions (pcidev);pci_disable_device (pcidev);
Signature · 1 line
2.47.1
PATCH v2 30/36 mmc: vub300: Use devm_mmc_alloc_host() helper
In reply to Binbin ZhouUse new function devm_mmc_alloc_host() to simplify the code.
--- drivers/mmc/host/vub300.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-)
drivers/mmc/host/vub300.c +6 -10
@@ -369,13 +369,11 @@ struct vub300_mmc_host {static void vub300_delete (struct kref *kref) {/* kref callback - softirq */ struct vub300_mmc_host *vub300 =kref_to_vub300_mmc_host (kref); -struct mmc_host *mmc = vub300->mmc;usb_free_urb (vub300->command_out_urb); vub300->command_out_urb =NULL ;usb_free_urb (vub300->command_res_urb); vub300->command_res_urb =NULL ;usb_put_dev (vub300->udev); -mmc_free_host (mmc);/* * and hence also frees vub300 * which is contained at the end of struct mmc
@@ -2114,7 +2112,7 @@ static int vub300_probe(struct usb_interface *interface, goto error1; }/* this also allocates memory for our VUB300 mmc host device */ - mmc =mmc_alloc_host (sizeof (struct vub300_mmc_host ), &udev->dev); + mmc =devm_mmc_alloc_host (&udev->dev,sizeof (*vub300));if (!mmc) { retval = -ENOMEM ;dev_err (&udev->dev,"not enough memory for the mmc_host\n" );
@@ -2271,7 +2269,7 @@ static int vub300_probe(struct usb_interface *interface,dev_err (&vub300->udev->dev,"Could not find two sets of bulk-in/out endpoint pairs\n" ); retval = -EINVAL ; - goto error5; + goto error4; } retval = usb_control_msg(vub300->udev, usb_rcvctrlpipe(vub300->udev, 0),
@@ -2280,14 +2278,14 @@ static int vub300_probe(struct usb_interface *interface,0x0000 ,0x0000 , &vub300->hc_info, sizeof(vub300->hc_info), 1000);if (retval <0 ) - goto error5; + goto error4; retval =usb_control_msg (vub300->udev,usb_sndctrlpipe (vub300->udev,0 ),SET_ROM_WAIT_STATES ,USB_DIR_OUT |USB_TYPE_VENDOR |USB_RECIP_DEVICE , firmware_rom_wait_states,0x0000 ,NULL ,0 ,1000 );if (retval <0 ) - goto error5; + goto error4; dev_info(&vub300->udev->dev, "operating_mode = %s %s %d MHz %s %d byte USB packets\n", (mmc->caps & MMC_CAP_SDIO_IRQ) ? "IRQs" : "POLL",
@@ -2302,7 +2300,7 @@ static int vub300_probe(struct usb_interface *interface,0x0000 ,0x0000 , &vub300->system_port_status, sizeof(vub300->system_port_status), 1000);if (retval <0 ) { - goto error5; + goto error4; }else if (sizeof (vub300->system_port_status) == retval) { vub300->card_present = (0x0001 & vub300->system_port_status.port_flags) ?1 :0 ;
@@ -2310,7 +2308,7 @@ static int vub300_probe(struct usb_interface *interface, (0x0010 & vub300->system_port_status.port_flags) ?1 :0 ; }else { retval = -EINVAL ; - goto error5; + goto error4; }usb_set_intfdata (interface, vub300);INIT_DELAYED_WORK (&vub300->pollwork, vub300_pollwork_thread);
@@ -2340,8 +2338,6 @@ static int vub300_probe(struct usb_interface *interface,return 0 ; error6:timer_delete_sync (&vub300->inactivity_timer); -error5: -mmc_free_host (mmc);/* * and hence also frees vub300 * which is contained at the end of struct mmc
Signature · 1 line
2.47.1
PATCH v2 32/36 mmc: wmt-sdmmc: Use devm_mmc_alloc_host() helper
In reply to Binbin ZhouUse new function devm_mmc_alloc_host() to simplify the code.
--- drivers/mmc/host/wmt-sdmmc.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/mmc/host/wmt-sdmmc.c +2 -6
@@ -774,7 +774,7 @@ static int wmt_mci_probe(struct platform_device *pdev) goto fail1; } - mmc =mmc_alloc_host (sizeof (struct wmt_mci_priv ), &pdev->dev); + mmc =devm_mmc_alloc_host (&pdev->dev,sizeof (*priv));if (!mmc) {dev_err (&pdev->dev,"Failed to allocate mmc_host\n" ); ret = -ENOMEM ;
@@ -808,7 +808,7 @@ static int wmt_mci_probe(struct platform_device *pdev)if (!priv->sdmmc_base) {dev_err (&pdev->dev,"Failed to map IO space\n" ); ret = -ENOMEM ; - goto fail2; + goto fail1; } priv->irq_regular = regular_irq;
@@ -873,8 +873,6 @@ static int wmt_mci_probe(struct platform_device *pdev)free_irq (regular_irq, priv); fail3:iounmap (priv->sdmmc_base); -fail2: -mmc_free_host (mmc); fail1:return ret; }
@@ -910,8 +908,6 @@ static void wmt_mci_remove(struct platform_device *pdev)clk_disable_unprepare (priv->clk_sdmmc);clk_put (priv->clk_sdmmc); -mmc_free_host (mmc); -dev_info (&pdev->dev,"WMT MCI device removed\n" ); }
Signature · 1 line
2.47.1
PATCH v2 31/36 mmc: wbsd: Use devm_mmc_alloc_host() helper
In reply to Binbin ZhouUse new function devm_mmc_alloc_host() to simplify the code.
--- drivers/mmc/host/wbsd.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mmc/host/wbsd.c +1 -3
@@ -1190,7 +1190,7 @@ static int wbsd_alloc_mmc(struct device *dev)/* * Allocate MMC structure. */ - mmc =mmc_alloc_host (sizeof (struct wbsd_host ), dev); + mmc =devm_mmc_alloc_host (dev,sizeof (*host));if (!mmc)return -ENOMEM ;
@@ -1262,8 +1262,6 @@ static void wbsd_free_mmc(struct device *dev)BUG_ON (host ==NULL );timer_delete_sync (&host->ignore_timer); - -mmc_free_host (mmc); }/*
Signature · 1 line
2.47.1
PATCH v2 33/36 mmc: tmio: Use devm_mmc_alloc_host() helper
In reply to Binbin ZhouUse new function devm_mmc_alloc_host() to simplify the code.
--- drivers/mmc/host/renesas_sdhi_core.c | 6 +----- drivers/mmc/host/tmio_mmc.h | 1 - drivers/mmc/host/tmio_mmc_core.c | 18 +++--------------- drivers/mmc/host/uniphier-sd.c | 8 ++------ 4 files changed, 6 insertions(+), 27 deletions(-)
drivers/mmc/host/renesas_sdhi_core.c +1 -5
@@ -1164,7 +1164,7 @@ int renesas_sdhi_probe(struct platform_device *pdev, ret =renesas_sdhi_clk_enable (host);if (ret) - goto efree; +return ret; rcfg.of_node =of_get_available_child_by_name (dev->of_node,"vqmmc-regulator" );if (rcfg.of_node) {
@@ -1266,9 +1266,6 @@ int renesas_sdhi_probe(struct platform_device *pdev, edisclk:renesas_sdhi_clk_disable (host); -efree: -tmio_mmc_host_free (host); -return ret; }EXPORT_SYMBOL_GPL (renesas_sdhi_probe);
@@ -1279,7 +1276,6 @@ void renesas_sdhi_remove(struct platform_device *pdev)tmio_mmc_host_remove (host);renesas_sdhi_clk_disable (host); -tmio_mmc_host_free (host); }EXPORT_SYMBOL_GPL (renesas_sdhi_remove);
drivers/mmc/host/tmio_mmc.h +0 -1
@@ -199,7 +199,6 @@ struct tmio_mmc_host {struct tmio_mmc_host *tmio_mmc_host_alloc (struct platform_device *pdev,struct tmio_mmc_data *pdata); -void tmio_mmc_host_free (struct tmio_mmc_host *host);int tmio_mmc_host_probe (struct tmio_mmc_host *host);void tmio_mmc_host_remove (struct tmio_mmc_host *host);void tmio_mmc_do_data_irq (struct tmio_mmc_host *host);
drivers/mmc/host/tmio_mmc_core.c +3 -15
@@ -1097,7 +1097,7 @@ struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev,if (IS_ERR (ctl))return ERR_CAST (ctl); - mmc =mmc_alloc_host (sizeof (struct tmio_mmc_host ), &pdev->dev); + mmc =devm_mmc_alloc_host (&pdev->dev,sizeof (*host));if (!mmc)return ERR_PTR (-ENOMEM );
@@ -1110,29 +1110,17 @@ struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev, mmc->ops = &host->ops; ret =mmc_of_parse (host->mmc); -if (ret) { - host =ERR_PTR (ret); - goto free; - } +if (ret) +return ERR_PTR (ret);tmio_mmc_of_parse (pdev, mmc);platform_set_drvdata (pdev, host); -return host; -free: -mmc_free_host (mmc); -return host; }EXPORT_SYMBOL_GPL (tmio_mmc_host_alloc); -void tmio_mmc_host_free (struct tmio_mmc_host *host) -{ -mmc_free_host (host->mmc); -} -EXPORT_SYMBOL_GPL (tmio_mmc_host_free); -int tmio_mmc_host_probe (struct tmio_mmc_host *_host) {struct platform_device *pdev = _host->pdev;
drivers/mmc/host/uniphier-sd.c +2 -6
@@ -663,8 +663,7 @@ static int uniphier_sd_probe(struct platform_device *pdev) priv->rst_hw =devm_reset_control_get_exclusive (dev,"hw" );if (IS_ERR (priv->rst_hw)) {dev_err (dev,"failed to get hw reset\n" ); - ret =PTR_ERR (priv->rst_hw); - goto free_host; +return PTR_ERR (priv->rst_hw); } host->ops.card_hw_reset = uniphier_sd_hw_reset; }
@@ -694,7 +693,7 @@ static int uniphier_sd_probe(struct platform_device *pdev) ret =uniphier_sd_clk_enable (host);if (ret) - goto free_host; +return ret;uniphier_sd_host_init (host);
@@ -720,8 +719,6 @@ static int uniphier_sd_probe(struct platform_device *pdev) disable_clk:uniphier_sd_clk_disable (host); -free_host: -tmio_mmc_host_free (host);return ret; }
@@ -732,7 +729,6 @@ static void uniphier_sd_remove(struct platform_device *pdev)tmio_mmc_host_remove (host);uniphier_sd_clk_disable (host); -tmio_mmc_host_free (host); }static const struct of_device_id uniphier_sd_match[] = {
Signature · 1 line
2.47.1
PATCH v2 34/36 mmc: sunxi: Use devm_mmc_alloc_host() helper
In reply to Binbin ZhouUse new function devm_mmc_alloc_host() to simplify the code.
--- drivers/mmc/host/sunxi-mmc.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-)
drivers/mmc/host/sunxi-mmc.c +8 -14
@@ -1369,11 +1369,10 @@ static int sunxi_mmc_probe(struct platform_device *pdev)struct mmc_host *mmc;int ret; - mmc =mmc_alloc_host (sizeof (struct sunxi_mmc_host ), &pdev->dev); -if (!mmc) { -dev_err (&pdev->dev,"mmc alloc host failed\n" ); -return -ENOMEM ; - } + mmc =devm_mmc_alloc_host (&pdev->dev,sizeof (*host)); +if (!mmc) +return dev_err_probe (&pdev->dev, -ENOMEM , +"mmc alloc host failed\n" );platform_set_drvdata (pdev, mmc); host =mmc_priv (mmc);
@@ -1383,15 +1382,13 @@ static int sunxi_mmc_probe(struct platform_device *pdev) ret =sunxi_mmc_resource_request (host, pdev);if (ret) - goto error_free_host; +return ret; host->sg_cpu =dma_alloc_coherent (&pdev->dev,PAGE_SIZE , &host->sg_dma,GFP_KERNEL ); -if (!host->sg_cpu) { -dev_err (&pdev->dev,"Failed to allocate DMA descriptor mem\n" ); - ret = -ENOMEM ; - goto error_free_host; - } +if (!host->sg_cpu) +return dev_err_probe (&pdev->dev, -ENOMEM , +"Failed to allocate DMA descriptor mem\n" );if (host->cfg->ccu_has_timings_switch) {/*
@@ -1481,8 +1478,6 @@ static int sunxi_mmc_probe(struct platform_device *pdev) error_free_dma:dma_free_coherent (&pdev->dev,PAGE_SIZE , host->sg_cpu, host->sg_dma); -error_free_host: -mmc_free_host (mmc);return ret; }
@@ -1498,7 +1493,6 @@ static void sunxi_mmc_remove(struct platform_device *pdev)sunxi_mmc_disable (host); }dma_free_coherent (&pdev->dev,PAGE_SIZE , host->sg_cpu, host->sg_dma); -mmc_free_host (mmc); }#ifdef CONFIG_PM
Signature · 1 line
2.47.1
PATCH v2 35/36 mmc: mmc_spi: Use devm_mmc_alloc_host() helper
In reply to Binbin ZhouUse new function devm_mmc_alloc_host() to simplify the code.
--- drivers/mmc/host/mmc_spi.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mmc/host/mmc_spi.c +1 -3
@@ -1185,7 +1185,7 @@ static int mmc_spi_probe(struct spi_device *spi) goto nomem;memset (ones,0xff ,MMC_SPI_BLOCKSIZE ); - mmc =mmc_alloc_host (sizeof (*host), &spi->dev); + mmc =devm_mmc_alloc_host (&spi->dev,sizeof (*host));if (!mmc) goto nomem;
@@ -1305,7 +1305,6 @@ static int mmc_spi_probe(struct spi_device *spi)kfree (host->data); fail_nobuf1:mmc_spi_put_pdata (spi); -mmc_free_host (mmc); nomem:kfree (ones);return status;
@@ -1328,7 +1327,6 @@ static void mmc_spi_remove(struct spi_device *spi) spi->max_speed_hz = mmc->f_max;mmc_spi_put_pdata (spi); -mmc_free_host (mmc); }static const struct spi_device_id mmc_spi_dev_ids[] = {
Signature · 1 line
2.47.1
PATCH v2 36/36 mmc: meson-mx-sdio: Use devm_mmc_alloc_host() helper
In reply to Binbin ZhouUse new function devm_mmc_alloc_host() to simplify the code.
--- drivers/mmc/host/meson-mx-sdio.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)
drivers/mmc/host/meson-mx-sdio.c +8 -12
@@ -640,7 +640,7 @@ static int meson_mx_mmc_probe(struct platform_device *pdev)else if (IS_ERR (slot_pdev))return PTR_ERR (slot_pdev); - mmc =mmc_alloc_host (sizeof (*host), &slot_pdev->dev); + mmc =devm_mmc_alloc_host (&slot_pdev->dev,sizeof (*host));if (!mmc) { ret = -ENOMEM ; goto error_unregister_slot_pdev;
@@ -658,13 +658,13 @@ static int meson_mx_mmc_probe(struct platform_device *pdev) host->base =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (host->base)) { ret =PTR_ERR (host->base); - goto error_free_mmc; + goto error_unregister_slot_pdev; } irq =platform_get_irq (pdev,0 );if (irq <0 ) { ret = irq; - goto error_free_mmc; + goto error_unregister_slot_pdev; } ret = devm_request_threaded_irq(host->controller_dev, irq,
@@ -672,28 +672,28 @@ static int meson_mx_mmc_probe(struct platform_device *pdev) meson_mx_mmc_irq_thread,IRQF_ONESHOT , NULL, host);if (ret) - goto error_free_mmc; + goto error_unregister_slot_pdev; host->core_clk =devm_clk_get (host->controller_dev,"core" );if (IS_ERR (host->core_clk)) { ret =PTR_ERR (host->core_clk); - goto error_free_mmc; + goto error_unregister_slot_pdev; } host->parent_clk =devm_clk_get (host->controller_dev,"clkin" );if (IS_ERR (host->parent_clk)) { ret =PTR_ERR (host->parent_clk); - goto error_free_mmc; + goto error_unregister_slot_pdev; } ret =meson_mx_mmc_register_clks (host);if (ret) - goto error_free_mmc; + goto error_unregister_slot_pdev; ret =clk_prepare_enable (host->core_clk);if (ret) {dev_err (host->controller_dev,"Failed to enable core clock\n" ); - goto error_free_mmc; + goto error_unregister_slot_pdev; } ret =clk_prepare_enable (host->cfg_div_clk);
@@ -721,8 +721,6 @@ static int meson_mx_mmc_probe(struct platform_device *pdev)clk_disable_unprepare (host->cfg_div_clk); error_disable_core_clk:clk_disable_unprepare (host->core_clk); -error_free_mmc: -mmc_free_host (mmc); error_unregister_slot_pdev:of_platform_device_destroy (&slot_pdev->dev,NULL );return ret;
@@ -741,8 +739,6 @@ static void meson_mx_mmc_remove(struct platform_device *pdev)clk_disable_unprepare (host->cfg_div_clk);clk_disable_unprepare (host->core_clk); - -mmc_free_host (host->mmc); }static const struct of_device_id meson_mx_mmc_of_match[] = {
Signature · 1 line
2.47.1
Quoted 9 lines · Binbin Zhou
Hi all:
First of all, I'm very sorry for the compilation failure issue due to my cheap mistake in v1 patchset.
The patch series was tested by using lkp and cross compiling with different architectures (arm/mips/x86_64 etc architectures) and enabling COMPILE_TEST=y to ensure that each driver was compiled and tested.
No worries, it was my mistake too trying to rush this in for v6.16. I have dropped the series from my next branch for now.
Assuming that Linus doesn't create another rc for v6.15 on Monday, this will have to wait until after the merge window, thus for v6.17.
Kind regards
Uffe
Quoted 106 lines
Since the
devm_mmc_alloc_host()helper was already available, I tried to start cleaning up the use ofmmc_alloc_host().To make it easier to review the patchset, I decided to split it into two parts. As the first part, this patchset contains cleanup for drivers other than sdhci.
Of course, the sdhci part I have ready in my repository.
Thanks.
-----
V2:
- Collect Reviewed-by and Acked-by tags.
Patch-24
- Correct subject title:ish_mmicf->sh_mmicf.
Patch-34
- Fix cheap build error.Link to V1:
https://lore.kernel.org/all/[email protected]/Binbin Zhou (36):
mmc: alcor: Usedevm_mmc_alloc_host()helper
mmc: atmel: Usedevm_mmc_alloc_host()helper
mmc: au1xmmc: Usedevm_mmc_alloc_host()helper
mmc: bcm2835: Usedevm_mmc_alloc_host()helper
mmc: cavium: Usedevm_mmc_alloc_host()helper
mmc: cb710: Usedevm_mmc_alloc_host()helper
mmc:davinci_mmc: Usedevm_mmc_alloc_host()helper
mmc:dw_mmc: Usedevm_mmc_alloc_host()helper
mmc: jz4740: Usedevm_mmc_alloc_host()helper
mmc:litex_mmc: Usedevm_mmc_alloc_host()helper
mmc: meson-mx-sdhc: Usedevm_mmc_alloc_host()helper
mmc: mmci: Usedevm_mmc_alloc_host()helper
mmc: moxart-mmc: Usedevm_mmc_alloc_host()helper
mmc: mvsdio: Usedevm_mmc_alloc_host()helper
mmc: mxcmmc: Usedevm_mmc_alloc_host()helper
mmc: mxs-mmc: Usedevm_mmc_alloc_host()helper
mmc: omap: Usedevm_mmc_alloc_host()helper
mmc:omap_hsmmc: Usedevm_mmc_alloc_host()helper
mmc: owl-mmc: Usedevm_mmc_alloc_host()helper
mmc: pxamci: Usedevm_mmc_alloc_host()helper
mmc:rtsx_pci: Usedevm_mmc_alloc_host()helper
mmc:rtsx_usb_sdmmc: Usedevm_mmc_alloc_host()helper
mmc:sdricoh_cs: Usedevm_mmc_alloc_host()helper
mmc:sh_mmicf: Usedevm_mmc_alloc_host()helper
mmc:tifm_sd: Usedevm_mmc_alloc_host()helper
mmc: toshsd: Usedevm_mmc_alloc_host()helper
mmc: usdhi6ro10: Usedevm_mmc_alloc_host()helper
mmc: ushc: Usedevm_mmc_alloc_host()helper
mmc: via-sdmmc: Usedevm_mmc_alloc_host()helper
mmc: vub300: Usedevm_mmc_alloc_host()helper
mmc: wbsd: Usedevm_mmc_alloc_host()helper
mmc: wmt-sdmmc: Usedevm_mmc_alloc_host()helper
mmc: tmio: Usedevm_mmc_alloc_host()helper
mmc: sunxi: Usedevm_mmc_alloc_host()helper
mmc:mmc_spi: Usedevm_mmc_alloc_host()helper
mmc: meson-mx-sdio: Usedevm_mmc_alloc_host()helperdrivers/mmc/host/alcor.c | 20 ++++--------- drivers/mmc/host/atmel-mci.c | 7 ++--- drivers/mmc/host/au1xmmc.c | 14 +++------- drivers/mmc/host/bcm2835.c | 5 +--- drivers/mmc/host/cavium.c | 10 ++----- drivers/mmc/host/cb710-mmc.c | 5 +--- drivers/mmc/host/davinci_mmc.c | 22 +++++---------- drivers/mmc/host/dw_mmc.c | 15 ++++------ drivers/mmc/host/jz4740_mmc.c | 40 +++++++++----------------- drivers/mmc/host/litex_mmc.c | 12 +------- drivers/mmc/host/meson-mx-sdhc-mmc.c | 13 +-------- drivers/mmc/host/meson-mx-sdio.c | 20 ++++++------- drivers/mmc/host/mmc_spi.c | 4 +-- drivers/mmc/host/mmci.c | 31 ++++++++------------ drivers/mmc/host/moxart-mmc.c | 40 ++++++++++---------------- drivers/mmc/host/mvsdio.c | 24 +++++----------- drivers/mmc/host/mxcmmc.c | 31 +++++++------------- drivers/mmc/host/mxs-mmc.c | 31 ++++++++------------ drivers/mmc/host/omap.c | 25 ++++++----------- drivers/mmc/host/omap_hsmmc.c | 18 ++++-------- drivers/mmc/host/owl-mmc.c | 37 +++++++++--------------- drivers/mmc/host/pxamci.c | 42 ++++++++++------------------ drivers/mmc/host/renesas_sdhi_core.c | 6 +--- drivers/mmc/host/rtsx_pci_sdmmc.c | 5 +--- drivers/mmc/host/rtsx_usb_sdmmc.c | 4 +-- drivers/mmc/host/sdricoh_cs.c | 10 ++----- drivers/mmc/host/sh_mmcif.c | 17 ++++------- drivers/mmc/host/sunxi-mmc.c | 22 ++++++--------- drivers/mmc/host/tifm_sd.c | 7 +---- drivers/mmc/host/tmio_mmc.h | 1 - drivers/mmc/host/tmio_mmc_core.c | 18 ++---------- drivers/mmc/host/toshsd.c | 4 +-- drivers/mmc/host/uniphier-sd.c | 8 ++---- drivers/mmc/host/usdhi6rol0.c | 30 +++++++------------- drivers/mmc/host/ushc.c | 4 +-- drivers/mmc/host/via-sdmmc.c | 7 ++--- drivers/mmc/host/vub300.c | 16 ++++------- drivers/mmc/host/wbsd.c | 4 +-- drivers/mmc/host/wmt-sdmmc.c | 8 ++---- 39 files changed, 195 insertions(+), 442 deletions(-)base-commit:
61bd8e76021e779f7ba3c761919b533fb3f6f584--
2.47.1
Re: [PATCH v2 10/36] mmc: litex_mmc: Use devm_mmc_alloc_host() helper
In reply to Binbin ZhouQuoted 8 lines · Binbin Zhou
Use new function
devm_mmc_alloc_host()to simplify the code.Cc Karol Gugala <[email protected]>Cc Mateusz Holenko <[email protected]>Cc Gabriel Somlo <[email protected]>Cc Joel Stanley <[email protected]>Signed-off-by Binbin Zhou <[email protected]>Reviewed-by Huacai Chen <[email protected]>
Thanks,
--Gabriel
Quoted 40 lines
--- drivers/mmc/host/litex_mmc.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)drivers/mmc/host/litex_mmc.c +1
-11@@ -506,11 +506,6 @@ static int litex_mmc_irq_init(struct platform_device *pdev,return 0 ; } -static void litex_mmc_free_host_wrapper (void *mmc) -{ -mmc_free_host (mmc); -} -static int litex_mmc_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;@@ -525,15 +520,10 @@ static int litex_mmc_probe(struct platform_device *pdev)* If for some reason we need to modify max_blk_count, we must also * re-calculate `max_[req,seg]_size = max_blk_size * max_blk_count;` */ - mmc =mmc_alloc_host (sizeof (struct litex_mmc_host ), dev); + mmc =devm_mmc_alloc_host (dev,sizeof (*host));if (!mmc)return -ENOMEM ; - ret =devm_add_action_or_reset (dev, litex_mmc_free_host_wrapper, mmc); -if (ret) -return dev_err_probe (dev, ret, -"Can't register mmc_free_host action\n" ); - host =mmc_priv (mmc); host->mmc = mmc;Signature · 1 line
2.47.1