Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1690035 > unrolled thread

[PATCH v1 5/7] drm/stm: ltdc: add devm_reset_control & platform_get_ressource

Started byPhilippe CORNU <philippe.cornu@st.com>
First post2017-07-18 12:30 +0200
Last post2017-07-20 11:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v1 5/7] drm/stm: ltdc: add devm_reset_control & platform_get_ressource Philippe CORNU <philippe.cornu@st.com> - 2017-07-18 12:30 +0200
    Re: [PATCH v1 5/7] drm/stm: ltdc: add devm_reset_control & platform_get_ressource Benjamin Gaignard <benjamin.gaignard@linaro.org> - 2017-07-20 11:40 +0200

#1690035 — [PATCH v1 5/7] drm/stm: ltdc: add devm_reset_control & platform_get_ressource

FromPhilippe CORNU <philippe.cornu@st.com>
Date2017-07-18 12:30 +0200
Subject[PATCH v1 5/7] drm/stm: ltdc: add devm_reset_control & platform_get_ressource
Message-ID<u4xVo-1aY-23@gated-at.bofh.it>
Use devm_reset_control_get to avoid resource leakage.
Also use platform_get_resource, which is more usual and
consistent with platform_get_irq called later.

Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
Signed-off-by: Philippe CORNU <philippe.cornu@st.com>
---
 drivers/gpu/drm/stm/ltdc.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index 92e58ba..f4ed21a 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -874,7 +874,7 @@ int ltdc_load(struct drm_device *ddev)
 	struct drm_panel *panel;
 	struct drm_crtc *crtc;
 	struct reset_control *rstc;
-	struct resource res;
+	struct resource *res;
 	int irq, ret, i;
 
 	DRM_DEBUG_DRIVER("\n");
@@ -883,7 +883,7 @@ int ltdc_load(struct drm_device *ddev)
 	if (ret)
 		return ret;
 
-	rstc = of_reset_control_get(np, NULL);
+	rstc = devm_reset_control_get(dev, NULL);
 
 	mutex_init(&ldev->err_lock);
 
@@ -898,13 +898,14 @@ int ltdc_load(struct drm_device *ddev)
 		return -ENODEV;
 	}
 
-	if (of_address_to_resource(np, 0, &res)) {
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res) {
 		DRM_ERROR("Unable to get resource\n");
 		ret = -ENODEV;
 		goto err;
 	}
 
-	ldev->regs = devm_ioremap_resource(dev, &res);
+	ldev->regs = devm_ioremap_resource(dev, res);
 	if (IS_ERR(ldev->regs)) {
 		DRM_ERROR("Unable to get ltdc registers\n");
 		ret = PTR_ERR(ldev->regs);
-- 
1.9.1

[toc] | [next] | [standalone]


#1692700

FromBenjamin Gaignard <benjamin.gaignard@linaro.org>
Date2017-07-20 11:40 +0200
Message-ID<u5g66-5r9-35@gated-at.bofh.it>
In reply to#1690035
2017-07-18 12:20 GMT+02:00 Philippe CORNU <philippe.cornu@st.com>:
> Use devm_reset_control_get to avoid resource leakage.
> Also use platform_get_resource, which is more usual and
> consistent with platform_get_irq called later.
>
> Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
> Signed-off-by: Philippe CORNU <philippe.cornu@st.com>

Note that could be conflicting with Philippe Zabel work on reset

Reviewed-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
> ---
>  drivers/gpu/drm/stm/ltdc.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
> index 92e58ba..f4ed21a 100644
> --- a/drivers/gpu/drm/stm/ltdc.c
> +++ b/drivers/gpu/drm/stm/ltdc.c
> @@ -874,7 +874,7 @@ int ltdc_load(struct drm_device *ddev)
>         struct drm_panel *panel;
>         struct drm_crtc *crtc;
>         struct reset_control *rstc;
> -       struct resource res;
> +       struct resource *res;
>         int irq, ret, i;
>
>         DRM_DEBUG_DRIVER("\n");
> @@ -883,7 +883,7 @@ int ltdc_load(struct drm_device *ddev)
>         if (ret)
>                 return ret;
>
> -       rstc = of_reset_control_get(np, NULL);
> +       rstc = devm_reset_control_get(dev, NULL);
>
>         mutex_init(&ldev->err_lock);
>
> @@ -898,13 +898,14 @@ int ltdc_load(struct drm_device *ddev)
>                 return -ENODEV;
>         }
>
> -       if (of_address_to_resource(np, 0, &res)) {
> +       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +       if (!res) {
>                 DRM_ERROR("Unable to get resource\n");
>                 ret = -ENODEV;
>                 goto err;
>         }
>
> -       ldev->regs = devm_ioremap_resource(dev, &res);
> +       ldev->regs = devm_ioremap_resource(dev, res);
>         if (IS_ERR(ldev->regs)) {
>                 DRM_ERROR("Unable to get ltdc registers\n");
>                 ret = PTR_ERR(ldev->regs);
> --
> 1.9.1
>



-- 
Benjamin Gaignard

Graphic Study Group

Linaro.org │ Open source software for ARM SoCs

Follow Linaro: Facebook | Twitter | Blog

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web