Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 291000
b: refs/heads/master
c: f0d4b78
h: refs/heads/master
v: v3
  • Loading branch information
Marcel Holtmann authored and Johan Hedberg committed Feb 21, 2012
1 parent 0816a98 commit 220700c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c059e05353081471908c05029585765614e07cec
refs/heads/master: f0d4b78a68c4fe3b0d45de9a50e8d29419177b83
23 changes: 14 additions & 9 deletions trunk/net/bluetooth/mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,6 @@ static int read_index_list(struct sock *sk)

i = 0;
list_for_each_entry(d, &hci_dev_list, list) {
if (test_and_clear_bit(HCI_AUTO_OFF, &d->dev_flags))
cancel_delayed_work(&d->power_off);

if (test_bit(HCI_SETUP, &d->dev_flags))
continue;

Expand Down Expand Up @@ -392,11 +389,12 @@ static u32 get_current_settings(struct hci_dev *hdev)
{
u32 settings = 0;

if (test_bit(HCI_UP, &hdev->flags))
settings |= MGMT_SETTING_POWERED;
else
if (!test_bit(HCI_UP, &hdev->flags))
return settings;

if (!test_bit(HCI_AUTO_OFF, &hdev->dev_flags))
settings |= MGMT_SETTING_POWERED;

if (test_bit(HCI_PSCAN, &hdev->flags))
settings |= MGMT_SETTING_CONNECTABLE;

Expand Down Expand Up @@ -623,9 +621,6 @@ static int read_controller_info(struct sock *sk, u16 index)
return cmd_status(sk, index, MGMT_OP_READ_INFO,
MGMT_STATUS_INVALID_PARAMS);

if (test_and_clear_bit(HCI_AUTO_OFF, &hdev->dev_flags))
cancel_delayed_work_sync(&hdev->power_off);

hci_dev_lock(hdev);

if (test_and_clear_bit(HCI_PI_MGMT_INIT, &hci_pi(sk)->flags))
Expand Down Expand Up @@ -753,6 +748,16 @@ static int set_powered(struct sock *sk, u16 index, void *data, u16 len)

hci_dev_lock(hdev);

if (test_and_clear_bit(HCI_AUTO_OFF, &hdev->dev_flags)) {
cancel_delayed_work(&hdev->power_off);

if (cp->val) {
err = send_settings_rsp(sk, MGMT_OP_SET_POWERED, hdev);
mgmt_powered(hdev, 1);
goto failed;
}
}

up = test_bit(HCI_UP, &hdev->flags);
if ((cp->val && up) || (!cp->val && !up)) {
err = send_settings_rsp(sk, MGMT_OP_SET_POWERED, hdev);
Expand Down

0 comments on commit 220700c

Please sign in to comment.