summaryrefslogtreecommitdiffstats
path: root/net/bluetooth/mgmt.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2011-11-07 15:16:04 -0500
committerGustavo F. Padovan <padovan@profusion.mobi>2011-11-08 09:54:10 -0500
commit3243553fdc108a0ef49b9e25bdea9c87b341413e (patch)
treeb0ef367f37653b6fdefa3b028fdc0f2e685e5b2e /net/bluetooth/mgmt.c
parent2d7cee5836d6d466829b255b1290c9386d4e884f (diff)
Bluetooth: Convert power off mechanism to use delayed_work
The power off code doesn't need to use its own custom timer since the delayed_work API provides the exact same functionality. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth/mgmt.c')
-rw-r--r--net/bluetooth/mgmt.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 0cb023e0edb4..6f9e3cd0d1fd 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -150,7 +150,8 @@ static int read_index_list(struct sock *sk)
150 150
151 i = 0; 151 i = 0;
152 list_for_each_entry(d, &hci_dev_list, list) { 152 list_for_each_entry(d, &hci_dev_list, list) {
153 hci_del_off_timer(d); 153 if (test_and_clear_bit(HCI_AUTO_OFF, &d->flags))
154 cancel_delayed_work_sync(&d->power_off);
154 155
155 if (test_bit(HCI_SETUP, &d->flags)) 156 if (test_bit(HCI_SETUP, &d->flags))
156 continue; 157 continue;
@@ -180,7 +181,8 @@ static int read_controller_info(struct sock *sk, u16 index)
180 if (!hdev) 181 if (!hdev)
181 return cmd_status(sk, index, MGMT_OP_READ_INFO, ENODEV); 182 return cmd_status(sk, index, MGMT_OP_READ_INFO, ENODEV);
182 183
183 hci_del_off_timer(hdev); 184 if (test_and_clear_bit(HCI_AUTO_OFF, &hdev->flags))
185 cancel_delayed_work_sync(&hdev->power_off);
184 186
185 hci_dev_lock_bh(hdev); 187 hci_dev_lock_bh(hdev);
186 188
@@ -337,7 +339,7 @@ static int set_powered(struct sock *sk, u16 index, unsigned char *data, u16 len)
337 if (cp->val) 339 if (cp->val)
338 queue_work(hdev->workqueue, &hdev->power_on); 340 queue_work(hdev->workqueue, &hdev->power_on);
339 else 341 else
340 queue_work(hdev->workqueue, &hdev->power_off); 342 queue_work(hdev->workqueue, &hdev->power_off.work);
341 343
342 err = 0; 344 err = 0;
343 345