Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
04124681
Commit
04124681
authored
Mar 08, 2012
by
Gustavo F. Padovan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bluetooth: fix conding style issues all over the tree
Signed-off-by:
Gustavo F. Padovan
<
padovan@profusion.mobi
>
parent
f64b993f
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
384 additions
and
398 deletions
+384
-398
drivers/bluetooth/btmrvl_debugfs.c
drivers/bluetooth/btmrvl_debugfs.c
+12
-11
include/net/bluetooth/hci_core.h
include/net/bluetooth/hci_core.h
+33
-34
net/bluetooth/hci_core.c
net/bluetooth/hci_core.c
+22
-27
net/bluetooth/hci_event.c
net/bluetooth/hci_event.c
+53
-57
net/bluetooth/l2cap_core.c
net/bluetooth/l2cap_core.c
+7
-4
net/bluetooth/l2cap_sock.c
net/bluetooth/l2cap_sock.c
+2
-1
net/bluetooth/mgmt.c
net/bluetooth/mgmt.c
+242
-247
net/bluetooth/smp.c
net/bluetooth/smp.c
+13
-17
No files found.
drivers/bluetooth/btmrvl_debugfs.c
View file @
04124681
...
...
@@ -415,7 +415,8 @@ void btmrvl_debugfs_init(struct hci_dev *hdev)
dbg
->
status_dir
=
debugfs_create_dir
(
"status"
,
hdev
->
debugfs
);
dbg
->
curpsmode
=
debugfs_create_file
(
"curpsmode"
,
0444
,
dbg
->
status_dir
,
priv
,
&
btmrvl_curpsmode_fops
);
dbg
->
status_dir
,
priv
,
&
btmrvl_curpsmode_fops
);
dbg
->
psstate
=
debugfs_create_file
(
"psstate"
,
0444
,
dbg
->
status_dir
,
priv
,
&
btmrvl_psstate_fops
);
dbg
->
hsstate
=
debugfs_create_file
(
"hsstate"
,
0444
,
dbg
->
status_dir
,
...
...
include/net/bluetooth/hci_core.h
View file @
04124681
...
...
@@ -672,8 +672,8 @@ int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key,
bdaddr_t
*
bdaddr
,
u8
*
val
,
u8
type
,
u8
pin_len
);
struct
smp_ltk
*
hci_find_ltk
(
struct
hci_dev
*
hdev
,
__le16
ediv
,
u8
rand
[
8
]);
int
hci_add_ltk
(
struct
hci_dev
*
hdev
,
bdaddr_t
*
bdaddr
,
u8
addr_type
,
u8
type
,
int
new_key
,
u8
authenticated
,
u8
tk
[
16
]
,
u8
enc_size
,
u16
ediv
,
u8
rand
[
8
]);
int
new_key
,
u8
authenticated
,
u8
tk
[
16
],
u8
enc_size
,
u16
ediv
,
u8
rand
[
8
]);
struct
smp_ltk
*
hci_find_ltk_by_addr
(
struct
hci_dev
*
hdev
,
bdaddr_t
*
bdaddr
,
u8
addr_type
);
int
hci_remove_ltk
(
struct
hci_dev
*
hdev
,
bdaddr_t
*
bdaddr
);
...
...
@@ -980,8 +980,8 @@ int mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status);
int
mgmt_new_link_key
(
struct
hci_dev
*
hdev
,
struct
link_key
*
key
,
u8
persistent
);
int
mgmt_device_connected
(
struct
hci_dev
*
hdev
,
bdaddr_t
*
bdaddr
,
u8
link_type
,
u8
addr_type
,
u32
flags
,
u8
*
name
,
u8
name_len
,
u8
*
dev_class
);
u8
addr_type
,
u32
flags
,
u8
*
name
,
u8
name_len
,
u8
*
dev_class
);
int
mgmt_device_disconnected
(
struct
hci_dev
*
hdev
,
bdaddr_t
*
bdaddr
,
u8
link_type
,
u8
addr_type
);
int
mgmt_disconnect_failed
(
struct
hci_dev
*
hdev
,
bdaddr_t
*
bdaddr
,
...
...
@@ -1017,9 +1017,8 @@ int mgmt_read_local_oob_data_reply_complete(struct hci_dev *hdev, u8 *hash,
u8
*
randomizer
,
u8
status
);
int
mgmt_le_enable_complete
(
struct
hci_dev
*
hdev
,
u8
enable
,
u8
status
);
int
mgmt_device_found
(
struct
hci_dev
*
hdev
,
bdaddr_t
*
bdaddr
,
u8
link_type
,
u8
addr_type
,
u8
*
dev_class
,
s8
rssi
,
u8
cfm_name
,
u8
ssp
,
u8
*
eir
,
u16
eir_len
);
u8
addr_type
,
u8
*
dev_class
,
s8
rssi
,
u8
cfm_name
,
u8
ssp
,
u8
*
eir
,
u16
eir_len
);
int
mgmt_remote_name
(
struct
hci_dev
*
hdev
,
bdaddr_t
*
bdaddr
,
u8
link_type
,
u8
addr_type
,
s8
rssi
,
u8
*
name
,
u8
name_len
);
int
mgmt_start_discovery_failed
(
struct
hci_dev
*
hdev
,
u8
status
);
...
...
net/bluetooth/hci_core.c
View file @
04124681
...
...
@@ -1333,8 +1333,8 @@ int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key,
}
int
hci_add_ltk
(
struct
hci_dev
*
hdev
,
bdaddr_t
*
bdaddr
,
u8
addr_type
,
u8
type
,
int
new_key
,
u8
authenticated
,
u8
tk
[
16
],
u8
enc_size
,
u16
ediv
,
u8
rand
[
8
])
int
new_key
,
u8
authenticated
,
u8
tk
[
16
],
u8
enc_size
,
u16
ediv
,
u8
rand
[
8
])
{
struct
smp_ltk
*
key
,
*
old_key
;
...
...
@@ -1476,8 +1476,7 @@ int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *hash,
return
0
;
}
struct
bdaddr_list
*
hci_blacklist_lookup
(
struct
hci_dev
*
hdev
,
bdaddr_t
*
bdaddr
)
struct
bdaddr_list
*
hci_blacklist_lookup
(
struct
hci_dev
*
hdev
,
bdaddr_t
*
bdaddr
)
{
struct
bdaddr_list
*
b
;
...
...
@@ -1588,11 +1587,7 @@ static inline int is_connectable_adv(u8 evt_type)
}
int
hci_add_adv_entry
(
struct
hci_dev
*
hdev
,
struct
hci_ev_le_advertising_info
*
ev
)
{
struct
adv_entry
*
entry
;
if
(
!
is_connectable_adv
(
ev
->
evt_type
))
struct
hci_ev_le_advertising_info
*
ev
)
{
struct
adv_entry
*
entry
;
if
(
!
is_connectable_adv
(
ev
->
evt_type
))
return
-
EINVAL
;
/* Only new entries should be added to adv_entries. So, if
...
...
@@ -1692,8 +1687,8 @@ static void le_scan_work(struct work_struct *work)
BT_DBG
(
"%s"
,
hdev
->
name
);
hci_do_le_scan
(
hdev
,
param
->
type
,
param
->
interval
,
param
->
window
,
param
->
timeout
);
hci_do_le_scan
(
hdev
,
param
->
type
,
param
->
interval
,
param
->
window
,
param
->
timeout
);
}
int
hci_le_scan
(
struct
hci_dev
*
hdev
,
u8
type
,
u16
interval
,
u16
window
,
...
...
net/bluetooth/hci_event.c
View file @
04124681
...
...
@@ -577,14 +577,14 @@ static void hci_setup(struct hci_dev *hdev)
struct
hci_cp_read_local_ext_features
cp
;
cp
.
page
=
0x01
;
hci_send_cmd
(
hdev
,
HCI_OP_READ_LOCAL_EXT_FEATURES
,
sizeof
(
cp
),
&
cp
);
hci_send_cmd
(
hdev
,
HCI_OP_READ_LOCAL_EXT_FEATURES
,
sizeof
(
cp
),
&
cp
);
}
if
(
test_bit
(
HCI_LINK_SECURITY
,
&
hdev
->
dev_flags
))
{
u8
enable
=
1
;
hci_send_cmd
(
hdev
,
HCI_OP_WRITE_AUTH_ENABLE
,
sizeof
(
enable
),
&
enable
);
hci_send_cmd
(
hdev
,
HCI_OP_WRITE_AUTH_ENABLE
,
sizeof
(
enable
),
&
enable
);
}
}
...
...
@@ -628,8 +628,8 @@ static void hci_setup_link_policy(struct hci_dev *hdev)
link_policy
|=
HCI_LP_PARK
;
link_policy
=
cpu_to_le16
(
link_policy
);
hci_send_cmd
(
hdev
,
HCI_OP_WRITE_DEF_LINK_POLICY
,
sizeof
(
link_policy
),
&
link_policy
);
hci_send_cmd
(
hdev
,
HCI_OP_WRITE_DEF_LINK_POLICY
,
sizeof
(
link_policy
),
&
link_policy
);
}
static
void
hci_cc_read_local_commands
(
struct
hci_dev
*
hdev
,
struct
sk_buff
*
skb
)
...
...
@@ -717,8 +717,8 @@ static void hci_set_le_support(struct hci_dev *hdev)
}
if
(
cp
.
le
!=
!!
(
hdev
->
host_features
[
0
]
&
LMP_HOST_LE
))
hci_send_cmd
(
hdev
,
HCI_OP_WRITE_LE_HOST_SUPPORTED
,
sizeof
(
cp
),
&
cp
);
hci_send_cmd
(
hdev
,
HCI_OP_WRITE_LE_HOST_SUPPORTED
,
sizeof
(
cp
),
&
cp
);
}
static
void
hci_cc_read_local_ext_features
(
struct
hci_dev
*
hdev
,
...
...
@@ -976,8 +976,8 @@ static void hci_cc_user_confirm_reply(struct hci_dev *hdev, struct sk_buff *skb)
hci_dev_lock
(
hdev
);
if
(
test_bit
(
HCI_MGMT
,
&
hdev
->
dev_flags
))
mgmt_user_confirm_reply_complete
(
hdev
,
&
rp
->
bdaddr
,
ACL_LINK
,
0
,
rp
->
status
);
mgmt_user_confirm_reply_complete
(
hdev
,
&
rp
->
bdaddr
,
ACL_LINK
,
0
,
rp
->
status
);
hci_dev_unlock
(
hdev
);
}
...
...
@@ -993,8 +993,7 @@ static void hci_cc_user_confirm_neg_reply(struct hci_dev *hdev,
if
(
test_bit
(
HCI_MGMT
,
&
hdev
->
dev_flags
))
mgmt_user_confirm_neg_reply_complete
(
hdev
,
&
rp
->
bdaddr
,
ACL_LINK
,
0
,
rp
->
status
);
ACL_LINK
,
0
,
rp
->
status
);
hci_dev_unlock
(
hdev
);
}
...
...
@@ -1025,8 +1024,7 @@ static void hci_cc_user_passkey_neg_reply(struct hci_dev *hdev,
if
(
test_bit
(
HCI_MGMT
,
&
hdev
->
dev_flags
))
mgmt_user_passkey_neg_reply_complete
(
hdev
,
&
rp
->
bdaddr
,
ACL_LINK
,
0
,
rp
->
status
);
ACL_LINK
,
0
,
rp
->
status
);
hci_dev_unlock
(
hdev
);
}
...
...
@@ -1375,8 +1373,8 @@ static void hci_check_pending_name(struct hci_dev *hdev, struct hci_conn *conn,
struct
inquiry_entry
*
e
;
if
(
conn
&&
!
test_and_set_bit
(
HCI_CONN_MGMT_CONNECTED
,
&
conn
->
flags
))
mgmt_device_connected
(
hdev
,
bdaddr
,
ACL_LINK
,
0x00
,
0
,
name
,
name_len
,
conn
->
dev_class
);
mgmt_device_connected
(
hdev
,
bdaddr
,
ACL_LINK
,
0x00
,
0
,
name
,
name_len
,
conn
->
dev_class
);
if
(
discov
->
state
==
DISCOVERY_STOPPED
)
return
;
...
...
@@ -1718,8 +1716,8 @@ static inline void hci_inquiry_result_evt(struct hci_dev *hdev, struct sk_buff *
name_known
=
hci_inquiry_cache_update
(
hdev
,
&
data
,
false
,
&
ssp
);
mgmt_device_found
(
hdev
,
&
info
->
bdaddr
,
ACL_LINK
,
0x00
,
info
->
dev_class
,
0
,
!
name_known
,
ssp
,
NULL
,
0
);
info
->
dev_class
,
0
,
!
name_known
,
ssp
,
NULL
,
0
);
}
hci_dev_unlock
(
hdev
);
...
...
@@ -1778,8 +1776,8 @@ static inline void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *s
struct
hci_cp_change_conn_ptype
cp
;
cp
.
handle
=
ev
->
handle
;
cp
.
pkt_type
=
cpu_to_le16
(
conn
->
pkt_type
);
hci_send_cmd
(
hdev
,
HCI_OP_CHANGE_CONN_PTYPE
,
sizeof
(
cp
),
&
cp
);
hci_send_cmd
(
hdev
,
HCI_OP_CHANGE_CONN_PTYPE
,
sizeof
(
cp
),
&
cp
);
}
}
else
{
conn
->
state
=
BT_CLOSED
;
...
...
@@ -1850,8 +1848,8 @@ static inline void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *sk
else
cp
.
role
=
0x01
;
/* Remain slave */
hci_send_cmd
(
hdev
,
HCI_OP_ACCEPT_CONN_REQ
,
sizeof
(
cp
),
&
cp
);
hci_send_cmd
(
hdev
,
HCI_OP_ACCEPT_CONN_REQ
,
sizeof
(
cp
),
&
cp
);
}
else
{
struct
hci_cp_accept_sync_conn_req
cp
;
...
...
@@ -2994,9 +2992,8 @@ static inline void hci_extended_inquiry_result_evt(struct hci_dev *hdev, struct
name_known
=
hci_inquiry_cache_update
(
hdev
,
&
data
,
name_known
,
&
ssp
);
mgmt_device_found
(
hdev
,
&
info
->
bdaddr
,
ACL_LINK
,
0x00
,
info
->
dev_class
,
info
->
rssi
,
!
name_known
,
ssp
,
info
->
data
,
sizeof
(
info
->
data
));
info
->
dev_class
,
info
->
rssi
,
!
name_known
,
ssp
,
info
->
data
,
sizeof
(
info
->
data
));
}
hci_dev_unlock
(
hdev
);
...
...
@@ -3320,8 +3317,7 @@ static inline void hci_le_adv_report_evt(struct hci_dev *hdev,
rssi
=
ev
->
data
[
ev
->
length
];
mgmt_device_found
(
hdev
,
&
ev
->
bdaddr
,
LE_LINK
,
ev
->
bdaddr_type
,
NULL
,
rssi
,
0
,
1
,
ev
->
data
,
ev
->
length
);
NULL
,
rssi
,
0
,
1
,
ev
->
data
,
ev
->
length
);
ptr
+=
sizeof
(
*
ev
)
+
ev
->
length
+
1
;
}
...
...
net/bluetooth/l2cap_core.c
View file @
04124681
...
...
@@ -1546,7 +1546,9 @@ static void l2cap_send_srejtail(struct l2cap_chan *chan)
l2cap_send_sframe
(
chan
,
control
);
}
static
inline
int
l2cap_skbuff_fromiovec
(
struct
l2cap_chan
*
chan
,
struct
msghdr
*
msg
,
int
len
,
int
count
,
struct
sk_buff
*
skb
)
static
inline
int
l2cap_skbuff_fromiovec
(
struct
l2cap_chan
*
chan
,
struct
msghdr
*
msg
,
int
len
,
int
count
,
struct
sk_buff
*
skb
)
{
struct
l2cap_conn
*
conn
=
chan
->
conn
;
struct
sk_buff
**
frag
;
...
...
@@ -1564,7 +1566,8 @@ static inline int l2cap_skbuff_fromiovec(struct l2cap_chan *chan, struct msghdr
count
=
min_t
(
unsigned
int
,
conn
->
mtu
,
len
);
*
frag
=
chan
->
ops
->
alloc_skb
(
chan
,
count
,
msg
->
msg_flags
&
MSG_DONTWAIT
,
&
err
);
msg
->
msg_flags
&
MSG_DONTWAIT
,
&
err
);
if
(
!*
frag
)
return
err
;
...
...
net/bluetooth/l2cap_sock.c
View file @
04124681
...
...
@@ -926,7 +926,8 @@ static void l2cap_sock_state_change_cb(void *data, int state)
}
static
struct
sk_buff
*
l2cap_sock_alloc_skb_cb
(
struct
l2cap_chan
*
chan
,
unsigned
long
len
,
int
nb
,
int
*
err
)
unsigned
long
len
,
int
nb
,
int
*
err
)
{
struct
sock
*
sk
=
chan
->
sk
;
...
...
net/bluetooth/mgmt.c
View file @
04124681
...
...
@@ -267,8 +267,8 @@ static int cmd_complete(struct sock *sk, u16 index, u16 cmd, u8 status,
return
err
;
}
static
int
read_version
(
struct
sock
*
sk
,
struct
hci_dev
*
hdev
,
void
*
data
,
u16
data_len
)
static
int
read_version
(
struct
sock
*
sk
,
struct
hci_dev
*
hdev
,
void
*
data
,
u16
data_len
)
{
struct
mgmt_rp_read_version
rp
;
...
...
@@ -281,8 +281,8 @@ static int read_version(struct sock *sk, struct hci_dev *hdev,
sizeof
(
rp
));
}
static
int
read_commands
(
struct
sock
*
sk
,
struct
hci_dev
*
hdev
,
void
*
data
,
u16
data_len
)
static
int
read_commands
(
struct
sock
*
sk
,
struct
hci_dev
*
hdev
,
void
*
data
,
u16
data_len
)
{
struct
mgmt_rp_read_commands
*
rp
;
u16
num_commands
=
ARRAY_SIZE
(
mgmt_commands
);
...
...
@@ -315,8 +315,8 @@ static int read_commands(struct sock *sk, struct hci_dev *hdev,
return
err
;
}
static
int
read_index_list
(
struct
sock
*
sk
,
struct
hci_dev
*
hdev
,
void
*
data
,
u16
data_len
)
static
int
read_index_list
(
struct
sock
*
sk
,
struct
hci_dev
*
hdev
,
void
*
data
,
u16
data_len
)
{
struct
mgmt_rp_read_index_list
*
rp
;
struct
list_head
*
p
;
...
...
@@ -667,8 +667,8 @@ static void mgmt_pending_free(struct pending_cmd *cmd)
}
static
struct
pending_cmd
*
mgmt_pending_add
(
struct
sock
*
sk
,
u16
opcode
,
struct
hci_dev
*
hdev
,
void
*
data
,
u16
len
)
struct
hci_dev
*
hdev
,
void
*
data
,
u16
len
)
{
struct
pending_cmd
*
cmd
;
...
...
@@ -790,8 +790,8 @@ static int set_powered(struct sock *sk, struct hci_dev *hdev, void *data,
return
err
;
}
static
int
mgmt_event
(
u16
event
,
struct
hci_dev
*
hdev
,
void
*
data
,
u16
data_len
,
struct
sock
*
skip_sk
)
static
int
mgmt_event
(
u16
event
,
struct
hci_dev
*
hdev
,
void
*
data
,
u16
data_len
,
struct
sock
*
skip_sk
)
{
struct
sk_buff
*
skb
;
struct
mgmt_hdr
*
hdr
;
...
...
@@ -1023,8 +1023,8 @@ static int set_pairable(struct sock *sk, struct hci_dev *hdev, void *data,
return
err
;
}
static
int
set_link_security
(
struct
sock
*
sk
,
struct
hci_dev
*
hdev
,
void
*
data
,
u16
len
)
static
int
set_link_security
(
struct
sock
*
sk
,
struct
hci_dev
*
hdev
,
void
*
data
,
u16
len
)
{
struct
mgmt_mode
*
cp
=
data
;
struct
pending_cmd
*
cmd
;
...
...
@@ -1225,8 +1225,8 @@ static int set_le(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
hci_cp
.
simul
=
!!
(
hdev
->
features
[
6
]
&
LMP_SIMUL_LE_BR
);
}
err
=
hci_send_cmd
(
hdev
,
HCI_OP_WRITE_LE_HOST_SUPPORTED
,
sizeof
(
hci_cp
),
&
hci_cp
);
err
=
hci_send_cmd
(
hdev
,
HCI_OP_WRITE_LE_HOST_SUPPORTED
,
sizeof
(
hci_cp
),
&
hci_cp
);
if
(
err
<
0
)
{
mgmt_pending_remove
(
cmd
);
goto
unlock
;
...
...
@@ -1508,8 +1508,7 @@ static int unpair_device(struct sock *sk, struct hci_dev *hdev, void *data,
if
(
!
hdev_is_powered
(
hdev
))
{
err
=
cmd_complete
(
sk
,
hdev
->
id
,
MGMT_OP_UNPAIR_DEVICE
,
MGMT_STATUS_NOT_POWERED
,
&
rp
,
sizeof
(
rp
));
MGMT_STATUS_NOT_POWERED
,
&
rp
,
sizeof
(
rp
));
goto
unlock
;
}
...
...
@@ -1520,8 +1519,7 @@ static int unpair_device(struct sock *sk, struct hci_dev *hdev, void *data,
if
(
err
<
0
)
{
err
=
cmd_complete
(
sk
,
hdev
->
id
,
MGMT_OP_UNPAIR_DEVICE
,
MGMT_STATUS_NOT_PAIRED
,
&
rp
,
sizeof
(
rp
));
MGMT_STATUS_NOT_PAIRED
,
&
rp
,
sizeof
(
rp
));
goto
unlock
;
}
...
...
@@ -1634,8 +1632,8 @@ static u8 link_to_mgmt(u8 link_type, u8 addr_type)
}
}
static
int
get_connections
(
struct
sock
*
sk
,
struct
hci_dev
*
hdev
,
void
*
data
,
u16
data_len
)
static
int
get_connections
(
struct
sock
*
sk
,
struct
hci_dev
*
hdev
,
void
*
data
,
u16
data_len
)
{
struct
mgmt_rp_get_connections
*
rp
;
struct
hci_conn
*
c
;
...
...
@@ -1794,8 +1792,8 @@ static int pin_code_neg_reply(struct sock *sk, struct hci_dev *hdev,
return
err
;
}
static
int
set_io_capability
(
struct
sock
*
sk
,
struct
hci_dev
*
hdev
,
void
*
data
,
u16
len
)
static
int
set_io_capability
(
struct
sock
*
sk
,
struct
hci_dev
*
hdev
,
void
*
data
,
u16
len
)
{
struct
mgmt_cp_set_io_capability
*
cp
=
data
;
...
...
@@ -1810,8 +1808,8 @@ static int set_io_capability(struct sock *sk, struct hci_dev *hdev,
hci_dev_unlock
(
hdev
);
return
cmd_complete
(
sk
,
hdev
->
id
,
MGMT_OP_SET_IO_CAPABILITY
,
0
,
NULL
,
0
);
return
cmd_complete
(
sk
,
hdev
->
id
,
MGMT_OP_SET_IO_CAPABILITY
,
0
,
NULL
,
0
);
}
static
inline
struct
pending_cmd
*
find_pairing
(
struct
hci_conn
*
conn
)
...
...
@@ -1905,8 +1903,8 @@ static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data,
if
(
IS_ERR
(
conn
))
{
err
=
cmd_complete
(
sk
,
hdev
->
id
,
MGMT_OP_PAIR_DEVICE
,
MGMT_STATUS_CONNECT_FAILED
,
&
rp
,
sizeof
(
rp
));
MGMT_STATUS_CONNECT_FAILED
,
&
rp
,
sizeof
(
rp
));
goto
unlock
;
}
...
...
@@ -1944,8 +1942,8 @@ static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data,
return
err
;
}
static
int
cancel_pair_device
(
struct
sock
*
sk
,
struct
hci_dev
*
hdev
,
void
*
data
,
u16
len
)
static
int
cancel_pair_device
(
struct
sock
*
sk
,
struct
hci_dev
*
hdev
,
void
*
data
,
u16
len
)
{
struct
mgmt_addr_info
*
addr
=
data
;
struct
pending_cmd
*
cmd
;
...
...
@@ -2051,8 +2049,8 @@ static int user_pairing_resp(struct sock *sk, struct hci_dev *hdev,
return
err
;
}
static
int
user_confirm_reply
(
struct
sock
*
sk
,
struct
hci_dev
*
hdev
,
void
*
data
,
u16
len
)
static
int
user_confirm_reply
(
struct
sock
*
sk
,
struct
hci_dev
*
hdev
,
void
*
data
,
u16
len
)
{
struct
mgmt_cp_user_confirm_reply
*
cp
=
data
;
...
...
@@ -2079,8 +2077,8 @@ static int user_confirm_neg_reply(struct sock *sk, struct hci_dev *hdev,
HCI_OP_USER_CONFIRM_NEG_REPLY
,
0
);
}
static
int
user_passkey_reply
(
struct
sock
*
sk
,
struct
hci_dev
*
hdev
,
void
*
data
,
u16
len
)
static
int
user_passkey_reply
(
struct
sock
*
sk
,
struct
hci_dev
*
hdev
,
void
*
data
,
u16
len
)
{
struct
mgmt_cp_user_passkey_reply
*
cp
=
data
;
...
...
@@ -2088,8 +2086,7 @@ static int user_passkey_reply(struct sock *sk, struct hci_dev *hdev,
return
user_pairing_resp
(
sk
,
hdev
,
&
cp
->
addr
.
bdaddr
,
cp
->
addr
.
type
,
MGMT_OP_USER_PASSKEY_REPLY
,
HCI_OP_USER_PASSKEY_REPLY
,
cp
->
passkey
);
HCI_OP_USER_PASSKEY_REPLY
,
cp
->
passkey
);
}
static
int
user_passkey_neg_reply
(
struct
sock
*
sk
,
struct
hci_dev
*
hdev
,
...
...
@@ -2211,8 +2208,8 @@ static int add_remote_oob_data(struct sock *sk, struct hci_dev *hdev,
if
(
!
hdev_is_powered
(
hdev
))
{
err
=
cmd_complete
(
sk
,
hdev
->
id
,
MGMT_OP_ADD_REMOTE_OOB_DATA
,
MGMT_STATUS_NOT_POWERED
,
&
cp
->
addr
,
sizeof
(
cp
->
addr
));
MGMT_STATUS_NOT_POWERED
,
&
cp
->
addr
,
sizeof
(
cp
->
addr
));
goto
unlock
;
}
...
...
@@ -2245,8 +2242,8 @@ static int remove_remote_oob_data(struct sock *sk, struct hci_dev *hdev,
if
(
!
hdev_is_powered
(
hdev
))
{
err
=
cmd_complete
(
sk
,
hdev
->
id
,
MGMT_OP_REMOVE_REMOTE_OOB_DATA
,
MGMT_STATUS_NOT_POWERED
,
&
cp
->
addr
,
sizeof
(
cp
->
addr
));
MGMT_STATUS_NOT_POWERED
,
&
cp
->
addr
,
sizeof
(
cp
->
addr
));
goto
unlock
;
}
...
...
@@ -2331,7 +2328,8 @@ static int start_discovery(struct sock *sk, struct hci_dev *hdev,
case
DISCOV_TYPE_INTERLEAVED
:
if
(
lmp_host_le_capable
(
hdev
)
&&
lmp_bredr_capable
(
hdev
))
err
=
hci_le_scan
(
hdev
,
LE_SCAN_TYPE
,
LE_SCAN_INT
,
LE_SCAN_WIN
,
LE_SCAN_TIMEOUT_BREDR_LE
);
LE_SCAN_WIN
,
LE_SCAN_TIMEOUT_BREDR_LE
);
else
err
=
-
ENOTSUPP
;
break
;
...
...
@@ -2365,15 +2363,15 @@ static int stop_discovery(struct sock *sk, struct hci_dev *hdev, void *data,
if
(
!
hci_discovery_active
(
hdev
))
{
err
=
cmd_complete
(
sk
,
hdev
->
id
,
MGMT_OP_STOP_DISCOVERY
,
MGMT_STATUS_REJECTED
,
&
mgmt_cp
->
type
,
sizeof
(
mgmt_cp
->
type
));
MGMT_STATUS_REJECTED
,
&
mgmt_cp
->
type
,
sizeof
(
mgmt_cp
->
type
));
goto
unlock
;
}
if
(
hdev
->
discovery
.
type
!=
mgmt_cp
->
type
)
{
err
=
cmd_complete
(
sk
,
hdev
->
id
,
MGMT_OP_STOP_DISCOVERY
,
MGMT_STATUS_INVALID_PARAMS
,
&
mgmt_cp
->
type
,
sizeof
(
mgmt_cp
->
type
));
MGMT_STATUS_INVALID_PARAMS
,
&
mgmt_cp
->
type
,
sizeof
(
mgmt_cp
->
type
));
goto
unlock
;
}
...
...
@@ -2402,8 +2400,8 @@ static int stop_discovery(struct sock *sk, struct hci_dev *hdev, void *data,
}
bacpy
(
&
cp
.
bdaddr
,
&
e
->
data
.
bdaddr
);
err
=
hci_send_cmd
(
hdev
,
HCI_OP_REMOTE_NAME_REQ_CANCEL
,
sizeof
(
cp
),
&
cp
);
err
=
hci_send_cmd
(
hdev
,
HCI_OP_REMOTE_NAME_REQ_CANCEL
,
sizeof
(
cp
),
&
cp
);
if
(
err
<
0
)
mgmt_pending_remove
(
cmd
);
else
...
...
@@ -2533,8 +2531,8 @@ static int set_fast_connectable(struct sock *sk, struct hci_dev *hdev,
acp
.
window
=
0x0012
;
/* default 11.25 msec page scan window */
err
=
hci_send_cmd
(
hdev
,
HCI_OP_WRITE_PAGE_SCAN_ACTIVITY
,
sizeof
(
acp
),
&
acp
);
err
=
hci_send_cmd
(
hdev
,
HCI_OP_WRITE_PAGE_SCAN_ACTIVITY
,
sizeof
(
acp
),
&
acp
);
if
(
err
<
0
)
{
err
=
cmd_status
(
sk
,
hdev
->
id
,
MGMT_OP_SET_FAST_CONNECTABLE
,
MGMT_STATUS_FAILED
);
...
...
@@ -2599,8 +2597,8 @@ static int load_long_term_keys(struct sock *sk, struct hci_dev *hdev,
}
struct
mgmt_handler
{
int
(
*
func
)
(
struct
sock
*
sk
,
struct
hci_dev
*
hdev
,
void
*
data
,
u16
data_len
);
int
(
*
func
)
(
struct
sock
*
sk
,
struct
hci_dev
*
hdev
,
void
*
data
,
u16
data_len
);
bool
var_len
;
size_t
data_len
;
}
mgmt_handlers
[]
=
{
...
...
@@ -2881,8 +2879,7 @@ int mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status)
return
0
;
}
int
mgmt_new_link_key
(
struct
hci_dev
*
hdev
,
struct
link_key
*
key
,
u8
persistent
)
int
mgmt_new_link_key
(
struct
hci_dev
*
hdev
,
struct
link_key
*
key
,
u8
persistent
)
{
struct
mgmt_ev_new_link_key
ev
;
...
...
@@ -2917,13 +2914,13 @@ int mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, u8 persistent)
memcpy
(
ev
.
key
.
rand
,
key
->
rand
,
sizeof
(
key
->
rand
));
memcpy
(
ev
.
key
.
val
,
key
->
val
,
sizeof
(
key
->
val
));
return
mgmt_event
(
MGMT_EV_NEW_LONG_TERM_KEY
,
hdev
,
&
ev
,
sizeof
(
ev
),
NULL
);
return
mgmt_event
(
MGMT_EV_NEW_LONG_TERM_KEY
,
hdev
,
&
ev
,
sizeof
(
ev
),
NULL
);
}
int
mgmt_device_connected
(
struct
hci_dev
*
hdev
,
bdaddr_t
*
bdaddr
,
u8
link_type
,
u8
addr_type
,
u32
flags
,
u8
*
name
,
u8
name_len
,
u8
*
dev_class
)
u8
addr_type
,
u32
flags
,
u8
*
name
,
u8
name_len
,
u8
*
dev_class
)
{
char
buf
[
512
];
struct
mgmt_ev_device_connected
*
ev
=
(
void
*
)
buf
;
...
...
@@ -3252,8 +3249,8 @@ int mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status)
&
hdev
->
dev_flags
))
err
=
new_settings
(
hdev
,
NULL
);
mgmt_pending_foreach
(
MGMT_OP_SET_SSP
,
hdev
,
cmd_status_rsp
,
&
mgmt_err
);
mgmt_pending_foreach
(
MGMT_OP_SET_SSP
,
hdev
,
cmd_status_rsp
,
&
mgmt_err
);
return
err
;
}
...
...
@@ -3312,8 +3309,8 @@ int mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class,
mgmt_pending_foreach
(
MGMT_OP_REMOVE_UUID
,
hdev
,
class_rsp
,
&
match
);
if
(
!
status
)
err
=
mgmt_event
(
MGMT_EV_CLASS_OF_DEV_CHANGED
,
hdev
,
dev_class
,
3
,
NULL
);
err
=
mgmt_event
(
MGMT_EV_CLASS_OF_DEV_CHANGED
,
hdev
,
dev_class
,
3
,
NULL
);
if
(
match
.
sk
)
sock_put
(
match
.
sk
);
...
...
@@ -3382,8 +3379,7 @@ int mgmt_read_local_oob_data_reply_complete(struct hci_dev *hdev, u8 *hash,
return
-
ENOENT
;
if
(
status
)
{
err
=
cmd_status
(
cmd
->
sk
,
hdev
->
id
,
MGMT_OP_READ_LOCAL_OOB_DATA
,
err
=
cmd_status
(
cmd
->
sk
,
hdev
->
id
,
MGMT_OP_READ_LOCAL_OOB_DATA
,
mgmt_status
(
status
));
}
else
{
struct
mgmt_rp_read_local_oob_data
rp
;
...
...
@@ -3392,8 +3388,8 @@ int mgmt_read_local_oob_data_reply_complete(struct hci_dev *hdev, u8 *hash,
memcpy
(
rp
.
randomizer
,
randomizer
,
sizeof
(
rp
.
randomizer
));
err
=
cmd_complete
(
cmd
->
sk
,
hdev
->
id
,
MGMT_OP_READ_LOCAL_OOB_DATA
,
0
,
&
rp
,
sizeof
(
rp
));
MGMT_OP_READ_LOCAL_OOB_DATA
,
0
,
&
rp
,
sizeof
(
rp
));
}
mgmt_pending_remove
(
cmd
);
...
...
@@ -3440,8 +3436,8 @@ int mgmt_le_enable_complete(struct hci_dev *hdev, u8 enable, u8 status)
}
int
mgmt_device_found
(
struct
hci_dev
*
hdev
,
bdaddr_t
*
bdaddr
,
u8
link_type
,
u8
addr_type
,
u8
*
dev_class
,
s8
rssi
,
u8
cfm_name
,
u8
ssp
,
u8
*
eir
,
u16
eir_len
)
u8
addr_type
,
u8
*
dev_class
,
s8
rssi
,
u8
cfm_name
,
u8
ssp
,
u8
*
eir
,
u16
eir_len
)
{
char
buf
[
512
];
struct
mgmt_ev_device_found
*
ev
=
(
void
*
)
buf
;
...
...
@@ -3530,8 +3526,7 @@ int mgmt_stop_discovery_failed(struct hci_dev *hdev, u8 status)
return
-
ENOENT
;
err
=
cmd_complete
(
cmd
->
sk
,
hdev
->
id
,
cmd
->
opcode
,
mgmt_status
(
status
),
&
hdev
->
discovery
.
type
,
sizeof
(
hdev
->
discovery
.
type
));
&
hdev
->
discovery
.
type
,
sizeof
(
hdev
->
discovery
.
type
));
mgmt_pending_remove
(
cmd
);
return
err
;
...
...
@@ -3552,8 +3547,8 @@ int mgmt_discovering(struct hci_dev *hdev, u8 discovering)
if
(
cmd
!=
NULL
)
{
u8
type
=
hdev
->
discovery
.
type
;
cmd_complete
(
cmd
->
sk
,
hdev
->
id
,
cmd
->
opcode
,
0
,
&
type
,
sizeof
(
type
));
cmd_complete
(
cmd
->
sk
,
hdev
->
id
,
cmd
->
opcode
,
0
,
&
type
,
sizeof
(
type
));
mgmt_pending_remove
(
cmd
);
}
...
...
net/bluetooth/smp.c
View file @
04124681
...
...
@@ -384,8 +384,7 @@ static void confirm_work(struct work_struct *work)
if
(
conn
->
hcon
->
out
)
ret
=
smp_c1
(
tfm
,
smp
->
tk
,
smp
->
prnd
,
smp
->
preq
,
smp
->
prsp
,
0
,
conn
->
src
,
conn
->
hcon
->
dst_type
,
conn
->
dst
,
res
);
conn
->
src
,
conn
->
hcon
->
dst_type
,
conn
->
dst
,
res
);
else
ret
=
smp_c1
(
tfm
,
smp
->
tk
,
smp
->
prnd
,
smp
->
preq
,
smp
->
prsp
,
conn
->
hcon
->
dst_type
,
conn
->
dst
,
0
,
conn
->
src
,
...
...
@@ -424,12 +423,10 @@ static void random_work(struct work_struct *work)
if
(
hcon
->
out
)
ret
=
smp_c1
(
tfm
,
smp
->
tk
,
smp
->
rrnd
,
smp
->
preq
,
smp
->
prsp
,
0
,
conn
->
src
,
hcon
->
dst_type
,
conn
->
dst
,
res
);
conn
->
src
,
hcon
->
dst_type
,
conn
->
dst
,
res
);
else
ret
=
smp_c1
(
tfm
,
smp
->
tk
,
smp
->
rrnd
,
smp
->
preq
,
smp
->
prsp
,
hcon
->
dst_type
,
conn
->
dst
,
0
,
conn
->
src
,
res
);
hcon
->
dst_type
,
conn
->
dst
,
0
,
conn
->
src
,
res
);
if
(
ret
)
{
reason
=
SMP_UNSPECIFIED
;
goto
error
;
...
...
@@ -480,8 +477,8 @@ static void random_work(struct work_struct *work)
SMP_MAX_ENC_KEY_SIZE
-
smp
->
enc_key_size
);
hci_add_ltk
(
hcon
->
hdev
,
conn
->
dst
,
hcon
->
dst_type
,
HCI_SMP_STK_SLAVE
,
0
,
0
,
stk
,
smp
->
enc_key_size
,
ediv
,
rand
);
HCI_SMP_STK_SLAVE
,
0
,
0
,
stk
,
smp
->
enc_key_size
,
ediv
,
rand
);
}
return
;
...
...
@@ -829,8 +826,8 @@ static int smp_cmd_master_ident(struct l2cap_conn *conn, struct sk_buff *skb)
hci_dev_lock
(
hdev
);
authenticated
=
(
conn
->
hcon
->
sec_level
==
BT_SECURITY_HIGH
);
hci_add_ltk
(
conn
->
hcon
->
hdev
,
conn
->
dst
,
hcon
->
dst_type
,
HCI_SMP_LTK
,
1
,
authenticated
,
smp
->
tk
,
smp
->
enc_key_size
,
rp
->
ediv
,
rp
->
rand
);
HCI_SMP_LTK
,
1
,
authenticated
,
smp
->
tk
,
smp
->
enc_key_size
,
rp
->
ediv
,
rp
->
rand
);
smp_distribute_keys
(
conn
,
1
);
hci_dev_unlock
(
hdev
);
...
...
@@ -955,8 +952,7 @@ int smp_distribute_keys(struct l2cap_conn *conn, __u8 force)
authenticated
=
hcon
->
sec_level
==
BT_SECURITY_HIGH
;
hci_add_ltk
(
conn
->
hcon
->
hdev
,
conn
->
dst
,
hcon
->
dst_type
,
HCI_SMP_LTK_SLAVE
,
1
,
authenticated
,
enc
.
ltk
,
smp
->
enc_key_size
,
ediv
,
ident
.
rand
);
enc
.
ltk
,
smp
->
enc_key_size
,
ediv
,
ident
.
rand
);
ident
.
ediv
=
cpu_to_le16
(
ediv
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment