All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] drm/exynos: Use devm_* functions in exynos_drm_fimd.c
@ 2012-06-19  6:17 Sachin Kamat
  2012-06-19  6:17 ` [PATCH 2/3] drm/exynos: Use devm_* functions in exynos_hdmi.c Sachin Kamat
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Sachin Kamat @ 2012-06-19  6:17 UTC (permalink / raw)
  To: dri-devel; +Cc: inki.dae, patches, sachin.kamat

devm_* functions are device managed functions and make error handling
and cleanup cleaner and simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Sachin Kamat <sachin.kamat@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |   40 ++++++------------------------
 1 files changed, 8 insertions(+), 32 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 29fdbfe..a68d2b3 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -78,7 +78,6 @@ struct fimd_context {
 	struct drm_crtc			*crtc;
 	struct clk			*bus_clk;
 	struct clk			*lcd_clk;
-	struct resource			*regs_res;
 	void __iomem			*regs;
 	struct fimd_win_data		win_data[WINDOWS_NR];
 	unsigned int			clkdiv;
@@ -813,7 +812,7 @@ static int __devinit fimd_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
+	ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
 	if (!ctx)
 		return -ENOMEM;
 
@@ -838,33 +837,26 @@ static int __devinit fimd_probe(struct platform_device *pdev)
 		goto err_clk;
 	}
 
-	ctx->regs_res = request_mem_region(res->start, resource_size(res),
-					   dev_name(dev));
-	if (!ctx->regs_res) {
-		dev_err(dev, "failed to claim register region\n");
-		ret = -ENOENT;
-		goto err_clk;
-	}
-
-	ctx->regs = ioremap(res->start, resource_size(res));
+	ctx->regs = devm_request_and_ioremap(&pdev->dev, res);
 	if (!ctx->regs) {
 		dev_err(dev, "failed to map registers\n");
 		ret = -ENXIO;
-		goto err_req_region_io;
+		goto err_clk;
 	}
 
 	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
 	if (!res) {
 		dev_err(dev, "irq request failed.\n");
-		goto err_req_region_irq;
+		goto err_clk;
 	}
 
 	ctx->irq = res->start;
 
-	ret = request_irq(ctx->irq, fimd_irq_handler, 0, "drm_fimd", ctx);
-	if (ret < 0) {
+	ret = devm_request_irq(&pdev->dev, ctx->irq, fimd_irq_handler,
+							0, "drm_fimd", ctx);
+	if (ret) {
 		dev_err(dev, "irq request failed.\n");
-		goto err_req_irq;
+		goto err_clk;
 	}
 
 	ctx->vidcon0 = pdata->vidcon0;
@@ -899,14 +891,6 @@ static int __devinit fimd_probe(struct platform_device *pdev)
 
 	return 0;
 
-err_req_irq:
-err_req_region_irq:
-	iounmap(ctx->regs);
-
-err_req_region_io:
-	release_resource(ctx->regs_res);
-	kfree(ctx->regs_res);
-
 err_clk:
 	clk_disable(ctx->lcd_clk);
 	clk_put(ctx->lcd_clk);
@@ -916,7 +900,6 @@ err_bus_clk:
 	clk_put(ctx->bus_clk);
 
 err_clk_get:
-	kfree(ctx);
 	return ret;
 }
 
@@ -944,13 +927,6 @@ out:
 	clk_put(ctx->lcd_clk);
 	clk_put(ctx->bus_clk);
 
-	iounmap(ctx->regs);
-	release_resource(ctx->regs_res);
-	kfree(ctx->regs_res);
-	free_irq(ctx->irq, ctx);
-
-	kfree(ctx);
-
 	return 0;
 }
 
-- 
1.7.4.1

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

* [PATCH 2/3] drm/exynos: Use devm_* functions in exynos_hdmi.c
  2012-06-19  6:17 [PATCH 1/3] drm/exynos: Use devm_* functions in exynos_drm_fimd.c Sachin Kamat
@ 2012-06-19  6:17 ` Sachin Kamat
  2012-06-20 11:20   ` InKi Dae
  2012-06-19  6:17 ` [PATCH 3/3] drm/exynos: Use devm_* functions in exynos_mixer.c Sachin Kamat
  2012-06-20 11:16 ` [PATCH 1/3] drm/exynos: Use devm_* functions in exynos_drm_fimd.c InKi Dae
  2 siblings, 1 reply; 6+ messages in thread
From: Sachin Kamat @ 2012-06-19  6:17 UTC (permalink / raw)
  To: dri-devel; +Cc: inki.dae, patches, sachin.kamat

devm_* functions are device managed functions and make error handling
and cleanup cleaner and simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Sachin Kamat <sachin.kamat@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_hdmi.c |   36 ++++++---------------------------
 1 files changed, 7 insertions(+), 29 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index a137e9e..5816b0f 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -63,7 +63,6 @@ struct hdmi_context {
 	bool				dvi_mode;
 	struct mutex			hdmi_mutex;
 
-	struct resource			*regs_res;
 	void __iomem			*regs;
 	unsigned int			external_irq;
 	unsigned int			internal_irq;
@@ -2280,16 +2279,17 @@ static int __devinit hdmi_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	drm_hdmi_ctx = kzalloc(sizeof(*drm_hdmi_ctx), GFP_KERNEL);
+	drm_hdmi_ctx = devm_kzalloc(&pdev->dev, sizeof(*drm_hdmi_ctx),
+								GFP_KERNEL);
 	if (!drm_hdmi_ctx) {
 		DRM_ERROR("failed to allocate common hdmi context.\n");
 		return -ENOMEM;
 	}
 
-	hdata = kzalloc(sizeof(struct hdmi_context), GFP_KERNEL);
+	hdata = devm_kzalloc(&pdev->dev, sizeof(struct hdmi_context),
+								GFP_KERNEL);
 	if (!hdata) {
 		DRM_ERROR("out of memory\n");
-		kfree(drm_hdmi_ctx);
 		return -ENOMEM;
 	}
 
@@ -2318,26 +2318,18 @@ static int __devinit hdmi_probe(struct platform_device *pdev)
 		goto err_resource;
 	}
 
-	hdata->regs_res = request_mem_region(res->start, resource_size(res),
-					   dev_name(dev));
-	if (!hdata->regs_res) {
-		DRM_ERROR("failed to claim register region\n");
-		ret = -ENOENT;
-		goto err_resource;
-	}
-
-	hdata->regs = ioremap(res->start, resource_size(res));
+	hdata->regs = devm_request_and_ioremap(&pdev->dev, res);
 	if (!hdata->regs) {
 		DRM_ERROR("failed to map registers\n");
 		ret = -ENXIO;
-		goto err_req_region;
+		goto err_resource;
 	}
 
 	/* DDC i2c driver */
 	if (i2c_add_driver(&ddc_driver)) {
 		DRM_ERROR("failed to register ddc i2c driver\n");
 		ret = -ENOENT;
-		goto err_iomap;
+		goto err_resource;
 	}
 
 	hdata->ddc_port = hdmi_ddc;
@@ -2398,16 +2390,9 @@ err_hdmiphy:
 	i2c_del_driver(&hdmiphy_driver);
 err_ddc:
 	i2c_del_driver(&ddc_driver);
-err_iomap:
-	iounmap(hdata->regs);
-err_req_region:
-	release_mem_region(hdata->regs_res->start,
-			resource_size(hdata->regs_res));
 err_resource:
 	hdmi_resources_cleanup(hdata);
 err_data:
-	kfree(hdata);
-	kfree(drm_hdmi_ctx);
 	return ret;
 }
 
@@ -2425,18 +2410,11 @@ static int __devexit hdmi_remove(struct platform_device *pdev)
 
 	hdmi_resources_cleanup(hdata);
 
-	iounmap(hdata->regs);
-
-	release_mem_region(hdata->regs_res->start,
-			resource_size(hdata->regs_res));
-
 	/* hdmiphy i2c driver */
 	i2c_del_driver(&hdmiphy_driver);
 	/* DDC i2c driver */
 	i2c_del_driver(&ddc_driver);
 
-	kfree(hdata);
-
 	return 0;
 }
 
-- 
1.7.4.1

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

* [PATCH 3/3] drm/exynos: Use devm_* functions in exynos_mixer.c
  2012-06-19  6:17 [PATCH 1/3] drm/exynos: Use devm_* functions in exynos_drm_fimd.c Sachin Kamat
  2012-06-19  6:17 ` [PATCH 2/3] drm/exynos: Use devm_* functions in exynos_hdmi.c Sachin Kamat
