diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2013-10-18 12:04:51 -0700 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2013-10-19 16:24:27 +0300 |
commit | babdbb3c130bf8b6e58811a9cf4764eb68004d25 (patch) | |
tree | bc57d27da91e723e931f68fac9c620e787e3d7d2 /net/bluetooth/hci_core.c | |
parent | 0d5551f5e40c30ed8a6c1fc6bc6ea6aa96438324 (diff) | |
download | linux-babdbb3c130bf8b6e58811a9cf4764eb68004d25.tar.bz2 |
Bluetooth: Move export of class of device information into hci_core.c
The class of device debugfs information should be directly exported
from hci_core.c and so move them over there.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth/hci_core.c')
-rw-r--r-- | net/bluetooth/hci_core.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 1d3c8920f497..3ef5fdde8437 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -187,6 +187,30 @@ static const struct file_operations inquiry_cache_fops = { .release = single_release, }; +static int dev_class_show(struct seq_file *f, void *ptr) +{ + struct hci_dev *hdev = f->private; + + hci_dev_lock(hdev); + seq_printf(f, "0x%.2x%.2x%.2x\n", hdev->dev_class[2], + hdev->dev_class[1], hdev->dev_class[0]); + hci_dev_unlock(hdev); + + return 0; +} + +static int dev_class_open(struct inode *inode, struct file *file) +{ + return single_open(file, dev_class_show, inode->i_private); +} + +static const struct file_operations dev_class_fops = { + .open = dev_class_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + static int voice_setting_get(void *data, u64 *val) { struct hci_dev *hdev = data; @@ -1043,6 +1067,8 @@ static int __hci_init(struct hci_dev *hdev) if (lmp_bredr_capable(hdev)) { debugfs_create_file("inquiry_cache", 0444, hdev->debugfs, hdev, &inquiry_cache_fops); + debugfs_create_file("dev_class", 0444, hdev->debugfs, + hdev, &dev_class_fops); debugfs_create_file("voice_setting", 0444, hdev->debugfs, hdev, &voice_setting_fops); } |