devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
To: Mateusz Krawczuk <m.krawczuk@partner.samsung.com>
Cc: kgene.kim@samsung.com, kyungmin.park@samsung.com,
	t.figa@samsung.com, tomasz.figa@gmail.com,
	rob.herring@calxeda.com, pawel.moll@arm.com,
	mark.rutland@arm.com, swarren@wwwdotorg.org,
	ian.campbell@citrix.com, rob@landley.net, mturquette@linaro.org,
	thomas.abraham@linaro.org, t.stanislaws@samsung.com,
	m.chehab@samsung.com, s.nawrocki@samsung.com,
	m.szyprowski@samung.com, linux-kernel@vger.kernel.org,
	linux-samsung-soc@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux@arm.linux.org.uk,
	devicetree@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH RFC 2/5] media: s5p-tv: Fix mixer driver to work with CCF
Date: Mon, 26 Aug 2013 18:03:59 +0200	[thread overview]
Message-ID: <6152934.i30tL7314f@amdc1032> (raw)
In-Reply-To: <1377517114-20222-3-git-send-email-m.krawczuk@partner.samsung.com>


Hi,

On Monday, August 26, 2013 01:38:31 PM Mateusz Krawczuk wrote:
> Replace clk_enable by clock_enable_prepare and clk_disable with clk_disable_unprepare.
> Clock prepare is required by Clock Common Framework, and old clock driver didn`t support it.
> Without it Common Clock Framework prints a warning.
> 
> Signed-off-by: Mateusz Krawczuk <m.krawczuk@partner.samsung.com>
> ---
>  drivers/media/platform/s5p-tv/mixer_drv.c | 33 +++++++++++++++++++++++++------
>  1 file changed, 27 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/media/platform/s5p-tv/mixer_drv.c b/drivers/media/platform/s5p-tv/mixer_drv.c
> index 51805a5..f889591 100644
> --- a/drivers/media/platform/s5p-tv/mixer_drv.c
> +++ b/drivers/media/platform/s5p-tv/mixer_drv.c
> @@ -345,21 +345,42 @@ fail:
>  
>  static int mxr_runtime_resume(struct device *dev)
>  {
> +	int ret = 0;

There is no need to initialize it to 0 here.

>  	struct mxr_device *mdev = to_mdev(dev);
>  	struct mxr_resources *res = &mdev->res;
>  
>  	mxr_dbg(mdev, "resume - start\n");
>  	mutex_lock(&mdev->mutex);
>  	/* turn clocks on */
> -	clk_enable(res->mixer);
> -	clk_enable(res->vp);
> -	clk_enable(res->sclk_mixer);
> +	ret = clk_prepare_enable(res->mixer);
> +	if (ret < 0) {
> +		dev_err(dev, "clk_prepare_enable(mixer) failed\n");

There is no consistency in the error messages between patch #1 and #2.

How's about changing error messages in the patch #2 to use

"%s: Failed to prepare and enable mixer clock!", __func__

form?

> +		goto fail;
> +	}
> +	ret = clk_prepare_enable(res->vp);
> +	if (ret < 0) {
> +		dev_err(dev, "clk_prepare_enable(vp) failed\n");
> +		goto fail_mixer;
> +	}
> +	ret = clk_prepare_enable(res->sclk_mixer);
> +	if (ret < 0) {
> +		dev_err(dev, "clk_prepare_enable(sclk_mixer) failed\n");
> +		goto fail_vp;
> +	}
>  	/* apply default configuration */
>  	mxr_reg_reset(mdev);
>  	mxr_dbg(mdev, "resume - finished\n");

While at it the above mxr_dbg() can be moved outside the mutex lock.

>  	mutex_unlock(&mdev->mutex);
>  	return 0;
> +fail_vp:
> +	clk_disable_unprepare(res->vp);
> +fail_mixer:
> +	clk_disable_unprepare(res->mixer);
> +fail:
> +	mutex_unlock(&mdev->mutex);
> +	dev_info(dev, "resume failed\n");

Shouldn't it be dev_err()?

Please also add mxr_dbg(mdev, "resume - finished\n") call here
to match the earlier mxr_dbg(mdev, "resume - start\n") one.

> +	return ret;
>  }
>  
>  static int mxr_runtime_suspend(struct device *dev)
> @@ -369,9 +390,9 @@ static int mxr_runtime_suspend(struct device *dev)
>  	mxr_dbg(mdev, "suspend - start\n");
>  	mutex_lock(&mdev->mutex);
>  	/* turn clocks off */
> -	clk_disable(res->sclk_mixer);
> -	clk_disable(res->vp);
> -	clk_disable(res->mixer);
> +	clk_disable_unprepare(res->sclk_mixer);
> +	clk_disable_unprepare(res->vp);
> +	clk_disable_unprepare(res->mixer);
>  	mutex_unlock(&mdev->mutex);
>  	mxr_dbg(mdev, "suspend - finished\n");
>  	return 0;

While at this driver please note that currently it defines its own macros to
use instead of dev_err(), dev_warn() and dev_info().

drivers/media/platform/s5p-tv/mixer.h:
...
#define mxr_err(mdev, fmt, ...)  dev_err(mdev->dev, fmt, ##__VA_ARGS__)
#define mxr_warn(mdev, fmt, ...) dev_warn(mdev->dev, fmt, ##__VA_ARGS__)
#define mxr_info(mdev, fmt, ...) dev_info(mdev->dev, fmt, ##__VA_ARGS__)
...

Since your patch adds dev_err() and dev_info() instances it would be a good
thing to remove mxr_*() macros in the preparatory patch.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

  reply	other threads:[~2013-08-26 16:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-26 11:38 [PATCH RFC 0/5] ARM: s5pv210: move to common clk framework Mateusz Krawczuk
2013-08-26 11:38 ` [PATCH RFC 1/5] media: s5p-tv: Fix sdo driver to work with CCF Mateusz Krawczuk
2013-08-26 15:32   ` Bartlomiej Zolnierkiewicz
2013-08-26 11:38 ` [PATCH RFC 2/5] media: s5p-tv: Fix mixer " Mateusz Krawczuk
2013-08-26 16:03   ` Bartlomiej Zolnierkiewicz [this message]
2013-08-26 11:38 ` [PATCH RFC 3/5] ARM: samsung: add clock setup for FIMC and FIMD Mateusz Krawczuk
2013-08-26 16:19   ` Bartlomiej Zolnierkiewicz
2013-08-26 18:37     ` Sylwester Nawrocki
2013-08-27  3:07       ` Jingoo Han
2013-08-26 11:38 ` [PATCH RFC 4/5] clk: samsung: Add clock driver for s5pc110/s5pv210 Mateusz Krawczuk
2013-08-26 17:12   ` Bartlomiej Zolnierkiewicz
2013-08-26 11:38 ` [PATCH RFC 5/5] ARM: s5pv210: Migrate clock handling to Common Clock Framework Mateusz Krawczuk
2013-08-26 16:38   ` Bartlomiej Zolnierkiewicz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6152934.i30tL7314f@amdc1032 \
    --to=b.zolnierkie@samsung.com \
    --cc=devicetree@vger.kernel.org \
    --cc=ian.campbell@citrix.com \
    --cc=kgene.kim@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=m.chehab@samsung.com \
    --cc=m.krawczuk@partner.samsung.com \
    --cc=m.szyprowski@samung.com \
    --cc=mark.rutland@arm.com \
    --cc=mturquette@linaro.org \
    --cc=pawel.moll@arm.com \
    --cc=rob.herring@calxeda.com \
    --cc=rob@landley.net \
    --cc=s.nawrocki@samsung.com \
    --cc=swarren@wwwdotorg.org \
    --cc=t.figa@samsung.com \
    --cc=t.stanislaws@samsung.com \
    --cc=thomas.abraham@linaro.org \
    --cc=tomasz.figa@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).