Skip to content

Commit 40051e4

Browse files
committed
Bluetooth: Remove unneeded hci_conn_disconnect abstraction
The abstraction of disconnect operation via hci_conn_disconnect is not needed and it does not add any readability. Handle the difference of AMP physical channels and BR/EDR/LE connection in the timeout callback. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
1 parent a2b1976 commit 40051e4

1 file changed

Lines changed: 6 additions & 16 deletions

File tree

‎net/bluetooth/hci_conn.c‎

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -271,21 +271,6 @@ void hci_sco_setup(struct hci_conn *conn, __u8 status)
271271
}
272272
}
273273

274-
static void hci_conn_disconnect(struct hci_conn *conn)
275-
{
276-
__u8 reason;
277-
278-
switch (conn->type) {
279-
case AMP_LINK:
280-
hci_amp_disconn(conn);
281-
break;
282-
default:
283-
reason = hci_proto_disconn_ind(conn);
284-
hci_disconnect(conn, reason);
285-
break;
286-
}
287-
}
288-
289274
static void hci_conn_timeout(struct work_struct *work)
290275
{
291276
struct hci_conn *conn = container_of(work, struct hci_conn,
@@ -320,7 +305,12 @@ static void hci_conn_timeout(struct work_struct *work)
320305
break;
321306
case BT_CONFIG:
322307
case BT_CONNECTED:
323-
hci_conn_disconnect(conn);
308+
if (conn->type == AMP_LINK) {
309+
hci_amp_disconn(conn);
310+
} else {
311+
__u8 reason = hci_proto_disconn_ind(conn);
312+
hci_disconnect(conn, reason);
313+
}
324314
break;
325315
default:
326316
conn->state = BT_CLOSED;

0 commit comments

Comments
 (0)