All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] Bluetooth: Fix clearing of HCI_PENDING_CLASS flag
@ 2012-03-02  1:14 johan.hedberg
  2012-03-02  1:14 ` [PATCH 2/3] Bluetooth: mgmt: Fix command status error code values johan.hedberg
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: johan.hedberg @ 2012-03-02  1:14 UTC (permalink / raw)
  To: linux-bluetooth

From: Johan Hedberg <johan.hedberg@intel.com>

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 <johan.hedberg@intel.com>
---
 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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] Bluetooth: mgmt: Fix command status error code values
  2012-03-02  1:14 [PATCH 1/3] Bluetooth: Fix clearing of HCI_PENDING_CLASS flag johan.hedberg
@ 2012-03-02  1:14 ` johan.hedberg
  2012-03-02  1:16   ` Marcel Holtmann
  2012-03-02  1:15 ` [PATCH 3/3] Bluetooth: mgmt: Add new error code for invalid index johan.hedberg
  2012-03-02  1:15 ` [PATCH 1/3] Bluetooth: Fix clearing of HCI_PENDING_CLASS flag Marcel Holtmann
  2 siblings, 1 reply; 6+ messages in thread
From: johan.hedberg @ 2012-03-02  1:14 UTC (permalink / raw)
  To: linux-bluetooth

From: Johan Hedberg <johan.hedberg@intel.com>

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 <johan.hedberg@intel.com>
---
 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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] Bluetooth: mgmt: Add new error code for invalid index
  2012-03-02  1:14 [PATCH 1/3] Bluetooth: Fix clearing of HCI_PENDING_CLASS flag johan.hedberg
  2012-03-02  1:14 ` [PATCH 2/3] Bluetooth: mgmt: Fix command status error code values johan.hedberg
@ 2012-03-02  1:15 ` johan.hedberg
  2012-03-02  1:16   ` Marcel Holtmann
  2012-03-02  1:15 ` [PATCH 1/3] Bluetooth: Fix clearing of HCI_PENDING_CLASS flag Marcel Holtmann
  2 siblings, 1 reply; 6+ messages in thread
From: johan.hedberg @ 2012-03-02  1:15 UTC (permalink / raw)
  To: linux-bluetooth

From: Johan Hedberg <johan.hedberg@intel.com>

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 <johan.hedberg@intel.com>
---
 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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/3] Bluetooth: Fix clearing of HCI_PENDING_CLASS flag
  2012-03-02  1:14 [PATCH 1/3] Bluetooth: Fix clearing of HCI_PENDING_CLASS flag johan.hedberg
  2012-03-02  1:14 ` [PATCH 2/3] Bluetooth: mgmt: Fix command status error code values johan.hedberg
  2012-03-02  1:15 ` [PATCH 3/3] Bluetooth: mgmt: Add new error code for invalid index johan.hedberg
@ 2012-03-02  1:15 ` Marcel Holtmann
  2 siblings, 0 replies; 6+ messages in thread
From: Marcel Holtmann @ 2012-03-02  1:15 UTC (permalink / raw)
  To: johan.hedberg; +Cc: linux-bluetooth

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 <johan.hedberg@intel.com>
> ---
>  net/bluetooth/hci_event.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)

Acked-by: Marcel Holtmann <marcel@holtmann.org>

Regards

Marcel



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/3] Bluetooth: mgmt: Fix command status error code values
  2012-03-02  1:14 ` [PATCH 2/3] Bluetooth: mgmt: Fix command status error code values johan.hedberg
@ 2012-03-02  1:16   ` Marcel Holtmann
  0 siblings, 0 replies; 6+ messages in thread
From: Marcel Holtmann @ 2012-03-02  1:16 UTC (permalink / raw)
  To: johan.hedberg; +Cc: linux-bluetooth

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 <johan.hedberg@intel.com>
> ---
>  net/bluetooth/mgmt.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)

Acked-by: Marcel Holtmann <marcel@holtmann.org>

Regards

Marcel



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/3] Bluetooth: mgmt: Add new error code for invalid index
  2012-03-02  1:15 ` [PATCH 3/3] Bluetooth: mgmt: Add new error code for invalid index johan.hedberg
@ 2012-03-02  1:16   ` Marcel Holtmann
  0 siblings, 0 replies; 6+ messages in thread
From: Marcel Holtmann @ 2012-03-02  1:16 UTC (permalink / raw)
  To: johan.hedberg; +Cc: linux-bluetooth

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 <johan.hedberg@intel.com>
> ---
>  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



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-03-02  1:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-02  1:14 [PATCH 1/3] Bluetooth: Fix clearing of HCI_PENDING_CLASS flag johan.hedberg
2012-03-02  1:14 ` [PATCH 2/3] Bluetooth: mgmt: Fix command status error code values johan.hedberg
2012-03-02  1:16   ` Marcel Holtmann
2012-03-02  1:15 ` [PATCH 3/3] Bluetooth: mgmt: Add new error code for invalid index johan.hedberg
2012-03-02  1:16   ` Marcel Holtmann
2012-03-02  1:15 ` [PATCH 1/3] Bluetooth: Fix clearing of HCI_PENDING_CLASS flag Marcel Holtmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.