aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/l2cap_core.c
diff options
context:
space:
mode:
authorAndrei Emeltchenko <andrei.emeltchenko@intel.com>2012-05-24 08:42:51 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2012-06-04 23:34:09 -0400
commitac73498cbb54ebe3a06709ba7e4feb99c83113bf (patch)
treea3715f391d6793db546fd043efaad406cf0b287d /net/bluetooth/l2cap_core.c
parent2983fd682444180e45567ce8147a612b97ba69da (diff)
Bluetooth: Use __constant when dealing with constants
__constant_cpu_to_le16() is the right go here. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'net/bluetooth/l2cap_core.c')
-rw-r--r--net/bluetooth/l2cap_core.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 65c3f4e13965..6eb2ef2de723 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -616,7 +616,7 @@ void l2cap_chan_close(struct l2cap_chan *chan, int reason)
616 rsp.scid = cpu_to_le16(chan->dcid); 616 rsp.scid = cpu_to_le16(chan->dcid);
617 rsp.dcid = cpu_to_le16(chan->scid); 617 rsp.dcid = cpu_to_le16(chan->scid);
618 rsp.result = cpu_to_le16(result); 618 rsp.result = cpu_to_le16(result);
619 rsp.status = cpu_to_le16(L2CAP_CS_NO_INFO); 619 rsp.status = __constant_cpu_to_le16(L2CAP_CS_NO_INFO);
620 l2cap_send_cmd(conn, chan->ident, L2CAP_CONN_RSP, 620 l2cap_send_cmd(conn, chan->ident, L2CAP_CONN_RSP,
621 sizeof(rsp), &rsp); 621 sizeof(rsp), &rsp);
622 } 622 }
@@ -1010,7 +1010,7 @@ static void l2cap_do_start(struct l2cap_chan *chan)
1010 l2cap_send_conn_req(chan); 1010 l2cap_send_conn_req(chan);
1011 } else { 1011 } else {
1012 struct l2cap_info_req req; 1012 struct l2cap_info_req req;
1013 req.type = cpu_to_le16(L2CAP_IT_FEAT_MASK); 1013 req.type = __constant_cpu_to_le16(L2CAP_IT_FEAT_MASK);
1014 1014
1015 conn->info_state |= L2CAP_INFO_FEAT_MASK_REQ_SENT; 1015 conn->info_state |= L2CAP_INFO_FEAT_MASK_REQ_SENT;
1016 conn->info_ident = l2cap_get_ident(conn); 1016 conn->info_ident = l2cap_get_ident(conn);
@@ -1110,20 +1110,20 @@ static void l2cap_conn_start(struct l2cap_conn *conn)
1110 if (test_bit(BT_SK_DEFER_SETUP, 1110 if (test_bit(BT_SK_DEFER_SETUP,
1111 &bt_sk(sk)->flags)) { 1111 &bt_sk(sk)->flags)) {
1112 struct sock *parent = bt_sk(sk)->parent; 1112 struct sock *parent = bt_sk(sk)->parent;
1113 rsp.result = cpu_to_le16(L2CAP_CR_PEND); 1113 rsp.result = __constant_cpu_to_le16(L2CAP_CR_PEND);
1114 rsp.status = cpu_to_le16(L2CAP_CS_AUTHOR_PEND); 1114 rsp.status = __constant_cpu_to_le16(L2CAP_CS_AUTHOR_PEND);
1115 if (parent) 1115 if (parent)
1116 parent->sk_data_ready(parent, 0); 1116 parent->sk_data_ready(parent, 0);
1117 1117
1118 } else { 1118 } else {
1119 __l2cap_state_change(chan, BT_CONFIG); 1119 __l2cap_state_change(chan, BT_CONFIG);
1120 rsp.result = cpu_to_le16(L2CAP_CR_SUCCESS); 1120 rsp.result = __constant_cpu_to_le16(L2CAP_CR_SUCCESS);
1121 rsp.status = cpu_to_le16(L2CAP_CS_NO_INFO); 1121 rsp.status = __constant_cpu_to_le16(L2CAP_CS_NO_INFO);
1122 } 1122 }
1123 release_sock(sk); 1123 release_sock(sk);
1124 } else { 1124 } else {
1125 rsp.result = cpu_to_le16(L2CAP_CR_PEND); 1125 rsp.result = __constant_cpu_to_le16(L2CAP_CR_PEND);
1126 rsp.status = cpu_to_le16(L2CAP_CS_AUTHEN_PEND); 1126 rsp.status = __constant_cpu_to_le16(L2CAP_CS_AUTHEN_PEND);
1127 } 1127 }
1128 1128
1129 l2cap_send_cmd(conn, chan->ident, L2CAP_CONN_RSP, 1129 l2cap_send_cmd(conn, chan->ident, L2CAP_CONN_RSP,
@@ -2595,9 +2595,9 @@ static struct sk_buff *l2cap_build_cmd(struct l2cap_conn *conn,
2595 lh->len = cpu_to_le16(L2CAP_CMD_HDR_SIZE + dlen); 2595 lh->len = cpu_to_le16(L2CAP_CMD_HDR_SIZE + dlen);
2596 2596
2597 if (conn->hcon->type == LE_LINK) 2597 if (conn->hcon->type == LE_LINK)
2598 lh->cid = cpu_to_le16(L2CAP_CID_LE_SIGNALING); 2598 lh->cid = __constant_cpu_to_le16(L2CAP_CID_LE_SIGNALING);
2599 else 2599 else
2600 lh->cid = cpu_to_le16(L2CAP_CID_SIGNALING); 2600 lh->cid = __constant_cpu_to_le16(L2CAP_CID_SIGNALING);
2601 2601
2602 cmd = (struct l2cap_cmd_hdr *) skb_put(skb, L2CAP_CMD_HDR_SIZE); 2602 cmd = (struct l2cap_cmd_hdr *) skb_put(skb, L2CAP_CMD_HDR_SIZE);
2603 cmd->code = code; 2603 cmd->code = code;
@@ -2709,8 +2709,8 @@ static void l2cap_add_opt_efs(void **ptr, struct l2cap_chan *chan)
2709 efs.stype = chan->local_stype; 2709 efs.stype = chan->local_stype;
2710 efs.msdu = cpu_to_le16(chan->local_msdu); 2710 efs.msdu = cpu_to_le16(chan->local_msdu);
2711 efs.sdu_itime = cpu_to_le32(chan->local_sdu_itime); 2711 efs.sdu_itime = cpu_to_le32(chan->local_sdu_itime);
2712 efs.acc_lat = cpu_to_le32(L2CAP_DEFAULT_ACC_LAT); 2712 efs.acc_lat = __constant_cpu_to_le32(L2CAP_DEFAULT_ACC_LAT);
2713 efs.flush_to = cpu_to_le32(L2CAP_DEFAULT_FLUSH_TO); 2713 efs.flush_to = __constant_cpu_to_le32(L2CAP_DEFAULT_FLUSH_TO);
2714 break; 2714 break;
2715 2715
2716 case L2CAP_MODE_STREAMING: 2716 case L2CAP_MODE_STREAMING:
@@ -3290,8 +3290,8 @@ void __l2cap_connect_rsp_defer(struct l2cap_chan *chan)
3290 3290
3291 rsp.scid = cpu_to_le16(chan->dcid); 3291 rsp.scid = cpu_to_le16(chan->dcid);
3292 rsp.dcid = cpu_to_le16(chan->scid); 3292 rsp.dcid = cpu_to_le16(chan->scid);
3293 rsp.result = cpu_to_le16(L2CAP_CR_SUCCESS); 3293 rsp.result = __constant_cpu_to_le16(L2CAP_CR_SUCCESS);
3294 rsp.status = cpu_to_le16(L2CAP_CS_NO_INFO); 3294 rsp.status = __constant_cpu_to_le16(L2CAP_CS_NO_INFO);
3295 l2cap_send_cmd(conn, chan->ident, 3295 l2cap_send_cmd(conn, chan->ident,
3296 L2CAP_CONN_RSP, sizeof(rsp), &rsp); 3296 L2CAP_CONN_RSP, sizeof(rsp), &rsp);
3297 3297
@@ -3329,8 +3329,8 @@ static void l2cap_conf_rfc_get(struct l2cap_chan *chan, void *rsp, int len)
3329 * did not send an RFC option. 3329 * did not send an RFC option.
3330 */ 3330 */
3331 rfc.mode = chan->mode; 3331 rfc.mode = chan->mode;
3332 rfc.retrans_timeout = cpu_to_le16(L2CAP_DEFAULT_RETRANS_TO); 3332 rfc.retrans_timeout = __constant_cpu_to_le16(L2CAP_DEFAULT_RETRANS_TO);
3333 rfc.monitor_timeout = cpu_to_le16(L2CAP_DEFAULT_MONITOR_TO); 3333 rfc.monitor_timeout = __constant_cpu_to_le16(L2CAP_DEFAULT_MONITOR_TO);
3334 rfc.max_pdu_size = cpu_to_le16(chan->imtu); 3334 rfc.max_pdu_size = cpu_to_le16(chan->imtu);
3335 3335
3336 BT_ERR("Expected RFC option was not found, using defaults"); 3336 BT_ERR("Expected RFC option was not found, using defaults");
@@ -3474,7 +3474,7 @@ sendresp:
3474 3474
3475 if (result == L2CAP_CR_PEND && status == L2CAP_CS_NO_INFO) { 3475 if (result == L2CAP_CR_PEND && status == L2CAP_CS_NO_INFO) {
3476 struct l2cap_info_req info; 3476 struct l2cap_info_req info;
3477 info.type = cpu_to_le16(L2CAP_IT_FEAT_MASK); 3477 info.type = __constant_cpu_to_le16(L2CAP_IT_FEAT_MASK);
3478 3478
3479 conn->info_state |= L2CAP_INFO_FEAT_MASK_REQ_SENT; 3479 conn->info_state |= L2CAP_INFO_FEAT_MASK_REQ_SENT;
3480 conn->info_ident = l2cap_get_ident(conn); 3480 conn->info_ident = l2cap_get_ident(conn);
@@ -3596,7 +3596,7 @@ static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr
3596 if (chan->state != BT_CONFIG && chan->state != BT_CONNECT2) { 3596 if (chan->state != BT_CONFIG && chan->state != BT_CONNECT2) {
3597 struct l2cap_cmd_rej_cid rej; 3597 struct l2cap_cmd_rej_cid rej;
3598 3598
3599 rej.reason = cpu_to_le16(L2CAP_REJ_INVALID_CID); 3599 rej.reason = __constant_cpu_to_le16(L2CAP_REJ_INVALID_CID);
3600 rej.scid = cpu_to_le16(chan->scid); 3600 rej.scid = cpu_to_le16(chan->scid);
3601 rej.dcid = cpu_to_le16(chan->dcid); 3601 rej.dcid = cpu_to_le16(chan->dcid);
3602 3602
@@ -3886,8 +3886,8 @@ static inline int l2cap_information_req(struct l2cap_conn *conn, struct l2cap_cm
3886 u8 buf[8]; 3886 u8 buf[8];
3887 u32 feat_mask = l2cap_feat_mask; 3887 u32 feat_mask = l2cap_feat_mask;
3888 struct l2cap_info_rsp *rsp = (struct l2cap_info_rsp *) buf; 3888 struct l2cap_info_rsp *rsp = (struct l2cap_info_rsp *) buf;
3889 rsp->type = cpu_to_le16(L2CAP_IT_FEAT_MASK); 3889 rsp->type = __constant_cpu_to_le16(L2CAP_IT_FEAT_MASK);
3890 rsp->result = cpu_to_le16(L2CAP_IR_SUCCESS); 3890 rsp->result = __constant_cpu_to_le16(L2CAP_IR_SUCCESS);
3891 if (!disable_ertm) 3891 if (!disable_ertm)
3892 feat_mask |= L2CAP_FEAT_ERTM | L2CAP_FEAT_STREAMING 3892 feat_mask |= L2CAP_FEAT_ERTM | L2CAP_FEAT_STREAMING
3893 | L2CAP_FEAT_FCS; 3893 | L2CAP_FEAT_FCS;
@@ -3907,15 +3907,15 @@ static inline int l2cap_information_req(struct l2cap_conn *conn, struct l2cap_cm
3907 else 3907 else
3908 l2cap_fixed_chan[0] &= ~L2CAP_FC_A2MP; 3908 l2cap_fixed_chan[0] &= ~L2CAP_FC_A2MP;
3909 3909
3910 rsp->type = cpu_to_le16(L2CAP_IT_FIXED_CHAN); 3910 rsp->type = __constant_cpu_to_le16(L2CAP_IT_FIXED_CHAN);
3911 rsp->result = cpu_to_le16(L2CAP_IR_SUCCESS); 3911 rsp->result = __constant_cpu_to_le16(L2CAP_IR_SUCCESS);
3912 memcpy(rsp->data, l2cap_fixed_chan, sizeof(l2cap_fixed_chan)); 3912 memcpy(rsp->data, l2cap_fixed_chan, sizeof(l2cap_fixed_chan));
3913 l2cap_send_cmd(conn, cmd->ident, 3913 l2cap_send_cmd(conn, cmd->ident,
3914 L2CAP_INFO_RSP, sizeof(buf), buf); 3914 L2CAP_INFO_RSP, sizeof(buf), buf);
3915 } else { 3915 } else {
3916 struct l2cap_info_rsp rsp; 3916 struct l2cap_info_rsp rsp;
3917 rsp.type = cpu_to_le16(type); 3917 rsp.type = cpu_to_le16(type);
3918 rsp.result = cpu_to_le16(L2CAP_IR_NOTSUPP); 3918 rsp.result = __constant_cpu_to_le16(L2CAP_IR_NOTSUPP);
3919 l2cap_send_cmd(conn, cmd->ident, 3919 l2cap_send_cmd(conn, cmd->ident,
3920 L2CAP_INFO_RSP, sizeof(rsp), &rsp); 3920 L2CAP_INFO_RSP, sizeof(rsp), &rsp);
3921 } 3921 }
@@ -3955,7 +3955,7 @@ static inline int l2cap_information_rsp(struct l2cap_conn *conn, struct l2cap_cm
3955 3955
3956 if (conn->feat_mask & L2CAP_FEAT_FIXED_CHAN) { 3956 if (conn->feat_mask & L2CAP_FEAT_FIXED_CHAN) {
3957 struct l2cap_info_req req; 3957 struct l2cap_info_req req;
3958 req.type = cpu_to_le16(L2CAP_IT_FIXED_CHAN); 3958 req.type = __constant_cpu_to_le16(L2CAP_IT_FIXED_CHAN);
3959 3959
3960 conn->info_ident = l2cap_get_ident(conn); 3960 conn->info_ident = l2cap_get_ident(conn);
3961 3961
@@ -4190,9 +4190,9 @@ static inline int l2cap_conn_param_update_req(struct l2cap_conn *conn,
4190 4190
4191 err = l2cap_check_conn_param(min, max, latency, to_multiplier); 4191 err = l2cap_check_conn_param(min, max, latency, to_multiplier);
4192 if (err) 4192 if (err)
4193 rsp.result = cpu_to_le16(L2CAP_CONN_PARAM_REJECTED); 4193 rsp.result = __constant_cpu_to_le16(L2CAP_CONN_PARAM_REJECTED);
4194 else 4194 else
4195 rsp.result = cpu_to_le16(L2CAP_CONN_PARAM_ACCEPTED); 4195 rsp.result = __constant_cpu_to_le16(L2CAP_CONN_PARAM_ACCEPTED);
4196 4196
4197 l2cap_send_cmd(conn, cmd->ident, L2CAP_CONN_PARAM_UPDATE_RSP, 4197 l2cap_send_cmd(conn, cmd->ident, L2CAP_CONN_PARAM_UPDATE_RSP,
4198 sizeof(rsp), &rsp); 4198 sizeof(rsp), &rsp);
@@ -4340,7 +4340,7 @@ static inline void l2cap_sig_channel(struct l2cap_conn *conn,
4340 BT_ERR("Wrong link type (%d)", err); 4340 BT_ERR("Wrong link type (%d)", err);
4341 4341
4342 /* FIXME: Map err to a valid reason */ 4342 /* FIXME: Map err to a valid reason */
4343 rej.reason = cpu_to_le16(L2CAP_REJ_NOT_UNDERSTOOD); 4343 rej.reason = __constant_cpu_to_le16(L2CAP_REJ_NOT_UNDERSTOOD);
4344 l2cap_send_cmd(conn, cmd.ident, L2CAP_COMMAND_REJ, sizeof(rej), &rej); 4344 l2cap_send_cmd(conn, cmd.ident, L2CAP_COMMAND_REJ, sizeof(rej), &rej);
4345 } 4345 }
4346 4346