nimble/mesh: Fix build on linux

Use MIN/MAX macros instead of min/max.
This commit is contained in:
Szymon Janc
2022-12-13 00:21:58 +01:00
parent eddc008fa5
commit 2587fbfd8b
8 changed files with 13 additions and 13 deletions
+1 -1
View File
@@ -61,7 +61,7 @@ static inline void adv_send(struct os_mbuf *buf)
struct bt_data ad;
int err;
adv_int = max(adv_int_min,
adv_int = MAX(adv_int_min,
BT_MESH_TRANSMIT_INT(BT_MESH_ADV(buf)->xmit));
#if MYNEWT_VAL(BLE_CONTROLLER)
duration = ((BT_MESH_TRANSMIT_COUNT(BT_MESH_ADV(buf)->xmit) + 1) *
+1 -1
View File
@@ -52,7 +52,7 @@ static int comp_data_status(struct bt_mesh_model *model,
if (param->page) {
*(param->page) = net_buf_simple_pull_u8(buf);
}
to_copy = min(net_buf_simple_tailroom(param->comp), buf->om_len);
to_copy = MIN(net_buf_simple_tailroom(param->comp), buf->om_len);
net_buf_simple_add_mem(param->comp, buf->om_data, to_copy);
bt_mesh_msg_ack_ctx_rx(&cli->ack_ctx);
+1 -1
View File
@@ -2042,7 +2042,7 @@ static int mod_app_get(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct os_mbuf *buf)
{
struct os_mbuf *msg = NET_BUF_SIMPLE(max(BT_MESH_MODEL_BUF_LEN(OP_VND_MOD_APP_LIST,
struct os_mbuf *msg = NET_BUF_SIMPLE(MAX(BT_MESH_MODEL_BUF_LEN(OP_VND_MOD_APP_LIST,
9 + KEY_LIST_LEN),
BT_MESH_MODEL_BUF_LEN(OP_SIG_MOD_APP_LIST,
9 + KEY_LIST_LEN)));
+1 -1
View File
@@ -53,7 +53,7 @@ bt_hex(const void *buf, size_t len)
str = hexbufs[curbuf++];
curbuf %= ARRAY_SIZE(hexbufs);
len = min(len, (sizeof(hexbufs[0]) - 1) / 2);
len = MIN(len, (sizeof(hexbufs[0]) - 1) / 2);
for (i = 0; i < len; i++) {
str[i * 2] = hex[b[i] >> 4];
+4 -4
View File
@@ -32,7 +32,7 @@
#endif
#define LPN_RECV_DELAY MYNEWT_VAL(BLE_MESH_LPN_RECV_DELAY)
#define SCAN_LATENCY min(MYNEWT_VAL(BLE_MESH_LPN_SCAN_LATENCY), \
#define SCAN_LATENCY MIN(MYNEWT_VAL(BLE_MESH_LPN_SCAN_LATENCY), \
LPN_RECV_DELAY)
#define FRIEND_REQ_RETRY_TIMEOUT K_SECONDS(MYNEWT_VAL(BLE_MESH_LPN_RETRY_TIMEOUT))
@@ -152,12 +152,12 @@ static int32_t poll_timeout(struct bt_mesh_lpn *lpn)
{
/* If we're waiting for segment acks keep polling at high freq */
if (bt_mesh_tx_in_progress()) {
return min(POLL_TIMEOUT_MAX(lpn), K_SECONDS(1));
return MIN(POLL_TIMEOUT_MAX(lpn), K_SECONDS(1));
}
if (lpn->poll_timeout < POLL_TIMEOUT_MAX(lpn)) {
lpn->poll_timeout *= 2;
lpn->poll_timeout = min(lpn->poll_timeout,
lpn->poll_timeout = MIN(lpn->poll_timeout,
POLL_TIMEOUT_MAX(lpn));
}
@@ -1000,7 +1000,7 @@ int bt_mesh_lpn_friend_update(struct bt_mesh_net_rx *rx,
}
/* Set initial poll timeout */
lpn->poll_timeout = min(POLL_TIMEOUT_MAX(lpn),
lpn->poll_timeout = MIN(POLL_TIMEOUT_MAX(lpn),
POLL_TIMEOUT_INIT);
}
+2 -2
View File
@@ -581,8 +581,8 @@ static int gatt_proxy_advertise(struct bt_mesh_subnet *sub)
* 6 slices, but make sure that a slice is at least one
* second long (to avoid excessive rotation).
*/
max_timeout = NODE_ID_TIMEOUT / max(subnet_count, 6);
max_timeout = max(max_timeout, K_SECONDS(1));
max_timeout = NODE_ID_TIMEOUT / MAX(subnet_count, 6);
max_timeout = MAX(max_timeout, K_SECONDS(1));
if (remaining > max_timeout || remaining < 0) {
remaining = max_timeout;
+1 -1
View File
@@ -1008,7 +1008,7 @@ static inline int32_t ack_timeout(struct seg_rx *rx)
/* Make sure we don't send more frequently than the duration for
* each packet (default is 300ms).
*/
return max(to, K_MSEC(400));
return MAX(to, K_MSEC(400));
}
int bt_mesh_ctl_send(struct bt_mesh_net_tx *tx, uint8_t ctl_op, void *data,
+2 -2
View File
@@ -54,7 +54,7 @@ fault_get_cur(struct bt_mesh_model *model,
*test_id = recent_test_id;
*company_id = CID_VENDOR;
*fault_count = min(*fault_count, sizeof(reg_faults));
*fault_count = MIN(*fault_count, sizeof(reg_faults));
memcpy(faults, reg_faults, *fault_count);
return 0;
@@ -78,7 +78,7 @@ fault_get_reg(struct bt_mesh_model *model,
if (has_reg_fault) {
uint8_t reg_faults[FAULT_ARR_SIZE] = { [0 ... FAULT_ARR_SIZE-1] = 0xff };
*fault_count = min(*fault_count, sizeof(reg_faults));
*fault_count = MIN(*fault_count, sizeof(reg_faults));
memcpy(faults, reg_faults, *fault_count);
} else {
*fault_count = 0;