dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] Exynos DRM: use of_device_get_match_data helper
@ 2016-04-01 13:17 Marek Szyprowski
  2016-04-01 13:17 ` [PATCH 1/7] drm/exynos: exynos5433_decon: use generic " Marek Szyprowski
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Marek Szyprowski @ 2016-04-01 13:17 UTC (permalink / raw)
  To: dri-devel, linux-samsung-soc
  Cc: Marek Szyprowski, Inki Dae, Joonyoung Shim, Seung-Woo Kim,
	Andrzej Hajda, Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz

Hello,

This patch series simplifies the code by replacing custom code with
generic helper.

Best regards
Marek Szyprowski
Samsung R&D Institute Poland


Patch summary:

Marek Szyprowski (7):
  drm/exynos: exynos5433_decon: use generic of_device_get_match_data
    helper
  drm/exynos: dsi: use generic of_device_get_match_data helper
  drm/exynos: fimd: use generic of_device_get_match_data helper
  drm/exynos: rotator: use generic of_device_get_match_data helper
  drm/exynos: hdmi: use generic of_device_get_match_data helper
  drm/exynos: mixer: remove support for non-dt platforms
  drm/exynos: mixer: use generic of_device_get_match_data helper

 drivers/gpu/drm/exynos/exynos5433_drm_decon.c |  5 +----
 drivers/gpu/drm/exynos/exynos_drm_dsi.c       | 11 +----------
 drivers/gpu/drm/exynos/exynos_drm_fimd.c      | 11 +----------
 drivers/gpu/drm/exynos/exynos_drm_rotator.c   | 11 +++--------
 drivers/gpu/drm/exynos/exynos_hdmi.c          |  7 +------
 drivers/gpu/drm/exynos/exynos_mixer.c         | 26 +++-----------------------
 6 files changed, 10 insertions(+), 61 deletions(-)

-- 
1.9.2

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/7] drm/exynos: exynos5433_decon: use generic of_device_get_match_data helper
  2016-04-01 13:17 [PATCH 0/7] Exynos DRM: use of_device_get_match_data helper Marek Szyprowski
@ 2016-04-01 13:17 ` Marek Szyprowski
  2016-04-01 13:17 ` [PATCH 2/7] drm/exynos: dsi: " Marek Szyprowski
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Marek Szyprowski @ 2016-04-01 13:17 UTC (permalink / raw)
  To: dri-devel, linux-samsung-soc
  Cc: Marek Szyprowski, Inki Dae, Joonyoung Shim, Seung-Woo Kim,
	Andrzej Hajda, Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz

Simplify code by replacing custom code by generic helper.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
index 5245bc5e82e9..fa3dd6e91fd5 100644
--- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
@@ -629,7 +629,6 @@ MODULE_DEVICE_TABLE(of, exynos5433_decon_driver_dt_match);
 
 static int exynos5433_decon_probe(struct platform_device *pdev)
 {
-	const struct of_device_id *of_id;
 	struct device *dev = &pdev->dev;
 	struct decon_context *ctx;
 	struct resource *res;
@@ -642,9 +641,7 @@ static int exynos5433_decon_probe(struct platform_device *pdev)
 
 	__set_bit(BIT_SUSPENDED, &ctx->flags);
 	ctx->dev = dev;
-
-	of_id = of_match_device(exynos5433_decon_driver_dt_match, &pdev->dev);
-	ctx->out_type = (enum decon_iftype)of_id->data;
+	ctx->out_type = (enum decon_iftype)of_device_get_match_data(dev);
 
 	if (ctx->out_type == IFTYPE_HDMI)
 		ctx->first_win = 1;
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/7] drm/exynos: dsi: use generic of_device_get_match_data helper
  2016-04-01 13:17 [PATCH 0/7] Exynos DRM: use of_device_get_match_data helper Marek Szyprowski
  2016-04-01 13:17 ` [PATCH 1/7] drm/exynos: exynos5433_decon: use generic " Marek Szyprowski
