linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@ti.com>
To: Nishanth Menon <nm@ti.com>
Cc: Joel Fernandes <joelf@ti.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-omap@vger.kernel.org, Joachim Eastwood <manabian@gmail.com>,
	balbi@ti.com
Subject: Re: [PATCH V2] crypto: omap-des - handle error of pm_runtime_get_sync
Date: Tue, 15 Apr 2014 12:05:01 -0500	[thread overview]
Message-ID: <20140415170501.GA16002@saruman.home> (raw)
In-Reply-To: <1397581111-21148-1-git-send-email-nm@ti.com>

[-- Attachment #1: Type: text/plain, Size: 2460 bytes --]

On Tue, Apr 15, 2014 at 11:58:31AM -0500, Nishanth Menon wrote:
> pm_runtime_get_sync may not always succeed depending on SoC involved.
> So handle the error appropriately ensuring usage_count is accurate in
> case of failure.
> 
> Signed-off-by: Nishanth Menon <nm@ti.com>

Reviewed-by: Felipe Balbi <balbi@ti.com>

> ---
> V2:
> 	- review fixes, print function names in error log as well.
> 
> V1: https://patchwork.kernel.org/patch/3993861/
>  drivers/crypto/omap-des.c |   26 +++++++++++++++++++++++---
>  1 file changed, 23 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/crypto/omap-des.c b/drivers/crypto/omap-des.c
> index ec5f131..1d570c4 100644
> --- a/drivers/crypto/omap-des.c
> +++ b/drivers/crypto/omap-des.c
> @@ -223,12 +223,19 @@ static void omap_des_write_n(struct omap_des_dev *dd, u32 offset,
>  
>  static int omap_des_hw_init(struct omap_des_dev *dd)
>  {
> +	int err;
> +
>  	/*
>  	 * clocks are enabled when request starts and disabled when finished.
>  	 * It may be long delays between requests.
>  	 * Device might go to off mode to save power.
>  	 */
> -	pm_runtime_get_sync(dd->dev);
> +	err = pm_runtime_get_sync(dd->dev);
> +	if (err < 0) {
> +		pm_runtime_put_noidle(dd->dev);
> +		dev_err(dd->dev, "%s: failed to get_sync(%d)\n", __func__, err);
> +		return err;
> +	}
>  
>  	if (!(dd->flags & FLAGS_INIT)) {
>  		dd->flags |= FLAGS_INIT;
> @@ -1083,7 +1090,12 @@ static int omap_des_probe(struct platform_device *pdev)
>  	dd->phys_base = res->start;
>  
>  	pm_runtime_enable(dev);
> -	pm_runtime_get_sync(dev);
> +	err = pm_runtime_get_sync(dev);
> +	if (err < 0) {
> +		pm_runtime_put_noidle(dev);
> +		dev_err(dd->dev, "%s: failed to get_sync(%d)\n", __func__, err);
> +		goto err_get;
> +	}
>  
>  	omap_des_dma_stop(dd);
>  
> @@ -1148,6 +1160,7 @@ err_algs:
>  err_irq:
>  	tasklet_kill(&dd->done_task);
>  	tasklet_kill(&dd->queue_task);
> +err_get:
>  	pm_runtime_disable(dev);
>  err_res:
>  	dd = NULL;
> @@ -1191,7 +1204,14 @@ static int omap_des_suspend(struct device *dev)
>  
>  static int omap_des_resume(struct device *dev)
>  {
> -	pm_runtime_get_sync(dev);
> +	int err;
> +
> +	err = pm_runtime_get_sync(dev);
> +	if (err < 0) {
> +		pm_runtime_put_noidle(dev);
> +		dev_err(dev, "%s: failed to get_sync(%d)\n", __func__, err);
> +		return err;
> +	}
>  	return 0;
>  }
>  #endif
> -- 
> 1.7.9.5
> 

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2014-04-15 17:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-15 15:33 [PATCH] crypto: omap-des - handle error of pm_runtime_get_sync Nishanth Menon
2014-04-15 15:50 ` Felipe Balbi
2014-04-15 16:44   ` Nishanth Menon
2014-04-15 16:58     ` [PATCH V2] " Nishanth Menon
2014-04-15 17:05       ` Felipe Balbi [this message]
2014-04-15 17:06       ` Joachim Eastwood
2014-04-15 17:18         ` Nishanth Menon
2014-04-15 17:51           ` Joel Fernandes
2014-04-16 13:50             ` Herbert Xu

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=20140415170501.GA16002@saruman.home \
    --to=balbi@ti.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=joelf@ti.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=manabian@gmail.com \
    --cc=nm@ti.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).