[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dcba97d5-639f-2f41-70ff-0ee9de9031d5@axentia.se>
Date: Tue, 26 Mar 2019 10:24:03 +0000
From: Peter Rosin <peda@...ntia.se>
To: Steven Price <steven.price@....com>,
"laurentiu.tudor@....com" <laurentiu.tudor@....com>,
"linux-i2c@...r.kernel.org" <linux-i2c@...r.kernel.org>,
"ying.zhang22455@....com" <ying.zhang22455@....com>
CC: "upstream-release@...ux.nxdi.nxp.com"
<upstream-release@...ux.nxdi.nxp.com>,
"shawnguo@...nel.org" <shawnguo@...nel.org>,
"s.hauer@...gutronix.de" <s.hauer@...gutronix.de>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"leoyang.li@....com" <leoyang.li@....com>,
"linux-imx@....com" <linux-imx@....com>,
"kernel@...gutronix.de" <kernel@...gutronix.de>,
"festevam@...il.com" <festevam@...il.com>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>
Subject: Re: [RESEND] i2c: imx: defer probing on dma channel request
On 2019-03-25 18:12, Steven Price wrote:
> On 25/03/2019 15:30, laurentiu.tudor@....com wrote:
>> From: Laurentiu Tudor <laurentiu.tudor@....com>
>>
>> If the dma controller is not yet probed, defer i2c probe.
>> The error path in probe was slightly modified (no functional change)
*snip*
>> @@ -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:
>
> if (ret) {
> if (ret == -EPROBE_DEFER)
> goto del_adapter;
> dev_info();
> }
>
> or even:
>
> if (ret == -EPROBE_DEFER)
> goto del_adapter;
> else if (ret)
> dev_info();
>
While we're looking for stuff to take out, zap the "else"...
if (ret == -EPROBE_DEFER)
goto del_adapter;
if (ret)
dev_info(...);
Cheers,
Peter
Powered by blists - more mailing lists