[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAG3jFyuoJGNGHmQFfNsBJfnYbUw+jMCiP5uiLcYspYapYKydpA@mail.gmail.com>
Date: Tue, 18 Oct 2022 11:17:53 +0200
From: Robert Foss <robert.foss@...aro.org>
To: "Bryan O'Donoghue" <bryan.odonoghue@...aro.org>
Cc: loic.poulain@...aro.org, wsa@...nel.org, linux-i2c@...r.kernel.org,
linux-arm-msm@...r.kernel.org, linux-kernel@...r.kernel.org,
vladimir.zapolskiy@...aro.org, stable@...r.kernel.org
Subject: Re: [PATCH v3 1/1] i2c: qcom-cci: Fix ordering of pm_runtime_xx and i2c_add_adapter
On Tue, 18 Oct 2022 at 04:19, Bryan O'Donoghue
<bryan.odonoghue@...aro.org> wrote:
>
> When we compile-in the CCI along with the imx412 driver and run on the RB5
> we see that i2c_add_adapter() causes the probe of the imx412 driver to
> happen.
>
> This probe tries to perform an i2c xfer() and the xfer() in i2c-qcom-cci.c
> fails on pm_runtime_get() because the i2c-qcom-cci.c::probe() function has
> not completed to pm_runtime_enable(dev).
>
> Fix this sequence by ensuring pm_runtime_xxx() calls happen prior to adding
> the i2c adapter.
>
> Fixes: e517526195de ("i2c: Add Qualcomm CCI I2C driver")
> Reported-by: Vladimir Zapolskiy <vladimir.zapolskiy@...aro.org>
> Reviewed-by: Vladimir Zapolskiy <vladimir.zapolskiy@...aro.org>
> Tested-by: Vladimir Zapolskiy <vladimir.zapolskiy@...aro.org>
> Cc: <stable@...r.kernel.org>
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@...aro.org>
> ---
> drivers/i2c/busses/i2c-qcom-cci.c | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-qcom-cci.c b/drivers/i2c/busses/i2c-qcom-cci.c
> index 87739fb4388b..a4b97fe3c3a5 100644
> --- a/drivers/i2c/busses/i2c-qcom-cci.c
> +++ b/drivers/i2c/busses/i2c-qcom-cci.c
> @@ -639,6 +639,11 @@ static int cci_probe(struct platform_device *pdev)
> if (ret < 0)
> goto error;
>
> + pm_runtime_set_autosuspend_delay(dev, MSEC_PER_SEC);
> + pm_runtime_use_autosuspend(dev);
> + pm_runtime_set_active(dev);
> + pm_runtime_enable(dev);
> +
> for (i = 0; i < cci->data->num_masters; i++) {
> if (!cci->master[i].cci)
> continue;
> @@ -650,14 +655,12 @@ static int cci_probe(struct platform_device *pdev)
> }
> }
>
> - pm_runtime_set_autosuspend_delay(dev, MSEC_PER_SEC);
> - pm_runtime_use_autosuspend(dev);
> - pm_runtime_set_active(dev);
> - pm_runtime_enable(dev);
> -
> return 0;
>
> error_i2c:
> + pm_runtime_disable(dev);
> + pm_runtime_dont_use_autosuspend(dev);
> +
> for (--i ; i >= 0; i--) {
> if (cci->master[i].cci) {
> i2c_del_adapter(&cci->master[i].adap);
> --
> 2.34.1
>
Reviewed-by: Robert Foss <robert.foss@...aro.org>
Powered by blists - more mailing lists