From: Wolfram Sang <wsa@the-dreams.de>
To: Alain Volmat <alain.volmat@st.com>,
Jarkko Nikula <jarkko.nikula@linux.intel.com>
Cc: robh+dt@kernel.org, mark.rutland@arm.com,
pierre-yves.mordret@st.com, mcoquelin.stm32@gmail.com,
alexandre.torgue@st.com, linux-i2c@vger.kernel.org,
devicetree@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, fabrice.gasnier@st.com
Subject: Re: [PATCH] i2c: fix missing pm_runtime_put_sync in i2c_device_probe
Date: Thu, 30 Apr 2020 18:35:03 +0200 [thread overview]
Message-ID: <20200430163503.GA15047@ninjato> (raw)
In-Reply-To: <1588261401-11914-1-git-send-email-alain.volmat@st.com>
[-- Attachment #1: Type: text/plain, Size: 2316 bytes --]
On Thu, Apr 30, 2020 at 05:43:21PM +0200, Alain Volmat wrote:
> In case of the I2C client exposes the flag I2C_CLIENT_HOST_NOTIFY,
> pm_runtime_get_sync is called in order to always keep active the
> adapter. However later on, pm_runtime_put_sync is never called
> within the function in case of an error. This commit add this
> error handling.
>
> Fixes: 72bfcee11cf8 ("i2c: Prevent runtime suspend of adapter when Host Notify is required")
Adding the patch author to CC.
> Signed-off-by: Alain Volmat <alain.volmat@st.com>
> ---
> drivers/i2c/i2c-core-base.c | 22 ++++++++++++++++------
> 1 file changed, 16 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
> index 139aea351ffb..2e4560671183 100644
> --- a/drivers/i2c/i2c-core-base.c
> +++ b/drivers/i2c/i2c-core-base.c
> @@ -338,8 +338,10 @@ static int i2c_device_probe(struct device *dev)
> } else if (ACPI_COMPANION(dev)) {
> irq = i2c_acpi_get_irq(client);
> }
> - if (irq == -EPROBE_DEFER)
> - return irq;
> + if (irq == -EPROBE_DEFER) {
> + status = irq;
> + goto put_sync_adapter;
> + }
>
> if (irq < 0)
> irq = 0;
> @@ -353,15 +355,19 @@ static int i2c_device_probe(struct device *dev)
> */
> if (!driver->id_table &&
> !i2c_acpi_match_device(dev->driver->acpi_match_table, client) &&
> - !i2c_of_match_device(dev->driver->of_match_table, client))
> - return -ENODEV;
> + !i2c_of_match_device(dev->driver->of_match_table, client)) {
> + status = -ENODEV;
> + goto put_sync_adapter;
> + }
>
> if (client->flags & I2C_CLIENT_WAKE) {
> int wakeirq;
>
> wakeirq = of_irq_get_byname(dev->of_node, "wakeup");
> - if (wakeirq == -EPROBE_DEFER)
> - return wakeirq;
> + if (wakeirq == -EPROBE_DEFER) {
> + status = wakeirq;
> + goto put_sync_adapter;
> + }
>
> device_init_wakeup(&client->dev, true);
>
> @@ -408,6 +414,10 @@ static int i2c_device_probe(struct device *dev)
> err_clear_wakeup_irq:
> dev_pm_clear_wake_irq(&client->dev);
> device_init_wakeup(&client->dev, false);
> +put_sync_adapter:
> + if (client->flags & I2C_CLIENT_HOST_NOTIFY)
> + pm_runtime_put_sync(&client->adapter->dev);
> +
> return status;
> }
>
> --
> 2.17.1
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Wolfram Sang <wsa@the-dreams.de>
To: Alain Volmat <alain.volmat@st.com>,
Jarkko Nikula <jarkko.nikula@linux.intel.com>
Cc: mark.rutland@arm.com, devicetree@vger.kernel.org,
alexandre.torgue@st.com, linux-kernel@vger.kernel.org,
pierre-yves.mordret@st.com, robh+dt@kernel.org,
linux-i2c@vger.kernel.org, mcoquelin.stm32@gmail.com,
fabrice.gasnier@st.com, linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] i2c: fix missing pm_runtime_put_sync in i2c_device_probe
Date: Thu, 30 Apr 2020 18:35:03 +0200 [thread overview]
Message-ID: <20200430163503.GA15047@ninjato> (raw)
In-Reply-To: <1588261401-11914-1-git-send-email-alain.volmat@st.com>
[-- Attachment #1.1: Type: text/plain, Size: 2316 bytes --]
On Thu, Apr 30, 2020 at 05:43:21PM +0200, Alain Volmat wrote:
> In case of the I2C client exposes the flag I2C_CLIENT_HOST_NOTIFY,
> pm_runtime_get_sync is called in order to always keep active the
> adapter. However later on, pm_runtime_put_sync is never called
> within the function in case of an error. This commit add this
> error handling.
>
> Fixes: 72bfcee11cf8 ("i2c: Prevent runtime suspend of adapter when Host Notify is required")
Adding the patch author to CC.
> Signed-off-by: Alain Volmat <alain.volmat@st.com>
> ---
> drivers/i2c/i2c-core-base.c | 22 ++++++++++++++++------
> 1 file changed, 16 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
> index 139aea351ffb..2e4560671183 100644
> --- a/drivers/i2c/i2c-core-base.c
> +++ b/drivers/i2c/i2c-core-base.c
> @@ -338,8 +338,10 @@ static int i2c_device_probe(struct device *dev)
> } else if (ACPI_COMPANION(dev)) {
> irq = i2c_acpi_get_irq(client);
> }
> - if (irq == -EPROBE_DEFER)
> - return irq;
> + if (irq == -EPROBE_DEFER) {
> + status = irq;
> + goto put_sync_adapter;
> + }
>
> if (irq < 0)
> irq = 0;
> @@ -353,15 +355,19 @@ static int i2c_device_probe(struct device *dev)
> */
> if (!driver->id_table &&
> !i2c_acpi_match_device(dev->driver->acpi_match_table, client) &&
> - !i2c_of_match_device(dev->driver->of_match_table, client))
> - return -ENODEV;
> + !i2c_of_match_device(dev->driver->of_match_table, client)) {
> + status = -ENODEV;
> + goto put_sync_adapter;
> + }
>
> if (client->flags & I2C_CLIENT_WAKE) {
> int wakeirq;
>
> wakeirq = of_irq_get_byname(dev->of_node, "wakeup");
> - if (wakeirq == -EPROBE_DEFER)
> - return wakeirq;
> + if (wakeirq == -EPROBE_DEFER) {
> + status = wakeirq;
> + goto put_sync_adapter;
> + }
>
> device_init_wakeup(&client->dev, true);
>
> @@ -408,6 +414,10 @@ static int i2c_device_probe(struct device *dev)
> err_clear_wakeup_irq:
> dev_pm_clear_wake_irq(&client->dev);
> device_init_wakeup(&client->dev, false);
> +put_sync_adapter:
> + if (client->flags & I2C_CLIENT_HOST_NOTIFY)
> + pm_runtime_put_sync(&client->adapter->dev);
> +
> return status;
> }
>
> --
> 2.17.1
>
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-04-30 16:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-30 15:43 [PATCH] i2c: fix missing pm_runtime_put_sync in i2c_device_probe Alain Volmat
2020-04-30 15:43 ` Alain Volmat
2020-04-30 16:35 ` Wolfram Sang [this message]
2020-04-30 16:35 ` Wolfram Sang
2020-05-04 5:46 ` Jarkko Nikula
2020-05-04 5:46 ` Jarkko Nikula
2020-05-05 14:28 ` Wolfram Sang
2020-05-05 14:28 ` Wolfram Sang
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=20200430163503.GA15047@ninjato \
--to=wsa@the-dreams.de \
--cc=alain.volmat@st.com \
--cc=alexandre.torgue@st.com \
--cc=devicetree@vger.kernel.org \
--cc=fabrice.gasnier@st.com \
--cc=jarkko.nikula@linux.intel.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mark.rutland@arm.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=pierre-yves.mordret@st.com \
--cc=robh+dt@kernel.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.