Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code style changes #1847

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 5 additions & 13 deletions nimble/host/src/ble_att_svr.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,7 @@ struct ble_att_svr_entry *
ble_att_svr_find_by_handle(uint16_t handle_id)
{
struct ble_att_svr_entry *entry;

for (entry = STAILQ_FIRST(&ble_att_svr_list);
entry != NULL;
entry = STAILQ_NEXT(entry, ha_next)) {

STAILQ_FOREACH(entry, &ble_att_svr_list, ha_next) {
if (entry->ha_handle_id == handle_id) {
return entry;
}
Expand Down Expand Up @@ -1449,16 +1445,12 @@ ble_att_svr_rx_read(uint16_t conn_handle, uint16_t cid, struct os_mbuf **rxom)
return BLE_HS_ENOTSUP;
#endif

struct ble_att_read_req *req;
struct os_mbuf *txom;
uint16_t err_handle;
uint8_t att_err;
int rc;

struct ble_att_read_req *req;
/* Initialize some values in case of early error. */
txom = NULL;
att_err = 0;
err_handle = 0;
struct os_mbuf *txom = NULL;
uint16_t err_handle = 0;
uint8_t att_err = 0;

rc = ble_att_svr_pullup_req_base(rxom, sizeof(*req), &att_err);
if (rc != 0) {
Expand Down
9 changes: 3 additions & 6 deletions nimble/host/src/ble_gatts.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,21 +407,18 @@ ble_gatts_chr_val_access(uint16_t conn_handle, uint16_t attr_handle,
uint8_t att_op, uint16_t offset,
struct os_mbuf **om, void *arg)
{
const struct ble_gatt_chr_def *chr_def;
struct ble_gatt_access_ctxt gatt_ctxt;
int rc;

chr_def = arg;
const struct ble_gatt_chr_def *chr_def = arg;
BLE_HS_DBG_ASSERT(chr_def != NULL && chr_def->access_cb != NULL);

gatt_ctxt.op = ble_gatts_chr_op(att_op);
gatt_ctxt.chr = chr_def;

ble_gatts_chr_inc_val_stat(gatt_ctxt.op);
rc = ble_gatts_val_access(conn_handle, attr_handle, offset, &gatt_ctxt, om,
chr_def->access_cb, chr_def->arg);

return rc;
return ble_gatts_val_access(conn_handle, attr_handle, offset, &gatt_ctxt, om,
chr_def->access_cb, chr_def->arg);
}

static int
Expand Down
22 changes: 10 additions & 12 deletions nimble/host/src/ble_hs_hci_evt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,10 @@ ble_hs_hci_evt_process(struct ble_hci_ev *ev)
int
ble_hs_hci_evt_acl_process(struct os_mbuf *om)
{
#if NIMBLE_BLE_CONNECT
#if !NIMBLE_BLE_CONNECT
return BLE_HS_ENOTSUP;
#endif

struct hci_data_hdr hci_hdr;
struct ble_hs_conn *conn;
ble_l2cap_rx_fn *rx_cb;
Expand All @@ -1055,16 +1058,14 @@ ble_hs_hci_evt_acl_process(struct os_mbuf *om)
goto err;
}

#if (BLETEST_THROUGHPUT_TEST == 0)
#if !BLE_MONITOR
#if (BLETEST_THROUGHPUT_TEST == 0) && !BLE_MONITOR
BLE_HS_LOG(DEBUG, "ble_hs_hci_evt_acl_process(): conn_handle=%u pb=%x "
"len=%u data=",
BLE_HCI_DATA_HANDLE(hci_hdr.hdh_handle_pb_bc),
BLE_HCI_DATA_PB(hci_hdr.hdh_handle_pb_bc),
hci_hdr.hdh_len);
ble_hs_log_mbuf(om);
BLE_HS_LOG(DEBUG, "\n");
#endif
#endif

if (hci_hdr.hdh_len != OS_MBUF_PKTHDR(om)->omp_len) {
Expand All @@ -1077,14 +1078,14 @@ ble_hs_hci_evt_acl_process(struct os_mbuf *om)
ble_hs_lock();

conn = ble_hs_conn_find(conn_handle);
if (conn == NULL) {
/* Peer not connected; quietly discard packet. */
rc = BLE_HS_ENOTCONN;
reject_cid = -1;
} else {
if (conn) {
/* Forward ACL data to L2CAP. */
rc = ble_l2cap_rx(conn, &hci_hdr, om, &rx_cb, &reject_cid);
om = NULL;
} else {
/* Peer not connected; quietly discard packet. */
rc = BLE_HS_ENOTCONN;
reject_cid = -1;
}

ble_hs_unlock();
Expand Down Expand Up @@ -1113,7 +1114,4 @@ ble_hs_hci_evt_acl_process(struct os_mbuf *om)
err:
os_mbuf_free_chain(om);
return rc;
#else
return BLE_HS_ENOTSUP;
#endif
}
Loading