@ 2012-06-19  6:17 ` Sachin Kamat
  2012-06-20 11:24   ` InKi Dae
  2012-06-20 11:16 ` [PATCH 1/3] drm/exynos: Use devm_* functions in exynos_drm_fimd.c InKi Dae
  2 siblings, 1 reply; 6+ messages in thread
From: Sachin Kamat @ 2012-06-19  6:17 UTC (permalink / raw)
  To: dri-devel; +Cc: inki.dae, patches, sachin.kamat

devm_* functions are device managed functions and make error handling
and cleanup cleaner and simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Sachin Kamat <sachin.kamat@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_mixer.c |   48 +++++++++-----------------------
 1 files changed, 14 insertions(+), 34 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
index e2147a2..30fcc12 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -956,7 +956,8 @@ static int __devinit mixer_resources_init(struct exynos_drm_hdmi_context *ctx,
 
 	clk_set_parent(mixer_res->sclk_mixer, mixer_res->sclk_hdmi);
 
-	mixer_res->mixer_regs = ioremap(res->start, resource_size(res));
+	mixer_res->mixer_regs = devm_ioremap(&pdev->dev, res->start,
+							resource_size(res));
 	if (mixer_res->mixer_regs == NULL) {
 		dev_err(dev, "register mapping failed.\n");
 		ret = -ENXIO;
@@ -967,38 +968,34 @@ static int __devinit mixer_resources_init(struct exynos_drm_hdmi_context *ctx,
 	if (res == NULL) {
 		dev_err(dev, "get memory resource failed.\n");
 		ret = -ENXIO;
-		goto fail_mixer_regs;
+		goto fail;
 	}
 
-	mixer_res->vp_regs = ioremap(res->start, resource_size(res));
+	mixer_res->vp_regs = devm_ioremap(&pdev->dev, res->start,
+							resource_size(res));
 	if (mixer_res->vp_regs == NULL) {
 		dev_err(dev, "register mapping failed.\n");
 		ret = -ENXIO;
-		goto fail_mixer_regs;
+		goto fail;
 	}
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "irq");
 	if (res == NULL) {
 		dev_err(dev, "get interrupt resource failed.\n");
 		ret = -ENXIO;
-		goto fail_vp_regs;
+		goto fail;
 	}
 
-	ret = request_irq(res->start, mixer_irq_handler, 0, "drm_mixer", ctx);
+	ret = devm_request_irq(&pdev->dev, res->start, mixer_irq_handler,
+							0, "drm_mixer", ctx);
 	if (ret) {
 		dev_err(dev, "request interrupt failed.\n");
-		goto fail_vp_regs;
+		goto fail;
 	}
 	mixer_res->irq = res->start;
 
 	return 0;
 
-fail_vp_regs:
-	iounmap(mixer_res->vp_regs);
-
-fail_mixer_regs:
-	iounmap(mixer_res->mixer_regs);
-
 fail:
 	if (!IS_ERR_OR_NULL(mixer_res->sclk_dac))
 		clk_put(mixer_res->sclk_dac);
@@ -1013,16 +1010,6 @@ fail:
 	return ret;
 }
 
-static void mixer_resources_cleanup(struct mixer_context *ctx)
-{
-	struct mixer_resources *res = &ctx->mixer_res;
-
-	free_irq(res->irq, ctx);
-
-	iounmap(res->vp_regs);
-	iounmap(res->mixer_regs);
-}
-
 static int __devinit mixer_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
@@ -1032,16 +1019,16 @@ static int __devinit mixer_probe(struct platform_device *pdev)
 
 	dev_info(dev, "probe start\n");
 
-	drm_hdmi_ctx = kzalloc(sizeof(*drm_hdmi_ctx), GFP_KERNEL);
+	drm_hdmi_ctx = devm_kzalloc(&pdev->dev, sizeof(*drm_hdmi_ctx),
+								GFP_KERNEL);
 	if (!drm_hdmi_ctx) {
 		DRM_ERROR("failed to allocate common hdmi context.\n");
 		return -ENOMEM;
 	}
 
-	ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
+	ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
 	if (!ctx) {
 		DRM_ERROR("failed to alloc mixer context.\n");
-		kfree(drm_hdmi_ctx);
 		return -ENOMEM;
 	}
 
@@ -1072,17 +1059,10 @@ fail:
 
 static int mixer_remove(struct platform_device *pdev)
 {
-	struct device *dev = &pdev->dev;
-	struct exynos_drm_hdmi_context *drm_hdmi_ctx =
-					platform_get_drvdata(pdev);
-	struct mixer_context *ctx = drm_hdmi_ctx->ctx;
-
-	dev_info(dev, "remove successful\n");
+	dev_info(&pdev->dev, "remove successful\n");
 
 	pm_runtime_disable(&pdev->dev);
 
-	mixer_resources_cleanup(ctx);
-
 	return 0;
 }
 
-- 
1.7.4.1

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

* Re: [PATCH 1/3] drm/exynos: Use devm_* functions in exynos_drm_fimd.c
  2012-06-19  6:17 [PATCH 1/3] drm/exynos: Use devm_* functions in exynos_drm_fimd.c Sachin Kamat
  2012-06-19  6:17 ` [PATCH 2/3] drm/exynos: Use devm_* functions in exynos_hdmi.c Sachin Kamat
  2012-06-19  6:17 ` [PATCH 3/3] drm/exynos: Use devm_* functions in exynos_mixer.c Sachin Kamat
@ 2012-06-20 11:16 ` InKi Dae
  2 siblings, 0 replies; 6+ messages in thread
