* [PATCH] mmc: meson-gx: switch to device-managed dmam_alloc_coherent()
@ 2022-04-15 23:12 ` Heiner Kallweit
0 siblings, 0 replies; 6+ messages in thread
From: Heiner Kallweit @ 2022-04-15 23:12 UTC (permalink / raw)
To: Ulf Hansson, Neil Armstrong, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl
Cc: linux-mmc, linux-arm-kernel, open list:ARM/Amlogic Meson...
Using the device-managed version allows to simplify clean-up in probe()
error path and remove().
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/mmc/host/meson-gx-mmc.c | 21 +++++----------------
1 file changed, 5 insertions(+), 16 deletions(-)
diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
index 9f815cfbd..d4134b18d 100644
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -1301,8 +1301,8 @@ static int meson_mmc_probe(struct platform_device *pdev)
/* data bounce buffer */
host->bounce_buf_size = mmc->max_req_size;
host->bounce_buf =
- dma_alloc_coherent(host->dev, host->bounce_buf_size,
- &host->bounce_dma_addr, GFP_KERNEL);
+ dmam_alloc_coherent(host->dev, host->bounce_buf_size,
+ &host->bounce_dma_addr, GFP_KERNEL);
if (host->bounce_buf == NULL) {
dev_err(host->dev, "Unable to map allocate DMA bounce buffer.\n");
ret = -ENOMEM;
@@ -1310,12 +1310,12 @@ static int meson_mmc_probe(struct platform_device *pdev)
}
}
- host->descs = dma_alloc_coherent(host->dev, SD_EMMC_DESC_BUF_LEN,
- &host->descs_dma_addr, GFP_KERNEL);
+ host->descs = dmam_alloc_coherent(host->dev, SD_EMMC_DESC_BUF_LEN,
+ &host->descs_dma_addr, GFP_KERNEL);
if (!host->descs) {
dev_err(host->dev, "Allocating descriptor DMA buffer failed\n");
ret = -ENOMEM;
- goto err_bounce_buf;
+ goto err_free_irq;
}
mmc->ops = &meson_mmc_ops;
@@ -1323,10 +1323,6 @@ static int meson_mmc_probe(struct platform_device *pdev)
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:
free_irq(host->irq, host);
err_init_clk:
@@ -1348,13 +1344,6 @@ static int meson_mmc_remove(struct platform_device *pdev)
writel(0, host->regs + SD_EMMC_IRQ_EN);
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->core_clk);
--
2.35.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] mmc: meson-gx: switch to device-managed dmam_alloc_coherent()
@ 2022-04-15 23:12 ` Heiner Kallweit
0 siblings, 0 replies; 6+ messages in thread
From: Heiner Kallweit @ 2022-04-15 23:12 UTC (permalink / raw)
To: Ulf Hansson, Neil Armstrong, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl
Cc: linux-mmc, linux-arm-kernel, open list:ARM/Amlogic Meson...
Using the device-managed version allows to simplify clean-up in probe()
error path and remove().
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/mmc/host/meson-gx-mmc.c | 21 +++++----------------
1 file changed, 5 insertions(+), 16 deletions(-)
diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
index 9f815cfbd..d4134b18d 100644
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -1301,8 +1301,8 @@ static int meson_mmc_probe(struct platform_device *pdev)
/* data bounce buffer */
host->bounce_buf_size = mmc->max_req_size;
host->bounce_buf =
- dma_alloc_coherent(host->dev, host->bounce_buf_size,
- &host->bounce_dma_addr, GFP_KERNEL);
+ dmam_alloc_coherent(host->dev, host->bounce_buf_size,
+ &host->bounce_dma_addr, GFP_KERNEL);
if (host->bounce_buf == NULL) {
dev_err(host->dev, "Unable to map allocate DMA bounce buffer.\n");
ret = -ENOMEM;
@@ -1310,12 +1310,12 @@ static int meson_mmc_probe(struct platform_device *pdev)
}
}
- host->descs = dma_alloc_coherent(host->dev, SD_EMMC_DESC_BUF_LEN,
- &host->descs_dma_addr, GFP_KERNEL);
+ host->descs = dmam_alloc_coherent(host->dev, SD_EMMC_DESC_BUF_LEN,
+ &host->descs_dma_addr, GFP_KERNEL);
if (!host->descs) {
dev_err(host->dev, "Allocating descriptor DMA buffer failed\n");
ret = -ENOMEM;
- goto err_bounce_buf;
+ goto err_free_irq;
}
mmc->ops = &meson_mmc_ops;
@@ -1323,10 +1323,6 @@ static int meson_mmc_probe(struct platform_device *pdev)
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:
free_irq(host->irq, host);
err_init_clk:
@@ -1348,13 +1344,6 @@ static int meson_mmc_remove(struct platform_device *pdev)
writel(0, host->regs + SD_EMMC_IRQ_EN);
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->core_clk);
--
2.35.3
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] mmc: meson-gx: switch to device-managed dmam_alloc_coherent()
@ 2022-04-15 23:12 ` Heiner Kallweit
0 siblings, 0 replies; 6+ messages in thread
From: Heiner Kallweit @ 2022-04-15 23:12 UTC (permalink / raw)
To: Ulf Hansson, Neil Armstrong, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl
Cc: linux-mmc, linux-arm-kernel, open list:ARM/Amlogic Meson...
Using the device-managed version allows to simplify clean-up in probe()
error path and remove().
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/mmc/host/meson-gx-mmc.c | 21 +++++----------------
1 file changed, 5 insertions(+), 16 deletions(-)
diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
index 9f815cfbd..d4134b18d 100644
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -1301,8 +1301,8 @@ static int meson_mmc_probe(struct platform_device *pdev)
/* data bounce buffer */
host->bounce_buf_size = mmc->max_req_size;
host->bounce_buf =
- dma_alloc_coherent(host->dev, host->bounce_buf_size,
- &host->bounce_dma_addr, GFP_KERNEL);
+ dmam_alloc_coherent(host->dev, host->bounce_buf_size,
+ &host->bounce_dma_addr, GFP_KERNEL);
if (host->bounce_buf == NULL) {
dev_err(host->dev, "Unable to map allocate DMA bounce buffer.\n");
ret = -ENOMEM;
@@ -1310,12 +1310,12 @@ static int meson_mmc_probe(struct platform_device *pdev)
}
}
- host->descs = dma_alloc_coherent(host->dev, SD_EMMC_DESC_BUF_LEN,
- &host->descs_dma_addr, GFP_KERNEL);
+ host->descs = dmam_alloc_coherent(host->dev, SD_EMMC_DESC_BUF_LEN,
+ &host->descs_dma_addr, GFP_KERNEL);
if (!host->descs) {
dev_err(host->dev, "Allocating descriptor DMA buffer failed\n");
ret = -ENOMEM;
- goto err_bounce_buf;
+ goto err_free_irq;
}
mmc->ops = &meson_mmc_ops;
@@ -1323,10 +1323,6 @@ static int meson_mmc_probe(struct platform_device *pdev)
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:
free_irq(host->irq, host);
err_init_clk:
@@ -1348,13 +1344,6 @@ static int meson_mmc_remove(struct platform_device *pdev)
writel(0, host->regs + SD_EMMC_IRQ_EN);
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->core_clk);
--
2.35.3
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] mmc: meson-gx: switch to device-managed dmam_alloc_coherent()
2022-04-15 23:12 ` Heiner Kallweit
(?)
@ 2022-04-21 13:54 ` Ulf Hansson
-1 siblings, 0 replies; 6+ messages in thread
From: Ulf Hansson @ 2022-04-21 13:54 UTC (permalink / raw)
To: Heiner Kallweit
Cc: Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
linux-mmc, linux-arm-kernel, open list:ARM/Amlogic Meson...
On Sat, 16 Apr 2022 at 01:12, Heiner Kallweit <hkallweit1@gmail.com> wrote:
>
> Using the device-managed version allows to simplify clean-up in probe()
> error path and remove().
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Applied for next, thanks!
Kind regards
Uffe
> ---
> drivers/mmc/host/meson-gx-mmc.c | 21 +++++----------------
> 1 file changed, 5 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
> index 9f815cfbd..d4134b18d 100644
> --- a/drivers/mmc/host/meson-gx-mmc.c
> +++ b/drivers/mmc/host/meson-gx-mmc.c
> @@ -1301,8 +1301,8 @@ static int meson_mmc_probe(struct platform_device *pdev)
> /* data bounce buffer */
> host->bounce_buf_size = mmc->max_req_size;
> host->bounce_buf =
> - dma_alloc_coherent(host->dev, host->bounce_buf_size,
> - &host->bounce_dma_addr, GFP_KERNEL);
> + dmam_alloc_coherent(host->dev, host->bounce_buf_size,
> + &host->bounce_dma_addr, GFP_KERNEL);
> if (host->bounce_buf == NULL) {
> dev_err(host->dev, "Unable to map allocate DMA bounce buffer.\n");
> ret = -ENOMEM;
> @@ -1310,12 +1310,12 @@ static int meson_mmc_probe(struct platform_device *pdev)
> }
> }
>
> - host->descs = dma_alloc_coherent(host->dev, SD_EMMC_DESC_BUF_LEN,
> - &host->descs_dma_addr, GFP_KERNEL);
> + host->descs = dmam_alloc_coherent(host->dev, SD_EMMC_DESC_BUF_LEN,
> + &host->descs_dma_addr, GFP_KERNEL);
> if (!host->descs) {
> dev_err(host->dev, "Allocating descriptor DMA buffer failed\n");
> ret = -ENOMEM;
> - goto err_bounce_buf;
> + goto err_free_irq;
> }
>
> mmc->ops = &meson_mmc_ops;
> @@ -1323,10 +1323,6 @@ static int meson_mmc_probe(struct platform_device *pdev)
>
> 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:
> free_irq(host->irq, host);
> err_init_clk:
> @@ -1348,13 +1344,6 @@ static int meson_mmc_remove(struct platform_device *pdev)
> writel(0, host->regs + SD_EMMC_IRQ_EN);
> 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->core_clk);
>
> --
> 2.35.3
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mmc: meson-gx: switch to device-managed dmam_alloc_coherent()
@ 2022-04-21 13:54 ` Ulf Hansson
0 siblings, 0 replies; 6+ messages in thread
From: Ulf Hansson @ 2022-04-21 13:54 UTC (permalink / raw)
To: Heiner Kallweit
Cc: Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
linux-mmc, linux-arm-kernel, open list:ARM/Amlogic Meson...
On Sat, 16 Apr 2022 at 01:12, Heiner Kallweit <hkallweit1@gmail.com> wrote:
>
> Using the device-managed version allows to simplify clean-up in probe()
> error path and remove().
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Applied for next, thanks!
Kind regards
Uffe
> ---
> drivers/mmc/host/meson-gx-mmc.c | 21 +++++----------------
> 1 file changed, 5 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
> index 9f815cfbd..d4134b18d 100644
> --- a/drivers/mmc/host/meson-gx-mmc.c
> +++ b/drivers/mmc/host/meson-gx-mmc.c
> @@ -1301,8 +1301,8 @@ static int meson_mmc_probe(struct platform_device *pdev)
> /* data bounce buffer */
> host->bounce_buf_size = mmc->max_req_size;
> host->bounce_buf =
> - dma_alloc_coherent(host->dev, host->bounce_buf_size,
> - &host->bounce_dma_addr, GFP_KERNEL);
> + dmam_alloc_coherent(host->dev, host->bounce_buf_size,
> + &host->bounce_dma_addr, GFP_KERNEL);
> if (host->bounce_buf == NULL) {
> dev_err(host->dev, "Unable to map allocate DMA bounce buffer.\n");
> ret = -ENOMEM;
> @@ -1310,12 +1310,12 @@ static int meson_mmc_probe(struct platform_device *pdev)
> }
> }
>
> - host->descs = dma_alloc_coherent(host->dev, SD_EMMC_DESC_BUF_LEN,
> - &host->descs_dma_addr, GFP_KERNEL);
> + host->descs = dmam_alloc_coherent(host->dev, SD_EMMC_DESC_BUF_LEN,
> + &host->descs_dma_addr, GFP_KERNEL);
> if (!host->descs) {
> dev_err(host->dev, "Allocating descriptor DMA buffer failed\n");
> ret = -ENOMEM;
> - goto err_bounce_buf;
> + goto err_free_irq;
> }
>
> mmc->ops = &meson_mmc_ops;
> @@ -1323,10 +1323,6 @@ static int meson_mmc_probe(struct platform_device *pdev)
>
> 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:
> free_irq(host->irq, host);
> err_init_clk:
> @@ -1348,13 +1344,6 @@ static int meson_mmc_remove(struct platform_device *pdev)
> writel(0, host->regs + SD_EMMC_IRQ_EN);
> 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->core_clk);
>
> --
> 2.35.3
>
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mmc: meson-gx: switch to device-managed dmam_alloc_coherent()
@ 2022-04-21 13:54 ` Ulf Hansson
0 siblings, 0 replies; 6+ messages in thread
From: Ulf Hansson @ 2022-04-21 13:54 UTC (permalink / raw)
To: Heiner Kallweit
Cc: Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
linux-mmc, linux-arm-kernel, open list:ARM/Amlogic Meson...
On Sat, 16 Apr 2022 at 01:12, Heiner Kallweit <hkallweit1@gmail.com> wrote:
>
> Using the device-managed version allows to simplify clean-up in probe()
> error path and remove().
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Applied for next, thanks!
Kind regards
Uffe
> ---
> drivers/mmc/host/meson-gx-mmc.c | 21 +++++----------------
> 1 file changed, 5 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
> index 9f815cfbd..d4134b18d 100644
> --- a/drivers/mmc/host/meson-gx-mmc.c
> +++ b/drivers/mmc/host/meson-gx-mmc.c
> @@ -1301,8 +1301,8 @@ static int meson_mmc_probe(struct platform_device *pdev)
> /* data bounce buffer */
> host->bounce_buf_size = mmc->max_req_size;
> host->bounce_buf =
> - dma_alloc_coherent(host->dev, host->bounce_buf_size,
> - &host->bounce_dma_addr, GFP_KERNEL);
> + dmam_alloc_coherent(host->dev, host->bounce_buf_size,
> + &host->bounce_dma_addr, GFP_KERNEL);
> if (host->bounce_buf == NULL) {
> dev_err(host->dev, "Unable to map allocate DMA bounce buffer.\n");
> ret = -ENOMEM;
> @@ -1310,12 +1310,12 @@ static int meson_mmc_probe(struct platform_device *pdev)
> }
> }
>
> - host->descs = dma_alloc_coherent(host->dev, SD_EMMC_DESC_BUF_LEN,
> - &host->descs_dma_addr, GFP_KERNEL);
> + host->descs = dmam_alloc_coherent(host->dev, SD_EMMC_DESC_BUF_LEN,
> + &host->descs_dma_addr, GFP_KERNEL);
> if (!host->descs) {
> dev_err(host->dev, "Allocating descriptor DMA buffer failed\n");
> ret = -ENOMEM;
> - goto err_bounce_buf;
> + goto err_free_irq;
> }
>
> mmc->ops = &meson_mmc_ops;
> @@ -1323,10 +1323,6 @@ static int meson_mmc_probe(struct platform_device *pdev)
>
> 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:
> free_irq(host->irq, host);
> err_init_clk:
> @@ -1348,13 +1344,6 @@ static int meson_mmc_remove(struct platform_device *pdev)
> writel(0, host->regs + SD_EMMC_IRQ_EN);
> 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->core_clk);
>
> --
> 2.35.3
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-04-21 13:56 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-15 23:12 [PATCH] mmc: meson-gx: switch to device-managed dmam_alloc_coherent() Heiner Kallweit
2022-04-15 23:12 ` Heiner Kallweit
2022-04-15 23:12 ` Heiner Kallweit
2022-04-21 13:54 ` Ulf Hansson
2022-04-21 13:54 ` Ulf Hansson
2022-04-21 13:54 ` Ulf Hansson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.