diff options
| author | Johan Hedberg <johan.hedberg@intel.com> | 2013-10-16 11:11:39 -0400 |
|---|---|---|
| committer | Marcel Holtmann <marcel@holtmann.org> | 2013-10-16 12:12:12 -0400 |
| commit | 7bc18d9d3d7ffbc09dabb201933a063583a39027 (patch) | |
| tree | 3d72b9a4fce174e064c852d5a44100a988c3308e /net | |
| parent | bfe4655f05d7ec4a7c0c1c7e4051862f824cd8ec (diff) | |
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: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net')
| -rw-r--r-- | net/bluetooth/hci_conn.c | 14 | ||||
| -rw-r--r-- | net/bluetooth/hci_event.c | 3 |
2 files changed, 8 insertions, 9 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index ff04b051792d..8d1f466520a5 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
| @@ -361,12 +361,12 @@ static void hci_conn_idle(unsigned long arg) | |||
| 361 | hci_conn_enter_sniff_mode(conn); | 361 | hci_conn_enter_sniff_mode(conn); |
| 362 | } | 362 | } |
| 363 | 363 | ||
| 364 | static void hci_conn_auto_accept(unsigned long arg) | 364 | static void hci_conn_auto_accept(struct work_struct *work) |
| 365 | { | 365 | { |
| 366 | struct hci_conn *conn = (void *) arg; | 366 | struct hci_conn *conn = container_of(work, struct hci_conn, |
| 367 | struct hci_dev *hdev = conn->hdev; | 367 | auto_accept_work.work); |
| 368 | 368 | ||
| 369 | hci_send_cmd(hdev, HCI_OP_USER_CONFIRM_REPLY, sizeof(conn->dst), | 369 | hci_send_cmd(conn->hdev, HCI_OP_USER_CONFIRM_REPLY, sizeof(conn->dst), |
| 370 | &conn->dst); | 370 | &conn->dst); |
| 371 | } | 371 | } |
| 372 | 372 | ||
| @@ -415,9 +415,8 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst) | |||
| 415 | INIT_LIST_HEAD(&conn->chan_list); | 415 | INIT_LIST_HEAD(&conn->chan_list); |
| 416 | 416 | ||
| 417 | INIT_DELAYED_WORK(&conn->disc_work, hci_conn_timeout); | 417 | INIT_DELAYED_WORK(&conn->disc_work, hci_conn_timeout); |
| 418 | INIT_DELAYED_WORK(&conn->auto_accept_work, hci_conn_auto_accept); | ||
| 418 | setup_timer(&conn->idle_timer, hci_conn_idle, (unsigned long)conn); | 419 | setup_timer(&conn->idle_timer, hci_conn_idle, (unsigned long)conn); |
| 419 | setup_timer(&conn->auto_accept_timer, hci_conn_auto_accept, | ||
| 420 | (unsigned long) conn); | ||
| 421 | 420 | ||
| 422 | atomic_set(&conn->refcnt, 0); | 421 | atomic_set(&conn->refcnt, 0); |
| 423 | 422 | ||
| @@ -441,8 +440,7 @@ int hci_conn_del(struct hci_conn *conn) | |||
| 441 | del_timer(&conn->idle_timer); | 440 | del_timer(&conn->idle_timer); |
| 442 | 441 | ||
| 443 | cancel_delayed_work_sync(&conn->disc_work); | 442 | cancel_delayed_work_sync(&conn->disc_work); |
| 444 | 443 | cancel_delayed_work_sync(&conn->auto_accept_work); | |
| 445 | del_timer(&conn->auto_accept_timer); | ||
| 446 | 444 | ||
| 447 | if (conn->type == ACL_LINK) { | 445 | if (conn->type == ACL_LINK) { |
| 448 | struct hci_conn *sco = conn->link; | 446 | struct hci_conn *sco = conn->link; |
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index e71c98fedc9b..6c3b193951ad 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
| @@ -3188,7 +3188,8 @@ static void hci_user_confirm_request_evt(struct hci_dev *hdev, | |||
| 3188 | 3188 | ||
| 3189 | if (hdev->auto_accept_delay > 0) { | 3189 | if (hdev->auto_accept_delay > 0) { |
| 3190 | int delay = msecs_to_jiffies(hdev->auto_accept_delay); | 3190 | int delay = msecs_to_jiffies(hdev->auto_accept_delay); |
| 3191 | mod_timer(&conn->auto_accept_timer, jiffies + delay); | 3191 | queue_delayed_work(conn->hdev->workqueue, |
| 3192 | &conn->auto_accept_work, delay); | ||
| 3192 | goto unlock; | 3193 | goto unlock; |
| 3193 | } | 3194 | } |
| 3194 | 3195 | ||