From: InKi Dae @ 2012-06-20 11:16 UTC (permalink / raw)
  To: Sachin Kamat; +Cc: inki.dae, dri-devel, patches

2012/6/19, Sachin Kamat <sachin.kamat@linaro.org>:
> devm_* functions are device managed functions and make error handling
> and cleanup cleaner and simpler.
>
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> Signed-off-by: Sachin Kamat <sachin.kamat@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_fimd.c |   40
> ++++++------------------------
>  1 files changed, 8 insertions(+), 32 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> index 29fdbfe..a68d2b3 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> @@ -78,7 +78,6 @@ struct fimd_context {
>  	struct drm_crtc			*crtc;
>  	struct clk			*bus_clk;
>  	struct clk			*lcd_clk;
> -	struct resource			*regs_res;
>  	void __iomem			*regs;
>  	struct fimd_win_data		win_data[WINDOWS_NR];
>  	unsigned int			clkdiv;
> @@ -813,7 +812,7 @@ static int __devinit fimd_probe(struct platform_device
> *pdev)
>  		return -EINVAL;
>  	}
>
> -	ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
> +	ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
>  	if (!ctx)
>  		return -ENOMEM;
>
> @@ -838,33 +837,26 @@ static int __devinit fimd_probe(struct platform_device
> *pdev)
>  		goto err_clk;
>  	}
>
> -	ctx->regs_res = request_mem_region(res->start, resource_size(res),
> -					   dev_name(dev));
> -	if (!ctx->regs_res) {
> -		dev_err(dev, "failed to claim register region\n");
> -		ret = -ENOENT;
> -		goto err_clk;
> -	}
> -
> -	ctx->regs = ioremap(res->start, resource_size(res));
> +	ctx->regs = devm_request_and_ioremap(&pdev->dev, res);
>  	if (!ctx->regs) {
>  		dev_err(dev, "failed to map registers\n");
>  		ret = -ENXIO;
> -		goto err_req_region_io;
> +		goto err_clk;
>  	}
>
>  	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
>  	if (!res) {
>  		dev_err(dev, "irq request failed.\n");
> -		goto err_req_region_irq;
> +		goto err_clk;
>  	}
>
>  	ctx->irq = res->start;
>
> -	ret = request_irq(ctx->irq, fimd_irq_handler, 0, "drm_fimd", ctx);
> -	if (ret < 0) {
> +	ret = devm_request_irq(&pdev->dev, ctx->irq, fimd_irq_handler,
> +							0, "drm_fimd", ctx);
> +	if (ret) {
>  		dev_err(dev, "irq request failed.\n");
> -		goto err_req_irq;
> +		goto err_clk;
>  	}
>
>  	ctx->vidcon0 = pdata->vidcon0;
> @@ -899,14 +891,6 @@ static int __devinit fimd_probe(struct platform_device
> *pdev)
>
>  	return 0;
>
> -err_req_irq:
> -err_req_region_irq:
> -	iounmap(ctx->regs);
> -
> -err_req_region_io:
> -	release_resource(ctx->regs_res);
> -	kfree(ctx->regs_res);
> -
>  err_clk:
>  	clk_disable(ctx->lcd_clk);
>  	clk_put(ctx->lcd_clk);
> @@ -916,7 +900,6 @@ err_bus_clk:
>  	clk_put(ctx->bus_clk);
>
>  err_clk_get:
> -	kfree(ctx);
>  	return ret;
>  }
>
> @@ -944,13 +927,6 @@ out:
>  	clk_put(ctx->lcd_clk);
>  	clk_put(ctx->bus_clk);
>
> -	iounmap(ctx->regs);
> -	release_resource(ctx->regs_res);
> -	kfree(ctx->regs_res);
> -	free_irq(ctx->irq, ctx);
> -
> -	kfree(ctx);
> -
>  	return 0;
>  }
>
> --
> 1.7.4.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>

