Bluetooth: fix conding style issues all over the tree

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
This commit is contained in:
Gustavo F. Padovan 2012-03-08 01:25:00 -03:00
parent f64b993f44
commit 04124681f1
8 changed files with 384 additions and 398 deletions

View File

@ -401,28 +401,29 @@ void btmrvl_debugfs_init(struct hci_dev *hdev)
dbg->config_dir = debugfs_create_dir("config", hdev->debugfs); dbg->config_dir = debugfs_create_dir("config", hdev->debugfs);
dbg->psmode = debugfs_create_file("psmode", 0644, dbg->config_dir, dbg->psmode = debugfs_create_file("psmode", 0644, dbg->config_dir,
priv, &btmrvl_psmode_fops); priv, &btmrvl_psmode_fops);
dbg->pscmd = debugfs_create_file("pscmd", 0644, dbg->config_dir, dbg->pscmd = debugfs_create_file("pscmd", 0644, dbg->config_dir,
priv, &btmrvl_pscmd_fops); priv, &btmrvl_pscmd_fops);
dbg->gpiogap = debugfs_create_file("gpiogap", 0644, dbg->config_dir, dbg->gpiogap = debugfs_create_file("gpiogap", 0644, dbg->config_dir,
priv, &btmrvl_gpiogap_fops); priv, &btmrvl_gpiogap_fops);
dbg->hsmode = debugfs_create_file("hsmode", 0644, dbg->config_dir, dbg->hsmode = debugfs_create_file("hsmode", 0644, dbg->config_dir,
priv, &btmrvl_hsmode_fops); priv, &btmrvl_hsmode_fops);
dbg->hscmd = debugfs_create_file("hscmd", 0644, dbg->config_dir, dbg->hscmd = debugfs_create_file("hscmd", 0644, dbg->config_dir,
priv, &btmrvl_hscmd_fops); priv, &btmrvl_hscmd_fops);
dbg->hscfgcmd = debugfs_create_file("hscfgcmd", 0644, dbg->config_dir, dbg->hscfgcmd = debugfs_create_file("hscfgcmd", 0644, dbg->config_dir,
priv, &btmrvl_hscfgcmd_fops); priv, &btmrvl_hscfgcmd_fops);
dbg->status_dir = debugfs_create_dir("status", hdev->debugfs); dbg->status_dir = debugfs_create_dir("status", hdev->debugfs);
dbg->curpsmode = debugfs_create_file("curpsmode", 0444, 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, dbg->psstate = debugfs_create_file("psstate", 0444, dbg->status_dir,
priv, &btmrvl_psstate_fops); priv, &btmrvl_psstate_fops);
dbg->hsstate = debugfs_create_file("hsstate", 0444, dbg->status_dir, dbg->hsstate = debugfs_create_file("hsstate", 0444, dbg->status_dir,
priv, &btmrvl_hsstate_fops); priv, &btmrvl_hsstate_fops);
dbg->txdnldready = debugfs_create_file("txdnldready", 0444, dbg->txdnldready = debugfs_create_file("txdnldready", 0444,
dbg->status_dir, priv, dbg->status_dir, priv,
&btmrvl_txdnldready_fops); &btmrvl_txdnldready_fops);
} }
void btmrvl_debugfs_remove(struct hci_dev *hdev) void btmrvl_debugfs_remove(struct hci_dev *hdev)

View File

