public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] [media] exynos-gsc: Some fixes and updates
@ 2012-11-26  6:20 Sachin Kamat
  2012-11-26  6:20 ` [PATCH v2 1/3] [media] exynos-gsc: Rearrange error messages for valid prints Sachin Kamat
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Sachin Kamat @ 2012-11-26  6:20 UTC (permalink / raw)
  To: linux-media
  Cc: shaik.ameer, sylvester.nawrocki, s.nawrocki, sachin.kamat,
	patches

Hi Sylwester,

I have re-organised this series as per your suggestion and included your patch
"exynos-gsc: Correct clock handling". However, I have created 3 patches as I
found making them into 2 a little cumbersome. Hope they look good.
This series is based on samsung/for_v3.8 branch of
git://linuxtv.org/snawrocki/media.git

Shaik,
Please test this series at your end.

Sachin Kamat (2):
  [media] exynos-gsc: Rearrange error messages for valid prints
  [media] exynos-gsc: Use devm_clk_get()

Sylwester Nawrocki (1):
  [media] exynos-gsc: Correct clock handling

 drivers/media/platform/exynos-gsc/gsc-core.c |   35 ++++++++++---------------
 1 files changed, 14 insertions(+), 21 deletions(-)

-- 
1.7.4.1


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

* [PATCH v2 1/3] [media] exynos-gsc: Rearrange error messages for valid prints
  2012-11-26  6:20 [PATCH v2 0/3] [media] exynos-gsc: Some fixes and updates Sachin Kamat
@ 2012-11-26  6:20 ` Sachin Kamat
  2012-11-26  6:20 ` [PATCH 2/3] [media] exynos-gsc: Correct clock handling Sachin Kamat
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Sachin Kamat @ 2012-11-26  6:20 UTC (permalink / raw)
  To: linux-media
  Cc: shaik.ameer, sylvester.nawrocki, s.nawrocki, sachin.kamat,
	patches

In case of clk_prepare failure, the function gsc_clk_get also prints
"failed to get clock" which is not correct. Hence move the error
messages to their respective blocks. While at it, also renamed the labels
meaningfully.

Cc: Shaik Ameer Basha <shaik.ameer@samsung.com>
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/media/platform/exynos-gsc/gsc-core.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c
index 6d6f65d..45bcfa7 100644
--- a/drivers/media/platform/exynos-gsc/gsc-core.c
+++ b/drivers/media/platform/exynos-gsc/gsc-core.c
@@ -1017,25 +1017,26 @@ static int gsc_clk_get(struct gsc_dev *gsc)
 	dev_dbg(&gsc->pdev->dev, "gsc_clk_get Called\n");
 
 	gsc->clock = clk_get(&gsc->pdev->dev, GSC_CLOCK_GATE_NAME);
-	if (IS_ERR(gsc->clock))
-		goto err_print;
+	if (IS_ERR(gsc->clock)) {
+		dev_err(&gsc->pdev->dev, "failed to get clock~~~: %s\n",
+			GSC_CLOCK_GATE_NAME);
+		goto err_clk_get;
+	}
 
 	ret = clk_prepare(gsc->clock);
 	if (ret < 0) {
+		dev_err(&gsc->pdev->dev, "clock prepare failed for clock: %s\n",
+			GSC_CLOCK_GATE_NAME);
 		clk_put(gsc->clock);
 		gsc->clock = NULL;
-		goto err;
+		goto err_clk_prepare;
 	}
 
 	return 0;
 
-err:
-	dev_err(&gsc->pdev->dev, "clock prepare failed for clock: %s\n",
-					GSC_CLOCK_GATE_NAME);
+err_clk_prepare:
 	gsc_clk_put(gsc);
-err_print:
-	dev_err(&gsc->pdev->dev, "failed to get clock~~~: %s\n",
-					GSC_CLOCK_GATE_NAME);
+err_clk_get:
 	return -ENXIO;
 }
 
-- 
1.7.4.1


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

* [PATCH 2/3] [media] exynos-gsc: Correct clock handling
  2012-11-26  6:20 [PATCH v2 0/3] [media] exynos-gsc: Some fixes and updates Sachin Kamat
  2012-11-26  6:20 ` [PATCH v2 1/3] [media] exynos-gsc: Rearrange error messages for valid prints Sachin Kamat