Applied.

Thanks,
Inki Dae

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

* Re: [PATCH 2/3] drm/exynos: Use devm_* functions in exynos_hdmi.c
  2012-06-19  6:17 ` [PATCH 2/3] drm/exynos: Use devm_* functions in exynos_hdmi.c Sachin Kamat
@ 2012-06-20 11:20   ` InKi Dae
  0 siblings, 0 replies; 6+ messages in thread
From: InKi Dae @ 2012-06-20 11:20 UTC (permalink / raw)
  To: Sachin Kamat; +Cc: inki.dae, dri-devel, patches

2012/6/19, Sachin Kamat <sachin.kamat@linaro.org>:
> devm_* functions are device managed functions and make error handling
> and cleanup cleaner and simpler.
>
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> Signed-off-by: Sachin Kamat <sachin.kamat@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_hdmi.c |   36
> ++++++---------------------------
>  1 files changed, 7 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c
> b/drivers/gpu/drm/exynos/exynos_hdmi.c
> index a137e9e..5816b0f 100644
> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
> @@ -63,7 +63,6 @@ struct hdmi_context {
>  	bool				dvi_mode;
>  	struct mutex			hdmi_mutex;
>
> -	struct resource			*regs_res;
>  	void __iomem			*regs;
>  	unsigned int			external_irq;
>  	unsigned int			internal_irq;
> @@ -2280,16 +2279,17 @@ static int __devinit hdmi_probe(struct
> platform_device *pdev)
>  		return -EINVAL;
>  	}
>
> -	drm_hdmi_ctx = kzalloc(sizeof(*drm_hdmi_ctx), GFP_KERNEL);
> +	drm_hdmi_ctx = devm_kzalloc(&pdev->dev, sizeof(*drm_hdmi_ctx),
> +								GFP_KERNEL);
>  	if (!drm_hdmi_ctx) {
>  		DRM_ERROR("failed to allocate common hdmi context.\n");
>  		return -ENOMEM;
>  	}
>
> -	hdata = kzalloc(sizeof(struct hdmi_context), GFP_KERNEL);
> +	hdata = devm_kzalloc(&pdev->dev, sizeof(struct hdmi_context),
> +								GFP_KERNEL);
>  	if (!hdata) {
>  		DRM_ERROR("out of memory\n");
> -		kfree(drm_hdmi_ctx);
>  		return -ENOMEM;
>  	}
>
> @@ -2318,26 +2318,18 @@ static int __devinit hdmi_probe(struct
> platform_device *pdev)
>  		goto err_resource;
>  	}
>
> -	hdata->regs_res = request_mem_region(res->start, resource_size(res),
> -					   dev_name(dev));
> -	if (!hdata->regs_res) {
> -		DRM_ERROR("failed to claim register region\n");
> -		ret = -ENOENT;
> -		goto err_resource;
> -	}
> -
> -	hdata->regs = ioremap(res->start, resource_size(res));
> +	hdata->regs = devm_request_and_ioremap(&pdev->dev, res);
>  	if (!hdata->regs) {
>  		DRM_ERROR("failed to map registers\n");
>  		ret = -ENXIO;
> -		goto err_req_region;
> +		goto err_resource;
>  	}
>
>  	/* DDC i2c driver */
>  	if (i2c_add_driver(&ddc_driver)) {
>  		DRM_ERROR("failed to register ddc i2c driver\n");
>  		ret = -ENOENT;
> -		goto err_iomap;
> +		goto err_resource;
>  	}
>
>  	hdata->ddc_port = hdmi_ddc;
> @@ -2398,16 +2390,9 @@ err_hdmiphy:
>  	i2c_del_driver(&hdmiphy_driver);
>  err_ddc:
>  	i2c_del_driver(&ddc_driver);
> -err_iomap:
> -	iounmap(hdata->regs);
> -err_req_region:
> -	release_mem_region(hdata->regs_res->start,
> -			resource_size(hdata->regs_res));
>  err_resource:
>  	hdmi_resources_cleanup(hdata);
>  err_data:
> -	kfree(hdata);
> -	kfree(drm_hdmi_ctx);
>  	return ret;
>  }
>
> @@ -2425,18 +2410,11 @@ static int __devexit hdmi_remove(struct
> platform_device *pdev)
>
>  	hdmi_resources_cleanup(hdata);
>
> -	iounmap(hdata->regs);
> -
> -	release_mem_region(hdata->regs_res->start,
> -			resource_size(hdata->regs_res));
> -
>  	/* hdmiphy i2c driver */
>  	i2c_del_driver(&hdmiphy_driver);
>  	/* DDC i2c driver */
>  	i2c_del_driver(&ddc_driver);
>
> -	kfree(hdata);
> -
>  	return 0;
>  }
>
> --
> 1.7.4.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>

