linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Laurentiu Tudor <laurentiu.tudor@nxp.com>
To: Steven Price <steven.price@arm.com>,
	"linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>,
	Ying Zhang <ying.zhang22455@nxp.com>
Cc: "upstream-release@linux.nxdi.nxp.com"
	<upstream-release@linux.nxdi.nxp.com>,
	"festevam@gmail.com" <festevam@gmail.com>,
	"s.hauer@pengutronix.de" <s.hauer@pengutronix.de>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Leo Li <leoyang.li@nxp.com>, dl-linux-imx <linux-imx@nxp.com>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	"shawnguo@kernel.org" <shawnguo@kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [RESEND] i2c: imx: defer probing on dma channel request
Date: Tue, 26 Mar 2019 11:52:41 +0000	[thread overview]
Message-ID: <7c702cc4-4bb6-02e8-6c2d-1686de503c85@nxp.com> (raw)
In-Reply-To: <873b5aeb-e20a-de6b-515e-bc8fcc263452@arm.com>

Hi Steve,

Thanks for the review! Few comments inline.

On 25.03.2019 19:12, Steven Price wrote:
> On 25/03/2019 15:30, laurentiu.tudor@nxp.com wrote:
>> From: Laurentiu Tudor <laurentiu.tudor@nxp.com>
>>
>> If the dma controller is not yet probed, defer i2c probe.
>> The error path in probe was slightly modified (no functional change)
> 
> There is a functional change for cases like:
> 
>> 	ret = pm_runtime_get_sync(&pdev->dev);
>> 	if (ret < 0)
>> 		goto rpm_disable;
> 
> ...as rpm_disable will no longer fall through to the call of
> clk_disable_unprepare().

Good point, I missed that.

>> to avoid triggering this WARN_ON():
>> "cg-pll0-div1 already disabled
>> WARNING: CPU: 1 PID: 1 at drivers/clk/clk.c:828 clk_core_disable+0xa8/0xb0"
> 
> I'm also not sure how this WARN_ON was hit. i2c_imx_probe() calls
> clk_prepare_enable() which should increment the reference count. So it
> should always be possible to decrememt the enable_count. What am I missing?

I am no longer able to replicate this. Perhaps in the mean time changes 
in the clk core fixed this corner case.

>> Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
>> ---
>>   drivers/i2c/busses/i2c-imx.c | 21 +++++++++++++--------
>>   1 file changed, 13 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
>> index 42fed40198a0..4e34b1572756 100644
>> --- a/drivers/i2c/busses/i2c-imx.c
>> +++ b/drivers/i2c/busses/i2c-imx.c
>> @@ -1111,7 +1111,8 @@ static int i2c_imx_probe(struct platform_device *pdev)
>>   				pdev->name, i2c_imx);
>>   	if (ret) {
>>   		dev_err(&pdev->dev, "can't claim irq %d\n", irq);
>> -		goto clk_disable;
>> +		clk_disable_unprepare(i2c_imx->clk);
>> +		return ret;
>>   	}
>>   
>>   	/* Init queue */
>> @@ -1161,19 +1162,25 @@ static int i2c_imx_probe(struct platform_device *pdev)
>>   	pm_runtime_mark_last_busy(&pdev->dev);
>>   	pm_runtime_put_autosuspend(&pdev->dev);
>>   
>> +	/* Init DMA config if supported */
>> +	ret = i2c_imx_dma_request(i2c_imx, phy_addr);
>> +	if (ret) {
>> +		if (ret != -EPROBE_DEFER)
>> +			dev_info(&pdev->dev, "can't use DMA, using PIO instead.\n");
>> +		else
>> +			goto del_adapter;
>> +	}
>> +
> 
> This can be simplified by reversing the condition:

Well, in the mean time I just found out that this commit [1] fixes the 
issue I was seeing so I think the patch is no longer needed.

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git/commit/?h=i2c/for-next&id=e1ab9a468e3b1

---
Best Regards, Laurentiu
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2019-03-26 11:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-25 15:30 [RESEND] i2c: imx: defer probing on dma channel request laurentiu.tudor
2019-03-25 17:12 ` Steven Price
2019-03-26 10:24   ` Peter Rosin
2019-03-26 11:52   ` Laurentiu Tudor [this message]
2019-03-27 13:43   ` Laurentiu Tudor
2019-03-27 18:47     ` Li Yang
2019-03-28 10:47       ` Laurentiu Tudor
2019-03-25 19:15 ` Leo Li
2019-03-28  7:31 ` Aisheng Dong

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=7c702cc4-4bb6-02e8-6c2d-1686de503c85@nxp.com \
    --to=laurentiu.tudor@nxp.com \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=leoyang.li@nxp.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=steven.price@arm.com \
    --cc=upstream-release@linux.nxdi.nxp.com \
    --cc=ying.zhang22455@nxp.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;
as well as URLs for NNTP newsgroup(s).