2011-06-01 22:16:37

by Hartley Sweeten

[permalink] [raw]
Subject: [PATCH] dma: at_hdmac.c: use resource_size

Signed-off-by: H Hartley Sweeten <[email protected]>
Cc: Dan Williams <[email protected]>
Cc: Vinod Koul <[email protected]>

---

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index 36144f8..6a483ea 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -1216,7 +1216,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
atdma->dma_common.cap_mask = pdata->cap_mask;
atdma->all_chan_mask = (1 << pdata->nr_channels) - 1;

- size = io->end - io->start + 1;
+ size = resource_size(io);
if (!request_mem_region(io->start, size, pdev->dev.driver->name)) {
err = -EBUSY;
goto err_kfree;
@@ -1362,7 +1362,7 @@ static int __exit at_dma_remove(struct platform_device *pdev)
atdma->regs = NULL;

io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- release_mem_region(io->start, io->end - io->start + 1);
+ release_mem_region(io->start, resource_size(io));

kfree(atdma);


2011-06-06 08:49:53

by Vinod Koul

[permalink] [raw]
Subject: Re: [PATCH] dma: at_hdmac.c: use resource_size

On Wed, 2011-06-01 at 15:16 -0700, H Hartley Sweeten wrote:
> Signed-off-by: H Hartley Sweeten <[email protected]>
> Cc: Dan Williams <[email protected]>
> Cc: Vinod Koul <[email protected]>
>
> ---
>
> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> index 36144f8..6a483ea 100644
> --- a/drivers/dma/at_hdmac.c
> +++ b/drivers/dma/at_hdmac.c
> @@ -1216,7 +1216,7 @@ static int __init at_dma_probe(struct platform_device *pdev)
> atdma->dma_common.cap_mask = pdata->cap_mask;
> atdma->all_chan_mask = (1 << pdata->nr_channels) - 1;
>
> - size = io->end - io->start + 1;
> + size = resource_size(io);
> if (!request_mem_region(io->start, size, pdev->dev.driver->name)) {
> err = -EBUSY;
> goto err_kfree;
> @@ -1362,7 +1362,7 @@ static int __exit at_dma_remove(struct platform_device *pdev)
> atdma->regs = NULL;
>
> io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - release_mem_region(io->start, io->end - io->start + 1);
> + release_mem_region(io->start, resource_size(io));
>
> kfree(atdma);
>
Applied, Thanks

--
~Vinod