diff mbox series

[-next] dmaengine: ti: k3-udma: use devm_platform_ioremap_resource_byname

Message ID 20200917074457.52748-1-zhangqilong3@huawei.com (mailing list archive)
State Changes Requested
Headers show
Series [-next] dmaengine: ti: k3-udma: use devm_platform_ioremap_resource_byname | expand

Commit Message

Zhang Qilong Sept. 17, 2020, 7:44 a.m. UTC
From: Zhang Qilong <zhangqilong3@huawei.com>

Use the devm_platform_ioremap_resource_byname() helper instead of
calling platform_get_resource_byname() and devm_ioremap_resource()
separately.

Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
---
 drivers/dma/ti/k3-udma.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Peter Ujfalusi Sept. 17, 2020, 9:41 a.m. UTC | #1
On 17/09/2020 10.44, Qilong Zhang wrote:
> From: Zhang Qilong <zhangqilong3@huawei.com>
> 
> Use the devm_platform_ioremap_resource_byname() helper instead of
> calling platform_get_resource_byname() and devm_ioremap_resource()
> separately.

Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

> Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
> ---
>  drivers/dma/ti/k3-udma.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
> index de7bfc02a2de..eb29fdc9ffc1 100644
> --- a/drivers/dma/ti/k3-udma.c
> +++ b/drivers/dma/ti/k3-udma.c
> @@ -3157,13 +3157,11 @@ static const struct soc_device_attribute k3_soc_devices[] = {
>  
>  static int udma_get_mmrs(struct platform_device *pdev, struct udma_dev *ud)
>  {
> -	struct resource *res;
>  	int i;
>  
>  	for (i = 0; i < MMR_LAST; i++) {
> -		res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
> -						   mmr_names[i]);
> -		ud->mmrs[i] = devm_ioremap_resource(&pdev->dev, res);
> +		ud->mmrs[i] = devm_platform_ioremap_resource_byname(pdev,
> +								    mmr_names[i]);
>  		if (IS_ERR(ud->mmrs[i]))
>  			return PTR_ERR(ud->mmrs[i]);
>  	}
> 

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Vinod Koul Sept. 17, 2020, 11:21 a.m. UTC | #2
On 17-09-20, 15:44, Qilong Zhang wrote:
> From: Zhang Qilong <zhangqilong3@huawei.com>
> 
> Use the devm_platform_ioremap_resource_byname() helper instead of
> calling platform_get_resource_byname() and devm_ioremap_resource()
> separately.
> 
> Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
> ---
>  drivers/dma/ti/k3-udma.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
> index de7bfc02a2de..eb29fdc9ffc1 100644
> --- a/drivers/dma/ti/k3-udma.c
> +++ b/drivers/dma/ti/k3-udma.c
> @@ -3157,13 +3157,11 @@ static const struct soc_device_attribute k3_soc_devices[] = {
>  
>  static int udma_get_mmrs(struct platform_device *pdev, struct udma_dev *ud)
>  {
> -	struct resource *res;
>  	int i;
>  
>  	for (i = 0; i < MMR_LAST; i++) {
> -		res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
> -						   mmr_names[i]);
> -		ud->mmrs[i] = devm_ioremap_resource(&pdev->dev, res);
> +		ud->mmrs[i] = devm_platform_ioremap_resource_byname(pdev,
> +								    mmr_names[i]);

One line please ;)

>  		if (IS_ERR(ud->mmrs[i]))
>  			return PTR_ERR(ud->mmrs[i]);
>  	}
> -- 
> 2.17.1
diff mbox series

Patch

diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
index de7bfc02a2de..eb29fdc9ffc1 100644
--- a/drivers/dma/ti/k3-udma.c
+++ b/drivers/dma/ti/k3-udma.c
@@ -3157,13 +3157,11 @@  static const struct soc_device_attribute k3_soc_devices[] = {
 
 static int udma_get_mmrs(struct platform_device *pdev, struct udma_dev *ud)
 {
-	struct resource *res;
 	int i;
 
 	for (i = 0; i < MMR_LAST; i++) {
-		res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
-						   mmr_names[i]);
-		ud->mmrs[i] = devm_ioremap_resource(&pdev->dev, res);
+		ud->mmrs[i] = devm_platform_ioremap_resource_byname(pdev,
+								    mmr_names[i]);
 		if (IS_ERR(ud->mmrs[i]))
 			return PTR_ERR(ud->mmrs[i]);
 	}