Skip to content

Commit 1db7a11

Browse files
joerchanjhedberg
authored andcommitted
Bluetooth: host: Document bt_conn_unref responsibility of caller
Document the need for the caller to call bt_conn_unref on the connection object returned from API functions. Signed-off-by: Joakim Andersson <[email protected]>
1 parent e489a59 commit 1db7a11

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

include/bluetooth/conn.h

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,13 @@ void bt_conn_foreach(int type, void (*func)(struct bt_conn *conn, void *data),
9393
*
9494
* Look up an existing connection based on the remote address.
9595
*
96+
* The caller gets a new reference to the connection object which must be
97+
* released with bt_conn_unref() once done using the object.
98+
*
9699
* @param id Local identity (in most cases BT_ID_DEFAULT).
97100
* @param peer Remote address.
98101
*
99-
* @return Connection object or NULL if not found. The caller gets a
100-
* new reference to the connection object which must be released with
101-
* bt_conn_unref() once done using the object.
102+
* @return Connection object or NULL if not found.
102103
*/
103104
struct bt_conn *bt_conn_lookup_addr_le(u8_t id, const bt_addr_le_t *peer);
104105

@@ -280,7 +281,9 @@ int bt_conn_disconnect(struct bt_conn *conn, u8_t reason);
280281
/** @brief Initiate an LE connection to a remote device.
281282
*
282283
* Allows initiate new LE link to remote peer using its address.
283-
* Returns a new reference that the the caller is responsible for managing.
284+
*
285+
* The caller gets a new reference to the connection object which must be
286+
* released with bt_conn_unref() once done using the object.
284287
*
285288
* This uses the General Connection Establishment procedure.
286289
*
@@ -345,7 +348,8 @@ int bt_le_set_auto_conn(const bt_addr_le_t *addr,
345348
*
346349
* The advertising may be canceled with bt_conn_disconnect().
347350
*
348-
* Returns a new reference that the the caller is responsible for managing.
351+
* The caller gets a new reference to the connection object which must be
352+
* released with bt_conn_unref() once done using the object.
349353
*
350354
* @param peer Remote address.
351355
* @param param Directed advertising parameters.
@@ -1023,7 +1027,9 @@ struct bt_br_conn_param {
10231027
/** @brief Initiate an BR/EDR connection to a remote device.
10241028
*
10251029
* Allows initiate new BR/EDR link to remote peer using its address.
1026-
* Returns a new reference that the the caller is responsible for managing.
1030+
*
1031+
* The caller gets a new reference to the connection object which must be
1032+
* released with bt_conn_unref() once done using the object.
10271033
*
10281034
* @param peer Remote address.
10291035
* @param param Initial connection parameters.
@@ -1036,7 +1042,9 @@ struct bt_conn *bt_conn_create_br(const bt_addr_t *peer,
10361042
/** @brief Initiate an SCO connection to a remote device.
10371043
*
10381044
* Allows initiate new SCO link to remote peer using its address.
1039-
* Returns a new reference that the the caller is responsible for managing.
1045+
*
1046+
* The caller gets a new reference to the connection object which must be
1047+
* released with bt_conn_unref() once done using the object.
10401048
*
10411049
* @param peer Remote address.
10421050
*

0 commit comments

Comments
 (0)