On Fri, Dec 20, 2024 at 05:59:38AM +0000, Carlos Song wrote: > > > So we make this logic. Anyway we let the I2C controller registered whether > > DMA is available or not(except defer probe). > > > Ignoring ENODEV and EPROBE_DEFER makes it looks like nothing happened if > > DMA is defer probed or not enabled(This is an expected). > > > However we still need i2c DMA status is known when meet an unexpected > > error, so we use dev_err_probe() to print error. > > > > Why dev_err_probe() instead of dev_err()? > > > Hi, > In patch V2 discussion, Marc suggested just return dev_err_probe(), but I don't accept it so I choose to use dev_err_probe() to print error in V3.[1] > In this case, the two APIs have the same function, do you mean dev_err() is more suitable? Yes, dev_err_probe() should be used in combination with return. For example: return dev_err_probe(...); It will pass the return value on exit of the function and optionally print of the error message if it is not EPROBE_DEFER. Practically it replace commonly used coding pattern: if (ret == -EPROBE_DEFER) { return ret; } else if (ret) { dev_err(..); return ret; } -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |