drivers: serial: nrfx: Force poll_out when lock attempts are over

When the loop that tries to obtain the lock in poll_out() finishes
because of hitting the max number of trials (what normally should
never happen), force the lock to be taken instead of just giving up
with sending the data. The latter approach that was in use so far
could not deal with a situation when some thread was aborted while
keeping the lock. Other threads would then have no chance to send
anything with poll_out() until it was called from an ISR.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
This commit is contained in:
Andrzej Głąbek 2020-05-25 12:26:40 +00:00 committed by Carles Cufí
commit d000ff38dc
2 changed files with 2 additions and 2 deletions

View file

@ -280,7 +280,7 @@ static void uart_nrfx_poll_out(struct device *dev, unsigned char c)
*/
k_msleep(1);
if (--safety_cnt == 0) {
return;
break;
}
}
} else {

View file

@ -1030,7 +1030,7 @@ static void uarte_nrfx_poll_out(struct device *dev, unsigned char c)
*/
k_msleep(1);
if (--safety_cnt == 0) {
return;
break;
}
}
} else {