diff mbox

[PATCHv3,1/5] drm: exynos: hdmi: remove usage of struct s5p_hdmi_platform_data

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

Commit Message

Tomasz Stanislawski April 16, 2014, 3:12 p.m. UTC
This patch continues shift of DRM EXYNOS to DT-only configuration.
The usage of the old structure for HDMI's platform data is
removed.

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

Comments

Joonyoung Shim April 17, 2014, 1:54 a.m. UTC | #1
Hi Tomasz,

On 04/17/2014 12:12 AM, Tomasz Stanislawski wrote:
> This patch continues shift of DRM EXYNOS to DT-only configuration.
> The usage of the old structure for HDMI's platform data is
> removed.
>
> Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
> ---
>   drivers/gpu/drm/exynos/exynos_hdmi.c |   30 ++++++++----------------------
>   1 file changed, 8 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
> index 9a6d652..482ca77 100644
> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
> @@ -43,7 +43,6 @@
>   #include "exynos_mixer.h"
>   
>   #include <linux/gpio.h>
> -#include <media/s5p_hdmi.h>
>   
>   #define get_hdmi_display(dev)	platform_get_drvdata(to_platform_device(dev))
>   #define ctx_from_connector(c)	container_of(c, struct hdmi_context, connector)
> @@ -2011,28 +2010,18 @@ fail:
>   	return -ENODEV;
>   }
>   
> -static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata
> -					(struct device *dev)
> +static int drm_hdmi_dt_parse(struct hdmi_context *hdata, struct device_node *np)
>   {
> -	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;
> -
>   	if (!of_find_property(np, "hpd-gpio", &value)) {
>   		DRM_ERROR("no hpd gpio property found\n");
> -		goto err_data;
> +		return -ENOENT;
>   	}
>   
> -	pd->hpd_gpio = of_get_named_gpio(np, "hpd-gpio", 0);
> -
> -	return pd;
> +	hdata->hpd_gpio = of_get_named_gpio(np, "hpd-gpio", 0);
>   
> -err_data:
> -	return NULL;
> +	return 0;
>   }
>   
>   static struct of_device_id hdmi_match_types[] = {
> @@ -2051,7 +2040,6 @@ static int hdmi_probe(struct platform_device *pdev)
>   {
>   	struct device *dev = &pdev->dev;
>   	struct hdmi_context *hdata;
> -	struct s5p_hdmi_platform_data *pdata;
>   	struct resource *res;
>   	const struct of_device_id *match;
>   	struct device_node *ddc_node, *phy_node;
> @@ -2061,14 +2049,14 @@ static int hdmi_probe(struct platform_device *pdev)
>   	 if (!dev->of_node)
>   		return -ENODEV;
>   
> -	pdata = drm_hdmi_dt_parse_pdata(dev);
> -	if (!pdata)
> -		return -EINVAL;
> -
>   	hdata = devm_kzalloc(dev, sizeof(struct hdmi_context), GFP_KERNEL);
>   	if (!hdata)
>   		return -ENOMEM;
>   
> +	ret = drm_hdmi_dt_parse(hdata, dev->of_node);
> +	if (ret)
> +		return -EINVAL;

It's better to return ret value.
Tomasz Stanislawski April 17, 2014, 7:26 a.m. UTC | #2
Hi Joonyoung,

On 04/17/2014 03:54 AM, Joonyoung Shim wrote:
> Hi Tomasz,
> 
> On 04/17/2014 12:12 AM, Tomasz Stanislawski wrote:
>> This patch continues shift of DRM EXYNOS to DT-only configuration.
>> The usage of the old structure for HDMI's platform data is
>> removed.
>>
>> Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>

[snip]

>>   +    ret = drm_hdmi_dt_parse(hdata, dev->of_node);
>> +    if (ret)
>> +        return -EINVAL;
> 
> It's better to return ret value.
> 

I was considering return ret value. However, I preferred to
be consistent with other 'returns' which returns error literals.

Anyway, I will change it to 'return ret'.

Regards,
Tomasz Stanislawski
diff mbox

Patch

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 9a6d652..482ca77 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -43,7 +43,6 @@ 
 #include "exynos_mixer.h"
 
 #include <linux/gpio.h>
-#include <media/s5p_hdmi.h>
 
 #define get_hdmi_display(dev)	platform_get_drvdata(to_platform_device(dev))
 #define ctx_from_connector(c)	container_of(c, struct hdmi_context, connector)
@@ -2011,28 +2010,18 @@  fail:
 	return -ENODEV;
 }
 
-static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata
-					(struct device *dev)
+static int drm_hdmi_dt_parse(struct hdmi_context *hdata, struct device_node *np)
 {
-	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;
-
 	if (!of_find_property(np, "hpd-gpio", &value)) {
 		DRM_ERROR("no hpd gpio property found\n");
-		goto err_data;
+		return -ENOENT;
 	}
 
-	pd->hpd_gpio = of_get_named_gpio(np, "hpd-gpio", 0);
-
-	return pd;
+	hdata->hpd_gpio = of_get_named_gpio(np, "hpd-gpio", 0);
 
-err_data:
-	return NULL;
+	return 0;
 }
 
 static struct of_device_id hdmi_match_types[] = {
@@ -2051,7 +2040,6 @@  static int hdmi_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct hdmi_context *hdata;
-	struct s5p_hdmi_platform_data *pdata;
 	struct resource *res;
 	const struct of_device_id *match;
 	struct device_node *ddc_node, *phy_node;
@@ -2061,14 +2049,14 @@  static int hdmi_probe(struct platform_device *pdev)
 	 if (!dev->of_node)
 		return -ENODEV;
 
-	pdata = drm_hdmi_dt_parse_pdata(dev);
-	if (!pdata)
-		return -EINVAL;
-
 	hdata = devm_kzalloc(dev, sizeof(struct hdmi_context), GFP_KERNEL);
 	if (!hdata)
 		return -ENOMEM;
 
+	ret = drm_hdmi_dt_parse(hdata, dev->of_node);
+	if (ret)
+		return -EINVAL;
+
 	mutex_init(&hdata->hdmi_mutex);
 
 	platform_set_drvdata(pdev, &hdmi_display);
@@ -2079,8 +2067,6 @@  static int hdmi_probe(struct platform_device *pdev)
 
 	drv_data = (struct hdmi_driver_data *)match->data;
 	hdata->type = drv_data->type;
-
-	hdata->hpd_gpio = pdata->hpd_gpio;
 	hdata->dev = dev;
 
 	ret = hdmi_resources_init(hdata);