From: Lucas Stach <l.stach@pengutronix.de>
To: Wolfram Sang <wsa@the-dreams.de>
Cc: linux-i2c@vger.kernel.org, kernel@pengutronix.de,
patchwork-lst@pengutronix.de, Lukas Rusak <lorusak@gmail.com>,
Chris Healy <cphealy@gmail.com>
Subject: [PATCH 3/3] i2c: imx: use runtime PM provided by core
Date: Fri, 17 Nov 2017 19:05:39 +0100 [thread overview]
Message-ID: <20171117180539.4984-4-l.stach@pengutronix.de> (raw)
In-Reply-To: <20171117180539.4984-1-l.stach@pengutronix.de>
Simplifies the driver and fixes a deadlock, which has been observed
in the wild, due to the i2c bus lock and the clk framework clk_prepare
lock being taken in different order by multiple i2c devices.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
drivers/i2c/busses/i2c-imx.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index 800c1f390308..95da40e74847 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -904,10 +904,6 @@ static int i2c_imx_xfer(struct i2c_adapter *adapter,
dev_dbg(&i2c_imx->adapter.dev, "<%s>\n", __func__);
- result = pm_runtime_get_sync(i2c_imx->adapter.dev.parent);
- if (result < 0)
- goto out;
-
/* Start I2C transfer */
result = i2c_imx_start(i2c_imx);
if (result) {
@@ -971,10 +967,6 @@ static int i2c_imx_xfer(struct i2c_adapter *adapter,
/* Stop I2C transfer */
i2c_imx_stop(i2c_imx);
- pm_runtime_mark_last_busy(i2c_imx->adapter.dev.parent);
- pm_runtime_put_autosuspend(i2c_imx->adapter.dev.parent);
-
-out:
dev_dbg(&i2c_imx->adapter.dev, "<%s> exit with: %s: %d\n", __func__,
(result < 0) ? "error" : "success msg",
(result < 0) ? result : num);
@@ -1099,6 +1091,7 @@ static int i2c_imx_probe(struct platform_device *pdev)
i2c_imx->adapter.dev.parent = &pdev->dev;
i2c_imx->adapter.nr = pdev->id;
i2c_imx->adapter.dev.of_node = pdev->dev.of_node;
+ i2c_imx->adapter.auto_rpm = true;
i2c_imx->base = base;
/* Get I2C clock */
--
2.11.0
prev parent reply other threads:[~2017-11-17 18:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-17 18:05 [PATCH 0/3] imx i2c vs clk framework deadlock fix Lucas Stach
2017-11-17 18:05 ` [PATCH 1/3] i2c: imx: use clk notifier for rate changes Lucas Stach
2017-11-17 18:05 ` [PATCH 2/3] i2c: add runtime PM handling to core Lucas Stach
2017-11-17 18:05 ` Lucas Stach [this message]
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=20171117180539.4984-4-l.stach@pengutronix.de \
--to=l.stach@pengutronix.de \
--cc=cphealy@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-i2c@vger.kernel.org \
--cc=lorusak@gmail.com \
--cc=patchwork-lst@pengutronix.de \
--cc=wsa@the-dreams.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 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).