@ -398,16 +398,16 @@ static inline long inquiry_entry_age(struct inquiry_entry *e)
} }
struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev, struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev,
bdaddr_t *bdaddr); bdaddr_t *bdaddr);
struct inquiry_entry *hci_inquiry_cache_lookup_unknown(struct hci_dev *hdev, struct inquiry_entry *hci_inquiry_cache_lookup_unknown(struct hci_dev *hdev,
bdaddr_t *bdaddr); bdaddr_t *bdaddr);
struct inquiry_entry *hci_inquiry_cache_lookup_resolve(struct hci_dev *hdev, struct inquiry_entry *hci_inquiry_cache_lookup_resolve(struct hci_dev *hdev,
bdaddr_t *bdaddr, bdaddr_t *bdaddr,
int state); int state);
void hci_inquiry_cache_update_resolve(struct hci_dev *hdev, void hci_inquiry_cache_update_resolve(struct hci_dev *hdev,
struct inquiry_entry *ie); struct inquiry_entry *ie);
bool hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data, bool hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data,
bool name_known, bool *ssp); bool name_known, bool *ssp);
/* ----- HCI Connections ----- */ /* ----- HCI Connections ----- */
enum { enum {
@ -669,13 +669,13 @@ int hci_uuids_clear(struct hci_dev *hdev);
int hci_link_keys_clear(struct hci_dev *hdev); int hci_link_keys_clear(struct hci_dev *hdev);
struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr);
int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key, 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); 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]); 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 hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 addr_type, u8 type,
int new_key, u8 authenticated, u8 tk[16], int new_key, u8 authenticated, u8 tk[16], u8 enc_size, u16 ediv,
u8 enc_size, u16 ediv, u8 rand[8]); u8 rand[8]);
struct smp_ltk *hci_find_ltk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr, struct smp_ltk *hci_find_ltk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr,
u8 addr_type); u8 addr_type);
int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr); int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr);
int hci_smp_ltks_clear(struct hci_dev *hdev); int hci_smp_ltks_clear(struct hci_dev *hdev);
int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr);
@ -931,7 +931,7 @@ static inline bool eir_has_data_type(u8 *data, size_t data_len, u8 type)
} }
static inline u16 eir_append_data(u8 *eir, u16 eir_len, u8 type, u8 *data, static inline u16 eir_append_data(u8 *eir, u16 eir_len, u8 type, u8 *data,
u8 data_len) u8 data_len)
{ {
eir[eir_len++] = sizeof(type) + data_len; eir[eir_len++] = sizeof(type) + data_len;
eir[eir_len++] = type; eir[eir_len++] = type;
@ -978,50 +978,49 @@ int mgmt_discoverable(struct hci_dev *hdev, u8 discoverable);
int mgmt_connectable(struct hci_dev *hdev, u8 connectable); int mgmt_connectable(struct hci_dev *hdev, u8 connectable);
int mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status); 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, int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key,
u8 persistent); u8 persistent);
int mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, int mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
u8 addr_type, u32 flags, u8 *name, u8 addr_type, u32 flags, u8 *name, u8 name_len,
u8 name_len, u8 *dev_class); u8 *dev_class);
int mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr, int mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr,
u8 link_type, u8 addr_type); u8 link_type, u8 addr_type);
int mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, int mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr,
u8 link_type, u8 addr_type, u8 status); u8 link_type, u8 addr_type, u8 status);
int mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, int mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
u8 addr_type, u8 status); u8 addr_type, u8 status);
int mgmt_pin_code_request(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 secure); int mgmt_pin_code_request(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 secure);
int mgmt_pin_code_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, int mgmt_pin_code_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
u8 status); u8 status);
int mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, int mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
u8 status); u8 status);
int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr, int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr,
u8 link_type, u8 addr_type, __le32 value, u8 link_type, u8 addr_type, __le32 value,
u8 confirm_hint); u8 confirm_hint);
int mgmt_user_confirm_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, int mgmt_user_confirm_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
u8 link_type, u8 addr_type, u8 status); u8 link_type, u8 addr_type, u8 status);
int mgmt_user_confirm_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, int mgmt_user_confirm_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
u8 link_type, u8 addr_type, u8 status); u8 link_type, u8 addr_type, u8 status);
int mgmt_user_passkey_request(struct hci_dev *hdev, bdaddr_t *bdaddr, int mgmt_user_passkey_request(struct hci_dev *hdev, bdaddr_t *bdaddr,
u8 link_type, u8 addr_type); u8 link_type, u8 addr_type);
int mgmt_user_passkey_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, int mgmt_user_passkey_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
u8 link_type, u8 addr_type, u8 status); u8 link_type, u8 addr_type, u8 status);
int mgmt_user_passkey_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, int mgmt_user_passkey_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
u8 link_type, u8 addr_type, u8 status); u8 link_type, u8 addr_type, u8 status);
int mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, int mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
u8 addr_type, u8 status); u8 addr_type, u8 status);
int mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status); int mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status);
int mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status); int mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status);
int mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class, int mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class,
u8 status); u8 status);
int mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status); int mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status);
int mgmt_read_local_oob_data_reply_complete(struct hci_dev *hdev, u8 *hash, int mgmt_read_local_oob_data_reply_complete(struct hci_dev *hdev, u8 *hash,
u8 *randomizer, u8 status); u8 *randomizer, u8 status);
int mgmt_le_enable_complete(struct hci_dev *hdev, u8 enable, 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, int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
u8 addr_type, u8 *dev_class, s8 rssi, u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name,
u8 cfm_name, u8 ssp, u8 *eir, u8 ssp, u8 *eir, u16 eir_len);
u16 eir_len);
int mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, int mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
u8 addr_type, s8 rssi, u8 *name, u8 name_len); u8 addr_type, s8 rssi, u8 *name, u8 name_len);
int mgmt_start_discovery_failed(struct hci_dev *hdev, u8 status); int mgmt_start_discovery_failed(struct hci_dev *hdev, u8 status);
int mgmt_stop_discovery_failed(struct hci_dev *hdev, u8 status); int mgmt_stop_discovery_failed(struct hci_dev *hdev, u8 status);
int mgmt_discovering(struct hci_dev *hdev, u8 discovering); int mgmt_discovering(struct hci_dev *hdev, u8 discovering);
@ -1071,6 +1070,6 @@ void hci_le_ltk_neg_reply(struct hci_conn *conn);
int hci_do_inquiry(struct hci_dev *hdev, u8 length); int hci_do_inquiry(struct hci_dev *hdev, u8 length);
int hci_cancel_inquiry(struct hci_dev *hdev); int hci_cancel_inquiry(struct hci_dev *hdev);
int hci_le_scan(struct hci_dev *hdev, u8 type, u16 interval, u16 window, int hci_le_scan(struct hci_dev *hdev, u8 type, u16 interval, u16 window,
int timeout); int timeout);
#endif /* __HCI_CORE_H */ #endif /* __HCI_CORE_H */

View File

