public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Jarkko Nikula <jarkko.nikula@linux.intel.com>
To: ende.tan@starfivetech.com, linux-i2c@vger.kernel.org
Cc: andriy.shevchenko@linux.intel.com,
	mika.westerberg@linux.intel.com, jsd@semihalf.com,
	andi.shyti@kernel.org, linux-kernel@vger.kernel.org,
	leyfoon.tan@starfivetech.com, endeneer@gmail.com
Subject: Re: [1/1] i2c: designware: Ensure runtime suspend is invoked during rapid slave unregistration and registration
Date: Tue, 15 Apr 2025 16:57:03 +0300	[thread overview]
Message-ID: <6e155241-3403-49df-8f0d-5aa63e2e74ab@linux.intel.com> (raw)
In-Reply-To: <20250412023303.378600-1-ende.tan@starfivetech.com>

Hi

On 4/12/25 5:33 AM, ende.tan@starfivetech.com wrote:
> From: Tan En De <ende.tan@starfivetech.com>
> 
> Replaced pm_runtime_put() with pm_runtime_put_sync_suspend() to ensure
> the runtime suspend is invoked immediately when unregistering a slave.
> This prevents a race condition where suspend was skipped when
> unregistering and registering slave in quick succession.
> 
> Signed-off-by: Tan En De <ende.tan@starfivetech.com>
> ---
>   drivers/i2c/busses/i2c-designware-slave.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/i2c-designware-slave.c b/drivers/i2c/busses/i2c-designware-slave.c
> index 5cd4a5f7a472..b936a240db0a 100644
> --- a/drivers/i2c/busses/i2c-designware-slave.c
> +++ b/drivers/i2c/busses/i2c-designware-slave.c
> @@ -96,7 +96,7 @@ static int i2c_dw_unreg_slave(struct i2c_client *slave)
>   	i2c_dw_disable(dev);
>   	synchronize_irq(dev->irq);
>   	dev->slave = NULL;
> -	pm_runtime_put(dev->dev);
> +	pm_runtime_put_sync_suspend(dev->dev);
>   
>   	return 0;
>   }

What kind of issue you are seeing?

I tried to test with no delay and 1 second delays between registering 
and unregistering. Power state was changing between D0 and D3 if there 
was delay between unregister and register but I could not see any issue.

  reply	other threads:[~2025-04-15 13:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-12  2:33 [1/1] i2c: designware: Ensure runtime suspend is invoked during rapid slave unregistration and registration ende.tan
2025-04-15 13:57 ` Jarkko Nikula [this message]
2025-04-20  3:31   ` EnDe Tan
2025-05-02 11:03     ` Jarkko Nikula
2025-05-05 21:48       ` Andi Shyti
2025-05-08  8:30         ` EnDe Tan
2025-05-08 11:55           ` Jarkko Nikula
2025-05-12 23:29           ` Andi Shyti

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=6e155241-3403-49df-8f0d-5aa63e2e74ab@linux.intel.com \
    --to=jarkko.nikula@linux.intel.com \
    --cc=andi.shyti@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=ende.tan@starfivetech.com \
    --cc=endeneer@gmail.com \
    --cc=jsd@semihalf.com \
    --cc=leyfoon.tan@starfivetech.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.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