diff options
-rw-r--r-- | net/bluetooth/hci_core.c | 29 | ||||
-rw-r--r-- | net/bluetooth/hci_sysfs.c | 31 |
2 files changed, 29 insertions, 31 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 73c8def0c327..bb95dddb5e50 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -93,6 +93,31 @@ static const struct file_operations inquiry_cache_fops = { | |||
93 | .release = single_release, | 93 | .release = single_release, |
94 | }; | 94 | }; |
95 | 95 | ||
96 | static int auto_accept_delay_set(void *data, u64 val) | ||
97 | { | ||
98 | struct hci_dev *hdev = data; | ||
99 | |||
100 | hci_dev_lock(hdev); | ||
101 | hdev->auto_accept_delay = val; | ||
102 | hci_dev_unlock(hdev); | ||
103 | |||
104 | return 0; | ||
105 | } | ||
106 | |||
107 | static int auto_accept_delay_get(void *data, u64 *val) | ||
108 | { | ||
109 | struct hci_dev *hdev = data; | ||
110 | |||
111 | hci_dev_lock(hdev); | ||
112 | *val = hdev->auto_accept_delay; | ||
113 | hci_dev_unlock(hdev); | ||
114 | |||
115 | return 0; | ||
116 | } | ||
117 | |||
118 | DEFINE_SIMPLE_ATTRIBUTE(auto_accept_delay_fops, auto_accept_delay_get, | ||
119 | auto_accept_delay_set, "%llu\n"); | ||
120 | |||
96 | /* ---- HCI requests ---- */ | 121 | /* ---- HCI requests ---- */ |
97 | 122 | ||
98 | static void hci_req_sync_complete(struct hci_dev *hdev, u8 result) | 123 | static void hci_req_sync_complete(struct hci_dev *hdev, u8 result) |
@@ -787,6 +812,10 @@ static int __hci_init(struct hci_dev *hdev) | |||
787 | hdev, &inquiry_cache_fops); | 812 | hdev, &inquiry_cache_fops); |
788 | } | 813 | } |
789 | 814 | ||
815 | if (lmp_ssp_capable(hdev)) | ||
816 | debugfs_create_file("auto_accept_delay", 0644, hdev->debugfs, | ||
817 | hdev, &auto_accept_delay_fops); | ||
818 | |||
790 | return 0; | 819 | return 0; |
791 | } | 820 | } |
792 | 821 | ||
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index 65ecb9e6fdb7..a14196034bab 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c | |||
@@ -466,35 +466,6 @@ static const struct file_operations uuids_fops = { | |||
466 | .release = single_release, | 466 | .release = single_release, |
467 | }; | 467 | }; |
468 | 468 | ||
469 | static int auto_accept_delay_set(void *data, u64 val) | ||
470 | { | ||
471 | struct hci_dev *hdev = data; | ||
472 | |||
473 | hci_dev_lock(hdev); | ||
474 | |||
475 | hdev->auto_accept_delay = val; | ||
476 | |||
477 | hci_dev_unlock(hdev); | ||
478 | |||
479 | return 0; | ||
480 | } | ||
481 | |||
482 | static int auto_accept_delay_get(void *data, u64 *val) | ||
483 | { | ||
484 | struct hci_dev *hdev = data; | ||
485 | |||
486 | hci_dev_lock(hdev); | ||
487 | |||
488 | *val = hdev->auto_accept_delay; | ||
489 | |||
490 | hci_dev_unlock(hdev); | ||
491 | |||
492 | return 0; | ||
493 | } | ||
494 | |||
495 | DEFINE_SIMPLE_ATTRIBUTE(auto_accept_delay_fops, auto_accept_delay_get, | ||
496 | auto_accept_delay_set, "%llu\n"); | ||
497 | |||
498 | void hci_init_sysfs(struct hci_dev *hdev) | 469 | void hci_init_sysfs(struct hci_dev *hdev) |
499 | { | 470 | { |
500 | struct device *dev = &hdev->dev; | 471 | struct device *dev = &hdev->dev; |
@@ -531,8 +502,6 @@ int hci_add_sysfs(struct hci_dev *hdev) | |||
531 | 502 | ||
532 | debugfs_create_file("uuids", 0444, hdev->debugfs, hdev, &uuids_fops); | 503 | debugfs_create_file("uuids", 0444, hdev->debugfs, hdev, &uuids_fops); |
533 | 504 | ||
534 | debugfs_create_file("auto_accept_delay", 0444, hdev->debugfs, hdev, | ||
535 | &auto_accept_delay_fops); | ||
536 | return 0; | 505 | return 0; |
537 | } | 506 | } |
538 | 507 | ||