Skip to content

Commit 40ce72b

Browse files
holtmannJohan Hedberg
authored andcommitted
Bluetooth: Move common debugfs file creation into hci_debugfs.c
This patch moves the creation of the debugs files common for all controllers into hci_debugfs.c file. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
1 parent 60c5f5f commit 40ce72b

File tree

2 files changed

+200
-201
lines changed

2 files changed

+200
-201
lines changed

net/bluetooth/hci_core.c

Lines changed: 0 additions & 201 deletions
Original file line numberDiff line numberDiff line change
@@ -139,104 +139,6 @@ static const struct file_operations dut_mode_fops = {
139139
.llseek = default_llseek,
140140
};
141141

142-
static int features_show(struct seq_file *f, void *ptr)
143-
{
144-
struct hci_dev *hdev = f->private;
145-
u8 p;
146-
147-
hci_dev_lock(hdev);
148-
for (p = 0; p < HCI_MAX_PAGES && p <= hdev->max_page; p++) {
149-
seq_printf(f, "%2u: 0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x "
150-
"0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x\n", p,
151-
hdev->features[p][0], hdev->features[p][1],
152-
hdev->features[p][2], hdev->features[p][3],
153-
hdev->features[p][4], hdev->features[p][5],
154-
hdev->features[p][6], hdev->features[p][7]);
155-
}
156-
if (lmp_le_capable(hdev))
157-
seq_printf(f, "LE: 0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x "
158-
"0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x\n",
159-
hdev->le_features[0], hdev->le_features[1],
160-
hdev->le_features[2], hdev->le_features[3],
161-
hdev->le_features[4], hdev->le_features[5],
162-
hdev->le_features[6], hdev->le_features[7]);
163-
hci_dev_unlock(hdev);
164-
165-
return 0;
166-
}
167-
168-
static int features_open(struct inode *inode, struct file *file)
169-
{
170-
return single_open(file, features_show, inode->i_private);
171-
}
172-
173-
static const struct file_operations features_fops = {
174-
.open = features_open,
175-
.read = seq_read,
176-
.llseek = seq_lseek,
177-
.release = single_release,
178-
};
179-
180-
static int blacklist_show(struct seq_file *f, void *p)
181-
{
182-
struct hci_dev *hdev = f->private;
183-
struct bdaddr_list *b;
184-
185-
hci_dev_lock(hdev);
186-
list_for_each_entry(b, &hdev->blacklist, list)
187-
seq_printf(f, "%pMR (type %u)\n", &b->bdaddr, b->bdaddr_type);
188-
hci_dev_unlock(hdev);
189-
190-
return 0;
191-
}
192-
193-
static int blacklist_open(struct inode *inode, struct file *file)
194-
{
195-
return single_open(file, blacklist_show, inode->i_private);
196-
}
197-
198-
static const struct file_operations blacklist_fops = {
199-
.open = blacklist_open,
200-
.read = seq_read,
201-
.llseek = seq_lseek,
202-
.release = single_release,
203-
};
204-
205-
static int uuids_show(struct seq_file *f, void *p)
206-
{
207-
struct hci_dev *hdev = f->private;
208-
struct bt_uuid *uuid;
209-
210-
hci_dev_lock(hdev);
211-
list_for_each_entry(uuid, &hdev->uuids, list) {
212-
u8 i, val[16];
213-
214-
/* The Bluetooth UUID values are stored in big endian,
215-
* but with reversed byte order. So convert them into
216-
* the right order for the %pUb modifier.
217-
*/
218-
for (i = 0; i < 16; i++)
219-
val[i] = uuid->uuid[15 - i];
220-
221-
seq_printf(f, "%pUb\n", val);
222-
}
223-
hci_dev_unlock(hdev);
224-
225-
return 0;
226-
}
227-
228-
static int uuids_open(struct inode *inode, struct file *file)
229-
{
230-
return single_open(file, uuids_show, inode->i_private);
231-
}
232-
233-
static const struct file_operations uuids_fops = {
234-
.open = uuids_open,
235-
.read = seq_read,
236-
.llseek = seq_lseek,
237-
.release = single_release,
238-
};
239-
240142
static int inquiry_cache_show(struct seq_file *f, void *p)
241143
{
242144
struct hci_dev *hdev = f->private;
@@ -584,62 +486,6 @@ static int sniff_max_interval_get(void *data, u64 *val)
584486
DEFINE_SIMPLE_ATTRIBUTE(sniff_max_interval_fops, sniff_max_interval_get,
585487
sniff_max_interval_set, "%llu\n");
586488

587-
static int conn_info_min_age_set(void *data, u64 val)
588-
{
589-
struct hci_dev *hdev = data;
590-
591-
if (val == 0 || val > hdev->conn_info_max_age)
592-
return -EINVAL;
593-
594-
hci_dev_lock(hdev);
595-
hdev->conn_info_min_age = val;
596-
hci_dev_unlock(hdev);
597-
598-
return 0;
599-
}
600-
601-
static int conn_info_min_age_get(void *data, u64 *val)
602-
{
603-
struct hci_dev *hdev = data;
604-
605-
hci_dev_lock(hdev);
606-
*val = hdev->conn_info_min_age;
607-
hci_dev_unlock(hdev);
608-
609-
return 0;
610-
}
611-
612-
DEFINE_SIMPLE_ATTRIBUTE(conn_info_min_age_fops, conn_info_min_age_get,
613-
conn_info_min_age_set, "%llu\n");
614-
615-
static int conn_info_max_age_set(void *data, u64 val)
616-
{
617-
struct hci_dev *hdev = data;
618-
619-
if (val == 0 || val < hdev->conn_info_min_age)
620-
return -EINVAL;
621-
622-
hci_dev_lock(hdev);
623-
hdev->conn_info_max_age = val;
624-
hci_dev_unlock(hdev);
625-
626-
return 0;
627-
}
628-
629-
static int conn_info_max_age_get(void *data, u64 *val)
630-
{
631-
struct hci_dev *hdev = data;
632-
633-
hci_dev_lock(hdev);
634-
*val = hdev->conn_info_max_age;
635-
hci_dev_unlock(hdev);
636-
637-
return 0;
638-
}
639-
640-
DEFINE_SIMPLE_ATTRIBUTE(conn_info_max_age_fops, conn_info_max_age_get,
641-
conn_info_max_age_set, "%llu\n");
642-
643489
static int identity_show(struct seq_file *f, void *p)
644490
{
645491
struct hci_dev *hdev = f->private;
@@ -1041,36 +887,6 @@ static int adv_max_interval_get(void *data, u64 *val)
1041887
DEFINE_SIMPLE_ATTRIBUTE(adv_max_interval_fops, adv_max_interval_get,
1042888
adv_max_interval_set, "%llu\n");
1043889

1044-
static int device_list_show(struct seq_file *f, void *ptr)
1045-
{
1046-
struct hci_dev *hdev = f->private;
1047-
struct hci_conn_params *p;
1048-
struct bdaddr_list *b;
1049-
1050-
hci_dev_lock(hdev);
1051-
list_for_each_entry(b, &hdev->whitelist, list)
1052-
seq_printf(f, "%pMR (type %u)\n", &b->bdaddr, b->bdaddr_type);
1053-
list_for_each_entry(p, &hdev->le_conn_params, list) {
1054-
seq_printf(f, "%pMR (type %u) %u\n", &p->addr, p->addr_type,
1055-
p->auto_connect);
1056-
}
1057-
hci_dev_unlock(hdev);
1058-
1059-
return 0;
1060-
}
1061-
1062-
static int device_list_open(struct inode *inode, struct file *file)
1063-
{
1064-
return single_open(file, device_list_show, inode->i_private);
1065-
}
1066-
1067-
static const struct file_operations device_list_fops = {
1068-
.open = device_list_open,
1069-
.read = seq_read,
1070-
.llseek = seq_lseek,
1071-
.release = single_release,
1072-
};
1073-
1074890
/* ---- HCI requests ---- */
1075891

1076892
static void hci_req_sync_complete(struct hci_dev *hdev, u8 result)
@@ -1849,23 +1665,6 @@ static int __hci_init(struct hci_dev *hdev)
18491665
if (!test_bit(HCI_SETUP, &hdev->dev_flags))
18501666
return 0;
18511667

1852-
debugfs_create_file("features", 0444, hdev->debugfs, hdev,
1853-
&features_fops);
1854-
debugfs_create_u16("manufacturer", 0444, hdev->debugfs,
1855-
&hdev->manufacturer);
1856-
debugfs_create_u8("hci_version", 0444, hdev->debugfs, &hdev->hci_ver);
1857-
debugfs_create_u16("hci_revision", 0444, hdev->debugfs, &hdev->hci_rev);
1858-
debugfs_create_file("device_list", 0444, hdev->debugfs, hdev,
1859-
&device_list_fops);
1860-
debugfs_create_file("blacklist", 0444, hdev->debugfs, hdev,
1861-
&blacklist_fops);
1862-
debugfs_create_file("uuids", 0444, hdev->debugfs, hdev, &uuids_fops);
1863-
1864-
debugfs_create_file("conn_info_min_age", 0644, hdev->debugfs, hdev,
1865-
&conn_info_min_age_fops);
1866-
debugfs_create_file("conn_info_max_age", 0644, hdev->debugfs, hdev,
1867-
&conn_info_max_age_fops);
1868-
18691668
hci_debugfs_create_common(hdev);
18701669

18711670
if (lmp_bredr_capable(hdev)) {

0 commit comments

Comments
 (0)