aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_sysfs.c
diff options
context:
space:
mode:
authorJames Morris <jmorris@namei.org>2010-03-30 17:39:27 -0400
committerJames Morris <jmorris@namei.org>2010-03-30 17:39:27 -0400
commitd25d6fa1a95f465ff1ec4458ca15e30b2c8dffec (patch)
tree7362b182dedd825fc762ef7706830837e42943af /net/bluetooth/hci_sysfs.c
parent225a9be24d799aa16d543c31fb09f0c9ed1d9caa (diff)
parent2eaa9cfdf33b8d7fb7aff27792192e0019ae8fc6 (diff)
Merge branch 'master' into next
Diffstat (limited to 'net/bluetooth/hci_sysfs.c')
-rw-r--r--net/bluetooth/hci_sysfs.c44
1 files changed, 21 insertions, 23 deletions
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index 1a79a6c7e30e..05fd125f74fe 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -3,12 +3,12 @@
3#include <linux/kernel.h> 3#include <linux/kernel.h>
4#include <linux/init.h> 4#include <linux/init.h>
5#include <linux/debugfs.h> 5#include <linux/debugfs.h>
6#include <linux/seq_file.h>
6 7
7#include <net/bluetooth/bluetooth.h> 8#include <net/bluetooth/bluetooth.h>
8#include <net/bluetooth/hci_core.h> 9#include <net/bluetooth/hci_core.h>
9 10
10struct class *bt_class = NULL; 11static struct class *bt_class;
11EXPORT_SYMBOL_GPL(bt_class);
12 12
13struct dentry *bt_debugfs = NULL; 13struct dentry *bt_debugfs = NULL;
14EXPORT_SYMBOL_GPL(bt_debugfs); 14EXPORT_SYMBOL_GPL(bt_debugfs);
@@ -405,20 +405,11 @@ static struct device_type bt_host = {
405 .release = bt_host_release, 405 .release = bt_host_release,
406}; 406};
407 407
408static int inquiry_cache_open(struct inode *inode, struct file *file) 408static int inquiry_cache_show(struct seq_file *f, void *p)
409{
410 file->private_data = inode->i_private;
411 return 0;
412}
413
414static ssize_t inquiry_cache_read(struct file *file, char __user *userbuf,
415 size_t count, loff_t *ppos)
416{ 409{
417 struct hci_dev *hdev = file->private_data; 410 struct hci_dev *hdev = f->private;
418 struct inquiry_cache *cache = &hdev->inq_cache; 411 struct inquiry_cache *cache = &hdev->inq_cache;
419 struct inquiry_entry *e; 412 struct inquiry_entry *e;
420 char buf[4096];
421 int n = 0;
422 413
423 hci_dev_lock_bh(hdev); 414 hci_dev_lock_bh(hdev);
424 415
@@ -426,23 +417,30 @@ static ssize_t inquiry_cache_read(struct file *file, char __user *userbuf,
426 struct inquiry_data *data = &e->data; 417 struct inquiry_data *data = &e->data;
427 bdaddr_t bdaddr; 418 bdaddr_t bdaddr;
428 baswap(&bdaddr, &data->bdaddr); 419 baswap(&bdaddr, &data->bdaddr);
429 n += sprintf(buf + n, "%s %d %d %d 0x%.2x%.2x%.2x 0x%.4x %d %d %u\n", 420 seq_printf(f, "%s %d %d %d 0x%.2x%.2x%.2x 0x%.4x %d %d %u\n",
430 batostr(&bdaddr), 421 batostr(&bdaddr),
431 data->pscan_rep_mode, data->pscan_period_mode, 422 data->pscan_rep_mode, data->pscan_period_mode,
432 data->pscan_mode, data->dev_class[2], 423 data->pscan_mode, data->dev_class[2],
433 data->dev_class[1], data->dev_class[0], 424 data->dev_class[1], data->dev_class[0],
434 __le16_to_cpu(data->clock_offset), 425 __le16_to_cpu(data->clock_offset),
435 data->rssi, data->ssp_mode, e->timestamp); 426 data->rssi, data->ssp_mode, e->timestamp);
436 } 427 }
437 428
438 hci_dev_unlock_bh(hdev); 429 hci_dev_unlock_bh(hdev);
439 430
440 return simple_read_from_buffer(userbuf, count, ppos, buf, n); 431 return 0;
432}
433
434static int inquiry_cache_open(struct inode *inode, struct file *file)
435{
436 return single_open(file, inquiry_cache_show, inode->i_private);
441} 437}
442 438
443static const struct file_operations inquiry_cache_fops = { 439static const struct file_operations inquiry_cache_fops = {
444 .open = inquiry_cache_open, 440 .open = inquiry_cache_open,
445 .read = inquiry_cache_read, 441 .read = seq_read,
442 .llseek = seq_lseek,
443 .release = single_release,
446}; 444};
447 445
448int hci_register_sysfs(struct hci_dev *hdev) 446int hci_register_sysfs(struct hci_dev *hdev)