Bluetooth: host: Add reference count old and new value in debug print

Add reference count old to new value transition in the debug print, this
makes it easier to interpret the printed line when debuggin reference
count bugs.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
Joakim Andersson 2020-02-02 22:07:18 +01:00 committed by Johan Hedberg
commit 869bea659a

View file

@ -1917,18 +1917,20 @@ void bt_conn_foreach(int type, void (*func)(struct bt_conn *conn, void *data),
struct bt_conn *bt_conn_ref(struct bt_conn *conn)
{
atomic_inc(&conn->ref);
atomic_val_t old = atomic_inc(&conn->ref);
BT_DBG("handle %u ref %u", conn->handle, atomic_get(&conn->ref));
BT_DBG("handle %u ref %u -> %u", conn->handle, old,
atomic_get(&conn->ref));
return conn;
}
void bt_conn_unref(struct bt_conn *conn)
{
atomic_dec(&conn->ref);
atomic_val_t old = atomic_dec(&conn->ref);
BT_DBG("handle %u ref %u", conn->handle, atomic_get(&conn->ref));
BT_DBG("handle %u ref %u -> %u", conn->handle, old,
atomic_get(&conn->ref));
}
const bt_addr_le_t *bt_conn_get_dst(const struct bt_conn *conn)