diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2015-11-25 09:15:41 -0500 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2015-12-09 18:51:48 -0500 |
commit | 00cf5040b39638588cd10ae4ffcc76a1be6ecf2c (patch) | |
tree | db7e41e180723991cd833c3407ef54356f945b8f | |
parent | c366f555b8df67633b849a5088bb897d6c63aaa5 (diff) |
Bluetooth: HCI name update to hci_request.c
We'll soon need this both from hci_request.c and mgmt.c so move it as
a request helper function to hci_request.c.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
-rw-r--r-- | net/bluetooth/hci_request.c | 10 | ||||
-rw-r--r-- | net/bluetooth/hci_request.h | 2 | ||||
-rw-r--r-- | net/bluetooth/mgmt.c | 14 |
3 files changed, 14 insertions, 12 deletions
diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c index fe14fd121d36..3150461c52a4 100644 --- a/net/bluetooth/hci_request.c +++ b/net/bluetooth/hci_request.c | |||
@@ -420,6 +420,16 @@ static void __hci_update_background_scan(struct hci_request *req) | |||
420 | } | 420 | } |
421 | } | 421 | } |
422 | 422 | ||
423 | void __hci_req_update_name(struct hci_request *req) | ||
424 | { | ||
425 | struct hci_dev *hdev = req->hdev; | ||
426 | struct hci_cp_write_local_name cp; | ||
427 | |||
428 | memcpy(cp.name, hdev->dev_name, sizeof(cp.name)); | ||
429 | |||
430 | hci_req_add(req, HCI_OP_WRITE_LOCAL_NAME, sizeof(cp), &cp); | ||
431 | } | ||
432 | |||
423 | void hci_req_add_le_scan_disable(struct hci_request *req) | 433 | void hci_req_add_le_scan_disable(struct hci_request *req) |
424 | { | 434 | { |
425 | struct hci_cp_le_set_scan_enable cp; | 435 | struct hci_cp_le_set_scan_enable cp; |
diff --git a/net/bluetooth/hci_request.h b/net/bluetooth/hci_request.h index 41920348d68b..4e65a9c7906a 100644 --- a/net/bluetooth/hci_request.h +++ b/net/bluetooth/hci_request.h | |||
@@ -55,6 +55,8 @@ void hci_req_sync_cancel(struct hci_dev *hdev, int err); | |||
55 | struct sk_buff *hci_prepare_cmd(struct hci_dev *hdev, u16 opcode, u32 plen, | 55 | struct sk_buff *hci_prepare_cmd(struct hci_dev *hdev, u16 opcode, u32 plen, |
56 | const void *param); | 56 | const void *param); |
57 | 57 | ||
58 | void __hci_req_update_name(struct hci_request *req); | ||
59 | |||
58 | void hci_req_add_le_scan_disable(struct hci_request *req); | 60 | void hci_req_add_le_scan_disable(struct hci_request *req); |
59 | void hci_req_add_le_passive_scan(struct hci_request *req); | 61 | void hci_req_add_le_passive_scan(struct hci_request *req); |
60 | 62 | ||
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 29b3bb70ae9f..001a29a320e6 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -3153,16 +3153,6 @@ static int user_passkey_neg_reply(struct sock *sk, struct hci_dev *hdev, | |||
3153 | HCI_OP_USER_PASSKEY_NEG_REPLY, 0); | 3153 | HCI_OP_USER_PASSKEY_NEG_REPLY, 0); |
3154 | } | 3154 | } |
3155 | 3155 | ||
3156 | static void update_name(struct hci_request *req) | ||
3157 | { | ||
3158 | struct hci_dev *hdev = req->hdev; | ||
3159 | struct hci_cp_write_local_name cp; | ||
3160 | |||
3161 | memcpy(cp.name, hdev->dev_name, sizeof(cp.name)); | ||
3162 | |||
3163 | hci_req_add(req, HCI_OP_WRITE_LOCAL_NAME, sizeof(cp), &cp); | ||
3164 | } | ||
3165 | |||
3166 | static void set_name_complete(struct hci_dev *hdev, u8 status, u16 opcode) | 3156 | static void set_name_complete(struct hci_dev *hdev, u8 status, u16 opcode) |
3167 | { | 3157 | { |
3168 | struct mgmt_cp_set_local_name *cp; | 3158 | struct mgmt_cp_set_local_name *cp; |
@@ -3241,7 +3231,7 @@ static int set_local_name(struct sock *sk, struct hci_dev *hdev, void *data, | |||
3241 | hci_req_init(&req, hdev); | 3231 | hci_req_init(&req, hdev); |
3242 | 3232 | ||
3243 | if (lmp_bredr_capable(hdev)) { | 3233 | if (lmp_bredr_capable(hdev)) { |
3244 | update_name(&req); | 3234 | __hci_req_update_name(&req); |
3245 | update_eir(&req); | 3235 | update_eir(&req); |
3246 | } | 3236 | } |
3247 | 3237 | ||
@@ -6768,7 +6758,7 @@ static int powered_update_hci(struct hci_dev *hdev) | |||
6768 | write_fast_connectable(&req, false); | 6758 | write_fast_connectable(&req, false); |
6769 | __hci_req_update_scan(&req); | 6759 | __hci_req_update_scan(&req); |
6770 | __hci_req_update_class(&req); | 6760 | __hci_req_update_class(&req); |
6771 | update_name(&req); | 6761 | __hci_req_update_name(&req); |
6772 | update_eir(&req); | 6762 | update_eir(&req); |
6773 | } | 6763 | } |
6774 | 6764 | ||