All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] Bluetooth: trivial: Correct types
@ 2012-03-12 13:59 Andrei Emeltchenko
  2012-03-12 13:59 ` [PATCH 2/4] Bluetooth: Fix type in cpu_to_le conversion Andrei Emeltchenko
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Andrei Emeltchenko @ 2012-03-12 13:59 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Fix sparse warnigns below:
...
net/bluetooth/hci_sysfs.c:458:33: warning: cast to restricted __be32
net/bluetooth/hci_sysfs.c:458:47: warning: cast to restricted __be16
...

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
 net/bluetooth/hci_sysfs.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index bc15429..0a4e7ab 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -444,8 +444,8 @@ static const struct file_operations blacklist_fops = {
 
 static void print_bt_uuid(struct seq_file *f, u8 *uuid)
 {
-	u32 data0, data4;
-	u16 data1, data2, data3, data5;
+	__be32 data0, data4;
+	__be16 data1, data2, data3, data5;
 
 	memcpy(&data0, &uuid[0], 4);
 	memcpy(&data1, &uuid[4], 2);
-- 
1.7.9.1


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

* [PATCH 2/4] Bluetooth: Fix type in cpu_to_le conversion
  2012-03-12 13:59 [PATCH 1/4] Bluetooth: trivial: Correct types Andrei Emeltchenko
@ 2012-03-12 13:59 ` Andrei Emeltchenko
  2012-03-12 17:35   ` Marcel Holtmann
  2012-03-12 13:59 ` [PATCH 3/4] Bluetooth: Fix opcode access in hci_complete Andrei Emeltchenko
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Andrei Emeltchenko @ 2012-03-12 13:59 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Use struct hci_cp_write_def_link_policy to overcome sparse
warnigs below:

...
net/bluetooth/hci_event.c:633:21: warning: incorrect type in assignment
(different base types)
net/bluetooth/hci_event.c:633:21:    expected unsigned short [unsigned]
[assigned] [usertype] link_policy
net/bluetooth/hci_event.c:633:21:    got restricted __le16 [usertype] <noident>
...

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
 net/bluetooth/hci_event.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 66ffe45..7e0d1eb 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -616,6 +616,7 @@ done:
 
 static void hci_setup_link_policy(struct hci_dev *hdev)
 {
+	struct hci_cp_write_def_link_policy cp;
 	u16 link_policy = 0;
 
 	if (hdev->features[0] & LMP_RSWITCH)
@@ -627,9 +628,8 @@ static void hci_setup_link_policy(struct hci_dev *hdev)
 	if (hdev->features[1] & LMP_PARK)
 		link_policy |= HCI_LP_PARK;
 
-	link_policy = cpu_to_le16(link_policy);
-	hci_send_cmd(hdev, HCI_OP_WRITE_DEF_LINK_POLICY, sizeof(link_policy),
-		     &link_policy);
+	cp.policy = cpu_to_le16(link_policy);
+	hci_send_cmd(hdev, HCI_OP_WRITE_DEF_LINK_POLICY, sizeof(cp), &cp);
 }
 
 static void hci_cc_read_local_commands(struct hci_dev *hdev, struct sk_buff *skb)
-- 
1.7.9.1


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

* [PATCH 3/4] Bluetooth: Fix opcode access in hci_complete
  2012-03-12 13:59 [PATCH 1/4] Bluetooth: trivial: Correct types Andrei Emeltchenko
  2012-03-12 13:59 ` [PATCH 2/4] Bluetooth: Fix type in cpu_to_le conversion Andrei Emeltchenko
@ 2012-03-12 13:59 ` Andrei Emeltchenko
  2012-03-12 17:38   ` Marcel Holtmann
  2012-03-12 13:59 ` [PATCH 4/4] Bluetooth: trivial: Remove sparse warnings Andrei Emeltchenko
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Andrei Emeltchenko @ 2012-03-12 13:59 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

opcode to be accessed is in le16 format so convert it
first to cpu byte order.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
 net/bluetooth/hci_core.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 2f3e1bb..149d749 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -84,6 +84,7 @@ void hci_req_complete(struct hci_dev *hdev, __u16 cmd, int result)
 	 */
 	if (test_bit(HCI_INIT, &hdev->flags) && hdev->init_last_cmd != cmd) {
 		struct hci_command_hdr *sent = (void *) hdev->sent_cmd->data;
+		u16 opcode = __le16_to_cpu(sent->opcode);
 		struct sk_buff *skb;
 
 		/* Some CSR based controllers generate a spontaneous
@@ -93,7 +94,7 @@ void hci_req_complete(struct hci_dev *hdev, __u16 cmd, int result)
 		 * command.
 		 */
 
-		if (cmd != HCI_OP_RESET || sent->opcode == HCI_OP_RESET)
+		if (cmd != HCI_OP_RESET || opcode == HCI_OP_RESET)
 			return;
 
 		skb = skb_clone(hdev->sent_cmd, GFP_ATOMIC);
-- 
1.7.9.1


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

* [PATCH 4/4] Bluetooth: trivial: Remove sparse warnings
  2012-03-12 13:59 [PATCH 1/4] Bluetooth: trivial: Correct types Andrei Emeltchenko
  2012-03-12 13:59 ` [PATCH 2/4] Bluetooth: Fix type in cpu_to_le conversion Andrei Emeltchenko
  2012-03-12 13:59 ` [PATCH 3/4] Bluetooth: Fix opcode access in hci_complete Andrei Emeltchenko
@ 2012-03-12 13:59 ` Andrei Emeltchenko
  2012-03-12 17:36   ` Marcel Holtmann
  2012-03-12 17:39 ` [PATCH 1/4] Bluetooth: trivial: Correct types Marcel Holtmann
  2012-03-16 15:36 ` Johan Hedberg
  4 siblings, 1 reply; 10+ messages in thread
From: Andrei Emeltchenko @ 2012-03-12 13:59 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>


Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@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 06b5df3..5efca93 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -287,7 +287,7 @@ static int read_commands(struct sock *sk, struct hci_dev *hdev, void *data,
 	struct mgmt_rp_read_commands *rp;
 	u16 num_commands = ARRAY_SIZE(mgmt_commands);
 	u16 num_events = ARRAY_SIZE(mgmt_events);
-	u16 *opcode;
+	__le16 *opcode;
 	size_t rp_size;
 	int i, err;
 
@@ -2601,7 +2601,7 @@ static int load_long_term_keys(struct sock *sk, struct hci_dev *hdev,
 	return 0;
 }
 
-struct mgmt_handler {
+static struct mgmt_handler {
 	int (*func) (struct sock *sk, struct hci_dev *hdev, void *data,
 		     u16 data_len);
 	bool var_len;
-- 
1.7.9.1


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

* Re: [PATCH 2/4] Bluetooth: Fix type in cpu_to_le conversion
  2012-03-12 13:59 ` [PATCH 2/4] Bluetooth: Fix type in cpu_to_le conversion Andrei Emeltchenko
@ 2012-03-12 17:35   ` Marcel Holtmann
  0 siblings, 0 replies; 10+ messages in thread
From: Marcel Holtmann @ 2012-03-12 17:35 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth

Hi Andrei,

> Use struct hci_cp_write_def_link_policy to overcome sparse
> warnigs below:
> 
> ...
> net/bluetooth/hci_event.c:633:21: warning: incorrect type in assignment
> (different base types)
> net/bluetooth/hci_event.c:633:21:    expected unsigned short [unsigned]
> [assigned] [usertype] link_policy
> net/bluetooth/hci_event.c:633:21:    got restricted __le16 [usertype] <noident>
> ...
> 
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
>  net/bluetooth/hci_event.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)

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

Regards

Marcel



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

* Re: [PATCH 4/4] Bluetooth: trivial: Remove sparse warnings
  2012-03-12 13:59 ` [PATCH 4/4] Bluetooth: trivial: Remove sparse warnings Andrei Emeltchenko
@ 2012-03-12 17:36   ` Marcel Holtmann
  2012-03-13  8:16     ` Andrei Emeltchenko
  0 siblings, 1 reply; 10+ messages in thread
From: Marcel Holtmann @ 2012-03-12 17:36 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth

Hi Andrei,

at least put the sparse warning in the commit message.

> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@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 06b5df3..5efca93 100644
> --- a/net/bluetooth/mgmt.c
> +++ b/net/bluetooth/mgmt.c
> @@ -287,7 +287,7 @@ static int read_commands(struct sock *sk, struct hci_dev *hdev, void *data,
>  	struct mgmt_rp_read_commands *rp;
>  	u16 num_commands = ARRAY_SIZE(mgmt_commands);
>  	u16 num_events = ARRAY_SIZE(mgmt_events);
> -	u16 *opcode;
> +	__le16 *opcode;
>  	size_t rp_size;
>  	int i, err;
>  
> @@ -2601,7 +2601,7 @@ static int load_long_term_keys(struct sock *sk, struct hci_dev *hdev,
>  	return 0;
>  }
>  
> -struct mgmt_handler {
> +static struct mgmt_handler {
>  	int (*func) (struct sock *sk, struct hci_dev *hdev, void *data,
>  		     u16 data_len);
>  	bool var_len;

And this should be static const.

Regards

Marcel



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

* Re: [PATCH 3/4] Bluetooth: Fix opcode access in hci_complete
  2012-03-12 13:59 ` [PATCH 3/4] Bluetooth: Fix opcode access in hci_complete Andrei Emeltchenko
@ 2012-03-12 17:38   ` Marcel Holtmann
  0 siblings, 0 replies; 10+ messages in thread
From: Marcel Holtmann @ 2012-03-12 17:38 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth

Hi Andrei,

> opcode to be accessed is in le16 format so convert it
> first to cpu byte order.
> 
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
>  net/bluetooth/hci_core.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)

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

Regards

Marcel



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

* Re: [PATCH 1/4] Bluetooth: trivial: Correct types
  2012-03-12 13:59 [PATCH 1/4] Bluetooth: trivial: Correct types Andrei Emeltchenko
                   ` (2 preceding siblings ...)
  2012-03-12 13:59 ` [PATCH 4/4] Bluetooth: trivial: Remove sparse warnings Andrei Emeltchenko
@ 2012-03-12 17:39 ` Marcel Holtmann
  2012-03-16 15:36 ` Johan Hedberg
  4 siblings, 0 replies; 10+ messages in thread
From: Marcel Holtmann @ 2012-03-12 17:39 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth

Hi Andrei,

> Fix sparse warnigns below:
> ...
> net/bluetooth/hci_sysfs.c:458:33: warning: cast to restricted __be32
> net/bluetooth/hci_sysfs.c:458:47: warning: cast to restricted __be16
> ...
> 
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
>  net/bluetooth/hci_sysfs.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)

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

Regards

Marcel



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

* Re: [PATCH 4/4] Bluetooth: trivial: Remove sparse warnings
  2012-03-12 17:36   ` Marcel Holtmann
@ 2012-03-13  8:16     ` Andrei Emeltchenko
  0 siblings, 0 replies; 10+ messages in thread
From: Andrei Emeltchenko @ 2012-03-13  8:16 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth

Hi Marcel,

On Mon, Mar 12, 2012 at 10:36:17AM -0700, Marcel Holtmann wrote:
> Hi Andrei,
> 
> at least put the sparse warning in the commit message.
> 
> > Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@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 06b5df3..5efca93 100644
> > --- a/net/bluetooth/mgmt.c
> > +++ b/net/bluetooth/mgmt.c
> > @@ -287,7 +287,7 @@ static int read_commands(struct sock *sk, struct hci_dev *hdev, void *data,
> >  	struct mgmt_rp_read_commands *rp;
> >  	u16 num_commands = ARRAY_SIZE(mgmt_commands);
> >  	u16 num_events = ARRAY_SIZE(mgmt_events);
> > -	u16 *opcode;
> > +	__le16 *opcode;
> >  	size_t rp_size;
> >  	int i, err;
> >  
> > @@ -2601,7 +2601,7 @@ static int load_long_term_keys(struct sock *sk, struct hci_dev *hdev,
> >  	return 0;
> >  }
> >  
> > -struct mgmt_handler {
> > +static struct mgmt_handler {
> >  	int (*func) (struct sock *sk, struct hci_dev *hdev, void *data,
> >  		     u16 data_len);
> >  	bool var_len;
> 
> And this should be static const.

Thanks for the review, I will resend this patch.

Best regards 
Andrei Emeltchenko 

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

* Re: [PATCH 1/4] Bluetooth: trivial: Correct types
  2012-03-12 13:59 [PATCH 1/4] Bluetooth: trivial: Correct types Andrei Emeltchenko
                   ` (3 preceding siblings ...)
  2012-03-12 17:39 ` [PATCH 1/4] Bluetooth: trivial: Correct types Marcel Holtmann
@ 2012-03-16 15:36 ` Johan Hedberg
  4 siblings, 0 replies; 10+ messages in thread
From: Johan Hedberg @ 2012-03-16 15:36 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth

Hi Andrei,

On Mon, Mar 12, 2012, Andrei Emeltchenko wrote:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> 
> Fix sparse warnigns below:
> ...
> net/bluetooth/hci_sysfs.c:458:33: warning: cast to restricted __be32
> net/bluetooth/hci_sysfs.c:458:47: warning: cast to restricted __be16
> ...
> 
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
>  net/bluetooth/hci_sysfs.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)

Patches 1-3 have been applied. Thanks.

Johan

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

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

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-12 13:59 [PATCH 1/4] Bluetooth: trivial: Correct types Andrei Emeltchenko
2012-03-12 13:59 ` [PATCH 2/4] Bluetooth: Fix type in cpu_to_le conversion Andrei Emeltchenko
2012-03-12 17:35   ` Marcel Holtmann
2012-03-12 13:59 ` [PATCH 3/4] Bluetooth: Fix opcode access in hci_complete Andrei Emeltchenko
2012-03-12 17:38   ` Marcel Holtmann
2012-03-12 13:59 ` [PATCH 4/4] Bluetooth: trivial: Remove sparse warnings Andrei Emeltchenko
2012-03-12 17:36   ` Marcel Holtmann
2012-03-13  8:16     ` Andrei Emeltchenko
2012-03-12 17:39 ` [PATCH 1/4] Bluetooth: trivial: Correct types Marcel Holtmann
2012-03-16 15:36 ` Johan Hedberg

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.