Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 278569
b: refs/heads/master
c: 8680570
h: refs/heads/master
i:
  278567: be46ed0
v: v3
  • Loading branch information
Johan Hedberg authored and Gustavo F. Padovan committed Nov 16, 2011
1 parent fbd52f7 commit 1ccec4a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 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: 1425acb74b6d58690d78027021ce1d8f3068c66f
refs/heads/master: 8680570b0cae8f66ad28c8de227aab1894428ee5
26 changes: 14 additions & 12 deletions trunk/net/bluetooth/mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,15 @@ static void mgmt_pending_remove(struct pending_cmd *cmd)
mgmt_pending_free(cmd);
}

static int send_mode_rsp(struct sock *sk, u16 opcode, u16 index, u8 val)
{
struct mgmt_mode rp;

rp.val = val;

return cmd_complete(sk, index, opcode, &rp, sizeof(rp));
}

static int set_powered(struct sock *sk, u16 index, unsigned char *data, u16 len)
{
struct mgmt_mode *cp;
Expand All @@ -312,7 +321,7 @@ static int set_powered(struct sock *sk, u16 index, unsigned char *data, u16 len)

up = test_bit(HCI_UP, &hdev->flags);
if ((cp->val && up) || (!cp->val && !up)) {
err = cmd_status(sk, index, MGMT_OP_SET_POWERED, EALREADY);
err = send_mode_rsp(sk, index, MGMT_OP_SET_POWERED, cp->val);
goto failed;
}

Expand Down Expand Up @@ -375,7 +384,8 @@ static int set_discoverable(struct sock *sk, u16 index, unsigned char *data,

if (cp->val == test_bit(HCI_ISCAN, &hdev->flags) &&
test_bit(HCI_PSCAN, &hdev->flags)) {
err = cmd_status(sk, index, MGMT_OP_SET_DISCOVERABLE, EALREADY);
err = send_mode_rsp(sk, index, MGMT_OP_SET_DISCOVERABLE,
cp->val);
goto failed;
}

Expand Down Expand Up @@ -440,7 +450,8 @@ static int set_connectable(struct sock *sk, u16 index, unsigned char *data,
}

if (cp->val == test_bit(HCI_PSCAN, &hdev->flags)) {
err = cmd_status(sk, index, MGMT_OP_SET_CONNECTABLE, EALREADY);
err = send_mode_rsp(sk, index, MGMT_OP_SET_CONNECTABLE,
cp->val);
goto failed;
}

Expand Down Expand Up @@ -495,15 +506,6 @@ static int mgmt_event(u16 event, struct hci_dev *hdev, void *data,
return 0;
}

static int send_mode_rsp(struct sock *sk, u16 opcode, u16 index, u8 val)
{
struct mgmt_mode rp;

rp.val = val;

return cmd_complete(sk, index, opcode, &rp, sizeof(rp));
}

static int set_pairable(struct sock *sk, u16 index, unsigned char *data,
u16 len)
{
Expand Down

0 comments on commit 1ccec4a

Please sign in to comment.