@ 2016-04-01 13:17 ` Marek Szyprowski
  2016-04-18  8:48   ` Inki Dae
  2016-04-01 13:17 ` [PATCH 3/7] drm/exynos: fimd: " Marek Szyprowski
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 10+ messages in thread
From: Marek Szyprowski @ 2016-04-01 13:17 UTC (permalink / raw)
  To: dri-devel, linux-samsung-soc
  Cc: Marek Szyprowski, Inki Dae, Joonyoung Shim, Seung-Woo Kim,
	Andrzej Hajda, Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz

Simplify code by replacing custom code by generic helper.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_dsi.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
index 63c84a106c0b..b6518df2411d 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
@@ -532,15 +532,6 @@ static const struct of_device_id exynos_dsi_of_match[] = {
 	{ }
 };
 
-static inline struct exynos_dsi_driver_data *exynos_dsi_get_driver_data(
-						struct platform_device *pdev)
-{
-	const struct of_device_id *of_id =
-			of_match_device(exynos_dsi_of_match, &pdev->dev);
-
-	return (struct exynos_dsi_driver_data *)of_id->data;
-}
-
 static void exynos_dsi_wait_for_reset(struct exynos_dsi *dsi)
 {
 	if (wait_for_completion_timeout(&dsi->completed, msecs_to_jiffies(300)))
@@ -1833,7 +1824,7 @@ static int exynos_dsi_probe(struct platform_device *pdev)
 	dsi->dsi_host.dev = dev;
 
 	dsi->dev = dev;
-	dsi->driver_data = exynos_dsi_get_driver_data(pdev);
+	dsi->driver_data = of_device_get_match_data(dev);
 
 	ret = exynos_dsi_parse_dt(dsi);
 	if (ret)
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/7] drm/exynos: fimd: use generic of_device_get_match_data helper
  2016-04-01 13:17 [PATCH 0/7] Exynos DRM: use of_device_get_match_data helper Marek Szyprowski
  2016-04-01 13:17 ` [PATCH 1/7] drm/exynos: exynos5433_decon: use generic " Marek Szyprowski
  2016-04-01 13:17 ` [PATCH 2/7] drm/exynos: dsi: " Marek Szyprowski
@ 2016-04-01 13:17 ` Marek Szyprowski
  2016-04-01 13:17 ` [PATCH 4/7] drm/exynos: rotator: " Marek Szyprowski
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Marek Szyprowski @ 2016-04-01 13:17 UTC (permalink / raw)
  To: dri-devel, linux-samsung-soc
  Cc: Marek Szyprowski, Inki Dae, Joonyoung Shim, Seung-Woo Kim,
	Andrzej Hajda, Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz

Simplify code by replacing custom code by generic helper.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 018449f8d557..4f31a8aa17dd 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -219,15 +219,6 @@ static const uint32_t fimd_formats[] = {
 	DRM_FORMAT_ARGB8888,
 };
 
-static inline struct fimd_driver_data *drm_fimd_get_driver_data(
-	struct platform_device *pdev)
-{
-	const struct of_device_id *of_id =
-			of_match_device(fimd_driver_dt_match, &pdev->dev);
-
-	return (struct fimd_driver_data *)of_id->data;
-}
-
 static int fimd_enable_vblank(struct exynos_drm_crtc *crtc)
 {
 	struct fimd_context *ctx = crtc->ctx;
@@ -1035,7 +1026,7 @@ static int fimd_probe(struct platform_device *pdev)
 
 	ctx->dev = dev;
 	ctx->suspended = true;
-	ctx->driver_data = drm_fimd_get_driver_data(pdev);
+	ctx->driver_data = of_device_get_match_data(dev);
 
 	if (of_property_read_bool(dev->of_node, "samsung,invert-vden"))
 		ctx->vidcon1 |= VIDCON1_INV_VDEN;
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 4/7] drm/exynos: rotator: use generic of_device_get_match_data helper
  2016-04-01 13:17 [PATCH 0/7] Exynos DRM: use of_device_get_match_data helper Marek Szyprowski
                   ` (2 preceding siblings ...)
  2016-04-01 13:17 ` [PATCH 3/7] drm/exynos: fimd: " Marek Szyprowski
@ 2016-04-01 13:17 ` Marek Szyprowski
  2016-04-01 13:17 ` [PATCH 5/7] drm/exynos: hdmi: " Marek Szyprowski
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Marek Szyprowski @ 2016-04-01 13:17 UTC (permalink / raw)
  To: dri-devel, linux-samsung-soc
  Cc: Marek Szyprowski, Inki Dae, Joonyoung Shim, Seung-Woo Kim,
	Andrzej Hajda, Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz

Simplify code by replacing custom code by generic helper.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_rotator.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_rotator.c b/drivers/gpu/drm/exynos/exynos_drm_rotator.c
index f18fbe43f55f..404367a430b5 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_rotator.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_rotator.c
@@ -15,6 +15,7 @@
 #include <linux/io.h>
 #include <linux/platform_device.h>
 #include <linux/clk.h>
+#include <linux/of_device.h>
 #include <linux/pm_runtime.h>
 
 #include <drm/drmP.h>
@@ -696,7 +697,6 @@ static int rotator_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct rot_context *rot;
 	struct exynos_drm_ippdrv *ippdrv;
-	const struct of_device_id *match;
 	int ret;
 
 	if (!dev->of_node) {
@@ -708,13 +708,8 @@ static int rotator_probe(struct platform_device *pdev)
 	if (!rot)
 		return -ENOMEM;
 
-	match = of_match_node(exynos_rotator_match, dev->of_node);
-	if (!match) {
-		dev_err(dev, "failed to match node\n");
-		return -ENODEV;
-	}
-	rot->limit_tbl = (struct rot_limit_table *)match->data;
-
+	rot->limit_tbl = (struct rot_limit_table *)
+				of_device_get_match_data(dev);
 	rot->regs_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	rot->regs = devm_ioremap_resource(dev, rot->regs_res);
 	if (IS_ERR(rot->regs))
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 5/7] drm/exynos: hdmi: use generic of_device_get_match_data helper
  2016-04-01 13:17 [PATCH 0/7] Exynos DRM: use of_device_get_match_data helper Marek Szyprowski
                   ` (3 preceding siblings ...)
  2016-04-01 13:17 ` [PATCH 4/7] drm/exynos: rotator: " Marek Szyprowski
@ 2016-04-01 13:17 ` Marek Szyprowski
  2016-04-01 13:17 ` [PATCH 6/7] drm/exynos: mixer: remove support for non-dt platforms Marek Szyprowski
  2016-04-01 13:17 ` [PATCH 7/7] drm/exynos: mixer: use generic of_device_get_match_data helper Marek Szyprowski
  6 siblings, 0 replies; 10+ messages in thread
