Bluetooth: Controller: Make use of min() convenience macro

Instead of having custom logic for determining the minimum of two
values, use the existing min() helper from misc/util.h.

Change-Id: I9809883d4a31126329373f293897dd49eb91e9ad
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2016-12-02 08:41:48 +00:00
commit 299216b2f0

View file

@ -19,6 +19,7 @@
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include <misc/util.h>
#include <device.h> #include <device.h>
#include <clock_control.h> #include <clock_control.h>
@ -1260,20 +1261,14 @@ static inline void isr_rx_conn_pkt_ctrl_dle(struct pdu_data *pdu_data_rx,
/* use the minimal of our default_tx_octets and /* use the minimal of our default_tx_octets and
* peer max_rx_octets * peer max_rx_octets
*/ */
if (lr->max_rx_octets > _radio.conn_curr->default_tx_octets) { eff_tx_octets = min(lr->max_rx_octets,
eff_tx_octets = _radio.conn_curr->default_tx_octets; _radio.conn_curr->default_tx_octets);
} else {
eff_tx_octets = lr->max_rx_octets;
}
/* use the minimal of our max supported and /* use the minimal of our max supported and
* peer max_tx_octets * peer max_tx_octets
*/ */
if (lr->max_tx_octets > RADIO_LL_LENGTH_OCTETS_RX_MAX) { eff_rx_octets = min(lr->max_tx_octets,
eff_rx_octets = RADIO_LL_LENGTH_OCTETS_RX_MAX; RADIO_LL_LENGTH_OCTETS_RX_MAX);
} else {
eff_rx_octets = lr->max_tx_octets;
}
/* check if change in rx octets */ /* check if change in rx octets */
if (eff_rx_octets != _radio.conn_curr->max_rx_octets) { if (eff_rx_octets != _radio.conn_curr->max_rx_octets) {