Re: [RESEND] i2c: imx: defer probing on dma channel request

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2019-03-25 18:12, Steven Price wrote:
> On 25/03/2019 15:30, laurentiu.tudor@xxxxxxx wrote:
>> From: Laurentiu Tudor <laurentiu.tudor@xxxxxxx>
>>
>> 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




[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux