diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2013-10-18 15:04:46 -0400 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2013-10-19 09:22:30 -0400 |
commit | dfb826a8b07f23ca31156979a7effec7b1f1daa8 (patch) | |
tree | 5cd3863ce6c402fd6d82432023d1968331a6aefa | |
parent | cc8dba2bc302442f96d15c027fceb7b103b20ae3 (diff) |
Bluetooth: Move HCI device features into hci_core.c
Move the handling of HCI device features debugfs into hci_core.c and
also extend it with handling of multiple feature pages.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
-rw-r--r-- | net/bluetooth/hci_core.c | 34 | ||||
-rw-r--r-- | net/bluetooth/hci_sysfs.c | 14 |
2 files changed, 33 insertions, 15 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index e8058c3c9576..47fcb4983dbb 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -58,6 +58,37 @@ static void hci_notify(struct hci_dev *hdev, int event) | |||
58 | 58 | ||
59 | /* ---- HCI debugfs entries ---- */ | 59 | /* ---- HCI debugfs entries ---- */ |
60 | 60 | ||
61 | static int features_show(struct seq_file *f, void *ptr) | ||
62 | { | ||
63 | struct hci_dev *hdev = f->private; | ||
64 | u8 p; | ||
65 | |||
66 | hci_dev_lock(hdev); | ||
67 | for (p = 0; p < HCI_MAX_PAGES && p <= hdev->max_page; p++) { | ||
68 | seq_printf(f, "Page %u: 0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x " | ||
69 | "0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x\n", p, | ||
70 | hdev->features[p][0], hdev->features[p][1], | ||
71 | hdev->features[p][2], hdev->features[p][3], | ||
72 | hdev->features[p][4], hdev->features[p][5], | ||
73 | hdev->features[p][6], hdev->features[p][7]); | ||
74 | } | ||
75 | hci_dev_unlock(hdev); | ||
76 | |||
77 | return 0; | ||
78 | } | ||
79 | |||
80 | static int features_open(struct inode *inode, struct file *file) | ||
81 | { | ||
82 | return single_open(file, features_show, inode->i_private); | ||
83 | } | ||
84 | |||
85 | static const struct file_operations features_fops = { | ||
86 | .open = features_open, | ||
87 | .read = seq_read, | ||
88 | .llseek = seq_lseek, | ||
89 | .release = single_release, | ||
90 | }; | ||
91 | |||
61 | static int blacklist_show(struct seq_file *f, void *p) | 92 | static int blacklist_show(struct seq_file *f, void *p) |
62 | { | 93 | { |
63 | struct hci_dev *hdev = f->private; | 94 | struct hci_dev *hdev = f->private; |
@@ -991,9 +1022,10 @@ static int __hci_init(struct hci_dev *hdev) | |||
991 | if (!test_bit(HCI_SETUP, &hdev->dev_flags)) | 1022 | if (!test_bit(HCI_SETUP, &hdev->dev_flags)) |
992 | return 0; | 1023 | return 0; |
993 | 1024 | ||
1025 | debugfs_create_file("features", 0444, hdev->debugfs, hdev, | ||
1026 | &features_fops); | ||
994 | debugfs_create_file("blacklist", 0444, hdev->debugfs, hdev, | 1027 | debugfs_create_file("blacklist", 0444, hdev->debugfs, hdev, |
995 | &blacklist_fops); | 1028 | &blacklist_fops); |
996 | |||
997 | debugfs_create_file("uuids", 0444, hdev->debugfs, hdev, &uuids_fops); | 1029 | debugfs_create_file("uuids", 0444, hdev->debugfs, hdev, &uuids_fops); |
998 | 1030 | ||
999 | if (lmp_bredr_capable(hdev)) { | 1031 | if (lmp_bredr_capable(hdev)) { |
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index 4fac57c5ddb7..90142ae49e37 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c | |||
@@ -222,18 +222,6 @@ static ssize_t show_address(struct device *dev, | |||
222 | return sprintf(buf, "%pMR\n", &hdev->bdaddr); | 222 | return sprintf(buf, "%pMR\n", &hdev->bdaddr); |
223 | } | 223 | } |
224 | 224 | ||
225 | static ssize_t show_features(struct device *dev, | ||
226 | struct device_attribute *attr, char *buf) | ||
227 | { | ||
228 | struct hci_dev *hdev = to_hci_dev(dev); | ||
229 | |||
230 | return sprintf(buf, "0x%02x%02x%02x%02x%02x%02x%02x%02x\n", | ||
231 | hdev->features[0][0], hdev->features[0][1], | ||
232 | hdev->features[0][2], hdev->features[0][3], | ||
233 | hdev->features[0][4], hdev->features[0][5], | ||
234 | hdev->features[0][6], hdev->features[0][7]); | ||
235 | } | ||
236 | |||
237 | static ssize_t show_manufacturer(struct device *dev, | 225 | static ssize_t show_manufacturer(struct device *dev, |
238 | struct device_attribute *attr, char *buf) | 226 | struct device_attribute *attr, char *buf) |
239 | { | 227 | { |
@@ -260,7 +248,6 @@ static DEVICE_ATTR(type, S_IRUGO, show_type, NULL); | |||
260 | static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); | 248 | static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); |
261 | static DEVICE_ATTR(class, S_IRUGO, show_class, NULL); | 249 | static DEVICE_ATTR(class, S_IRUGO, show_class, NULL); |
262 | static DEVICE_ATTR(address, S_IRUGO, show_address, NULL); | 250 | static DEVICE_ATTR(address, S_IRUGO, show_address, NULL); |
263 | static DEVICE_ATTR(features, S_IRUGO, show_features, NULL); | ||
264 | static DEVICE_ATTR(manufacturer, S_IRUGO, show_manufacturer, NULL); | 251 | static DEVICE_ATTR(manufacturer, S_IRUGO, show_manufacturer, NULL); |
265 | static DEVICE_ATTR(hci_version, S_IRUGO, show_hci_version, NULL); | 252 | static DEVICE_ATTR(hci_version, S_IRUGO, show_hci_version, NULL); |
266 | static DEVICE_ATTR(hci_revision, S_IRUGO, show_hci_revision, NULL); | 253 | static DEVICE_ATTR(hci_revision, S_IRUGO, show_hci_revision, NULL); |
@@ -271,7 +258,6 @@ static struct attribute *bt_host_attrs[] = { | |||
271 | &dev_attr_name.attr, | 258 | &dev_attr_name.attr, |
272 | &dev_attr_class.attr, | 259 | &dev_attr_class.attr, |
273 | &dev_attr_address.attr, | 260 | &dev_attr_address.attr, |
274 | &dev_attr_features.attr, | ||
275 | &dev_attr_manufacturer.attr, | 261 | &dev_attr_manufacturer.attr, |
276 | &dev_attr_hci_version.attr, | 262 | &dev_attr_hci_version.attr, |
277 | &dev_attr_hci_revision.attr, | 263 | &dev_attr_hci_revision.attr, |