All of lore.kernel.org
 help / color / mirror / Atom feed
From: Huang Shijie <b32955@freescale.com>
To: Fabio Estevam <festevam@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>,
	computersforpeace@gmail.com, linux-mtd@lists.infradead.org
Subject: Re: [PATCH] mtd: gpmi: Use devm_clk_get()
Date: Fri, 8 Nov 2013 10:25:46 +0800	[thread overview]
Message-ID: <527C4BAA.40209@freescale.com> (raw)
In-Reply-To: <1383870758-29777-1-git-send-email-festevam@gmail.com>

于 2013年11月08日 08:32, Fabio Estevam 写道:
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> Using devm_clk_get() can make the code smaller and cleaner.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
>  drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 21 ++-------------------
>  1 file changed, 2 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> index 7ac2280..43d25ec 100644
> --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> @@ -579,21 +579,6 @@ acquire_err:
>  	return -EINVAL;
>  }
>  
> -static void gpmi_put_clks(struct gpmi_nand_data *this)
> -{
> -	struct resources *r = &this->resources;
> -	struct clk *clk;
> -	int i;
> -
> -	for (i = 0; i < GPMI_CLK_MAX; i++) {
> -		clk = r->clock[i];
> -		if (clk) {
> -			clk_put(clk);
> -			r->clock[i] = NULL;
> -		}
> -	}
> -}
> -
>  static char *extra_clks_for_mx6q[GPMI_CLK_MAX] = {
>  	"gpmi_apb", "gpmi_bch", "gpmi_bch_apb", "per1_bch",
>  };
> @@ -606,7 +591,7 @@ static int gpmi_get_clks(struct gpmi_nand_data *this)
>  	int err, i;
>  
>  	/* The main clock is stored in the first. */
> -	r->clock[0] = clk_get(this->dev, "gpmi_io");
> +	r->clock[0] = devm_clk_get(this->dev, "gpmi_io");
>  	if (IS_ERR(r->clock[0])) {
>  		err = PTR_ERR(r->clock[0]);
>  		goto err_clock;
> @@ -622,7 +607,7 @@ static int gpmi_get_clks(struct gpmi_nand_data *this)
>  		if (extra_clks[i - 1] == NULL)
>  			break;
>  
> -		clk = clk_get(this->dev, extra_clks[i - 1]);
> +		clk = devm_clk_get(this->dev, extra_clks[i - 1]);
>  		if (IS_ERR(clk)) {
>  			err = PTR_ERR(clk);
>  			goto err_clock;
> @@ -644,7 +629,6 @@ static int gpmi_get_clks(struct gpmi_nand_data *this)
>  
>  err_clock:
>  	dev_dbg(this->dev, "failed in finding the clocks.\n");
> -	gpmi_put_clks(this);
>  	return err;
>  }
>  
> @@ -684,7 +668,6 @@ exit_regs:
>  
>  static void release_resources(struct gpmi_nand_data *this)
>  {
> -	gpmi_put_clks(this);
>  	release_register_block(this);
>  	release_bch_irq(this);
>  	release_dma_channels(this);
I ever planed to do the gpmi-nand's clean-up myself.

Since you like to do it, i am happy too.

thanks.

Acked-by: Huang Shijie <b32955@freescale.com>

  reply	other threads:[~2013-11-08  2:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-08  0:32 [PATCH] mtd: gpmi: Use devm_clk_get() Fabio Estevam
2013-11-08  2:25 ` Huang Shijie [this message]
2013-11-13 20:40 ` Brian Norris

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=527C4BAA.40209@freescale.com \
    --to=b32955@freescale.com \
    --cc=computersforpeace@gmail.com \
    --cc=fabio.estevam@freescale.com \
    --cc=festevam@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    /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 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.