* [PATCH 1/2] Bluetooth: mgmt: Remove not needed restriction on add/remove OOB data
@ 2012-12-13 14:11 Szymon Janc
2012-12-13 14:11 ` [PATCH 2/2] Bluetooth: mgmt: Avoid using magic number in status code Szymon Janc
0 siblings, 1 reply; 3+ messages in thread
From: Szymon Janc @ 2012-12-13 14:11 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
Those commands don't send any HCI commands to controller so there is no
need to restrict them to only powered up controller. This also makes
implementation more consistent as already stored remote OOB data
persist power toggle.
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
---
net/bluetooth/mgmt.c | 17 -----------------
1 file changed, 17 deletions(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 5d0ef75..65f9a2d 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2252,13 +2252,6 @@ static int add_remote_oob_data(struct sock *sk, struct hci_dev *hdev,
hci_dev_lock(hdev);
- if (!hdev_is_powered(hdev)) {
- err = cmd_complete(sk, hdev->id, MGMT_OP_ADD_REMOTE_OOB_DATA,
- MGMT_STATUS_NOT_POWERED, &cp->addr,
- sizeof(cp->addr));
- goto unlock;
- }
-
err = hci_add_remote_oob_data(hdev, &cp->addr.bdaddr, cp->hash,
cp->randomizer);
if (err < 0)
@@ -2269,7 +2262,6 @@ static int add_remote_oob_data(struct sock *sk, struct hci_dev *hdev,
err = cmd_complete(sk, hdev->id, MGMT_OP_ADD_REMOTE_OOB_DATA, status,
&cp->addr, sizeof(cp->addr));
-unlock:
hci_dev_unlock(hdev);
return err;
}
@@ -2285,14 +2277,6 @@ static int remove_remote_oob_data(struct sock *sk, struct hci_dev *hdev,
hci_dev_lock(hdev);
- if (!hdev_is_powered(hdev)) {
- err = cmd_complete(sk, hdev->id,
- MGMT_OP_REMOVE_REMOTE_OOB_DATA,
- MGMT_STATUS_NOT_POWERED, &cp->addr,
- sizeof(cp->addr));
- goto unlock;
- }
-
err = hci_remove_remote_oob_data(hdev, &cp->addr.bdaddr);
if (err < 0)
status = MGMT_STATUS_INVALID_PARAMS;
@@ -2302,7 +2286,6 @@ static int remove_remote_oob_data(struct sock *sk, struct hci_dev *hdev,
err = cmd_complete(sk, hdev->id, MGMT_OP_REMOVE_REMOTE_OOB_DATA,
status, &cp->addr, sizeof(cp->addr));
-unlock:
hci_dev_unlock(hdev);
return err;
}
--
1.8.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH 2/2] Bluetooth: mgmt: Avoid using magic number in status code
2012-12-13 14:11 [PATCH 1/2] Bluetooth: mgmt: Remove not needed restriction on add/remove OOB data Szymon Janc
@ 2012-12-13 14:11 ` Szymon Janc
2012-12-21 19:10 ` Gustavo Padovan
0 siblings, 1 reply; 3+ messages in thread
From: Szymon Janc @ 2012-12-13 14:11 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
Use MGMT_STATUS_SUCCESS for success return code.
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
---
net/bluetooth/mgmt.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 65f9a2d..8752c55 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2257,7 +2257,7 @@ static int add_remote_oob_data(struct sock *sk, struct hci_dev *hdev,
if (err < 0)
status = MGMT_STATUS_FAILED;
else
- status = 0;
+ status = MGMT_STATUS_SUCCESS;
err = cmd_complete(sk, hdev->id, MGMT_OP_ADD_REMOTE_OOB_DATA, status,
&cp->addr, sizeof(cp->addr));
@@ -2281,7 +2281,7 @@ static int remove_remote_oob_data(struct sock *sk, struct hci_dev *hdev,
if (err < 0)
status = MGMT_STATUS_INVALID_PARAMS;
else
- status = 0;
+ status = MGMT_STATUS_SUCCESS;
err = cmd_complete(sk, hdev->id, MGMT_OP_REMOVE_REMOTE_OOB_DATA,
status, &cp->addr, sizeof(cp->addr));
@@ -2513,7 +2513,7 @@ static int block_device(struct sock *sk, struct hci_dev *hdev, void *data,
if (err < 0)
status = MGMT_STATUS_FAILED;
else
- status = 0;
+ status = MGMT_STATUS_SUCCESS;
err = cmd_complete(sk, hdev->id, MGMT_OP_BLOCK_DEVICE, status,
&cp->addr, sizeof(cp->addr));
@@ -2538,7 +2538,7 @@ static int unblock_device(struct sock *sk, struct hci_dev *hdev, void *data,
if (err < 0)
status = MGMT_STATUS_INVALID_PARAMS;
else
- status = 0;
+ status = MGMT_STATUS_SUCCESS;
err = cmd_complete(sk, hdev->id, MGMT_OP_UNBLOCK_DEVICE, status,
&cp->addr, sizeof(cp->addr));
--
1.8.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-12-21 19:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-13 14:11 [PATCH 1/2] Bluetooth: mgmt: Remove not needed restriction on add/remove OOB data Szymon Janc
2012-12-13 14:11 ` [PATCH 2/2] Bluetooth: mgmt: Avoid using magic number in status code Szymon Janc
2012-12-21 19:10 ` Gustavo Padovan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).