diff mbox

[1/4] drm: exynos: hdmi: simplify extracting hpd-gpio from DT

Message ID 1397487622-3577-2-git-send-email-t.stanislaws@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tomasz Stanislawski April 14, 2014, 3 p.m. UTC
This patch eliminates redundant checks while retrieving HPD gpio from DT during
HDMI's probe().

Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_hdmi.c |   13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

Comments

Tomasz Stanislawski April 14, 2014, 3:49 p.m. UTC | #1
On 04/14/2014 05:00 PM, Tomasz Stanislawski wrote:
> This patch eliminates redundant checks while retrieving HPD gpio from DT during
> HDMI's probe().
> 
> Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_hdmi.c |   13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
> index 9a6d652..d2d6e2e 100644
> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
> @@ -2016,23 +2016,18 @@ static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata
>  {
>  	struct device_node *np = dev->of_node;
>  	struct s5p_hdmi_platform_data *pd;
> -	u32 value;
>  
>  	pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);
>  	if (!pd)
> -		goto err_data;
> +		return NULL;
>  
> -	if (!of_find_property(np, "hpd-gpio", &value)) {
> +	pd->hpd_gpio = of_get_named_gpio(np, "hpd-gpio", 0);
> +	if (gpio_is_valid(pd->hpd_gpio)) {

Sorry. Should be !gpio_is_valid().

>  		DRM_ERROR("no hpd gpio property found\n");
> -		goto err_data;
> +		return NULL;
>  	}
>  
> -	pd->hpd_gpio = of_get_named_gpio(np, "hpd-gpio", 0);
> -
>  	return pd;
> -
> -err_data:
> -	return NULL;
>  }
>  
>  static struct of_device_id hdmi_match_types[] = {
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 9a6d652..d2d6e2e 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -2016,23 +2016,18 @@  static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata
 {
 	struct device_node *np = dev->of_node;
 	struct s5p_hdmi_platform_data *pd;
-	u32 value;
 
 	pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);
 	if (!pd)
-		goto err_data;
+		return NULL;
 
-	if (!of_find_property(np, "hpd-gpio", &value)) {
+	pd->hpd_gpio = of_get_named_gpio(np, "hpd-gpio", 0);
+	if (gpio_is_valid(pd->hpd_gpio)) {
 		DRM_ERROR("no hpd gpio property found\n");
-		goto err_data;
+		return NULL;
 	}
 
-	pd->hpd_gpio = of_get_named_gpio(np, "hpd-gpio", 0);
-
 	return pd;
-
-err_data:
-	return NULL;
 }
 
 static struct of_device_id hdmi_match_types[] = {