aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAndre Guedes <andre.guedes@openbossa.org>2014-06-25 20:52:52 -0400
committerMarcel Holtmann <marcel@holtmann.org>2014-07-03 11:42:52 -0400
commitd4905f2453bd228d8ffc57f4e25bba0a8f52c805 (patch)
treee04e8379f1e9ed13d368c1235a2023181d1d8a60 /net
parentc20c02d5c8d76f39be461c25bf5de3a1dc96885e (diff)
Bluetooth: Connection parameters check helper
This patch renames l2cap_check_conn_param() to hci_check_conn_params() and moves it to hci_core.h so it can reused in others files. This helper will be reused in the next patch. Signed-off-by: Andre Guedes <andre.guedes@openbossa.org> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/l2cap_core.c23
1 files changed, 1 insertions, 22 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index d015aa190fdc..e203a5fdf874 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -5213,27 +5213,6 @@ static inline int l2cap_move_channel_confirm_rsp(struct l2cap_conn *conn,
5213 return 0; 5213 return 0;
5214} 5214}
5215 5215
5216static inline int l2cap_check_conn_param(u16 min, u16 max, u16 latency,
5217 u16 to_multiplier)
5218{
5219 u16 max_latency;
5220
5221 if (min > max || min < 6 || max > 3200)
5222 return -EINVAL;
5223
5224 if (to_multiplier < 10 || to_multiplier > 3200)
5225 return -EINVAL;
5226
5227 if (max >= to_multiplier * 8)
5228 return -EINVAL;
5229
5230 max_latency = (to_multiplier * 8 / max) - 1;
5231 if (latency > 499 || latency > max_latency)
5232 return -EINVAL;
5233
5234 return 0;
5235}
5236
5237static inline int l2cap_conn_param_update_req(struct l2cap_conn *conn, 5216static inline int l2cap_conn_param_update_req(struct l2cap_conn *conn,
5238 struct l2cap_cmd_hdr *cmd, 5217 struct l2cap_cmd_hdr *cmd,
5239 u16 cmd_len, u8 *data) 5218 u16 cmd_len, u8 *data)
@@ -5261,7 +5240,7 @@ static inline int l2cap_conn_param_update_req(struct l2cap_conn *conn,
5261 5240
5262 memset(&rsp, 0, sizeof(rsp)); 5241 memset(&rsp, 0, sizeof(rsp));
5263 5242
5264 err = l2cap_check_conn_param(min, max, latency, to_multiplier); 5243 err = hci_check_conn_params(min, max, latency, to_multiplier);
5265 if (err) 5244 if (err)
5266 rsp.result = cpu_to_le16(L2CAP_CONN_PARAM_REJECTED); 5245 rsp.result = cpu_to_le16(L2CAP_CONN_PARAM_REJECTED);
5267 else 5246 else