@ 2012-11-26  6:20 ` Sachin Kamat
  2012-11-26  6:20 ` [PATCH v2 3/3] [media] exynos-gsc: Use devm_clk_get() Sachin Kamat
  2012-11-27 23:11 ` [PATCH v2 0/3] [media] exynos-gsc: Some fixes and updates Sylwester Nawrocki
  3 siblings, 0 replies; 6+ messages in thread
From: Sachin Kamat @ 2012-11-26  6:20 UTC (permalink / raw)
  To: linux-media
  Cc: shaik.ameer, sylvester.nawrocki, s.nawrocki, sachin.kamat,
	patches

From: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>

Make sure there is no unbalanced clk_unprepare call and add missing
clock release in the driver's remove() callback.

Signed-off-by: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/media/platform/exynos-gsc/gsc-core.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c
index 45bcfa7..c8b82c0 100644
--- a/drivers/media/platform/exynos-gsc/gsc-core.c
+++ b/drivers/media/platform/exynos-gsc/gsc-core.c
@@ -1002,12 +1002,11 @@ static void *gsc_get_drv_data(struct platform_device *pdev)
 
 static void gsc_clk_put(struct gsc_dev *gsc)
 {
-	if (IS_ERR_OR_NULL(gsc->clock))
-		return;
-
-	clk_unprepare(gsc->clock);
-	clk_put(gsc->clock);
-	gsc->clock = NULL;
+	if (!IS_ERR(gsc->clock)) {
+		clk_unprepare(gsc->clock);
+		clk_put(gsc->clock);
+		gsc->clock = NULL;
+	}
 }
 
 static int gsc_clk_get(struct gsc_dev *gsc)
@@ -1028,7 +1027,7 @@ static int gsc_clk_get(struct gsc_dev *gsc)
 		dev_err(&gsc->pdev->dev, "clock prepare failed for clock: %s\n",
 			GSC_CLOCK_GATE_NAME);
 		clk_put(gsc->clock);
-		gsc->clock = NULL;
+		gsc->clock = ERR_PTR(-EINVAL);
 		goto err_clk_prepare;
 	}
 
@@ -1106,6 +1105,7 @@ static int gsc_probe(struct platform_device *pdev)
 	init_waitqueue_head(&gsc->irq_queue);
 	spin_lock_init(&gsc->slock);
 	mutex_init(&gsc->lock);
+	gsc->clock = ERR_PTR(-EINVAL);
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	gsc->regs = devm_request_and_ioremap(dev, res);
@@ -1169,6 +1169,7 @@ static int __devexit gsc_remove(struct platform_device *pdev)
 
 	vb2_dma_contig_cleanup_ctx(gsc->alloc_ctx);
 	pm_runtime_disable(&pdev->dev);
+	gsc_clk_put(gsc);
 
 	dev_dbg(&pdev->dev, "%s driver unloaded\n", pdev->name);
 	return 0;
-- 
1.7.4.1


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

* [PATCH v2 3/3] [media] exynos-gsc: Use devm_clk_get()
  2012-11-26  6:20 [PATCH v2 0/3] [media] exynos-gsc: Some fixes and updates Sachin Kamat
  2012-11-26  6:20 ` [PATCH v2 1/3] [media] exynos-gsc: Rearrange error messages for valid prints Sachin Kamat
  2012-11-26  6:20 ` [PATCH 2/3] [media] exynos-gsc: Correct clock handling Sachin Kamat
@ 2012-11-26  6:20 ` Sachin Kamat
  2012-11-27 23:11 ` [PATCH v2 0/3] [media] exynos-gsc: Some fixes and updates Sylwester Nawrocki
  3 siblings, 0 replies; 6+ messages in thread
From: Sachin Kamat @ 2012-11-26  6:20 UTC (permalink / raw)
  To: linux-media
  Cc: shaik.ameer, sylvester.nawrocki, s.nawrocki, sachin.kamat,
	patches

devm_clk_get() is a device managed function and makes error handling
a bit simpler.

Cc: Shaik Ameer Basha <shaik.ameer@samsung.com>
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/media/platform/exynos-gsc/gsc-core.c |   17 ++++-------------
 1 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c
index c8b82c0..0c22ad5 100644
--- a/drivers/media/platform/exynos-gsc/gsc-core.c
+++ b/drivers/media/platform/exynos-gsc/gsc-core.c
@@ -1002,11 +1002,8 @@ static void *gsc_get_drv_data(struct platform_device *pdev)
 
 static void gsc_clk_put(struct gsc_dev *gsc)
 {
-	if (!IS_ERR(gsc->clock)) {
+	if (!IS_ERR(gsc->clock))
 		clk_unprepare(gsc->clock);
-		clk_put(gsc->clock);
-		gsc->clock = NULL;
-	}
 }
 
 static int gsc_clk_get(struct gsc_dev *gsc)
@@ -1015,28 +1012,22 @@ static int gsc_clk_get(struct gsc_dev *gsc)
 
 	dev_dbg(&gsc->pdev->dev, "gsc_clk_get Called\n");
 
-	gsc->clock = clk_get(&gsc->pdev->dev, GSC_CLOCK_GATE_NAME);
+	gsc->clock = devm_clk_get(&gsc->pdev->dev, GSC_CLOCK_GATE_NAME);
 	if (IS_ERR(gsc->clock)) {
 		dev_err(&gsc->pdev->dev, "failed to get clock~~~: %s\n",
 			GSC_CLOCK_GATE_NAME);
-		goto err_clk_get;
+		return PTR_ERR(gsc->clock);
 	}
 
 	ret = clk_prepare(gsc->clock);
 	if (ret < 0) {
 		dev_err(&gsc->pdev->dev, "clock prepare failed for clock: %s\n",
 			GSC_CLOCK_GATE_NAME);
-		clk_put(gsc->clock);
 		gsc->clock = ERR_PTR(-EINVAL);
-		goto err_clk_prepare;
+		return ret;
 	}
 
 	return 0;
-
-err_clk_prepare:
-	gsc_clk_put(gsc);
-err_clk_get:
-	return -ENXIO;
 }
 
 static int gsc_m2m_suspend(struct gsc_dev *gsc)
-- 
1.7.4.1


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

* Re: [PATCH v2 0/3] [media] exynos-gsc: Some fixes and updates
  2012-11-26  6:20 [PATCH v2 0/3] [media] exynos-gsc: Some fixes and updates Sachin Kamat
                   ` (2 preceding siblings ...)
  2012-11-26  6:20 ` [PATCH v2 3/3] [media] exynos-gsc: Use devm_clk_get() Sachin Kamat
@ 2012-11-27 23:11 ` Sylwester Nawrocki
  2012-11-28  3:37   ` Sachin Kamat
  3 siblings, 1 reply; 6+ messages in thread
From: Sylwester Nawrocki @ 2012-11-27 23:11 UTC (permalink / raw)
  To: Sachin Kamat
  Cc: linux-media, shaik.ameer, sylvester.nawrocki, s.nawrocki, patches

Hi Sachin,

On 11/26/2012 07:20 AM, Sachin Kamat wrote:
> I have re-organised this series as per your suggestion and included your patch
> "exynos-gsc: Correct clock handling". However, I have created 3 patches as I
> found making them into 2 a little cumbersome. Hope they look good.
> This series is based on samsung/for_v3.8 branch of
> git://linuxtv.org/snawrocki/media.git

Thanks, I've put together all exynos-gsc patches into this branch
http://git.infradead.org/users/kmpark/linux-samsung/shortlog/refs/heads/exynos_gsc_v3.8

Please let me know if there is anything missing there.

The other patches are here
http://git.infradead.org/users/kmpark/linux-samsung/shortlog/refs/heads/media_for_v3.8

--

Regards,
Sylwester

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

* Re: [PATCH v2 0/3] [media] exynos-gsc: Some fixes and updates
  2012-11-27 23:11 ` [PATCH v2 0/3] [media] exynos-gsc: Some fixes and updates Sylwester Nawrocki
@ 2012-11-28  3:37   ` Sachin Kamat
  0 siblings, 0 replies; 6+ messages in thread
From: Sachin Kamat @ 2012-11-28  3:37 UTC (permalink / raw)
  To: Sylwester Nawrocki; +Cc: linux-media, shaik.ameer, s.nawrocki, Kamil Debski

Hi Sylwester,

On 28 November 2012 04:41, Sylwester Nawrocki
<sylvester.nawrocki@gmail.com> wrote:
> Hi Sachin,
>
>
> On 11/26/2012 07:20 AM, Sachin Kamat wrote:
>>
>> I have re-organised this series as per your suggestion and included your
>> patch
>> "exynos-gsc: Correct clock handling". However, I have created 3 patches as
>> I
>> found making them into 2 a little cumbersome. Hope they look good.
>> This series is based on samsung/for_v3.8 branch of
>> git://linuxtv.org/snawrocki/media.git
>
>
> Thanks, I've put together all exynos-gsc patches into this branch
> http://git.infradead.org/users/kmpark/linux-samsung/shortlog/refs/heads/exynos_gsc_v3.8
>
> Please let me know if there is anything missing there.
>
> The other patches are here
> http://git.infradead.org/users/kmpark/linux-samsung/shortlog/refs/heads/media_for_v3.8

Thanks Sylwester. All accepted patches are present in the above 2 links.
Awaiting feedback from Kamil for patches related to MFC. G2D etc. in
the previous series.

>
> --
>
> Regards,
> Sylwester



-- 
With warm regards,
Sachin

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

end of thread, other threads:[~2012-11-28  3:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-26  6:20 [PATCH v2 0/3] [media] exynos-gsc: Some fixes and updates Sachin Kamat
2012-11-26  6:20 ` [PATCH v2 1/3] [media] exynos-gsc: Rearrange error messages for valid prints Sachin Kamat
2012-11-26  6:20 ` [PATCH 2/3] [media] exynos-gsc: Correct clock handling Sachin Kamat
2012-11-26  6:20 ` [PATCH v2 3/3] [media] exynos-gsc: Use devm_clk_get() Sachin Kamat
2012-11-27 23:11 ` [PATCH v2 0/3] [media] exynos-gsc: Some fixes and updates Sylwester Nawrocki
2012-11-28  3:37   ` Sachin Kamat

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