Applied.

Thanks,
Inki Dae

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

* Re: [PATCH 3/3] drm/exynos: Use devm_* functions in exynos_mixer.c
  2012-06-19  6:17 ` [PATCH 3/3] drm/exynos: Use devm_* functions in exynos_mixer.c Sachin Kamat
@ 2012-06-20 11:24   ` InKi Dae
  0 siblings, 0 replies; 6+ messages in thread
From: InKi Dae @ 2012-06-20 11:24 UTC (permalink / raw)
  To: Sachin Kamat; +Cc: inki.dae, dri-devel, patches

2012/6/19, Sachin Kamat <sachin.kamat@linaro.org>:
> devm_* functions are device managed functions and make error handling
> and cleanup cleaner and simpler.
>
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> Signed-off-by: Sachin Kamat <sachin.kamat@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_mixer.c |   48
> +++++++++-----------------------
>  1 files changed, 14 insertions(+), 34 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c
> b/drivers/gpu/drm/exynos/exynos_mixer.c
> index e2147a2..30fcc12 100644
> --- a/drivers/gpu/drm/exynos/exynos_mixer.c
> +++ b/drivers/gpu/drm/exynos/exynos_mixer.c
> @@ -956,7 +956,8 @@ static int __devinit mixer_resources_init(struct
> exynos_drm_hdmi_context *ctx,
>
>  	clk_set_parent(mixer_res->sclk_mixer, mixer_res->sclk_hdmi);
>
> -	mixer_res->mixer_regs = ioremap(res->start, resource_size(res));
> +	mixer_res->mixer_regs = devm_ioremap(&pdev->dev, res->start,
> +							resource_size(res));
>  	if (mixer_res->mixer_regs == NULL) {
>  		dev_err(dev, "register mapping failed.\n");
>  		ret = -ENXIO;
> @@ -967,38 +968,34 @@ static int __devinit mixer_resources_init(struct
> exynos_drm_hdmi_context *ctx,
>  	if (res == NULL) {
>  		dev_err(dev, "get memory resource failed.\n");
>  		ret = -ENXIO;
> -		goto fail_mixer_regs;
> +		goto fail;
>  	}
>
> -	mixer_res->vp_regs = ioremap(res->start, resource_size(res));
> +	mixer_res->vp_regs = devm_ioremap(&pdev->dev, res->start,
> +							resource_size(res));
>  	if (mixer_res->vp_regs == NULL) {
>  		dev_err(dev, "register mapping failed.\n");
>  		ret = -ENXIO;
> -		goto fail_mixer_regs;
> +		goto fail;
>  	}
>
>  	res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "irq");
>  	if (res == NULL) {
>  		dev_err(dev, "get interrupt resource failed.\n");
>  		ret = -ENXIO;
> -		goto fail_vp_regs;
> +		goto fail;
>  	}
>
> -	ret = request_irq(res->start, mixer_irq_handler, 0, "drm_mixer", ctx);
> +	ret = devm_request_irq(&pdev->dev, res->start, mixer_irq_handler,
> +							0, "drm_mixer", ctx);
>  	if (ret) {
>  		dev_err(dev, "request interrupt failed.\n");
> -		goto fail_vp_regs;
> +		goto fail;
>  	}
>  	mixer_res->irq = res->start;
>
>  	return 0;
>
> -fail_vp_regs:
> -	iounmap(mixer_res->vp_regs);
> -
> -fail_mixer_regs:
> -	iounmap(mixer_res->mixer_regs);
> -
>  fail:
>  	if (!IS_ERR_OR_NULL(mixer_res->sclk_dac))
>  		clk_put(mixer_res->sclk_dac);
> @@ -1013,16 +1010,6 @@ fail:
>  	return ret;
>  }
>
> -static void mixer_resources_cleanup(struct mixer_context *ctx)
> -{
> -	struct mixer_resources *res = &ctx->mixer_res;
> -
> -	free_irq(res->irq, ctx);
> -
> -	iounmap(res->vp_regs);
> -	iounmap(res->mixer_regs);
> -}
> -
>  static int __devinit mixer_probe(struct platform_device *pdev)
>  {
>  	struct device *dev = &pdev->dev;
> @@ -1032,16 +1019,16 @@ static int __devinit mixer_probe(struct
> platform_device *pdev)
>
>  	dev_info(dev, "probe start\n");
>
> -	drm_hdmi_ctx = kzalloc(sizeof(*drm_hdmi_ctx), GFP_KERNEL);
> +	drm_hdmi_ctx = devm_kzalloc(&pdev->dev, sizeof(*drm_hdmi_ctx),
> +								GFP_KERNEL);
>  	if (!drm_hdmi_ctx) {
>  		DRM_ERROR("failed to allocate common hdmi context.\n");
>  		return -ENOMEM;
>  	}
>
> -	ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
> +	ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
>  	if (!ctx) {
>  		DRM_ERROR("failed to alloc mixer context.\n");
> -		kfree(drm_hdmi_ctx);
>  		return -ENOMEM;
>  	}
>
> @@ -1072,17 +1059,10 @@ fail:
>
>  static int mixer_remove(struct platform_device *pdev)
>  {
> -	struct device *dev = &pdev->dev;
> -	struct exynos_drm_hdmi_context *drm_hdmi_ctx =
> -					platform_get_drvdata(pdev);
> -	struct mixer_context *ctx = drm_hdmi_ctx->ctx;
> -
> -	dev_info(dev, "remove successful\n");
> +	dev_info(&pdev->dev, "remove successful\n");
>
>  	pm_runtime_disable(&pdev->dev);
>
> -	mixer_resources_cleanup(ctx);
> -
>  	return 0;
>  }
>
> --
> 1.7.4.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>

Applied.

Thanks,
Inki Dae

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

end of thread, other threads:[~2012-06-20 11:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-19  6:17 [PATCH 1/3] drm/exynos: Use devm_* functions in exynos_drm_fimd.c Sachin Kamat
2012-06-19  6:17 ` [PATCH 2/3] drm/exynos: Use devm_* functions in exynos_hdmi.c Sachin Kamat
2012-06-20 11:20   ` InKi Dae
2012-06-19  6:17 ` [PATCH 3/3] drm/exynos: Use devm_* functions in exynos_mixer.c Sachin Kamat
2012-06-20 11:24   ` InKi Dae
2012-06-20 11:16 ` [PATCH 1/3] drm/exynos: Use devm_* functions in exynos_drm_fimd.c InKi Dae

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.