Bluetooth: Adjust debug logs for connection ref

Move debug log for connection object lifecycle's reference counter
after such ref is modified.
It then prints the exact value for all changes.

Change-Id: I36855c7f5b70d2b6f3e328a0298b869a7b582fa4
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
This commit is contained in:
Arkadiusz Lichwa 2015-06-26 14:52:55 +02:00 committed by Anas Nashif
commit caadf61a54

View file

@ -363,18 +363,22 @@ struct bt_conn *bt_conn_lookup_addr_le(const bt_addr_le_t *peer)
struct bt_conn *bt_conn_get(struct bt_conn *conn)
{
BT_DBG("handle %u ref %u\n", conn->handle, conn->ref);
atomic_inc(&conn->ref);
BT_DBG("handle %u ref %u\n", conn->handle, atomic_get(&conn->ref));
return conn;
}
void bt_conn_put(struct bt_conn *conn)
{
BT_DBG("handle %u ref %u\n", conn->handle, conn->ref);
atomic_val_t old_ref;
if (atomic_dec(&conn->ref) > 1) {
old_ref = atomic_dec(&conn->ref);
BT_DBG("handle %u ref %u\n", conn->handle, atomic_get(&conn->ref));
if (old_ref > 1) {
return;
}