Bluetooth: Fix L2CAP coding style
Follow the net subsystem coding style Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
This commit is contained in:
parent
4c89b6aad5
commit
2d7928184c
|
@ -60,7 +60,8 @@ static void l2cap_tx(struct l2cap_chan *chan, struct l2cap_ctrl *control,
|
|||
|
||||
/* ---- L2CAP channels ---- */
|
||||
|
||||
static struct l2cap_chan *__l2cap_get_chan_by_dcid(struct l2cap_conn *conn, u16 cid)
|
||||
static struct l2cap_chan *__l2cap_get_chan_by_dcid(struct l2cap_conn *conn,
|
||||
u16 cid)
|
||||
{
|
||||
struct l2cap_chan *c;
|
||||
|
||||
|
@ -71,7 +72,8 @@ static struct l2cap_chan *__l2cap_get_chan_by_dcid(struct l2cap_conn *conn, u16
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static struct l2cap_chan *__l2cap_get_chan_by_scid(struct l2cap_conn *conn, u16 cid)
|
||||
static struct l2cap_chan *__l2cap_get_chan_by_scid(struct l2cap_conn *conn,
|
||||
u16 cid)
|
||||
{
|
||||
struct l2cap_chan *c;
|
||||
|
||||
|
@ -84,7 +86,8 @@ static struct l2cap_chan *__l2cap_get_chan_by_scid(struct l2cap_conn *conn, u16
|
|||
|
||||
/* Find channel with given SCID.
|
||||
* Returns locked channel. */
|
||||
static struct l2cap_chan *l2cap_get_chan_by_scid(struct l2cap_conn *conn, u16 cid)
|
||||
static struct l2cap_chan *l2cap_get_chan_by_scid(struct l2cap_conn *conn,
|
||||
u16 cid)
|
||||
{
|
||||
struct l2cap_chan *c;
|
||||
|
||||
|
@ -97,7 +100,8 @@ static struct l2cap_chan *l2cap_get_chan_by_scid(struct l2cap_conn *conn, u16 ci
|
|||
return c;
|
||||
}
|
||||
|
||||
static struct l2cap_chan *__l2cap_get_chan_by_ident(struct l2cap_conn *conn, u8 ident)
|
||||
static struct l2cap_chan *__l2cap_get_chan_by_ident(struct l2cap_conn *conn,
|
||||
u8 ident)
|
||||
{
|
||||
struct l2cap_chan *c;
|
||||
|
||||
|
@ -573,8 +577,8 @@ void l2cap_chan_close(struct l2cap_chan *chan, int reason)
|
|||
struct l2cap_conn *conn = chan->conn;
|
||||
struct sock *sk = chan->sk;
|
||||
|
||||
BT_DBG("chan %p state %s sk %p", chan,
|
||||
state_to_string(chan->state), sk);
|
||||
BT_DBG("chan %p state %s sk %p", chan, state_to_string(chan->state),
|
||||
sk);
|
||||
|
||||
switch (chan->state) {
|
||||
case BT_LISTEN:
|
||||
|
@ -691,7 +695,8 @@ static u8 l2cap_get_ident(struct l2cap_conn *conn)
|
|||
return id;
|
||||
}
|
||||
|
||||
static void l2cap_send_cmd(struct l2cap_conn *conn, u8 ident, u8 code, u16 len, void *data)
|
||||
static void l2cap_send_cmd(struct l2cap_conn *conn, u8 ident, u8 code, u16 len,
|
||||
void *data)
|
||||
{
|
||||
struct sk_buff *skb = l2cap_build_cmd(conn, code, ident, len, data);
|
||||
u8 flags;
|
||||
|
@ -1020,8 +1025,8 @@ static void l2cap_do_start(struct l2cap_chan *chan)
|
|||
|
||||
schedule_delayed_work(&conn->info_timer, L2CAP_INFO_TIMEOUT);
|
||||
|
||||
l2cap_send_cmd(conn, conn->info_ident,
|
||||
L2CAP_INFO_REQ, sizeof(req), &req);
|
||||
l2cap_send_cmd(conn, conn->info_ident, L2CAP_INFO_REQ,
|
||||
sizeof(req), &req);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1041,7 +1046,8 @@ static inline int l2cap_mode_supported(__u8 mode, __u32 feat_mask)
|
|||
}
|
||||
}
|
||||
|
||||
static void l2cap_send_disconn_req(struct l2cap_conn *conn, struct l2cap_chan *chan, int err)
|
||||
static void l2cap_send_disconn_req(struct l2cap_conn *conn,
|
||||
struct l2cap_chan *chan, int err)
|
||||
{
|
||||
struct sock *sk = chan->sk;
|
||||
struct l2cap_disconn_req req;
|
||||
|
@ -1062,8 +1068,8 @@ static void l2cap_send_disconn_req(struct l2cap_conn *conn, struct l2cap_chan *c
|
|||
|
||||
req.dcid = cpu_to_le16(chan->dcid);
|
||||
req.scid = cpu_to_le16(chan->scid);
|
||||
l2cap_send_cmd(conn, l2cap_get_ident(conn),
|
||||
L2CAP_DISCONN_REQ, sizeof(req), &req);
|
||||
l2cap_send_cmd(conn, l2cap_get_ident(conn), L2CAP_DISCONN_REQ,
|
||||
sizeof(req), &req);
|
||||
|
||||
lock_sock(sk);
|
||||
__l2cap_state_change(chan, BT_DISCONN);
|
||||
|
@ -2653,7 +2659,8 @@ fail:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static inline int l2cap_get_conf_opt(void **ptr, int *type, int *olen, unsigned long *val)
|
||||
static inline int l2cap_get_conf_opt(void **ptr, int *type, int *olen,
|
||||
unsigned long *val)
|
||||
{
|
||||
struct l2cap_conf_opt *opt = *ptr;
|
||||
int len;
|
||||
|
@ -2900,8 +2907,7 @@ done:
|
|||
rfc.monitor_timeout = 0;
|
||||
|
||||
size = min_t(u16, L2CAP_DEFAULT_MAX_PDU_SIZE, chan->conn->mtu -
|
||||
L2CAP_EXT_HDR_SIZE -
|
||||
L2CAP_SDULEN_SIZE -
|
||||
L2CAP_EXT_HDR_SIZE - L2CAP_SDULEN_SIZE -
|
||||
L2CAP_FCS_SIZE);
|
||||
rfc.max_pdu_size = cpu_to_le16(size);
|
||||
|
||||
|
@ -2939,8 +2945,7 @@ done:
|
|||
rfc.monitor_timeout = 0;
|
||||
|
||||
size = min_t(u16, L2CAP_DEFAULT_MAX_PDU_SIZE, chan->conn->mtu -
|
||||
L2CAP_EXT_HDR_SIZE -
|
||||
L2CAP_SDULEN_SIZE -
|
||||
L2CAP_EXT_HDR_SIZE - L2CAP_SDULEN_SIZE -
|
||||
L2CAP_FCS_SIZE);
|
||||
rfc.max_pdu_size = cpu_to_le16(size);
|
||||
|
||||
|
@ -3071,8 +3076,8 @@ done:
|
|||
if (chan->num_conf_rsp == 1)
|
||||
return -ECONNREFUSED;
|
||||
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC,
|
||||
sizeof(rfc), (unsigned long) &rfc);
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC, sizeof(rfc),
|
||||
(unsigned long) &rfc);
|
||||
}
|
||||
|
||||
if (result == L2CAP_CONF_SUCCESS) {
|
||||
|
@ -3122,10 +3127,8 @@ done:
|
|||
chan->remote_max_tx = rfc.max_transmit;
|
||||
|
||||
size = min_t(u16, le16_to_cpu(rfc.max_pdu_size),
|
||||
chan->conn->mtu -
|
||||
L2CAP_EXT_HDR_SIZE -
|
||||
L2CAP_SDULEN_SIZE -
|
||||
L2CAP_FCS_SIZE);
|
||||
chan->conn->mtu - L2CAP_EXT_HDR_SIZE -
|
||||
L2CAP_SDULEN_SIZE - L2CAP_FCS_SIZE);
|
||||
rfc.max_pdu_size = cpu_to_le16(size);
|
||||
chan->remote_mps = size;
|
||||
|
||||
|
@ -3150,23 +3153,22 @@ done:
|
|||
chan->remote_sdu_itime =
|
||||
le32_to_cpu(efs.sdu_itime);
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_EFS,
|
||||
sizeof(efs), (unsigned long) &efs);
|
||||
sizeof(efs),
|
||||
(unsigned long) &efs);
|
||||
}
|
||||
break;
|
||||
|
||||
case L2CAP_MODE_STREAMING:
|
||||
size = min_t(u16, le16_to_cpu(rfc.max_pdu_size),
|
||||
chan->conn->mtu -
|
||||
L2CAP_EXT_HDR_SIZE -
|
||||
L2CAP_SDULEN_SIZE -
|
||||
L2CAP_FCS_SIZE);
|
||||
chan->conn->mtu - L2CAP_EXT_HDR_SIZE -
|
||||
L2CAP_SDULEN_SIZE - L2CAP_FCS_SIZE);
|
||||
rfc.max_pdu_size = cpu_to_le16(size);
|
||||
chan->remote_mps = size;
|
||||
|
||||
set_bit(CONF_MODE_DONE, &chan->conf_state);
|
||||
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC,
|
||||
sizeof(rfc), (unsigned long) &rfc);
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC, sizeof(rfc),
|
||||
(unsigned long) &rfc);
|
||||
|
||||
break;
|
||||
|
||||
|
@ -3187,7 +3189,8 @@ done:
|
|||
return ptr - data;
|
||||
}
|
||||
|
||||
static int l2cap_parse_conf_rsp(struct l2cap_chan *chan, void *rsp, int len, void *data, u16 *result)
|
||||
static int l2cap_parse_conf_rsp(struct l2cap_chan *chan, void *rsp, int len,
|
||||
void *data, u16 *result)
|
||||
{
|
||||
struct l2cap_conf_req *req = data;
|
||||
void *ptr = req->data;
|
||||
|
@ -3246,8 +3249,8 @@ static int l2cap_parse_conf_rsp(struct l2cap_chan *chan, void *rsp, int len, voi
|
|||
efs.stype != chan->local_stype)
|
||||
return -ECONNREFUSED;
|
||||
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_EFS,
|
||||
sizeof(efs), (unsigned long) &efs);
|
||||
l2cap_add_conf_opt(&ptr, L2CAP_CONF_EFS, sizeof(efs),
|
||||
(unsigned long) &efs);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -3288,7 +3291,8 @@ static int l2cap_parse_conf_rsp(struct l2cap_chan *chan, void *rsp, int len, voi
|
|||
return ptr - data;
|
||||
}
|
||||
|
||||
static int l2cap_build_conf_rsp(struct l2cap_chan *chan, void *data, u16 result, u16 flags)
|
||||
static int l2cap_build_conf_rsp(struct l2cap_chan *chan, void *data,
|
||||
u16 result, u16 flags)
|
||||
{
|
||||
struct l2cap_conf_rsp *rsp = data;
|
||||
void *ptr = rsp->data;
|
||||
|
@ -3312,8 +3316,7 @@ void __l2cap_connect_rsp_defer(struct l2cap_chan *chan)
|
|||
rsp.dcid = cpu_to_le16(chan->scid);
|
||||
rsp.result = __constant_cpu_to_le16(L2CAP_CR_SUCCESS);
|
||||
rsp.status = __constant_cpu_to_le16(L2CAP_CS_NO_INFO);
|
||||
l2cap_send_cmd(conn, chan->ident,
|
||||
L2CAP_CONN_RSP, sizeof(rsp), &rsp);
|
||||
l2cap_send_cmd(conn, chan->ident, L2CAP_CONN_RSP, sizeof(rsp), &rsp);
|
||||
|
||||
if (test_and_set_bit(CONF_REQ_SENT, &chan->conf_state))
|
||||
return;
|
||||
|
@ -3374,7 +3377,8 @@ static void l2cap_conf_rfc_get(struct l2cap_chan *chan, void *rsp, int len)
|
|||
}
|
||||
}
|
||||
|
||||
static inline int l2cap_command_rej(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u8 *data)
|
||||
static inline int l2cap_command_rej(struct l2cap_conn *conn,
|
||||
struct l2cap_cmd_hdr *cmd, u8 *data)
|
||||
{
|
||||
struct l2cap_cmd_rej_unk *rej = (struct l2cap_cmd_rej_unk *) data;
|
||||
|
||||
|
@ -3500,8 +3504,8 @@ sendresp:
|
|||
|
||||
schedule_delayed_work(&conn->info_timer, L2CAP_INFO_TIMEOUT);
|
||||
|
||||
l2cap_send_cmd(conn, conn->info_ident,
|
||||
L2CAP_INFO_REQ, sizeof(info), &info);
|
||||
l2cap_send_cmd(conn, conn->info_ident, L2CAP_INFO_REQ,
|
||||
sizeof(info), &info);
|
||||
}
|
||||
|
||||
if (chan && !test_bit(CONF_REQ_SENT, &chan->conf_state) &&
|
||||
|
@ -3521,7 +3525,8 @@ static int l2cap_connect_req(struct l2cap_conn *conn,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static inline int l2cap_connect_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u8 *data)
|
||||
static inline int l2cap_connect_rsp(struct l2cap_conn *conn,
|
||||
struct l2cap_cmd_hdr *cmd, u8 *data)
|
||||
{
|
||||
struct l2cap_conn_rsp *rsp = (struct l2cap_conn_rsp *) data;
|
||||
u16 scid, dcid, result, status;
|
||||
|
@ -3616,7 +3621,9 @@ static void l2cap_send_efs_conf_rsp(struct l2cap_chan *chan, void *data,
|
|||
L2CAP_CONF_SUCCESS, flags), data);
|
||||
}
|
||||
|
||||
static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u16 cmd_len, u8 *data)
|
||||
static inline int l2cap_config_req(struct l2cap_conn *conn,
|
||||
struct l2cap_cmd_hdr *cmd, u16 cmd_len,
|
||||
u8 *data)
|
||||
{
|
||||
struct l2cap_conf_req *req = (struct l2cap_conf_req *) data;
|
||||
u16 dcid, flags;
|
||||
|
@ -3719,7 +3726,8 @@ unlock:
|
|||
return err;
|
||||
}
|
||||
|
||||
static inline int l2cap_config_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u8 *data)
|
||||
static inline int l2cap_config_rsp(struct l2cap_conn *conn,
|
||||
struct l2cap_cmd_hdr *cmd, u8 *data)
|
||||
{
|
||||
struct l2cap_conf_rsp *rsp = (struct l2cap_conf_rsp *)data;
|
||||
u16 scid, flags, result;
|
||||
|
@ -3820,7 +3828,8 @@ done:
|
|||
return err;
|
||||
}
|
||||
|
||||
static inline int l2cap_disconnect_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u8 *data)
|
||||
static inline int l2cap_disconnect_req(struct l2cap_conn *conn,
|
||||
struct l2cap_cmd_hdr *cmd, u8 *data)
|
||||
{
|
||||
struct l2cap_disconn_req *req = (struct l2cap_disconn_req *) data;
|
||||
struct l2cap_disconn_rsp rsp;
|
||||
|
@ -3866,7 +3875,8 @@ static inline int l2cap_disconnect_req(struct l2cap_conn *conn, struct l2cap_cmd
|
|||
return 0;
|
||||
}
|
||||
|
||||
static inline int l2cap_disconnect_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u8 *data)
|
||||
static inline int l2cap_disconnect_rsp(struct l2cap_conn *conn,
|
||||
struct l2cap_cmd_hdr *cmd, u8 *data)
|
||||
{
|
||||
struct l2cap_disconn_rsp *rsp = (struct l2cap_disconn_rsp *) data;
|
||||
u16 dcid, scid;
|
||||
|
@ -3900,7 +3910,8 @@ static inline int l2cap_disconnect_rsp(struct l2cap_conn *conn, struct l2cap_cmd
|
|||
return 0;
|
||||
}
|
||||
|
||||
static inline int l2cap_information_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u8 *data)
|
||||
static inline int l2cap_information_req(struct l2cap_conn *conn,
|
||||
struct l2cap_cmd_hdr *cmd, u8 *data)
|
||||
{
|
||||
struct l2cap_info_req *req = (struct l2cap_info_req *) data;
|
||||
u16 type;
|
||||
|
@ -3923,8 +3934,8 @@ static inline int l2cap_information_req(struct l2cap_conn *conn, struct l2cap_cm
|
|||
| L2CAP_FEAT_EXT_WINDOW;
|
||||
|
||||
put_unaligned_le32(feat_mask, rsp->data);
|
||||
l2cap_send_cmd(conn, cmd->ident,
|
||||
L2CAP_INFO_RSP, sizeof(buf), buf);
|
||||
l2cap_send_cmd(conn, cmd->ident, L2CAP_INFO_RSP, sizeof(buf),
|
||||
buf);
|
||||
} else if (type == L2CAP_IT_FIXED_CHAN) {
|
||||
u8 buf[12];
|
||||
struct l2cap_info_rsp *rsp = (struct l2cap_info_rsp *) buf;
|
||||
|
@ -3937,20 +3948,21 @@ static inline int l2cap_information_req(struct l2cap_conn *conn, struct l2cap_cm
|
|||
rsp->type = __constant_cpu_to_le16(L2CAP_IT_FIXED_CHAN);
|
||||
rsp->result = __constant_cpu_to_le16(L2CAP_IR_SUCCESS);
|
||||
memcpy(rsp->data, l2cap_fixed_chan, sizeof(l2cap_fixed_chan));
|
||||
l2cap_send_cmd(conn, cmd->ident,
|
||||
L2CAP_INFO_RSP, sizeof(buf), buf);
|
||||
l2cap_send_cmd(conn, cmd->ident, L2CAP_INFO_RSP, sizeof(buf),
|
||||
buf);
|
||||
} else {
|
||||
struct l2cap_info_rsp rsp;
|
||||
rsp.type = cpu_to_le16(type);
|
||||
rsp.result = __constant_cpu_to_le16(L2CAP_IR_NOTSUPP);
|
||||
l2cap_send_cmd(conn, cmd->ident,
|
||||
L2CAP_INFO_RSP, sizeof(rsp), &rsp);
|
||||
l2cap_send_cmd(conn, cmd->ident, L2CAP_INFO_RSP, sizeof(rsp),
|
||||
&rsp);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int l2cap_information_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u8 *data)
|
||||
static inline int l2cap_information_rsp(struct l2cap_conn *conn,
|
||||
struct l2cap_cmd_hdr *cmd, u8 *data)
|
||||
{
|
||||
struct l2cap_info_rsp *rsp = (struct l2cap_info_rsp *) data;
|
||||
u16 type, result;
|
||||
|
@ -4009,8 +4021,8 @@ static inline int l2cap_information_rsp(struct l2cap_conn *conn, struct l2cap_cm
|
|||
}
|
||||
|
||||
static inline int l2cap_create_channel_req(struct l2cap_conn *conn,
|
||||
struct l2cap_cmd_hdr *cmd, u16 cmd_len,
|
||||
void *data)
|
||||
struct l2cap_cmd_hdr *cmd,
|
||||
u16 cmd_len, void *data)
|
||||
{
|
||||
struct l2cap_create_chan_req *req = data;
|
||||
struct l2cap_create_chan_rsp rsp;
|
||||
|
@ -4039,6 +4051,15 @@ static inline int l2cap_create_channel_req(struct l2cap_conn *conn,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static inline int l2cap_create_channel_rsp(struct l2cap_conn *conn,
|
||||
struct l2cap_cmd_hdr *cmd,
|
||||
void *data)
|
||||
{
|
||||
BT_DBG("conn %p", conn);
|
||||
|
||||
return l2cap_connect_rsp(conn, cmd, data);
|
||||
}
|
||||
|
||||
static void l2cap_send_move_chan_rsp(struct l2cap_conn *conn, u8 ident,
|
||||
u16 icid, u16 result)
|
||||
{
|
||||
|
@ -4186,7 +4207,8 @@ static inline int l2cap_check_conn_param(u16 min, u16 max, u16 latency,
|
|||
}
|
||||
|
||||
static inline int l2cap_conn_param_update_req(struct l2cap_conn *conn,
|
||||
struct l2cap_cmd_hdr *cmd, u8 *data)
|
||||
struct l2cap_cmd_hdr *cmd,
|
||||
u8 *data)
|
||||
{
|
||||
struct hci_conn *hcon = conn->hcon;
|
||||
struct l2cap_conn_param_update_req *req;
|
||||
|
@ -4228,7 +4250,8 @@ static inline int l2cap_conn_param_update_req(struct l2cap_conn *conn,
|
|||
}
|
||||
|
||||
static inline int l2cap_bredr_sig_cmd(struct l2cap_conn *conn,
|
||||
struct l2cap_cmd_hdr *cmd, u16 cmd_len, u8 *data)
|
||||
struct l2cap_cmd_hdr *cmd, u16 cmd_len,
|
||||
u8 *data)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
|
@ -4343,7 +4366,8 @@ static inline void l2cap_sig_channel(struct l2cap_conn *conn,
|
|||
|
||||
cmd_len = le16_to_cpu(cmd.len);
|
||||
|
||||
BT_DBG("code 0x%2.2x len %d id 0x%2.2x", cmd.code, cmd_len, cmd.ident);
|
||||
BT_DBG("code 0x%2.2x len %d id 0x%2.2x", cmd.code, cmd_len,
|
||||
cmd.ident);
|
||||
|
||||
if (cmd_len > len || !cmd.ident) {
|
||||
BT_DBG("corrupted command");
|
||||
|
@ -4362,7 +4386,8 @@ static inline void l2cap_sig_channel(struct l2cap_conn *conn,
|
|||
|
||||
/* FIXME: Map err to a valid reason */
|
||||
rej.reason = __constant_cpu_to_le16(L2CAP_REJ_NOT_UNDERSTOOD);
|
||||
l2cap_send_cmd(conn, cmd.ident, L2CAP_COMMAND_REJ, sizeof(rej), &rej);
|
||||
l2cap_send_cmd(conn, cmd.ident, L2CAP_COMMAND_REJ,
|
||||
sizeof(rej), &rej);
|
||||
}
|
||||
|
||||
data += cmd_len;
|
||||
|
@ -4427,8 +4452,8 @@ static void l2cap_send_i_or_rr_or_rnr(struct l2cap_chan *chan)
|
|||
}
|
||||
}
|
||||
|
||||
static void append_skb_frag(struct sk_buff *skb,
|
||||
struct sk_buff *new_frag, struct sk_buff **last_frag)
|
||||
static void append_skb_frag(struct sk_buff *skb, struct sk_buff *new_frag,
|
||||
struct sk_buff **last_frag)
|
||||
{
|
||||
/* skb->len reflects data in skb as well as all fragments
|
||||
* skb->data_len reflects only data in fragments
|
||||
|
@ -4718,8 +4743,7 @@ static u8 l2cap_classify_txseq(struct l2cap_chan *chan, u16 txseq)
|
|||
}
|
||||
|
||||
if (__seq_offset(chan, txseq, chan->last_acked_seq) <
|
||||
__seq_offset(chan, chan->expected_tx_seq,
|
||||
chan->last_acked_seq)){
|
||||
__seq_offset(chan, chan->expected_tx_seq, chan->last_acked_seq)) {
|
||||
BT_DBG("Duplicate - expected_tx_seq later than txseq");
|
||||
return L2CAP_TXSEQ_DUPLICATE;
|
||||
}
|
||||
|
@ -5688,8 +5712,8 @@ int __init l2cap_init(void)
|
|||
return err;
|
||||
|
||||
if (bt_debugfs) {
|
||||
l2cap_debugfs = debugfs_create_file("l2cap", 0444,
|
||||
bt_debugfs, NULL, &l2cap_debugfs_fops);
|
||||
l2cap_debugfs = debugfs_create_file("l2cap", 0444, bt_debugfs,
|
||||
NULL, &l2cap_debugfs_fops);
|
||||
if (!l2cap_debugfs)
|
||||
BT_ERR("Failed to create L2CAP debug file");
|
||||
}
|
||||
|
|
|
@ -40,7 +40,8 @@ static struct bt_sock_list l2cap_sk_list = {
|
|||
|
||||
static const struct proto_ops l2cap_sock_ops;
|
||||
static void l2cap_sock_init(struct sock *sk, struct sock *parent);
|
||||
static struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock, int proto, gfp_t prio);
|
||||
static struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock,
|
||||
int proto, gfp_t prio);
|
||||
|
||||
static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen)
|
||||
{
|
||||
|
@ -106,7 +107,8 @@ done:
|
|||
return err;
|
||||
}
|
||||
|
||||
static int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr, int alen, int flags)
|
||||
static int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr,
|
||||
int alen, int flags)
|
||||
{
|
||||
struct sock *sk = sock->sk;
|
||||
struct l2cap_chan *chan = l2cap_pi(sk)->chan;
|
||||
|
@ -185,7 +187,8 @@ done:
|
|||
return err;
|
||||
}
|
||||
|
||||
static int l2cap_sock_accept(struct socket *sock, struct socket *newsock, int flags)
|
||||
static int l2cap_sock_accept(struct socket *sock, struct socket *newsock,
|
||||
int flags)
|
||||
{
|
||||
DECLARE_WAITQUEUE(wait, current);
|
||||
struct sock *sk = sock->sk, *nsk;
|
||||
|
@ -241,7 +244,8 @@ done:
|
|||
return err;
|
||||
}
|
||||
|
||||
static int l2cap_sock_getname(struct socket *sock, struct sockaddr *addr, int *len, int peer)
|
||||
static int l2cap_sock_getname(struct socket *sock, struct sockaddr *addr,
|
||||
int *len, int peer)
|
||||
{
|
||||
struct sockaddr_l2 *la = (struct sockaddr_l2 *) addr;
|
||||
struct sock *sk = sock->sk;
|
||||
|
@ -265,7 +269,8 @@ static int l2cap_sock_getname(struct socket *sock, struct sockaddr *addr, int *l
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int l2cap_sock_getsockopt_old(struct socket *sock, int optname, char __user *optval, int __user *optlen)
|
||||
static int l2cap_sock_getsockopt_old(struct socket *sock, int optname,
|
||||
char __user *optval, int __user *optlen)
|
||||
{
|
||||
struct sock *sk = sock->sk;
|
||||
struct l2cap_chan *chan = l2cap_pi(sk)->chan;
|
||||
|
@ -352,7 +357,8 @@ static int l2cap_sock_getsockopt_old(struct socket *sock, int optname, char __us
|
|||
return err;
|
||||
}
|
||||
|
||||
static int l2cap_sock_getsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user *optlen)
|
||||
static int l2cap_sock_getsockopt(struct socket *sock, int level, int optname,
|
||||
char __user *optval, int __user *optlen)
|
||||
{
|
||||
struct sock *sk = sock->sk;
|
||||
struct l2cap_chan *chan = l2cap_pi(sk)->chan;
|
||||
|
@ -466,7 +472,8 @@ static bool l2cap_valid_mtu(struct l2cap_chan *chan, u16 mtu)
|
|||
return true;
|
||||
}
|
||||
|
||||
static int l2cap_sock_setsockopt_old(struct socket *sock, int optname, char __user *optval, unsigned int optlen)
|
||||
static int l2cap_sock_setsockopt_old(struct socket *sock, int optname,
|
||||
char __user *optval, unsigned int optlen)
|
||||
{
|
||||
struct sock *sk = sock->sk;
|
||||
struct l2cap_chan *chan = l2cap_pi(sk)->chan;
|
||||
|
@ -565,7 +572,8 @@ static int l2cap_sock_setsockopt_old(struct socket *sock, int optname, char __us
|
|||
return err;
|
||||
}
|
||||
|
||||
static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen)
|
||||
static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname,
|
||||
char __user *optval, unsigned int optlen)
|
||||
{
|
||||
struct sock *sk = sock->sk;
|
||||
struct l2cap_chan *chan = l2cap_pi(sk)->chan;
|
||||
|
@ -738,7 +746,8 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, ch
|
|||
return err;
|
||||
}
|
||||
|
||||
static int l2cap_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len)
|
||||
static int l2cap_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
|
||||
struct msghdr *msg, size_t len)
|
||||
{
|
||||
struct sock *sk = sock->sk;
|
||||
struct l2cap_chan *chan = l2cap_pi(sk)->chan;
|
||||
|
@ -763,7 +772,8 @@ static int l2cap_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct ms
|
|||
return err;
|
||||
}
|
||||
|
||||
static int l2cap_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len, int flags)
|
||||
static int l2cap_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
|
||||
struct msghdr *msg, size_t len, int flags)
|
||||
{
|
||||
struct sock *sk = sock->sk;
|
||||
struct l2cap_pinfo *pi = l2cap_pi(sk);
|
||||
|
@ -1161,7 +1171,8 @@ static struct proto l2cap_proto = {
|
|||
.obj_size = sizeof(struct l2cap_pinfo)
|
||||
};
|
||||
|
||||
static struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock, int proto, gfp_t prio)
|
||||
static struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock,
|
||||
int proto, gfp_t prio)
|
||||
{
|
||||
struct sock *sk;
|
||||
struct l2cap_chan *chan;
|
||||
|
@ -1263,7 +1274,8 @@ int __init l2cap_init_sockets(void)
|
|||
goto error;
|
||||
}
|
||||
|
||||
err = bt_procfs_init(THIS_MODULE, &init_net, "l2cap", &l2cap_sk_list, NULL);
|
||||
err = bt_procfs_init(THIS_MODULE, &init_net, "l2cap", &l2cap_sk_list,
|
||||
NULL);
|
||||
if (err < 0) {
|
||||
BT_ERR("Failed to create L2CAP proc file");
|
||||
bt_sock_unregister(BTPROTO_L2CAP);
|
||||
|
|
Loading…
Reference in New Issue