From: Marek Szyprowski @ 2016-04-01 13:17 UTC (permalink / raw)
  To: dri-devel, linux-samsung-soc
  Cc: Marek Szyprowski, Inki Dae, Joonyoung Shim, Seung-Woo Kim,
	Andrzej Hajda, Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz

Simplify code by replacing custom code by generic helper.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_hdmi.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 06105feb6c87..fb1c0f2850dc 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -2015,7 +2015,6 @@ static struct device_node *hdmi_legacy_phy_dt_binding(struct device *dev)
 static int hdmi_probe(struct platform_device *pdev)
 {
 	struct device_node *ddc_node, *phy_node;
-	const struct of_device_id *match;
 	struct device *dev = &pdev->dev;
 	struct hdmi_context *hdata;
 	struct resource *res;
@@ -2025,11 +2024,7 @@ static int hdmi_probe(struct platform_device *pdev)
 	if (!hdata)
 		return -ENOMEM;
 
-	match = of_match_device(hdmi_match_types, dev);
-	if (!match)
-		return -ENODEV;
-
-	hdata->drv_data = match->data;
+	hdata->drv_data = of_device_get_match_data(dev);
 
 	platform_set_drvdata(pdev, hdata);
 
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 6/7] drm/exynos: mixer: remove support for non-dt platforms
  2016-04-01 13:17 [PATCH 0/7] Exynos DRM: use of_device_get_match_data helper Marek Szyprowski
                   ` (4 preceding siblings ...)
  2016-04-01 13:17 ` [PATCH 5/7] drm/exynos: hdmi: " Marek Szyprowski
@ 2016-04-01 13:17 ` Marek Szyprowski
  2016-04-01 13:17 ` [PATCH 7/7] drm/exynos: mixer: use generic of_device_get_match_data helper Marek Szyprowski
  6 siblings, 0 replies; 10+ messages in thread
From: Marek Szyprowski @ 2016-04-01 13:17 UTC (permalink / raw)
  To: dri-devel, linux-samsung-soc
  Cc: Marek Szyprowski, Inki Dae, Joonyoung Shim, Seung-Woo Kim,
	Andrzej Hajda, Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz

