lkml.org 
[lkml]   [2019]   [Mar]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [RESEND] i2c: imx: defer probing on dma channel request
Date
On 2019-03-25 18: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)

*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
\
 
 \ /
  Last update: 2019-03-26 11:24    [W:0.111 / U:68.260 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site