diff options
| author | Thomas Gleixner <tglx@linutronix.de> | 2010-05-10 11:59:37 +0200 | 
|---|---|---|
| committer | Thomas Gleixner <tglx@linutronix.de> | 2010-05-10 14:20:42 +0200 | 
| commit | dbb6be6d5e974c42bbecd183effaa0df69e1dd8b (patch) | |
| tree | 5735cb47e70853d057a9881dd0ce44b83e88fa63 /net/bluetooth/sco.c | |
| parent | 6a867a395558a7f882d041783e4cdea6744ca2bf (diff) | |
| parent | b57f95a38233a2e73b679bea4a5453a1cc2a1cc9 (diff) | |
| download | olio-linux-3.10-dbb6be6d5e974c42bbecd183effaa0df69e1dd8b.tar.xz olio-linux-3.10-dbb6be6d5e974c42bbecd183effaa0df69e1dd8b.zip  | |
Merge branch 'linus' into timers/core
Reason: Further posix_cpu_timer patches depend on mainline changes
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'net/bluetooth/sco.c')
| -rw-r--r-- | net/bluetooth/sco.c | 41 | 
1 files changed, 28 insertions, 13 deletions
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index f93b939539b..ca6b2ad1c3f 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c @@ -38,6 +38,8 @@  #include <linux/socket.h>  #include <linux/skbuff.h>  #include <linux/device.h> +#include <linux/debugfs.h> +#include <linux/seq_file.h>  #include <linux/list.h>  #include <net/sock.h> @@ -497,7 +499,8 @@ static int sco_sock_connect(struct socket *sock, struct sockaddr *addr, int alen  	BT_DBG("sk %p", sk); -	if (addr->sa_family != AF_BLUETOOTH || alen < sizeof(struct sockaddr_sco)) +	if (alen < sizeof(struct sockaddr_sco) || +	    addr->sa_family != AF_BLUETOOTH)  		return -EINVAL;  	if (sk->sk_state != BT_OPEN && sk->sk_state != BT_BOUND) @@ -953,28 +956,36 @@ drop:  	return 0;  } -static ssize_t sco_sysfs_show(struct class *dev, -				struct class_attribute *attr, -				char *buf) +static int sco_debugfs_show(struct seq_file *f, void *p)  {  	struct sock *sk;  	struct hlist_node *node; -	char *str = buf;  	read_lock_bh(&sco_sk_list.lock);  	sk_for_each(sk, node, &sco_sk_list.head) { -		str += sprintf(str, "%s %s %d\n", -				batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), -				sk->sk_state); +		seq_printf(f, "%s %s %d\n", batostr(&bt_sk(sk)->src), +				batostr(&bt_sk(sk)->dst), sk->sk_state);  	}  	read_unlock_bh(&sco_sk_list.lock); -	return (str - buf); +	return 0;  } -static CLASS_ATTR(sco, S_IRUGO, sco_sysfs_show, NULL); +static int sco_debugfs_open(struct inode *inode, struct file *file) +{ +	return single_open(file, sco_debugfs_show, inode->i_private); +} + +static const struct file_operations sco_debugfs_fops = { +	.open		= sco_debugfs_open, +	.read		= seq_read, +	.llseek		= seq_lseek, +	.release	= single_release, +}; + +static struct dentry *sco_debugfs;  static const struct proto_ops sco_sock_ops = {  	.family		= PF_BLUETOOTH, @@ -1032,8 +1043,12 @@ static int __init sco_init(void)  		goto error;  	} -	if (class_create_file(bt_class, &class_attr_sco) < 0) -		BT_ERR("Failed to create SCO info file"); +	if (bt_debugfs) { +		sco_debugfs = debugfs_create_file("sco", 0444, +					bt_debugfs, NULL, &sco_debugfs_fops); +		if (!sco_debugfs) +			BT_ERR("Failed to create SCO debug file"); +	}  	BT_INFO("SCO (Voice Link) ver %s", VERSION);  	BT_INFO("SCO socket layer initialized"); @@ -1047,7 +1062,7 @@ error:  static void __exit sco_exit(void)  { -	class_remove_file(bt_class, &class_attr_sco); +	debugfs_remove(sco_debugfs);  	if (bt_sock_unregister(BTPROTO_SCO) < 0)  		BT_ERR("SCO socket unregistration failed");  |