struct delayed_work info_timer;
+ int disconn_err;
+ struct work_struct disconn_work;
+
struct sk_buff *rx_skb;
__u32 rx_len;
__u8 tx_ident;
u8 status);
void __l2cap_physical_cfm(struct l2cap_chan *chan, int result);
+void l2cap_conn_shutdown(struct l2cap_conn *conn, int err);
void l2cap_conn_get(struct l2cap_conn *conn);
void l2cap_conn_put(struct l2cap_conn *conn);
if (work_pending(&conn->pending_rx_work))
cancel_work_sync(&conn->pending_rx_work);
+ if (work_pending(&conn->disconn_work))
+ cancel_work_sync(&conn->disconn_work);
+
l2cap_unregister_all_users(conn);
mutex_lock(&conn->chan_lock);
}
}
+static void disconn_work(struct work_struct *work)
+{
+ struct l2cap_conn *conn = container_of(work, struct l2cap_conn,
+ disconn_work);
+
+ BT_DBG("conn %p", conn);
+
+ l2cap_conn_del(conn->hcon, conn->disconn_err);
+}
+
+void l2cap_conn_shutdown(struct l2cap_conn *conn, int err)
+{
+ struct hci_dev *hdev = conn->hcon->hdev;
+
+ BT_DBG("conn %p err %d", conn, err);
+
+ conn->disconn_err = err;
+ queue_work(hdev->workqueue, &conn->disconn_work);
+}
+
static void l2cap_conn_free(struct kref *ref)
{
struct l2cap_conn *conn = container_of(ref, struct l2cap_conn, ref);
else
INIT_DELAYED_WORK(&conn->info_timer, l2cap_info_timeout);
+ INIT_WORK(&conn->disconn_work, disconn_work);
+
skb_queue_head_init(&conn->pending_rx);
INIT_WORK(&conn->pending_rx_work, process_pending_rx);