Bluetooth: Move blacklist debugfs entry creation into hci_core.c
The blacklist debugfs should only be created together with the other entries after the setup procedure has been finished. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
committed by
Johan Hedberg
parent
b9ee0a783a
commit
70afe0b856
@@ -57,6 +57,31 @@ static void hci_notify(struct hci_dev *hdev, int event)
|
|||||||
|
|
||||||
/* ---- HCI debugfs entries ---- */
|
/* ---- HCI debugfs entries ---- */
|
||||||
|
|
||||||
|
static int blacklist_show(struct seq_file *f, void *p)
|
||||||
|
{
|
||||||
|
struct hci_dev *hdev = f->private;
|
||||||
|
struct bdaddr_list *b;
|
||||||
|
|
||||||
|
hci_dev_lock(hdev);
|
||||||
|
list_for_each_entry(b, &hdev->blacklist, list)
|
||||||
|
seq_printf(f, "%pMR\n", &b->bdaddr);
|
||||||
|
hci_dev_unlock(hdev);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int blacklist_open(struct inode *inode, struct file *file)
|
||||||
|
{
|
||||||
|
return single_open(file, blacklist_show, inode->i_private);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct file_operations blacklist_fops = {
|
||||||
|
.open = blacklist_open,
|
||||||
|
.read = seq_read,
|
||||||
|
.llseek = seq_lseek,
|
||||||
|
.release = single_release,
|
||||||
|
};
|
||||||
|
|
||||||
static int inquiry_cache_show(struct seq_file *f, void *p)
|
static int inquiry_cache_show(struct seq_file *f, void *p)
|
||||||
{
|
{
|
||||||
struct hci_dev *hdev = f->private;
|
struct hci_dev *hdev = f->private;
|
||||||
@@ -844,6 +869,9 @@ static int __hci_init(struct hci_dev *hdev)
|
|||||||
if (!test_bit(HCI_SETUP, &hdev->dev_flags))
|
if (!test_bit(HCI_SETUP, &hdev->dev_flags))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
debugfs_create_file("blacklist", 0444, hdev->debugfs, hdev,
|
||||||
|
&blacklist_fops);
|
||||||
|
|
||||||
if (lmp_bredr_capable(hdev)) {
|
if (lmp_bredr_capable(hdev)) {
|
||||||
debugfs_create_file("inquiry_cache", 0444, hdev->debugfs,
|
debugfs_create_file("inquiry_cache", 0444, hdev->debugfs,
|
||||||
hdev, &inquiry_cache_fops);
|
hdev, &inquiry_cache_fops);
|
||||||
|
@@ -396,33 +396,6 @@ static struct device_type bt_host = {
|
|||||||
.release = bt_host_release,
|
.release = bt_host_release,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int blacklist_show(struct seq_file *f, void *p)
|
|
||||||
{
|
|
||||||
struct hci_dev *hdev = f->private;
|
|
||||||
struct bdaddr_list *b;
|
|
||||||
|
|
||||||
hci_dev_lock(hdev);
|
|
||||||
|
|
||||||
list_for_each_entry(b, &hdev->blacklist, list)
|
|
||||||
seq_printf(f, "%pMR\n", &b->bdaddr);
|
|
||||||
|
|
||||||
hci_dev_unlock(hdev);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int blacklist_open(struct inode *inode, struct file *file)
|
|
||||||
{
|
|
||||||
return single_open(file, blacklist_show, inode->i_private);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct file_operations blacklist_fops = {
|
|
||||||
.open = blacklist_open,
|
|
||||||
.read = seq_read,
|
|
||||||
.llseek = seq_lseek,
|
|
||||||
.release = single_release,
|
|
||||||
};
|
|
||||||
|
|
||||||
static void print_bt_uuid(struct seq_file *f, u8 *uuid)
|
static void print_bt_uuid(struct seq_file *f, u8 *uuid)
|
||||||
{
|
{
|
||||||
u32 data0, data5;
|
u32 data0, data5;
|
||||||
@@ -497,9 +470,6 @@ int hci_add_sysfs(struct hci_dev *hdev)
|
|||||||
if (!hdev->debugfs)
|
if (!hdev->debugfs)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
debugfs_create_file("blacklist", 0444, hdev->debugfs,
|
|
||||||
hdev, &blacklist_fops);
|
|
||||||
|
|
||||||
debugfs_create_file("uuids", 0444, hdev->debugfs, hdev, &uuids_fops);
|
debugfs_create_file("uuids", 0444, hdev->debugfs, hdev, &uuids_fops);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user