[12/18] drm/tegra: dpaux: Convert to devm_platform_ioremap_resource()

Message ID 20230707072034.48977-12-frank.li@vivo.com
State New
Headers
Series [01/18] drm/renesas: Convert to devm_platform_ioremap_resource() |

Commit Message

李扬韬 July 7, 2023, 7:20 a.m. UTC
  Use devm_platform_ioremap_resource() to simplify code.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 drivers/gpu/drm/tegra/dpaux.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
  

Comments

Thierry Reding July 7, 2023, 12:28 p.m. UTC | #1
On Fri, Jul 07, 2023 at 03:20:28PM +0800, Yangtao Li wrote:
> Use devm_platform_ioremap_resource() to simplify code.
> 
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
>  drivers/gpu/drm/tegra/dpaux.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tegra/dpaux.c b/drivers/gpu/drm/tegra/dpaux.c
> index 4d2677dcd831..f120897ce4b3 100644
> --- a/drivers/gpu/drm/tegra/dpaux.c
> +++ b/drivers/gpu/drm/tegra/dpaux.c
> @@ -447,7 +447,6 @@ static const struct pinmux_ops tegra_dpaux_pinmux_ops = {
>  static int tegra_dpaux_probe(struct platform_device *pdev)
>  {
>  	struct tegra_dpaux *dpaux;
> -	struct resource *regs;
>  	u32 value;
>  	int err;
>  
> @@ -461,14 +460,13 @@ static int tegra_dpaux_probe(struct platform_device *pdev)
>  	INIT_LIST_HEAD(&dpaux->list);
>  	dpaux->dev = &pdev->dev;
>  
> -	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	dpaux->regs = devm_ioremap_resource(&pdev->dev, regs);
> +	dpaux->regs = devm_platform_ioremap_resource(pdev, 0);
>  	if (IS_ERR(dpaux->regs))
>  		return PTR_ERR(dpaux->regs);
>  
>  	dpaux->irq = platform_get_irq(pdev, 0);
>  	if (dpaux->irq < 0)
> -		return -ENXIO;
> +		return dpaux->irq;

This change has nothing to do with what the commit message says. It
looks correct, but it should be a separate patch.

Thierry
  

Patch

diff --git a/drivers/gpu/drm/tegra/dpaux.c b/drivers/gpu/drm/tegra/dpaux.c
index 4d2677dcd831..f120897ce4b3 100644
--- a/drivers/gpu/drm/tegra/dpaux.c
+++ b/drivers/gpu/drm/tegra/dpaux.c
@@ -447,7 +447,6 @@  static const struct pinmux_ops tegra_dpaux_pinmux_ops = {
 static int tegra_dpaux_probe(struct platform_device *pdev)
 {
 	struct tegra_dpaux *dpaux;
-	struct resource *regs;
 	u32 value;
 	int err;
 
@@ -461,14 +460,13 @@  static int tegra_dpaux_probe(struct platform_device *pdev)
 	INIT_LIST_HEAD(&dpaux->list);
 	dpaux->dev = &pdev->dev;
 
-	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	dpaux->regs = devm_ioremap_resource(&pdev->dev, regs);
+	dpaux->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(dpaux->regs))
 		return PTR_ERR(dpaux->regs);
 
 	dpaux->irq = platform_get_irq(pdev, 0);
 	if (dpaux->irq < 0)
-		return -ENXIO;
+		return dpaux->irq;
 
 	if (!pdev->dev.pm_domain) {
 		dpaux->rst = devm_reset_control_get(&pdev->dev, "dpaux");