Bluetooth: Use min() macro where possible
There's no need to have custom minimum value evaluation logic when there's already a convenience macro available. Change-Id: I91ad50521deb2575100c3480cad516bbf6f4dc2d Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
2ea4e83446
commit
90475d78f2
1 changed files with 3 additions and 10 deletions
|
@ -35,6 +35,7 @@
|
|||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <misc/byteorder.h>
|
||||
#include <misc/util.h>
|
||||
|
||||
#include <bluetooth/hci.h>
|
||||
#include <bluetooth/bluetooth.h>
|
||||
|
@ -157,11 +158,7 @@ void bt_conn_send(struct bt_conn *conn, struct bt_buf *buf)
|
|||
|
||||
nano_fifo_init(&frags);
|
||||
|
||||
if (remaining > dev->le_mtu) {
|
||||
len = dev->le_mtu;
|
||||
} else {
|
||||
len = remaining;
|
||||
}
|
||||
len = min(remaining, dev->le_mtu);
|
||||
|
||||
hdr = (void *)bt_buf_push(buf, sizeof(*hdr));
|
||||
hdr->handle = sys_cpu_to_le16(conn->handle);
|
||||
|
@ -176,11 +173,7 @@ void bt_conn_send(struct bt_conn *conn, struct bt_buf *buf)
|
|||
while (remaining) {
|
||||
buf = bt_conn_create_pdu(conn);
|
||||
|
||||
if (remaining > dev->le_mtu) {
|
||||
len = dev->le_mtu;
|
||||
} else {
|
||||
len = remaining;
|
||||
}
|
||||
len = min(remaining, dev->le_mtu);
|
||||
|
||||
/* Copy from original buffer */
|
||||
memcpy(bt_buf_add(buf, len), ptr, len);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue