stm32/f1/can: clean up can_available_mailbox ->fewer 'if' statements

This commit is contained in:
Jeff Ciesielski 2012-10-31 17:03:26 -07:00
parent 7e9b79aa55
commit fa1d5f8e43

View file

@ -316,13 +316,5 @@ void can_receive(u32 canport, u8 fifo, bool release, u32 *id, bool *ext,
bool can_available_mailbox(u32 canport)
{
if ((CAN_TSR(canport) & CAN_TSR_TME0) == CAN_TSR_TME0) {
return true;
} else if ((CAN_TSR(canport) & CAN_TSR_TME1) == CAN_TSR_TME1) {
return true;
} else if ((CAN_TSR(canport) & CAN_TSR_TME2) == CAN_TSR_TME2) {
return true;
} else {
return false;
}
return CAN_TSR(canport) & (CAN_TSR_TME0 | CAN_TSR_TME1 | CAN_TSR_TME2);
}