20 Nov
2023
20 Nov
'23
4:46 p.m.
W dniu 20/11/2023 o 14:40, Mark Brown pisze:
On Mon, Nov 20, 2023 at 02:17:34PM +0000, Maciej Strozek wrote:
if (to_poll == &cs43130->xtal_rdy) {
offset = 0;
flag = CS43130_XTAL_RDY_INT;
} else if (to_poll == &cs43130->pll_rdy) {
offset = 0;
flag = CS43130_PLL_RDY_INT;
} else if (to_poll == &cs43130->hpload_evt) {
offset = 3;
flag = CS43130_HPLOAD_NO_DC_INT | CS43130_HPLOAD_UNPLUG_INT |
CS43130_HPLOAD_OOR_INT | CS43130_HPLOAD_AC_INT |
CS43130_HPLOAD_DC_INT | CS43130_HPLOAD_ON_INT |
CS43130_HPLOAD_OFF_INT;
} else {
return 0;
}
Is it a bug to call this function without to_poll set to something known? This will just silently ignore it which seems wrong and is inconsitent with the handling in the interrupt case which will wait for the the completion to be signalled and report a timeout on error.
In interrupt case 0 means timeout (and calling function should expect 0 as error/timeout), so the only inconsistency I see is in not waiting before returning a timeout, but that would be needlessly wasting time? Do you think adding a debug print or a comment would help here?