Commit 7bc18d9d authored by Johan Hedberg's avatar Johan Hedberg Committed by Marcel Holtmann

Bluetooth: Convert auto accept timer to use delayed work

Since the entire Bluetooth subsystem runs in workqueues these days there
is no need to use a timer for deferring work.
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent bfe4655f
...@@ -341,8 +341,8 @@ struct hci_conn { ...@@ -341,8 +341,8 @@ struct hci_conn {
struct list_head chan_list; struct list_head chan_list;
struct delayed_work disc_work; struct delayed_work disc_work;
struct delayed_work auto_accept_work;
struct timer_list idle_timer; struct timer_list idle_timer;
struct timer_list auto_accept_timer;
struct device dev; struct device dev;
......
...@@ -361,12 +361,12 @@ static void hci_conn_idle(unsigned long arg) ...@@ -361,12 +361,12 @@ static void hci_conn_idle(unsigned long arg)
hci_conn_enter_sniff_mode(conn); hci_conn_enter_sniff_mode(conn);
} }
static void hci_conn_auto_accept(unsigned long arg) static void hci_conn_auto_accept(struct work_struct *work)
{ {
struct hci_conn *conn = (void *) arg; struct hci_conn *conn = container_of(work, struct hci_conn,
struct hci_dev *hdev = conn->hdev; auto_accept_work.work);
hci_send_cmd(hdev, HCI_OP_USER_CONFIRM_REPLY, sizeof(conn->dst), hci_send_cmd(conn->hdev, HCI_OP_USER_CONFIRM_REPLY, sizeof(conn->dst),
&conn->dst); &conn->dst);
} }
...@@ -415,9 +415,8 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst) ...@@ -415,9 +415,8 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst)
INIT_LIST_HEAD(&conn->chan_list); INIT_LIST_HEAD(&conn->chan_list);
INIT_DELAYED_WORK(&conn->disc_work, hci_conn_timeout); INIT_DELAYED_WORK(&conn->disc_work, hci_conn_timeout);
INIT_DELAYED_WORK(&conn->auto_accept_work, hci_conn_auto_accept);
setup_timer(&conn->idle_timer, hci_conn_idle, (unsigned long)conn); setup_timer(&conn->idle_timer, hci_conn_idle, (unsigned long)conn);
setup_timer(&conn->auto_accept_timer, hci_conn_auto_accept,
(unsigned long) conn);
atomic_set(&conn->refcnt, 0); atomic_set(&conn->refcnt, 0);
...@@ -441,8 +440,7 @@ int hci_conn_del(struct hci_conn *conn) ...@@ -441,8 +440,7 @@ int hci_conn_del(struct hci_conn *conn)
del_timer(&conn->idle_timer); del_timer(&conn->idle_timer);
cancel_delayed_work_sync(&conn->disc_work); cancel_delayed_work_sync(&conn->disc_work);
cancel_delayed_work_sync(&conn->auto_accept_work);
del_timer(&conn->auto_accept_timer);
if (conn->type == ACL_LINK) { if (conn->type == ACL_LINK) {
struct hci_conn *sco = conn->link; struct hci_conn *sco = conn->link;
......
...@@ -3188,7 +3188,8 @@ static void hci_user_confirm_request_evt(struct hci_dev *hdev, ...@@ -3188,7 +3188,8 @@ static void hci_user_confirm_request_evt(struct hci_dev *hdev,
if (hdev->auto_accept_delay > 0) { if (hdev->auto_accept_delay > 0) {
int delay = msecs_to_jiffies(hdev->auto_accept_delay); int delay = msecs_to_jiffies(hdev->auto_accept_delay);
mod_timer(&conn->auto_accept_timer, jiffies + delay); queue_delayed_work(conn->hdev->workqueue,
&conn->auto_accept_work, delay);
goto unlock; goto unlock;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment