Skip to contentSkip to conversation

drm: exynos: hdmi: simplify extracting hpd-gpio from DT

PATCH In review Tomasz Stanislawski 2 participants 2 messages Apr 14, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: exynos: hdmi: simplify extracting hpd-gpio from DT

This patch eliminates redundant checks while retrieving HPD gpio from DT during HDMI's probe().

---
 drivers/gpu/drm/exynos/exynos_hdmi.c |   13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/gpu/drm/exynos/exynos_hdmi.c +4 -9
index e1a2e88..300c2af 100644
@@ -2011,23 +2011,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_flags(np, "hpd-gpio", 0, NULL);
+	if (pd->hpd_gpio < 0) {
 		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[] = {
#1 lore raw

Hi Tomasz,

Quoted 15 lines · Tomasz Stanislawski

This patch eliminates redundant checks while retrieving HPD gpio from DT during HDMI's probe().

---
  drivers/gpu/drm/exynos/exynos_hdmi.c |   13 ++++---------
  1 file changed, 4 insertions(+), 9 deletions(-)
drivers/gpu/drm/exynos/exynos_hdmi.c +0 -0
index e1a2e88..300c2af 100644
@@ -2011,23 +2011,18 @@ static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata
  {
  	struct device_node *np = dev->of_node;

drivers/gpu/drm/exynos/exynos_hdmi.c static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata · line 2019

Quoted 10 lines
drivers/gpu/drm/exynos/exynos_hdmi.c +2 -3
  	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_flags(np, "hpd-gpio", 0, NULL);

This is same with
pd->hpd_gpio = of_get_named_gpio(np, "hpd-gpio", 0);

drivers/gpu/drm/exynos/exynos_hdmi.c static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata · line 2020

Quoted 1 line
drivers/gpu/drm/exynos/exynos_hdmi.c +1 -0
+	if (pd->hpd_gpio < 0) {

How about use gpio_is_valid()?

Quoted 6 lines
drivers/gpu/drm/exynos/exynos_hdmi.c +1 -1
  		DRM_ERROR("no hpd gpio property found\n");
-		goto err_data;
+		return NULL;
  	}

drivers/gpu/drm/exynos/exynos_hdmi.c static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata · line 2028

Quoted 10 lines
drivers/gpu/drm/exynos/exynos_hdmi.c +0 -5
 
-	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[] = {

Thanks.