[PATCH 1/3] Bluetooth: Fix clearing of HCI_PENDING_CLASS flag

Subsystems: bluetooth subsystem, the rest

STALE5308d

6 messages, 2 authors, 2012-03-02 · open the first message on its own page

[PATCH 1/3] Bluetooth: Fix clearing of HCI_PENDING_CLASS flag

From: <hidden>
Date: 2012-03-02 01:14:58

From: Johan Hedberg <redacted>

When doing reset HCI_PENDING_CLASS is one of the flags that should be
cleared (since it's used for a pending HCI command and a reset clear all
pending commands).

Signed-off-by: Johan Hedberg <redacted>
---
 net/bluetooth/hci_event.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index aee9556..d6c41bb 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -193,7 +193,7 @@ static void hci_cc_reset(struct hci_dev *hdev, struct sk_buff *skb)
 	hci_req_complete(hdev, HCI_OP_RESET, status);
 
 	/* Reset all non-persistent flags */
-	hdev->dev_flags &= ~(BIT(HCI_LE_SCAN));
+	hdev->dev_flags &= ~(BIT(HCI_LE_SCAN) | BIT(HCI_PENDING_CLASS));
 
 	hdev->discovery.state = DISCOVERY_STOPPED;
 }
-- 
1.7.9.1

[PATCH 2/3] Bluetooth: mgmt: Fix command status error code values

From: <hidden>
Date: 2012-03-02 01:14:59

From: Johan Hedberg <redacted>

Error codes in the command status should always be from the set of
values defined for mgmt and never e.g. POSIX error codes.

Signed-off-by: Johan Hedberg <redacted>
---
 net/bluetooth/mgmt.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 40b3da3..bd01e4a 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2745,7 +2745,7 @@ int mgmt_index_added(struct hci_dev *hdev)
 
 int mgmt_index_removed(struct hci_dev *hdev)
 {
-	u8 status = ENODEV;
+	u8 status = MGMT_STATUS_INVALID_PARAMS;
 
 	mgmt_pending_foreach(0, hdev, cmd_status_rsp, &status);
 
@@ -2798,7 +2798,7 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered)
 		update_class(hdev);
 		update_eir(hdev);
 	} else {
-		u8 status = ENETDOWN;
+		u8 status = MGMT_STATUS_NOT_POWERED;
 		mgmt_pending_foreach(0, hdev, cmd_status_rsp, &status);
 	}
 
-- 
1.7.9.1

[PATCH 3/3] Bluetooth: mgmt: Add new error code for invalid index

From: <hidden>
Date: 2012-03-02 01:15:00

From: Johan Hedberg <redacted>

The index is part of the command header and not its parameters so it
makes sense to distinguish this from the invalid parameters error.

Signed-off-by: Johan Hedberg <redacted>
---
 include/net/bluetooth/mgmt.h |    1 +
 net/bluetooth/mgmt.c         |    6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index d33457d..0ca3519 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -41,6 +41,7 @@
 #define MGMT_STATUS_DISCONNECTED	0x0e
 #define MGMT_STATUS_NOT_POWERED		0x0f
 #define MGMT_STATUS_CANCELLED		0x10
+#define MGMT_STATUS_INVALID_INDEX	0x11
 
 struct mgmt_hdr {
 	__le16 opcode;
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index bd01e4a..fa9a589 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2682,7 +2682,7 @@ int mgmt_control(struct sock *sk, struct msghdr *msg, size_t msglen)
 		hdev = hci_dev_get(index);
 		if (!hdev) {
 			err = cmd_status(sk, index, opcode,
-					MGMT_STATUS_INVALID_PARAMS);
+					MGMT_STATUS_INVALID_INDEX);
 			goto done;
 		}
 	}
@@ -2698,7 +2698,7 @@ int mgmt_control(struct sock *sk, struct msghdr *msg, size_t msglen)
 	if ((hdev && opcode < MGMT_OP_READ_INFO) ||
 			(!hdev && opcode >= MGMT_OP_READ_INFO)) {
 		err = cmd_status(sk, index, opcode,
-						MGMT_STATUS_INVALID_PARAMS);
+						MGMT_STATUS_INVALID_INDEX);
 		goto done;
 	}
 
@@ -2745,7 +2745,7 @@ int mgmt_index_added(struct hci_dev *hdev)
 
 int mgmt_index_removed(struct hci_dev *hdev)
 {
-	u8 status = MGMT_STATUS_INVALID_PARAMS;
+	u8 status = MGMT_STATUS_INVALID_INDEX;
 
 	mgmt_pending_foreach(0, hdev, cmd_status_rsp, &status);
 
-- 
1.7.9.1

Re: [PATCH 1/3] Bluetooth: Fix clearing of HCI_PENDING_CLASS flag

From: Marcel Holtmann <marcel@holtmann.org>
Date: 2012-03-02 01:15:44

Hi Johan,
When doing reset HCI_PENDING_CLASS is one of the flags that should be
cleared (since it's used for a pending HCI command and a reset clear all
pending commands).

Signed-off-by: Johan Hedberg <redacted>
---
 net/bluetooth/hci_event.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Acked-by: Marcel Holtmann <marcel@holtmann.org>

Regards

Marcel

Re: [PATCH 2/3] Bluetooth: mgmt: Fix command status error code values

From: Marcel Holtmann <marcel@holtmann.org>
Date: 2012-03-02 01:16:14

Hi Johan,
Error codes in the command status should always be from the set of
values defined for mgmt and never e.g. POSIX error codes.

Signed-off-by: Johan Hedberg <redacted>
---
 net/bluetooth/mgmt.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Acked-by: Marcel Holtmann <marcel@holtmann.org>

Regards

Marcel

Re: [PATCH 3/3] Bluetooth: mgmt: Add new error code for invalid index

From: Marcel Holtmann <marcel@holtmann.org>
Date: 2012-03-02 01:16:41

Hi Johan,
The index is part of the command header and not its parameters so it
makes sense to distinguish this from the invalid parameters error.

Signed-off-by: Johan Hedberg <redacted>
---
 include/net/bluetooth/mgmt.h |    1 +
 net/bluetooth/mgmt.c         |    6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)
Acked-by: Marcel Holtmann <marcel@holtmann.org>

Regards

Marcel

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help