diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2013-10-16 11:11:40 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2013-10-16 12:12:13 -0400 |
commit | a74a84f696537f38fa994c1b95a0dca9ae386865 (patch) | |
tree | 0d6ac825ac9843576b9e0dc3ba55c76219438cae /net/bluetooth/hci_conn.c | |
parent | 7bc18d9d3d7ffbc09dabb201933a063583a39027 (diff) |
Bluetooth: Convert idle timer to use delayed work
There is no need to use a timer since the entire Bluetooth subsystem
runs using workqueues these days.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/hci_conn.c')
-rw-r--r-- | net/bluetooth/hci_conn.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 8d1f466520a5..4e726505f52b 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
@@ -317,8 +317,10 @@ static void hci_conn_timeout(struct work_struct *work) | |||
317 | } | 317 | } |
318 | 318 | ||
319 | /* Enter sniff mode */ | 319 | /* Enter sniff mode */ |
320 | static void hci_conn_enter_sniff_mode(struct hci_conn *conn) | 320 | static void hci_conn_idle(struct work_struct *work) |
321 | { | 321 | { |
322 | struct hci_conn *conn = container_of(work, struct hci_conn, | ||
323 | idle_work.work); | ||
322 | struct hci_dev *hdev = conn->hdev; | 324 | struct hci_dev *hdev = conn->hdev; |
323 | 325 | ||
324 | BT_DBG("hcon %p mode %d", conn, conn->mode); | 326 | BT_DBG("hcon %p mode %d", conn, conn->mode); |
@@ -352,15 +354,6 @@ static void hci_conn_enter_sniff_mode(struct hci_conn *conn) | |||
352 | } | 354 | } |
353 | } | 355 | } |
354 | 356 | ||
355 | static void hci_conn_idle(unsigned long arg) | ||
356 | { | ||
357 | struct hci_conn *conn = (void *) arg; | ||
358 | |||
359 | BT_DBG("hcon %p mode %d", conn, conn->mode); | ||
360 | |||
361 | hci_conn_enter_sniff_mode(conn); | ||
362 | } | ||
363 | |||
364 | static void hci_conn_auto_accept(struct work_struct *work) | 357 | static void hci_conn_auto_accept(struct work_struct *work) |
365 | { | 358 | { |
366 | struct hci_conn *conn = container_of(work, struct hci_conn, | 359 | struct hci_conn *conn = container_of(work, struct hci_conn, |
@@ -416,7 +409,7 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst) | |||
416 | 409 | ||
417 | INIT_DELAYED_WORK(&conn->disc_work, hci_conn_timeout); | 410 | INIT_DELAYED_WORK(&conn->disc_work, hci_conn_timeout); |
418 | INIT_DELAYED_WORK(&conn->auto_accept_work, hci_conn_auto_accept); | 411 | INIT_DELAYED_WORK(&conn->auto_accept_work, hci_conn_auto_accept); |
419 | setup_timer(&conn->idle_timer, hci_conn_idle, (unsigned long)conn); | 412 | INIT_DELAYED_WORK(&conn->idle_work, hci_conn_idle); |
420 | 413 | ||
421 | atomic_set(&conn->refcnt, 0); | 414 | atomic_set(&conn->refcnt, 0); |
422 | 415 | ||
@@ -437,10 +430,9 @@ int hci_conn_del(struct hci_conn *conn) | |||
437 | 430 | ||
438 | BT_DBG("%s hcon %p handle %d", hdev->name, conn, conn->handle); | 431 | BT_DBG("%s hcon %p handle %d", hdev->name, conn, conn->handle); |
439 | 432 | ||
440 | del_timer(&conn->idle_timer); | ||
441 | |||
442 | cancel_delayed_work_sync(&conn->disc_work); | 433 | cancel_delayed_work_sync(&conn->disc_work); |
443 | cancel_delayed_work_sync(&conn->auto_accept_work); | 434 | cancel_delayed_work_sync(&conn->auto_accept_work); |
435 | cancel_delayed_work_sync(&conn->idle_work); | ||
444 | 436 | ||
445 | if (conn->type == ACL_LINK) { | 437 | if (conn->type == ACL_LINK) { |
446 | struct hci_conn *sco = conn->link; | 438 | struct hci_conn *sco = conn->link; |
@@ -920,8 +912,8 @@ void hci_conn_enter_active_mode(struct hci_conn *conn, __u8 force_active) | |||
920 | 912 | ||
921 | timer: | 913 | timer: |
922 | if (hdev->idle_timeout > 0) | 914 | if (hdev->idle_timeout > 0) |
923 | mod_timer(&conn->idle_timer, | 915 | queue_delayed_work(hdev->workqueue, &conn->idle_work, |
924 | jiffies + msecs_to_jiffies(hdev->idle_timeout)); | 916 | msecs_to_jiffies(hdev->idle_timeout)); |
925 | } | 917 | } |
926 | 918 | ||
927 | /* Drop all connection on the device */ | 919 | /* Drop all connection on the device */ |