aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGustavo Padovan <gustavo.padovan@collabora.co.uk>2012-11-23 13:50:51 -0500
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>2012-12-03 12:59:59 -0500
commitffa88e02bc67a1496fae762ad899e8f49136e7a1 (patch)
tree19ccfa6766bea3adc5d9cbfe9f903e4299e18ef4
parent20714bfef84d3e690c9c6f8e9cd46543b5ae1eed (diff)
Bluetooth: Move double negation to macros
Some comparisons needs to double negation(!!) in order to make the value of the field boolean. Add it to the macro makes the code more readable. Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
-rw-r--r--include/net/bluetooth/hci_core.h6
-rw-r--r--net/bluetooth/hci_event.c4
-rw-r--r--net/bluetooth/mgmt.c10
3 files changed, 10 insertions, 10 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 76891a914e75..2f2b743f5b10 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -767,7 +767,7 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
767#define lmp_sniffsubr_capable(dev) ((dev)->features[5] & LMP_SNIFF_SUBR) 767#define lmp_sniffsubr_capable(dev) ((dev)->features[5] & LMP_SNIFF_SUBR)
768#define lmp_pause_enc_capable(dev) ((dev)->features[5] & LMP_PAUSE_ENC) 768#define lmp_pause_enc_capable(dev) ((dev)->features[5] & LMP_PAUSE_ENC)
769#define lmp_ext_inq_capable(dev) ((dev)->features[6] & LMP_EXT_INQ) 769#define lmp_ext_inq_capable(dev) ((dev)->features[6] & LMP_EXT_INQ)
770#define lmp_le_br_capable(dev) ((dev)->features[6] & LMP_SIMUL_LE_BR) 770#define lmp_le_br_capable(dev) !!((dev)->features[6] & LMP_SIMUL_LE_BR)
771#define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR) 771#define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR)
772#define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH) 772#define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH)
773#define lmp_lsto_capable(dev) ((dev)->features[7] & LMP_LSTO) 773#define lmp_lsto_capable(dev) ((dev)->features[7] & LMP_LSTO)
@@ -776,8 +776,8 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
776 776
777/* ----- Extended LMP capabilities ----- */ 777/* ----- Extended LMP capabilities ----- */
778#define lmp_host_ssp_capable(dev) ((dev)->host_features[0] & LMP_HOST_SSP) 778#define lmp_host_ssp_capable(dev) ((dev)->host_features[0] & LMP_HOST_SSP)
779#define lmp_host_le_capable(dev) ((dev)->host_features[0] & LMP_HOST_LE) 779#define lmp_host_le_capable(dev) !!((dev)->host_features[0] & LMP_HOST_LE)
780#define lmp_host_le_br_capable(dev) ((dev)->host_features[0] & LMP_HOST_LE_BREDR) 780#define lmp_host_le_br_capable(dev) !!((dev)->host_features[0] & LMP_HOST_LE_BREDR)
781 781
782/* ----- HCI protocols ----- */ 782/* ----- HCI protocols ----- */
783#define HCI_PROTO_DEFER 0x01 783#define HCI_PROTO_DEFER 0x01
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 3843f1897c86..705078a0cc39 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -794,10 +794,10 @@ static void hci_set_le_support(struct hci_dev *hdev)
794 794
795 if (test_bit(HCI_LE_ENABLED, &hdev->dev_flags)) { 795 if (test_bit(HCI_LE_ENABLED, &hdev->dev_flags)) {
796 cp.le = 1; 796 cp.le = 1;
797 cp.simul = !!lmp_le_br_capable(hdev); 797 cp.simul = lmp_le_br_capable(hdev);
798 } 798 }
799 799
800 if (cp.le != !!lmp_host_le_capable(hdev)) 800 if (cp.le != lmp_host_le_capable(hdev))
801 hci_send_cmd(hdev, HCI_OP_WRITE_LE_HOST_SUPPORTED, sizeof(cp), 801 hci_send_cmd(hdev, HCI_OP_WRITE_LE_HOST_SUPPORTED, sizeof(cp),
802 &cp); 802 &cp);
803} 803}
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index dedbb1d8b2d2..5d0ef759ef49 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1225,7 +1225,7 @@ static int set_le(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
1225 } 1225 }
1226 1226
1227 val = !!cp->val; 1227 val = !!cp->val;
1228 enabled = !!lmp_host_le_capable(hdev); 1228 enabled = lmp_host_le_capable(hdev);
1229 1229
1230 if (!hdev_is_powered(hdev) || val == enabled) { 1230 if (!hdev_is_powered(hdev) || val == enabled) {
1231 bool changed = false; 1231 bool changed = false;
@@ -1261,7 +1261,7 @@ static int set_le(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
1261 1261
1262 if (val) { 1262 if (val) {
1263 hci_cp.le = val; 1263 hci_cp.le = val;
1264 hci_cp.simul = !!lmp_le_br_capable(hdev); 1264 hci_cp.simul = lmp_le_br_capable(hdev);
1265 } 1265 }
1266 1266
1267 err = hci_send_cmd(hdev, HCI_OP_WRITE_LE_HOST_SUPPORTED, sizeof(hci_cp), 1267 err = hci_send_cmd(hdev, HCI_OP_WRITE_LE_HOST_SUPPORTED, sizeof(hci_cp),
@@ -2924,13 +2924,13 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered)
2924 struct hci_cp_write_le_host_supported cp; 2924 struct hci_cp_write_le_host_supported cp;
2925 2925
2926 cp.le = 1; 2926 cp.le = 1;
2927 cp.simul = !!lmp_le_br_capable(hdev); 2927 cp.simul = lmp_le_br_capable(hdev);
2928 2928
2929 /* Check first if we already have the right 2929 /* Check first if we already have the right
2930 * host state (host features set) 2930 * host state (host features set)
2931 */ 2931 */
2932 if (cp.le != !!lmp_host_le_capable(hdev) || 2932 if (cp.le != lmp_host_le_capable(hdev) ||
2933 cp.simul != !!lmp_host_le_br_capable(hdev)) 2933 cp.simul != lmp_host_le_br_capable(hdev))
2934 hci_send_cmd(hdev, 2934 hci_send_cmd(hdev,
2935 HCI_OP_WRITE_LE_HOST_SUPPORTED, 2935 HCI_OP_WRITE_LE_HOST_SUPPORTED,
2936 sizeof(cp), &cp); 2936 sizeof(cp), &cp);