All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@ti.com>
To: Shubhrajyoti D <shubhrajyoti@ti.com>
Cc: linux-omap@vger.kernel.org, linux-i2c@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, ben-linux@fluff.org,
	tony@atomide.com, w.sang@pengutronix.de
Subject: Re: [PATCH 07/11] I2C: OMAP: Handle error check for pm runtime
Date: Tue, 26 Jun 2012 20:43:32 -0500	[thread overview]
Message-ID: <874npxv8aj.fsf@ti.com> (raw)
In-Reply-To: <1338288983-15026-8-git-send-email-shubhrajyoti@ti.com> (Shubhrajyoti D.'s message of "Tue, 29 May 2012 16:26:19 +0530")

Shubhrajyoti D <shubhrajyoti@ti.com> writes:

> If PM runtime get_sync fails return with the error
> so that no further reads/writes goes through the interface.
> This will avoid possible abort. Add a error message in case
> of failure with the cause of the failure.
>
> Reviewed-by: Kevin Hilman <khilman@ti.com>
> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>

This patch introduced a regression where the runtime PM usecount will
never reach zero and so CORE retention is prevented after any xfer
failures...

> ---
> -v10 Use IS_ERR_VALUE
> -v9 Fix the error handling
>
>  drivers/i2c/busses/i2c-omap.c |   14 +++++++++++---
>  1 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index 44e8cfa..c39b72f 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -585,7 +585,9 @@ omap_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
>  	int i;
>  	int r;
>  
> -	pm_runtime_get_sync(dev->dev);
> +	r = pm_runtime_get_sync(dev->dev);<
> +	if (IS_ERR_VALUE(r))
> +		return r;

This return should be 'goto out' so the runtime PM usecount is
decremented by the 'put'.  Otherwise, after failure, the usecount
remains non-zero, so the device is considered 'active' and keeps the
containing power domain active.

I found this on a 3730/OveroSTORM where the suspend/resume of MMC fails
because I2C is already suspended.  After the suspend though, the CORE
powerdomain never again hits retention, and I tracked it down to this.

I'll send a separate patch to fix this shortly.

Kevin 

WARNING: multiple messages have this Message-ID (diff)
From: khilman@ti.com (Kevin Hilman)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 07/11] I2C: OMAP: Handle error check for pm runtime
Date: Tue, 26 Jun 2012 20:43:32 -0500	[thread overview]
Message-ID: <874npxv8aj.fsf@ti.com> (raw)
In-Reply-To: <1338288983-15026-8-git-send-email-shubhrajyoti@ti.com> (Shubhrajyoti D.'s message of "Tue, 29 May 2012 16:26:19 +0530")

Shubhrajyoti D <shubhrajyoti@ti.com> writes:

> If PM runtime get_sync fails return with the error
> so that no further reads/writes goes through the interface.
> This will avoid possible abort. Add a error message in case
> of failure with the cause of the failure.
>
> Reviewed-by: Kevin Hilman <khilman@ti.com>
> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>

This patch introduced a regression where the runtime PM usecount will
never reach zero and so CORE retention is prevented after any xfer
failures...

> ---
> -v10 Use IS_ERR_VALUE
> -v9 Fix the error handling
>
>  drivers/i2c/busses/i2c-omap.c |   14 +++++++++++---
>  1 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index 44e8cfa..c39b72f 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -585,7 +585,9 @@ omap_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
>  	int i;
>  	int r;
>  
> -	pm_runtime_get_sync(dev->dev);
> +	r = pm_runtime_get_sync(dev->dev);<
> +	if (IS_ERR_VALUE(r))
> +		return r;

This return should be 'goto out' so the runtime PM usecount is
decremented by the 'put'.  Otherwise, after failure, the usecount
remains non-zero, so the device is considered 'active' and keeps the
containing power domain active.

I found this on a 3730/OveroSTORM where the suspend/resume of MMC fails
because I2C is already suspended.  After the suspend though, the CORE
powerdomain never again hits retention, and I tracked it down to this.

I'll send a separate patch to fix this shortly.

Kevin 

  reply	other threads:[~2012-06-27  1:43 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-29 10:56 [PATCHv10 00/11] I2C fixes Shubhrajyoti D
2012-05-29 10:56 ` Shubhrajyoti D
2012-05-29 10:56 ` [PATCHv10 05/11] I2C: OMAP: Don't check if wait_for_completion_timeout() returns less than zero Shubhrajyoti D
2012-05-29 10:56   ` Shubhrajyoti D
     [not found] ` <1338288983-15026-1-git-send-email-shubhrajyoti-l0cyMroinI0@public.gmane.org>
2012-05-29 10:56   ` [PATCHv10 01/11] I2C: OMAP: make omap_i2c_unidle/idle functions depend on CONFIG_PM_RUNTIME Shubhrajyoti D
2012-05-29 10:56     ` Shubhrajyoti D
2012-05-29 10:56   ` [PATCHv10 02/11] I2C: OMAP: Fix the mismatch of pm_runtime enable and disable Shubhrajyoti D
2012-05-29 10:56     ` Shubhrajyoti D
2012-05-29 10:56   ` [PATCHv10 03/11] I2C: OMAP: Fix the interrupt clearing in OMAP4 Shubhrajyoti D
2012-05-29 10:56     ` Shubhrajyoti D
2012-05-29 10:56   ` [PATCHv10 04/11] I2C: OMAP: Prevent the register access after pm_runtime_put in probe Shubhrajyoti D
2012-05-29 10:56     ` Shubhrajyoti D
2012-05-29 10:56   ` [PATCH 06/11] I2C: OMAP: Fix the crash in i2c remove Shubhrajyoti D
2012-05-29 10:56     ` Shubhrajyoti D
2012-05-29 10:56   ` [PATCH 07/11] I2C: OMAP: Handle error check for pm runtime Shubhrajyoti D
2012-05-29 10:56     ` Shubhrajyoti D
2012-06-27  1:43     ` Kevin Hilman [this message]
2012-06-27  1:43       ` Kevin Hilman
     [not found]       ` <874npxv8aj.fsf-l0cyMroinI0@public.gmane.org>
2012-06-27  9:01         ` Shubhrajyoti Datta
2012-06-27  9:01           ` Shubhrajyoti Datta
2012-05-29 10:56   ` [PATCHv10 09/11] I2C: OMAP: Do not set the XUDF(Transmit underflow) if the underflow is not reached Shubhrajyoti D
2012-05-29 10:56     ` Shubhrajyoti D
2012-05-29 10:56   ` [PATCHv10 10/11] I2C: OMAP: Rename the 1p153 to the erratum id i462 Shubhrajyoti D
2012-05-29 10:56     ` Shubhrajyoti D
2012-05-29 10:56 ` [PATCHv10 08/11] I2C: OMAP: prevent the overwrite of the errata flags Shubhrajyoti D
2012-05-29 10:56   ` Shubhrajyoti D
2012-05-29 10:56 ` [PATCHv10 11/11] OMAP/I2C - Fix timeout problem during suspend Shubhrajyoti D
2012-05-29 10:56   ` Shubhrajyoti D
2012-05-31 22:59 ` [PATCHv10 00/11] I2C fixes Kevin Hilman
2012-05-31 22:59   ` Kevin Hilman
2012-06-10  5:40   ` Shubhrajyoti Datta
2012-06-10  5:40     ` Shubhrajyoti Datta
2012-06-11 16:00     ` Wolfram Sang
2012-06-11 16:00       ` Wolfram Sang
2012-06-11 17:39       ` Shubhrajyoti
2012-06-11 17:39         ` Shubhrajyoti

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=874npxv8aj.fsf@ti.com \
    --to=khilman@ti.com \
    --cc=ben-linux@fluff.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=shubhrajyoti@ti.com \
    --cc=tony@atomide.com \
    --cc=w.sang@pengutronix.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 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.