There are no non-devicetree based Exynos platforms in mainline, so there
no point keeping old platform driver data for them.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_mixer.c | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
index 0a5a60005f7e..ffafb744154e 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -1155,18 +1155,6 @@ static struct mixer_drv_data exynos4210_mxr_drv_data = {
 	.has_sclk = 1,
 };
 
-static const struct platform_device_id mixer_driver_types[] = {
-	{
-		.name		= "s5p-mixer",
-		.driver_data	= (unsigned long)&exynos4210_mxr_drv_data,
-	}, {
-		.name		= "exynos5-mixer",
-		.driver_data	= (unsigned long)&exynos5250_mxr_drv_data,
-	}, {
-		/* end node */
-	}
-};
-
 static struct of_device_id mixer_match_types[] = {
 	{
 		.compatible = "samsung,exynos4210-mixer",
@@ -1258,9 +1246,6 @@ static int mixer_probe(struct platform_device *pdev)
 
 		match = of_match_node(mixer_match_types, dev->of_node);
 		drv = (struct mixer_drv_data *)match->data;
-	} else {
-		drv = (struct mixer_drv_data *)
-			platform_get_device_id(pdev)->driver_data;
 	}
 
 	ctx->pdev = pdev;
@@ -1355,5 +1340,4 @@ struct platform_driver mixer_driver = {
 	},
 	.probe = mixer_probe,
 	.remove = mixer_remove,
-	.id_table	= mixer_driver_types,
 };
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 7/7] drm/exynos: mixer: use generic of_device_get_match_data helper
  2016-04-01 13:17 [PATCH 0/7] Exynos DRM: use of_device_get_match_data helper Marek Szyprowski
                   ` (5 preceding siblings ...)
  2016-04-01 13:17 ` [PATCH 6/7] drm/exynos: mixer: remove support for non-dt platforms Marek Szyprowski
@ 2016-04-01 13:17 ` Marek Szyprowski
  6 siblings, 0 replies; 10+ messages in thread
From: Marek Szyprowski @ 2016-04-01 13:17 UTC (permalink / raw)
  To: dri-devel, linux-samsung-soc
  Cc: Marek Szyprowski, Inki Dae, Joonyoung Shim, Seung-Woo Kim,
	Andrzej Hajda, Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz

Simplify code by replacing custom code by generic helper.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_mixer.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
index ffafb744154e..caec5e4fb349 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -31,6 +31,7 @@
 #include <linux/clk.h>
 #include <linux/regulator/consumer.h>
 #include <linux/of.h>
+#include <linux/of_device.h>
 #include <linux/component.h>
 
 #include <drm/exynos_drm.h>
@@ -1231,7 +1232,7 @@ static const struct component_ops mixer_component_ops = {
 static int mixer_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
-	struct mixer_drv_data *drv;
+	const struct mixer_drv_data *drv;
 	struct mixer_context *ctx;
 	int ret;
 
@@ -1241,12 +1242,7 @@ static int mixer_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
-	if (dev->of_node) {
-		const struct of_device_id *match;
-
-		match = of_match_node(mixer_match_types, dev->of_node);
-		drv = (struct mixer_drv_data *)match->data;
-	}
+	drv = of_device_get_match_data(dev);
 
 	ctx->pdev = pdev;
 	ctx->dev = dev;
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/7] drm/exynos: dsi: use generic of_device_get_match_data helper
  2016-04-01 13:17 ` [PATCH 2/7] drm/exynos: dsi: " Marek Szyprowski
@ 2016-04-18  8:48   ` Inki Dae
  2016-04-19  7:37     ` [PATCH v2] " Marek Szyprowski
  0 siblings, 1 reply; 10+ messages in thread
From: Inki Dae @ 2016-04-18  8:48 UTC (permalink / raw)
  To: Marek Szyprowski, dri-devel, linux-samsung-soc
  Cc: Andrzej Hajda, Krzysztof Kozlowski, Seung-Woo Kim,
	Bartlomiej Zolnierkiewicz

Hi Marek,

