提交 238b638b 编写于 作者: H Heiner Kallweit 提交者: Ulf Hansson

mmc: meson-gx: switch to device-managed dmam_alloc_coherent()

Using the device-managed version allows to simplify clean-up in probe()
error path and remove().
Signed-off-by: NHeiner Kallweit <hkallweit1@gmail.com>
Link: https://lore.kernel.org/r/268b3cd5-2388-2553-bdba-c72853f91aa3@gmail.comSigned-off-by: NUlf Hansson <ulf.hansson@linaro.org>
上级 36ed2fd3
...@@ -1271,8 +1271,8 @@ static int meson_mmc_probe(struct platform_device *pdev) ...@@ -1271,8 +1271,8 @@ static int meson_mmc_probe(struct platform_device *pdev)
/* data bounce buffer */ /* data bounce buffer */
host->bounce_buf_size = mmc->max_req_size; host->bounce_buf_size = mmc->max_req_size;
host->bounce_buf = host->bounce_buf =
dma_alloc_coherent(host->dev, host->bounce_buf_size, dmam_alloc_coherent(host->dev, host->bounce_buf_size,
&host->bounce_dma_addr, GFP_KERNEL); &host->bounce_dma_addr, GFP_KERNEL);
if (host->bounce_buf == NULL) { if (host->bounce_buf == NULL) {
dev_err(host->dev, "Unable to map allocate DMA bounce buffer.\n"); dev_err(host->dev, "Unable to map allocate DMA bounce buffer.\n");
ret = -ENOMEM; ret = -ENOMEM;
...@@ -1280,12 +1280,12 @@ static int meson_mmc_probe(struct platform_device *pdev) ...@@ -1280,12 +1280,12 @@ static int meson_mmc_probe(struct platform_device *pdev)
} }
} }
host->descs = dma_alloc_coherent(host->dev, SD_EMMC_DESC_BUF_LEN, host->descs = dmam_alloc_coherent(host->dev, SD_EMMC_DESC_BUF_LEN,
&host->descs_dma_addr, GFP_KERNEL); &host->descs_dma_addr, GFP_KERNEL);
if (!host->descs) { if (!host->descs) {
dev_err(host->dev, "Allocating descriptor DMA buffer failed\n"); dev_err(host->dev, "Allocating descriptor DMA buffer failed\n");
ret = -ENOMEM; ret = -ENOMEM;
goto err_bounce_buf; goto err_free_irq;
} }
mmc->ops = &meson_mmc_ops; mmc->ops = &meson_mmc_ops;
...@@ -1293,10 +1293,6 @@ static int meson_mmc_probe(struct platform_device *pdev) ...@@ -1293,10 +1293,6 @@ static int meson_mmc_probe(struct platform_device *pdev)
return 0; return 0;
err_bounce_buf:
if (!host->dram_access_quirk)
dma_free_coherent(host->dev, host->bounce_buf_size,
host->bounce_buf, host->bounce_dma_addr);
err_free_irq: err_free_irq:
free_irq(host->irq, host); free_irq(host->irq, host);
err_init_clk: err_init_clk:
...@@ -1318,13 +1314,6 @@ static int meson_mmc_remove(struct platform_device *pdev) ...@@ -1318,13 +1314,6 @@ static int meson_mmc_remove(struct platform_device *pdev)
writel(0, host->regs + SD_EMMC_IRQ_EN); writel(0, host->regs + SD_EMMC_IRQ_EN);
free_irq(host->irq, host); free_irq(host->irq, host);
dma_free_coherent(host->dev, SD_EMMC_DESC_BUF_LEN,
host->descs, host->descs_dma_addr);
if (!host->dram_access_quirk)
dma_free_coherent(host->dev, host->bounce_buf_size,
host->bounce_buf, host->bounce_dma_addr);
clk_disable_unprepare(host->mmc_clk); clk_disable_unprepare(host->mmc_clk);
clk_disable_unprepare(host->core_clk); clk_disable_unprepare(host->core_clk);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册