@ -431,7 +431,7 @@ struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev, bdaddr_t *b
} }
struct inquiry_entry *hci_inquiry_cache_lookup_unknown(struct hci_dev *hdev, struct inquiry_entry *hci_inquiry_cache_lookup_unknown(struct hci_dev *hdev,
bdaddr_t *bdaddr) bdaddr_t *bdaddr)
{ {
struct discovery_state *cache = &hdev->discovery; struct discovery_state *cache = &hdev->discovery;
struct inquiry_entry *e; struct inquiry_entry *e;
@ -447,8 +447,8 @@ struct inquiry_entry *hci_inquiry_cache_lookup_unknown(struct hci_dev *hdev,
} }
struct inquiry_entry *hci_inquiry_cache_lookup_resolve(struct hci_dev *hdev, struct inquiry_entry *hci_inquiry_cache_lookup_resolve(struct hci_dev *hdev,
bdaddr_t *bdaddr, bdaddr_t *bdaddr,
int state) int state)
{ {
struct discovery_state *cache = &hdev->discovery; struct discovery_state *cache = &hdev->discovery;
struct inquiry_entry *e; struct inquiry_entry *e;
@ -466,7 +466,7 @@ struct inquiry_entry *hci_inquiry_cache_lookup_resolve(struct hci_dev *hdev,
} }
void hci_inquiry_cache_update_resolve(struct hci_dev *hdev, void hci_inquiry_cache_update_resolve(struct hci_dev *hdev,
struct inquiry_entry *ie) struct inquiry_entry *ie)
{ {
struct discovery_state *cache = &hdev->discovery; struct discovery_state *cache = &hdev->discovery;
struct list_head *pos = &cache->resolve; struct list_head *pos = &cache->resolve;
@ -485,7 +485,7 @@ void hci_inquiry_cache_update_resolve(struct hci_dev *hdev,
} }
bool hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data, bool hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data,
bool name_known, bool *ssp) bool name_known, bool *ssp)
{ {
struct discovery_state *cache = &hdev->discovery; struct discovery_state *cache = &hdev->discovery;
struct inquiry_entry *ie; struct inquiry_entry *ie;
@ -1264,7 +1264,7 @@ struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, u8 rand[8])
EXPORT_SYMBOL(hci_find_ltk); EXPORT_SYMBOL(hci_find_ltk);
struct smp_ltk *hci_find_ltk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr, struct smp_ltk *hci_find_ltk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr,
u8 addr_type) u8 addr_type)
{ {
struct smp_ltk *k; struct smp_ltk *k;
@ -1278,7 +1278,7 @@ struct smp_ltk *hci_find_ltk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr,
EXPORT_SYMBOL(hci_find_ltk_by_addr); EXPORT_SYMBOL(hci_find_ltk_by_addr);
int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key, 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) bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len)
{ {
struct link_key *key, *old_key; struct link_key *key, *old_key;
u8 old_key_type, persistent; u8 old_key_type, persistent;
@ -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 hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 addr_type, u8 type,
int new_key, u8 authenticated, u8 tk[16], int new_key, u8 authenticated, u8 tk[16], u8 enc_size, u16
u8 enc_size, u16 ediv, u8 rand[8]) ediv, u8 rand[8])
{ {
struct smp_ltk *key, *old_key; struct smp_ltk *key, *old_key;
@ -1413,7 +1413,7 @@ static void hci_cmd_timer(unsigned long arg)
} }
struct oob_data *hci_find_remote_oob_data(struct hci_dev *hdev, struct oob_data *hci_find_remote_oob_data(struct hci_dev *hdev,
bdaddr_t *bdaddr) bdaddr_t *bdaddr)
{ {
struct oob_data *data; struct oob_data *data;
@ -1453,7 +1453,7 @@ int hci_remote_oob_data_clear(struct hci_dev *hdev)
} }
int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *hash, int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *hash,
u8 *randomizer) u8 *randomizer)
{ {
struct oob_data *data; struct oob_data *data;
@ -1476,8 +1476,7 @@ int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *hash,
return 0; return 0;
} }
struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr)
bdaddr_t *bdaddr)
{ {
struct bdaddr_list *b; struct bdaddr_list *b;
@ -1545,7 +1544,7 @@ int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type)
static void hci_clear_adv_cache(struct work_struct *work) static void hci_clear_adv_cache(struct work_struct *work)
{ {
struct hci_dev *hdev = container_of(work, struct hci_dev, struct hci_dev *hdev = container_of(work, struct hci_dev,
adv_work.work); adv_work.work);
hci_dev_lock(hdev); hci_dev_lock(hdev);
@ -1588,11 +1587,7 @@ static inline int is_connectable_adv(u8 evt_type)
} }
int hci_add_adv_entry(struct hci_dev *hdev, int hci_add_adv_entry(struct hci_dev *hdev,
struct hci_ev_le_advertising_info *ev) struct hci_ev_le_advertising_info *ev) { struct adv_entry *entry; if (!is_connectable_adv(ev->evt_type))
{
struct adv_entry *entry;
if (!is_connectable_adv(ev->evt_type))
return -EINVAL; return -EINVAL;
/* Only new entries should be added to adv_entries. So, if /* Only new entries should be added to adv_entries. So, if
@ -1639,7 +1634,7 @@ static void le_scan_enable_req(struct hci_dev *hdev, unsigned long opt)
} }
static int hci_do_le_scan(struct hci_dev *hdev, u8 type, u16 interval, static int hci_do_le_scan(struct hci_dev *hdev, u8 type, u16 interval,
u16 window, int timeout) u16 window, int timeout)
{ {
long timeo = msecs_to_jiffies(3000); long timeo = msecs_to_jiffies(3000);
struct le_scan_params param; struct le_scan_params param;
@ -1657,7 +1652,7 @@ static int hci_do_le_scan(struct hci_dev *hdev, u8 type, u16 interval,
hci_req_lock(hdev); hci_req_lock(hdev);
err = __hci_request(hdev, le_scan_param_req, (unsigned long) &param, err = __hci_request(hdev, le_scan_param_req, (unsigned long) &param,
timeo); timeo);
if (!err) if (!err)
err = __hci_request(hdev, le_scan_enable_req, 0, timeo); err = __hci_request(hdev, le_scan_enable_req, 0, timeo);
@ -1667,7 +1662,7 @@ static int hci_do_le_scan(struct hci_dev *hdev, u8 type, u16 interval,
return err; return err;
schedule_delayed_work(&hdev->le_scan_disable, schedule_delayed_work(&hdev->le_scan_disable,
msecs_to_jiffies(timeout)); msecs_to_jiffies(timeout));
return 0; return 0;
} }
@ -1675,7 +1670,7 @@ static int hci_do_le_scan(struct hci_dev *hdev, u8 type, u16 interval,
static void le_scan_disable_work(struct work_struct *work) static void le_scan_disable_work(struct work_struct *work)
{ {
struct hci_dev *hdev = container_of(work, struct hci_dev, struct hci_dev *hdev = container_of(work, struct hci_dev,
le_scan_disable.work); le_scan_disable.work);
struct hci_cp_le_set_scan_enable cp; struct hci_cp_le_set_scan_enable cp;
BT_DBG("%s", hdev->name); BT_DBG("%s", hdev->name);
@ -1692,12 +1687,12 @@ static void le_scan_work(struct work_struct *work)
BT_DBG("%s", hdev->name); BT_DBG("%s", hdev->name);
hci_do_le_scan(hdev, param->type, param->interval, hci_do_le_scan(hdev, param->type, param->interval, param->window,
param->window, param->timeout); param->timeout);
} }
int hci_le_scan(struct hci_dev *hdev, u8 type, u16 interval, u16 window, int hci_le_scan(struct hci_dev *hdev, u8 type, u16 interval, u16 window,
int timeout) int timeout)
{ {
struct le_scan_params *param = &hdev->le_scan_params; struct le_scan_params *param = &hdev->le_scan_params;
@ -2558,7 +2553,7 @@ static inline void hci_sched_acl_pkt(struct hci_dev *hdev)
skb = skb_dequeue(&chan->data_q); skb = skb_dequeue(&chan->data_q);
hci_conn_enter_active_mode(chan->conn, hci_conn_enter_active_mode(chan->conn,
bt_cb(skb)->force_active); bt_cb(skb)->force_active);
hci_send_frame(skb); hci_send_frame(skb);
hdev->acl_last_tx = jiffies; hdev->acl_last_tx = jiffies;

View File

@ -556,7 +556,7 @@ static void hci_setup(struct hci_dev *hdev)
if (test_bit(HCI_SSP_ENABLED, &hdev->dev_flags)) { if (test_bit(HCI_SSP_ENABLED, &hdev->dev_flags)) {
u8 mode = 0x01; u8 mode = 0x01;
hci_send_cmd(hdev, HCI_OP_WRITE_SSP_MODE, hci_send_cmd(hdev, HCI_OP_WRITE_SSP_MODE,
sizeof(mode), &mode); sizeof(mode), &mode);
} else { } else {
struct hci_cp_write_eir cp; struct hci_cp_write_eir cp;
@ -577,14 +577,14 @@ static void hci_setup(struct hci_dev *hdev)
struct hci_cp_read_local_ext_features cp; struct hci_cp_read_local_ext_features cp;
cp.page = 0x01; cp.page = 0x01;
hci_send_cmd(hdev, HCI_OP_READ_LOCAL_EXT_FEATURES, hci_send_cmd(hdev, HCI_OP_READ_LOCAL_EXT_FEATURES, sizeof(cp),
sizeof(cp), &cp); &cp);
} }
if (test_bit(HCI_LINK_SECURITY, &hdev->dev_flags)) { if (test_bit(HCI_LINK_SECURITY, &hdev->dev_flags)) {
u8 enable = 1; u8 enable = 1;
hci_send_cmd(hdev, HCI_OP_WRITE_AUTH_ENABLE, hci_send_cmd(hdev, HCI_OP_WRITE_AUTH_ENABLE, sizeof(enable),
sizeof(enable), &enable); &enable);
} }
} }
@ -628,8 +628,8 @@ static void hci_setup_link_policy(struct hci_dev *hdev)
link_policy |= HCI_LP_PARK; link_policy |= HCI_LP_PARK;
link_policy = cpu_to_le16(link_policy); link_policy = cpu_to_le16(link_policy);
hci_send_cmd(hdev, HCI_OP_WRITE_DEF_LINK_POLICY, hci_send_cmd(hdev, HCI_OP_WRITE_DEF_LINK_POLICY, sizeof(link_policy),
sizeof(link_policy), &link_policy); &link_policy);
} }
static void hci_cc_read_local_commands(struct hci_dev *hdev, struct sk_buff *skb) 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)) if (cp.le != !!(hdev->host_features[0] & LMP_HOST_LE))
hci_send_cmd(hdev, HCI_OP_WRITE_LE_HOST_SUPPORTED, hci_send_cmd(hdev, HCI_OP_WRITE_LE_HOST_SUPPORTED, sizeof(cp),
sizeof(cp), &cp); &cp);
} }
static void hci_cc_read_local_ext_features(struct hci_dev *hdev, 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); hci_dev_lock(hdev);
if (test_bit(HCI_MGMT, &hdev->dev_flags)) if (test_bit(HCI_MGMT, &hdev->dev_flags))
mgmt_user_confirm_reply_complete(hdev, &rp->bdaddr, ACL_LINK, mgmt_user_confirm_reply_complete(hdev, &rp->bdaddr, ACL_LINK, 0,
0, rp->status); rp->status);
hci_dev_unlock(hdev); 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)) if (test_bit(HCI_MGMT, &hdev->dev_flags))
mgmt_user_confirm_neg_reply_complete(hdev, &rp->bdaddr, mgmt_user_confirm_neg_reply_complete(hdev, &rp->bdaddr,
ACL_LINK, 0, ACL_LINK, 0, rp->status);
rp->status);
hci_dev_unlock(hdev); hci_dev_unlock(hdev);
} }
@ -1009,7 +1008,7 @@ static void hci_cc_user_passkey_reply(struct hci_dev *hdev, struct sk_buff *skb)
if (test_bit(HCI_MGMT, &hdev->dev_flags)) if (test_bit(HCI_MGMT, &hdev->dev_flags))
mgmt_user_passkey_reply_complete(hdev, &rp->bdaddr, ACL_LINK, mgmt_user_passkey_reply_complete(hdev, &rp->bdaddr, ACL_LINK,
0, rp->status); 0, rp->status);
hci_dev_unlock(hdev); 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)) if (test_bit(HCI_MGMT, &hdev->dev_flags))
mgmt_user_passkey_neg_reply_complete(hdev, &rp->bdaddr, mgmt_user_passkey_neg_reply_complete(hdev, &rp->bdaddr,
ACL_LINK, 0, ACL_LINK, 0, rp->status);
rp->status);
hci_dev_unlock(hdev); hci_dev_unlock(hdev);
} }
@ -1337,7 +1335,7 @@ static int hci_outgoing_auth_needed(struct hci_dev *hdev,
} }
static inline int hci_resolve_name(struct hci_dev *hdev, static inline int hci_resolve_name(struct hci_dev *hdev,
struct inquiry_entry *e) struct inquiry_entry *e)
{ {
struct hci_cp_remote_name_req cp; struct hci_cp_remote_name_req cp;
@ -1369,14 +1367,14 @@ static bool hci_resolve_next_name(struct hci_dev *hdev)
} }
static void hci_check_pending_name(struct hci_dev *hdev, struct hci_conn *conn, static void hci_check_pending_name(struct hci_dev *hdev, struct hci_conn *conn,
bdaddr_t *bdaddr, u8 *name, u8 name_len) bdaddr_t *bdaddr, u8 *name, u8 name_len)
{ {
struct discovery_state *discov = &hdev->discovery; struct discovery_state *discov = &hdev->discovery;
struct inquiry_entry *e; struct inquiry_entry *e;
if (conn && !test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) if (conn && !test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags))
mgmt_device_connected(hdev, bdaddr, ACL_LINK, 0x00, 0, mgmt_device_connected(hdev, bdaddr, ACL_LINK, 0x00, 0, name,
name, name_len, conn->dev_class); name_len, conn->dev_class);
if (discov->state == DISCOVERY_STOPPED) if (discov->state == DISCOVERY_STOPPED)
return; return;
@ -1393,7 +1391,7 @@ static void hci_check_pending_name(struct hci_dev *hdev, struct hci_conn *conn,
list_del(&e->list); list_del(&e->list);
if (name) if (name)
mgmt_remote_name(hdev, bdaddr, ACL_LINK, 0x00, mgmt_remote_name(hdev, bdaddr, ACL_LINK, 0x00,
e->data.rssi, name, name_len); e->data.rssi, name, name_len);
} }
if (hci_resolve_next_name(hdev)) if (hci_resolve_next_name(hdev))
@ -1602,7 +1600,7 @@ static void hci_cs_disconnect(struct hci_dev *hdev, u8 status)
conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle));
if (conn) if (conn)
mgmt_disconnect_failed(hdev, &conn->dst, conn->type, mgmt_disconnect_failed(hdev, &conn->dst, conn->type,
conn->dst_type, status); conn->dst_type, status);
hci_dev_unlock(hdev); hci_dev_unlock(hdev);
} }
@ -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); name_known = hci_inquiry_cache_update(hdev, &data, false, &ssp);
mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00,
info->dev_class, 0, !name_known, ssp, info->dev_class, 0, !name_known, ssp, NULL,
NULL, 0); 0);
} }
hci_dev_unlock(hdev); hci_dev_unlock(hdev);
@ -1770,7 +1768,7 @@ static inline void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *s
struct hci_cp_read_remote_features cp; struct hci_cp_read_remote_features cp;
cp.handle = ev->handle; cp.handle = ev->handle;
hci_send_cmd(hdev, HCI_OP_READ_REMOTE_FEATURES, hci_send_cmd(hdev, HCI_OP_READ_REMOTE_FEATURES,
sizeof(cp), &cp); sizeof(cp), &cp);
} }
/* Set packet type for incoming connection */ /* Set packet type for incoming connection */
@ -1778,14 +1776,14 @@ static inline void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *s
struct hci_cp_change_conn_ptype cp; struct hci_cp_change_conn_ptype cp;
cp.handle = ev->handle; cp.handle = ev->handle;
cp.pkt_type = cpu_to_le16(conn->pkt_type); cp.pkt_type = cpu_to_le16(conn->pkt_type);
hci_send_cmd(hdev, HCI_OP_CHANGE_CONN_PTYPE, hci_send_cmd(hdev, HCI_OP_CHANGE_CONN_PTYPE, sizeof(cp),
sizeof(cp), &cp); &cp);
} }
} else { } else {
conn->state = BT_CLOSED; conn->state = BT_CLOSED;
if (conn->type == ACL_LINK) if (conn->type == ACL_LINK)
mgmt_connect_failed(hdev, &ev->bdaddr, conn->type, mgmt_connect_failed(hdev, &ev->bdaddr, conn->type,
conn->dst_type, ev->status); conn->dst_type, ev->status);
} }
if (conn->type == ACL_LINK) if (conn->type == ACL_LINK)
@ -1850,8 +1848,8 @@ static inline void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *sk
else else
cp.role = 0x01; /* Remain slave */ cp.role = 0x01; /* Remain slave */
hci_send_cmd(hdev, HCI_OP_ACCEPT_CONN_REQ, hci_send_cmd(hdev, HCI_OP_ACCEPT_CONN_REQ, sizeof(cp),
sizeof(cp), &cp); &cp);
} else { } else {
struct hci_cp_accept_sync_conn_req cp; struct hci_cp_accept_sync_conn_req cp;
@ -1865,7 +1863,7 @@ static inline void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *sk
cp.retrans_effort = 0xff; cp.retrans_effort = 0xff;
hci_send_cmd(hdev, HCI_OP_ACCEPT_SYNC_CONN_REQ, hci_send_cmd(hdev, HCI_OP_ACCEPT_SYNC_CONN_REQ,
sizeof(cp), &cp); sizeof(cp), &cp);
} }
} else { } else {
/* Connection rejected */ /* Connection rejected */
@ -1900,7 +1898,7 @@ static inline void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff
conn->dst_type, ev->status); conn->dst_type, ev->status);
else else
mgmt_device_disconnected(hdev, &conn->dst, conn->type, mgmt_device_disconnected(hdev, &conn->dst, conn->type,
conn->dst_type); conn->dst_type);
} }
if (ev->status == 0) { if (ev->status == 0) {
@ -1935,7 +1933,7 @@ static inline void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *s
} }
} else { } else {
mgmt_auth_failed(hdev, &conn->dst, conn->type, conn->dst_type, mgmt_auth_failed(hdev, &conn->dst, conn->type, conn->dst_type,
ev->status); ev->status);
} }
clear_bit(HCI_CONN_AUTH_PEND, &conn->flags); clear_bit(HCI_CONN_AUTH_PEND, &conn->flags);
@ -1996,7 +1994,7 @@ static inline void hci_remote_name_evt(struct hci_dev *hdev, struct sk_buff *skb
if (ev->status == 0) if (ev->status == 0)
hci_check_pending_name(hdev, conn, &ev->bdaddr, ev->name, hci_check_pending_name(hdev, conn, &ev->bdaddr, ev->name,
strnlen(ev->name, HCI_MAX_NAME_LENGTH)); strnlen(ev->name, HCI_MAX_NAME_LENGTH));
else else
hci_check_pending_name(hdev, conn, &ev->bdaddr, NULL, 0); hci_check_pending_name(hdev, conn, &ev->bdaddr, NULL, 0);
@ -2111,8 +2109,8 @@ static inline void hci_remote_features_evt(struct hci_dev *hdev, struct sk_buff
hci_send_cmd(hdev, HCI_OP_REMOTE_NAME_REQ, sizeof(cp), &cp); hci_send_cmd(hdev, HCI_OP_REMOTE_NAME_REQ, sizeof(cp), &cp);
} else if (!test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) } else if (!test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags))
mgmt_device_connected(hdev, &conn->dst, conn->type, mgmt_device_connected(hdev, &conn->dst, conn->type,
conn->dst_type, 0, NULL, 0, conn->dst_type, 0, NULL, 0,
conn->dev_class); conn->dev_class);
if (!hci_outgoing_auth_needed(hdev, conn)) { if (!hci_outgoing_auth_needed(hdev, conn)) {
conn->state = BT_CONNECTED; conn->state = BT_CONNECTED;
@ -2524,7 +2522,7 @@ static inline void hci_num_comp_pkts_evt(struct hci_dev *hdev, struct sk_buff *s
} }
static inline void hci_num_comp_blocks_evt(struct hci_dev *hdev, static inline void hci_num_comp_blocks_evt(struct hci_dev *hdev,
struct sk_buff *skb) struct sk_buff *skb)
{ {
struct hci_ev_num_comp_blocks *ev = (void *) skb->data; struct hci_ev_num_comp_blocks *ev = (void *) skb->data;
int i; int i;
@ -2816,10 +2814,10 @@ static inline void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, struct
data.ssp_mode = 0x00; data.ssp_mode = 0x00;
name_known = hci_inquiry_cache_update(hdev, &data, name_known = hci_inquiry_cache_update(hdev, &data,
false, &ssp); false, &ssp);
mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00,
info->dev_class, info->rssi, info->dev_class, info->rssi,
!name_known, ssp, NULL, 0); !name_known, ssp, NULL, 0);
} }
} else { } else {
struct inquiry_info_with_rssi *info = (void *) (skb->data + 1); struct inquiry_info_with_rssi *info = (void *) (skb->data + 1);
@ -2834,10 +2832,10 @@ static inline void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, struct
data.rssi = info->rssi; data.rssi = info->rssi;
data.ssp_mode = 0x00; data.ssp_mode = 0x00;
name_known = hci_inquiry_cache_update(hdev, &data, name_known = hci_inquiry_cache_update(hdev, &data,
false, &ssp); false, &ssp);
mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00,
info->dev_class, info->rssi, info->dev_class, info->rssi,
!name_known, ssp, NULL, 0); !name_known, ssp, NULL, 0);
} }
} }
@ -2879,8 +2877,8 @@ static inline void hci_remote_ext_features_evt(struct hci_dev *hdev, struct sk_b
hci_send_cmd(hdev, HCI_OP_REMOTE_NAME_REQ, sizeof(cp), &cp); hci_send_cmd(hdev, HCI_OP_REMOTE_NAME_REQ, sizeof(cp), &cp);
} else if (!test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) } else if (!test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags))
mgmt_device_connected(hdev, &conn->dst, conn->type, mgmt_device_connected(hdev, &conn->dst, conn->type,
conn->dst_type, 0, NULL, 0, conn->dst_type, 0, NULL, 0,
conn->dev_class); conn->dev_class);
if (!hci_outgoing_auth_needed(hdev, conn)) { if (!hci_outgoing_auth_needed(hdev, conn)) {
conn->state = BT_CONNECTED; conn->state = BT_CONNECTED;
@ -2986,17 +2984,16 @@ static inline void hci_extended_inquiry_result_evt(struct hci_dev *hdev, struct
if (test_bit(HCI_MGMT, &hdev->dev_flags)) if (test_bit(HCI_MGMT, &hdev->dev_flags))
name_known = eir_has_data_type(info->data, name_known = eir_has_data_type(info->data,
sizeof(info->data), sizeof(info->data),
EIR_NAME_COMPLETE); EIR_NAME_COMPLETE);
else else
name_known = true; name_known = true;
name_known = hci_inquiry_cache_update(hdev, &data, name_known, name_known = hci_inquiry_cache_update(hdev, &data, name_known,
&ssp); &ssp);
mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00, mgmt_device_found(hdev, &info->bdaddr, ACL_LINK, 0x00,
info->dev_class, info->rssi, info->dev_class, info->rssi, !name_known,
!name_known, ssp, info->data, ssp, info->data, sizeof(info->data));
sizeof(info->data));
} }
hci_dev_unlock(hdev); hci_dev_unlock(hdev);
@ -3157,7 +3154,7 @@ static inline void hci_user_confirm_request_evt(struct hci_dev *hdev,
confirm: confirm:
mgmt_user_confirm_request(hdev, &ev->bdaddr, ACL_LINK, 0, ev->passkey, mgmt_user_confirm_request(hdev, &ev->bdaddr, ACL_LINK, 0, ev->passkey,
confirm_hint); confirm_hint);
unlock: unlock:
hci_dev_unlock(hdev); hci_dev_unlock(hdev);
@ -3198,7 +3195,7 @@ static inline void hci_simple_pair_complete_evt(struct hci_dev *hdev, struct sk_
* the mgmt_auth_failed event */ * the mgmt_auth_failed event */
if (!test_bit(HCI_CONN_AUTH_PEND, &conn->flags) && ev->status != 0) if (!test_bit(HCI_CONN_AUTH_PEND, &conn->flags) && ev->status != 0)
mgmt_auth_failed(hdev, &conn->dst, conn->type, conn->dst_type, mgmt_auth_failed(hdev, &conn->dst, conn->type, conn->dst_type,
ev->status); ev->status);
hci_conn_put(conn); hci_conn_put(conn);
@ -3223,7 +3220,7 @@ static inline void hci_remote_host_features_evt(struct hci_dev *hdev, struct sk_
} }
static inline void hci_remote_oob_data_request_evt(struct hci_dev *hdev, static inline void hci_remote_oob_data_request_evt(struct hci_dev *hdev,
struct sk_buff *skb) struct sk_buff *skb)
{ {
struct hci_ev_remote_oob_data_request *ev = (void *) skb->data; struct hci_ev_remote_oob_data_request *ev = (void *) skb->data;
struct oob_data *data; struct oob_data *data;
@ -3289,7 +3286,7 @@ static inline void hci_le_conn_complete_evt(struct hci_dev *hdev, struct sk_buff
if (!test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) if (!test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags))
mgmt_device_connected(hdev, &ev->bdaddr, conn->type, mgmt_device_connected(hdev, &ev->bdaddr, conn->type,
conn->dst_type, 0, NULL, 0, NULL); conn->dst_type, 0, NULL, 0, NULL);
conn->sec_level = BT_SECURITY_LOW; conn->sec_level = BT_SECURITY_LOW;
conn->handle = __le16_to_cpu(ev->handle); conn->handle = __le16_to_cpu(ev->handle);
@ -3320,8 +3317,7 @@ static inline void hci_le_adv_report_evt(struct hci_dev *hdev,
rssi = ev->data[ev->length]; rssi = ev->data[ev->length];
mgmt_device_found(hdev, &ev->bdaddr, LE_LINK, ev->bdaddr_type, mgmt_device_found(hdev, &ev->bdaddr, LE_LINK, ev->bdaddr_type,
NULL, rssi, 0, 1, ev->data, NULL, rssi, 0, 1, ev->data, ev->length);
ev->length);
ptr += sizeof(*ev) + ev->length + 1; ptr += sizeof(*ev) + ev->length + 1;
} }

View File

@ -1546,7 +1546,9 @@ static void l2cap_send_srejtail(struct l2cap_chan *chan)
l2cap_send_sframe(chan, control); 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 l2cap_conn *conn = chan->conn;
struct sk_buff **frag; 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); count = min_t(unsigned int, conn->mtu, len);
*frag = chan->ops->alloc_skb(chan, count, *frag = chan->ops->alloc_skb(chan, count,
msg->msg_flags & MSG_DONTWAIT, &err); msg->msg_flags & MSG_DONTWAIT,
&err);
if (!*frag) if (!*frag)
return err; return err;
@ -1596,7 +1599,7 @@ static struct sk_buff *l2cap_create_connless_pdu(struct l2cap_chan *chan,
count = min_t(unsigned int, (conn->mtu - hlen), len); count = min_t(unsigned int, (conn->mtu - hlen), len);
skb = chan->ops->alloc_skb(chan, count + hlen, skb = chan->ops->alloc_skb(chan, count + hlen,
msg->msg_flags & MSG_DONTWAIT, &err); msg->msg_flags & MSG_DONTWAIT, &err);
if (!skb) if (!skb)
return ERR_PTR(err); return ERR_PTR(err);
@ -1631,7 +1634,7 @@ static struct sk_buff *l2cap_create_basic_pdu(struct l2cap_chan *chan,
count = min_t(unsigned int, (conn->mtu - hlen), len); count = min_t(unsigned int, (conn->mtu - hlen), len);
skb = chan->ops->alloc_skb(chan, count + hlen, skb = chan->ops->alloc_skb(chan, count + hlen,
msg->msg_flags & MSG_DONTWAIT, &err); msg->msg_flags & MSG_DONTWAIT, &err);
if (!skb) if (!skb)
return ERR_PTR(err); return ERR_PTR(err);

View File

@ -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, 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; struct sock *sk = chan->sk;

File diff suppressed because it is too large Load Diff

View File

@ -264,7 +264,7 @@ static void smp_failure(struct l2cap_conn *conn, u8 reason, u8 send)
clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->hcon->flags); clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->hcon->flags);
mgmt_auth_failed(conn->hcon->hdev, conn->dst, hcon->type, mgmt_auth_failed(conn->hcon->hdev, conn->dst, hcon->type,
hcon->dst_type, reason); hcon->dst_type, reason);
if (test_and_clear_bit(HCI_CONN_LE_SMP_PEND, &conn->hcon->flags)) { if (test_and_clear_bit(HCI_CONN_LE_SMP_PEND, &conn->hcon->flags)) {
cancel_delayed_work_sync(&conn->security_timer); cancel_delayed_work_sync(&conn->security_timer);
@ -384,12 +384,11 @@ static void confirm_work(struct work_struct *work)
if (conn->hcon->out) if (conn->hcon->out)
ret = smp_c1(tfm, smp->tk, smp->prnd, smp->preq, smp->prsp, 0, ret = smp_c1(tfm, smp->tk, smp->prnd, smp->preq, smp->prsp, 0,
conn->src, conn->hcon->dst_type, conn->dst, conn->src, conn->hcon->dst_type, conn->dst, res);
res);
else else
ret = smp_c1(tfm, smp->tk, smp->prnd, smp->preq, smp->prsp, ret = smp_c1(tfm, smp->tk, smp->prnd, smp->preq, smp->prsp,
conn->hcon->dst_type, conn->dst, 0, conn->src, conn->hcon->dst_type, conn->dst, 0, conn->src,
res); res);
if (ret) { if (ret) {
reason = SMP_UNSPECIFIED; reason = SMP_UNSPECIFIED;
goto error; goto error;
@ -424,12 +423,10 @@ static void random_work(struct work_struct *work)
if (hcon->out) if (hcon->out)
ret = smp_c1(tfm, smp->tk, smp->rrnd, smp->preq, smp->prsp, 0, ret = smp_c1(tfm, smp->tk, smp->rrnd, smp->preq, smp->prsp, 0,
conn->src, hcon->dst_type, conn->dst, conn->src, hcon->dst_type, conn->dst, res);
res);
else else
ret = smp_c1(tfm, smp->tk, smp->rrnd, smp->preq, smp->prsp, ret = smp_c1(tfm, smp->tk, smp->rrnd, smp->preq, smp->prsp,
hcon->dst_type, conn->dst, 0, conn->src, hcon->dst_type, conn->dst, 0, conn->src, res);
res);
if (ret) { if (ret) {
reason = SMP_UNSPECIFIED; reason = SMP_UNSPECIFIED;
goto error; goto error;
@ -454,7 +451,7 @@ static void random_work(struct work_struct *work)
swap128(key, stk); swap128(key, stk);
memset(stk + smp->enc_key_size, 0, memset(stk + smp->enc_key_size, 0,
SMP_MAX_ENC_KEY_SIZE - smp->enc_key_size); SMP_MAX_ENC_KEY_SIZE - smp->enc_key_size);
if (test_and_set_bit(HCI_CONN_ENCRYPT_PEND, &hcon->flags)) { if (test_and_set_bit(HCI_CONN_ENCRYPT_PEND, &hcon->flags)) {
reason = SMP_UNSPECIFIED; reason = SMP_UNSPECIFIED;
@ -480,8 +477,8 @@ static void random_work(struct work_struct *work)
SMP_MAX_ENC_KEY_SIZE - smp->enc_key_size); SMP_MAX_ENC_KEY_SIZE - smp->enc_key_size);
hci_add_ltk(hcon->hdev, conn->dst, hcon->dst_type, hci_add_ltk(hcon->hdev, conn->dst, hcon->dst_type,
HCI_SMP_STK_SLAVE, 0, 0, stk, HCI_SMP_STK_SLAVE, 0, 0, stk, smp->enc_key_size,
smp->enc_key_size, ediv, rand); ediv, rand);
} }
return; return;
@ -829,8 +826,8 @@ static int smp_cmd_master_ident(struct l2cap_conn *conn, struct sk_buff *skb)
hci_dev_lock(hdev); hci_dev_lock(hdev);
authenticated = (conn->hcon->sec_level == BT_SECURITY_HIGH); authenticated = (conn->hcon->sec_level == BT_SECURITY_HIGH);
hci_add_ltk(conn->hcon->hdev, conn->dst, hcon->dst_type, hci_add_ltk(conn->hcon->hdev, conn->dst, hcon->dst_type,
HCI_SMP_LTK, 1, authenticated, smp->tk, HCI_SMP_LTK, 1, authenticated, smp->tk, smp->enc_key_size,
smp->enc_key_size, rp->ediv, rp->rand); rp->ediv, rp->rand);
smp_distribute_keys(conn, 1); smp_distribute_keys(conn, 1);
hci_dev_unlock(hdev); hci_dev_unlock(hdev);
@ -954,9 +951,8 @@ int smp_distribute_keys(struct l2cap_conn *conn, __u8 force)
authenticated = hcon->sec_level == BT_SECURITY_HIGH; authenticated = hcon->sec_level == BT_SECURITY_HIGH;
hci_add_ltk(conn->hcon->hdev, conn->dst, hcon->dst_type, hci_add_ltk(conn->hcon->hdev, conn->dst, hcon->dst_type,
HCI_SMP_LTK_SLAVE, 1, authenticated, HCI_SMP_LTK_SLAVE, 1, authenticated,
enc.ltk, smp->enc_key_size, enc.ltk, smp->enc_key_size, ediv, ident.rand);
ediv, ident.rand);
ident.ediv = cpu_to_le16(ediv); ident.ediv = cpu_to_le16(ediv);