[09/11] media: platform: ti: Use devm_platform_get_and_ioremap_resource()

Message ID 20230706101100.75654-9-frank.li@vivo.com
State New
Headers
Series [01/11] media: atmel-isi: Convert to devm_platform_ioremap_resource() |

Commit Message

李扬韬 July 6, 2023, 10:10 a.m. UTC
  Convert platform_get_resource(), devm_ioremap_resource() to a single
call to devm_platform_get_and_ioremap_resource(), as this is exactly
what this function does.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 drivers/media/platform/ti/omap3isp/isp.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
  

Comments

Laurent Pinchart July 7, 2023, 8:37 a.m. UTC | #1
Hi Yangtao,

Thank you for the patch.

On Thu, Jul 06, 2023 at 06:10:57PM +0800, Yangtao Li wrote:
> Convert platform_get_resource(), devm_ioremap_resource() to a single
> call to devm_platform_get_and_ioremap_resource(), as this is exactly
> what this function does.
> 
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
>  drivers/media/platform/ti/omap3isp/isp.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/media/platform/ti/omap3isp/isp.c b/drivers/media/platform/ti/omap3isp/isp.c
> index f3aaa9e76492..1c8e4ede29b6 100644
> --- a/drivers/media/platform/ti/omap3isp/isp.c
> +++ b/drivers/media/platform/ti/omap3isp/isp.c
> @@ -2329,9 +2329,7 @@ static int isp_probe(struct platform_device *pdev)
>  	for (i = 0; i < 2; i++) {
>  		unsigned int map_idx = i ? OMAP3_ISP_IOMEM_CSI2A_REGS1 : 0;
>  
> -		mem = platform_get_resource(pdev, IORESOURCE_MEM, i);
> -		isp->mmio_base[map_idx] =
> -			devm_ioremap_resource(isp->dev, mem);
> +		isp->mmio_base[map_idx] = devm_platform_get_and_ioremap_resource(pdev, i, &mem);

I expect Sakari to prefer a line wrap:

		isp->mmio_base[map_idx] =
			devm_platform_get_and_ioremap_resource(pdev, i, &mem);

I assume he will be able to change this when picking up the patch,
without requiring a v2.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

>  		if (IS_ERR(isp->mmio_base[map_idx])) {
>  			ret = PTR_ERR(isp->mmio_base[map_idx]);
>  			goto error;
  

Patch

diff --git a/drivers/media/platform/ti/omap3isp/isp.c b/drivers/media/platform/ti/omap3isp/isp.c
index f3aaa9e76492..1c8e4ede29b6 100644
--- a/drivers/media/platform/ti/omap3isp/isp.c
+++ b/drivers/media/platform/ti/omap3isp/isp.c
@@ -2329,9 +2329,7 @@  static int isp_probe(struct platform_device *pdev)
 	for (i = 0; i < 2; i++) {
 		unsigned int map_idx = i ? OMAP3_ISP_IOMEM_CSI2A_REGS1 : 0;
 
-		mem = platform_get_resource(pdev, IORESOURCE_MEM, i);
-		isp->mmio_base[map_idx] =
-			devm_ioremap_resource(isp->dev, mem);
+		isp->mmio_base[map_idx] = devm_platform_get_and_ioremap_resource(pdev, i, &mem);
 		if (IS_ERR(isp->mmio_base[map_idx])) {
 			ret = PTR_ERR(isp->mmio_base[map_idx]);
 			goto error;