public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Cc: wsa@the-dreams.de, linux-i2c@vger.kernel.org,
	linux-kernel@vger.kernel.org, julia.lawall@lip6.fr
Subject: Re: [PATCH v2] 2c: mv64xxx: Use clk_enable_prepare and clk_disable_unprepare
Date: Fri, 22 Jul 2016 09:28:36 +0200	[thread overview]
Message-ID: <20160722072836.GO5368@pengutronix.de> (raw)
In-Reply-To: <20160720051417.GA21765@amitoj-Inspiron-3542>

there is an i missing in the Subject.

On Wed, Jul 20, 2016 at 10:44:18AM +0530, Amitoj Kaur Chawla wrote:
> Replace clk_enable and clk_prepare with clk_enable_prepare and
> clk_disable and clk_unprepare with clk_disable_unprepare.
> 
> The Coccinelle semantic patch used to make this change is as follows:
> @@
> expression e;
> @@
> 
> - clk_prepare(e);
> - clk_enable(e);
> + clk_prepare_enable(e);
> 
> @@
> expression e;
> @@
> 
> - clk_disable(e);
> - clk_unprepare(e);
> + clk_disable_unprepare(e);
> 
> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
> ---
> Changes in v2:
>         -Rebased patch
> 
>  drivers/i2c/busses/i2c-mv64xxx.c | 18 ++++++------------
>  1 file changed, 6 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
> index 43207f5..79bae48 100644
> --- a/drivers/i2c/busses/i2c-mv64xxx.c
> +++ b/drivers/i2c/busses/i2c-mv64xxx.c
> @@ -910,10 +910,8 @@ mv64xxx_i2c_probe(struct platform_device *pd)
>  #if defined(CONFIG_HAVE_CLK)
>  	/* Not all platforms have a clk */
>  	drv_data->clk = devm_clk_get(&pd->dev, NULL);
> -	if (!IS_ERR(drv_data->clk)) {
> -		clk_prepare(drv_data->clk);
> -		clk_enable(drv_data->clk);
> -	}
> +	if (!IS_ERR(drv_data->clk))
> +		clk_prepare_enable(drv_data->clk);

When you touch this, better add error checking. I wonder why these
functions are not marked __must_check.

Also using IS_ERR(drv_data->clk) is wrong here, becauce devm_clk_get
might return -EPROBE_DEFER.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

      parent reply	other threads:[~2016-07-22  7:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-20  5:14 [PATCH v2] 2c: mv64xxx: Use clk_enable_prepare and clk_disable_unprepare Amitoj Kaur Chawla
2016-07-22  7:14 ` Wolfram Sang
2016-07-22  7:28 ` Uwe Kleine-König [this message]

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=20160722072836.GO5368@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=amitoj1606@gmail.com \
    --cc=julia.lawall@lip6.fr \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wsa@the-dreams.de \
    /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