2016년 04월 01일 22:17에 Marek Szyprowski 이(가) 쓴 글:
> Simplify code by replacing custom code by generic helper.
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_dsi.c | 11 +----------
>  1 file changed, 1 insertion(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> index 63c84a106c0b..b6518df2411d 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> @@ -532,15 +532,6 @@ static const struct of_device_id exynos_dsi_of_match[] = {
>  	{ }
>  };
>  
> -static inline struct exynos_dsi_driver_data *exynos_dsi_get_driver_data(
> -						struct platform_device *pdev)
> -{
> -	const struct of_device_id *of_id =
> -			of_match_device(exynos_dsi_of_match, &pdev->dev);
> -
> -	return (struct exynos_dsi_driver_data *)of_id->data;
> -}
> -
>  static void exynos_dsi_wait_for_reset(struct exynos_dsi *dsi)
>  {
>  	if (wait_for_completion_timeout(&dsi->completed, msecs_to_jiffies(300)))
> @@ -1833,7 +1824,7 @@ static int exynos_dsi_probe(struct platform_device *pdev)
>  	dsi->dsi_host.dev = dev;
>  
>  	dsi->dev = dev;
> -	dsi->driver_data = exynos_dsi_get_driver_data(pdev);
> +	dsi->driver_data = of_device_get_match_data(dev);

drivers/gpu/drm/exynos/exynos_drm_dsi.c: In function 'exynos_dsi_probe':
drivers/gpu/drm/exynos/exynos_drm_dsi.c:1827:19: warning: assignment discards 'const' qualifier from pointer target type

Looks you missed const prefix and for patch 3 also but I can fix them.

Thanks,
Inki Dae

>  
>  	ret = exynos_dsi_parse_dt(dsi);
>  	if (ret)
> 
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2] drm/exynos: dsi: use generic of_device_get_match_data helper
  2016-04-18  8:48   ` Inki Dae
@ 2016-04-19  7:37     ` Marek Szyprowski
  0 siblings, 0 replies; 10+ messages in thread
From: Marek Szyprowski @ 2016-04-19  7:37 UTC (permalink / raw)
  To: dri-devel, linux-samsung-soc
  Cc: Marek Szyprowski, Inki Dae, Joonyoung Shim, Seung-Woo Kim,
	Andrzej Hajda, Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz

Simplify code by replacing custom code by generic helper and add missing
const qualifier to driver data structures.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
v2:
- added missing const qualifier to driver data structures
---
 drivers/gpu/drm/exynos/exynos_drm_dsi.c | 27 +++++++++------------------
 1 file changed, 9 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
index 63c84a106c0b..72c3565d22ee 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
@@ -280,7 +280,7 @@ struct exynos_dsi {
 	spinlock_t transfer_lock; /* protects transfer_list */
 	struct list_head transfer_list;
 
-	struct exynos_dsi_driver_data *driver_data;
+	const struct exynos_dsi_driver_data *driver_data;
 	struct device_node *bridge_node;
 };
 
@@ -532,15 +532,6 @@ static const struct of_device_id exynos_dsi_of_match[] = {
 	{ }
 };
 
-static inline struct exynos_dsi_driver_data *exynos_dsi_get_driver_data(
-						struct platform_device *pdev)
-{
-	const struct of_device_id *of_id =
-			of_match_device(exynos_dsi_of_match, &pdev->dev);
-
-	return (struct exynos_dsi_driver_data *)of_id->data;
-}
-
 static void exynos_dsi_wait_for_reset(struct exynos_dsi *dsi)
 {
 	if (wait_for_completion_timeout(&dsi->completed, msecs_to_jiffies(300)))
@@ -564,7 +555,7 @@ static void exynos_dsi_reset(struct exynos_dsi *dsi)
 static unsigned long exynos_dsi_pll_find_pms(struct exynos_dsi *dsi,
 		unsigned long fin, unsigned long fout, u8 *p, u16 *m, u8 *s)
 {
-	struct exynos_dsi_driver_data *driver_data = dsi->driver_data;
+	const struct exynos_dsi_driver_data *driver_data = dsi->driver_data;
 	unsigned long best_freq = 0;
 	u32 min_delta = 0xffffffff;
 	u8 p_min, p_max;
@@ -618,7 +609,7 @@ static unsigned long exynos_dsi_pll_find_pms(struct exynos_dsi *dsi,
 static unsigned long exynos_dsi_set_pll(struct exynos_dsi *dsi,
 					unsigned long freq)
 {
-	struct exynos_dsi_driver_data *driver_data = dsi->driver_data;
+	const struct exynos_dsi_driver_data *driver_data = dsi->driver_data;
 	unsigned long fin, fout;
 	int timeout;
 	u8 p, s;
@@ -712,7 +703,7 @@ static int exynos_dsi_enable_clock(struct exynos_dsi *dsi)
 
 static void exynos_dsi_set_phy_ctrl(struct exynos_dsi *dsi)
 {
-	struct exynos_dsi_driver_data *driver_data = dsi->driver_data;
+	const struct exynos_dsi_driver_data *driver_data = dsi->driver_data;
 	const unsigned int *reg_values = driver_data->reg_values;
 	u32 reg;
 
@@ -790,7 +781,7 @@ static void exynos_dsi_enable_lane(struct exynos_dsi *dsi, u32 lane)
 
 static int exynos_dsi_init_link(struct exynos_dsi *dsi)
 {
-	struct exynos_dsi_driver_data *driver_data = dsi->driver_data;
+	const struct exynos_dsi_driver_data *driver_data = dsi->driver_data;
 	int timeout;
 	u32 reg;
 	u32 lanes_mask;
@@ -1334,7 +1325,7 @@ static void exynos_dsi_disable_irq(struct exynos_dsi *dsi)
 
 static int exynos_dsi_init(struct exynos_dsi *dsi)
 {
-	struct exynos_dsi_driver_data *driver_data = dsi->driver_data;
+	const struct exynos_dsi_driver_data *driver_data = dsi->driver_data;
 
 	exynos_dsi_reset(dsi);
 	exynos_dsi_enable_irq(dsi);
@@ -1833,7 +1824,7 @@ static int exynos_dsi_probe(struct platform_device *pdev)
 	dsi->dsi_host.dev = dev;
 
 	dsi->dev = dev;
-	dsi->driver_data = exynos_dsi_get_driver_data(pdev);
+	dsi->driver_data = of_device_get_match_data(dev);
 
 	ret = exynos_dsi_parse_dt(dsi);
 	if (ret)
@@ -1917,7 +1908,7 @@ static int __maybe_unused exynos_dsi_suspend(struct device *dev)
 {
 	struct drm_encoder *encoder = dev_get_drvdata(dev);
 	struct exynos_dsi *dsi = encoder_to_dsi(encoder);
-	struct exynos_dsi_driver_data *driver_data = dsi->driver_data;
+	const struct exynos_dsi_driver_data *driver_data = dsi->driver_data;
 	int ret, i;
 
 	usleep_range(10000, 20000);
@@ -1948,7 +1939,7 @@ static int __maybe_unused exynos_dsi_resume(struct device *dev)
 {
 	struct drm_encoder *encoder = dev_get_drvdata(dev);
 	struct exynos_dsi *dsi = encoder_to_dsi(encoder);
-	struct exynos_dsi_driver_data *driver_data = dsi->driver_data;
+	const struct exynos_dsi_driver_data *driver_data = dsi->driver_data;
 	int ret, i;
 
 	ret = regulator_bulk_enable(ARRAY_SIZE(dsi->supplies), dsi->supplies);
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-04-19  7:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-01 13:17 [PATCH 0/7] Exynos DRM: use of_device_get_match_data helper Marek Szyprowski
2016-04-01 13:17 ` [PATCH 1/7] drm/exynos: exynos5433_decon: use generic " Marek Szyprowski
2016-04-01 13:17 ` [PATCH 2/7] drm/exynos: dsi: " Marek Szyprowski
2016-04-18  8:48   ` Inki Dae
2016-04-19  7:37     ` [PATCH v2] " Marek Szyprowski
2016-04-01 13:17 ` [PATCH 3/7] drm/exynos: fimd: " Marek Szyprowski
2016-04-01 13:17 ` [PATCH 4/7] drm/exynos: rotator: " Marek Szyprowski
2016-04-01 13:17 ` [PATCH 5/7] drm/exynos: hdmi: " Marek Szyprowski
2016-04-01 13:17 ` [PATCH 6/7] drm/exynos: mixer: remove support for non-dt platforms Marek Szyprowski
2016-04-01 13:17 ` [PATCH 7/7] drm/exynos: mixer: use generic of_device_get_match_data helper Marek Szyprowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox