Skip to contentSkip to conversation

Bluetooth:hci_qca: Changed unsigned long to bool

PATCH Superseded Mutharaju, Prasanna (P.) 2 participants 3 messages Sep 28, 2015

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Bluetooth:hci_qca: Changed unsigned long to bool

From: Prasanna Karthik <[email protected]>

'retransmit' being set in HCI_IBS_TX_WAKING case,
using bool would be efficient.

---
 drivers/bluetooth/hci_qca.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/bluetooth/hci_qca.c +0 -0
index 21f4ea4..3fdb17d 100644
@@ -347,7 +347,7 @@ static void hci_ibs_wake_retrans_timeout(unsigned long =

arg)
struct hci_uart *hu =3D (struct hci_uart *)arg;
struct qca_data *qca =3D hu->priv;
unsigned long flags, retrans_delay;
- unsigned long retransmit =3D 0;
+ bool retransmit;
=20
BT_DBG("hu %p wake retransmit timeout in %d state",
hu, qca->tx_ibs_state);
@@ -358,7 +358,7 @@ static void hci_ibs_wake_retrans_timeout(unsigned long = arg)
switch (qca->tx_ibs_state) {
case HCI_IBS_TX_WAKING:
/* No WAKE_ACK, retransmit WAKE */
- retransmit =3D 1;
+ retransmit =3D true;
if (send_hci_ibs_cmd(HCI_IBS_WAKE_IND, hu) < 0) {
BT_ERR("Failed to acknowledge device wake up"); break;
--=20
1.9.1

#1 lore raw

Hi,

Quoted 24 lines · Prasanna

From: Prasanna Karthik <[email protected]>

'retransmit' being set in HCI_IBS_TX_WAKING case,
using bool would be efficient.

---
 drivers/bluetooth/hci_qca.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/bluetooth/hci_qca.c +1 -1
index 21f4ea4..3fdb17d 100644
@@ -347,7 +347,7 @@ static void hci_ibs_wake_retrans_timeout(unsigned long
 arg) struct hci_uart *hu = (struct hci_uart *)arg;
 	struct qca_data *qca = hu->priv;
 	unsigned long flags, retrans_delay;
-	unsigned long retransmit = 0;
+	bool retransmit;
 
 	BT_DBG("hu %p wake retransmit timeout in %d state",
 		hu, qca->tx_ibs_state);

drivers/bluetooth/hci_qca.c static void hci_ibs_wake_retrans_timeout(unsigned long · line 364

Quoted 8 lines
drivers/bluetooth/hci_qca.c +1 -1
@@ -358,7 +358,7 @@ static void hci_ibs_wake_retrans_timeout(unsigned long
 arg) switch (qca->tx_ibs_state) {
 	case HCI_IBS_TX_WAKING:
 		/* No WAKE_ACK, retransmit WAKE */
-		retransmit = 1;
+		retransmit = true;
 		if (send_hci_ibs_cmd(HCI_IBS_WAKE_IND, hu) < 0) {
 			BT_ERR("Failed to acknowledge device wake up");
 			break;

Isn't this patch giving you a warning about retransmit being used uninitialized? (it is never set to false)

Signature · 2 lines
BR
Szymon Janc
#2 lore raw
Quoted 18 lines · Szymon Janc

Hi,
=20

drivers/bluetooth/hci_qca.c static void hci_ibs_wake_retrans_timeout(unsigned l=

Quoted 15 lines · Prasanna

From: Prasanna Karthik <[email protected]>
=20
'retransmit' being set in HCI_IBS_TX_WAKING case,
using bool would be efficient.
=20

---
 drivers/bluetooth/hci_qca.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

=20

drivers/bluetooth/hci_qca.c +0 -0
index 21f4ea4..3fdb17d 100644
@@ -347,7 +347,7 @@ static void hci_ibs_wake_retrans_timeout(unsigned l=

ong

Quoted 9 lines

drivers/bluetooth/hci_qca.c static void hci_ibs_wake_retrans_timeout(unsigned l=

Quoted 9 lines
drivers/bluetooth/hci_qca.c +1 -1
 arg) struct hci_uart *hu =3D (struct hci_uart *)arg;
 	struct qca_data *qca =3D hu->priv;
 	unsigned long flags, retrans_delay;
-	unsigned long retransmit =3D 0;
+	bool retransmit;

=20

drivers/bluetooth/hci_qca.c +0 -0
 	BT_DBG("hu %p wake retransmit timeout in %d state",
 		hu, qca->tx_ibs_state);
@@ -358,7 +358,7 @@ static void hci_ibs_wake_retrans_timeout(unsigned l=

ong

Quoted 7 lines
Quoted 7 lines
drivers/bluetooth/hci_qca.c +1 -1
 arg) switch (qca->tx_ibs_state) {
 	case HCI_IBS_TX_WAKING:
 		/* No WAKE_ACK, retransmit WAKE */
-		retransmit =3D 1;
+		retransmit =3D true;
 		if (send_hci_ibs_cmd(HCI_IBS_WAKE_IND, hu) < 0) {
 			BT_ERR("Failed to acknowledge device wake up");
Quoted 8 lines

drivers/bluetooth/hci_qca.c static void hci_ibs_wake_retrans_timeout(unsigned l= · line 364

Quoted 1 line
drivers/bluetooth/hci_qca.c +0 -0
 			break;

=20
Isn't this patch giving you a warning about retransmit being used=20 uninitialized? (it is never set to false)
=20
--=20
BR
Szymon Janc

Nope, It doesn't show compiler warning, bool will be initialized to false by default by the compiler. I will send a V2 of the patch with retransmit set to false if needed. =