Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[Bluetooth]: Remove the usage of /proc completely

This patch removes all relics of the /proc usage from the Bluetooth
subsystem core and its upper layers. All the previous information are
now available via /sys/class/bluetooth through appropriate functions.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Marcel Holtmann and committed by
David S. Miller
be9d1227 1ebb9252

+69 -372
+2 -2
include/net/bluetooth/bluetooth.h
··· 57 57 #define BT_DBG(fmt, arg...) printk(KERN_INFO "%s: " fmt "\n" , __FUNCTION__ , ## arg) 58 58 #define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __FUNCTION__ , ## arg) 59 59 60 - extern struct proc_dir_entry *proc_bt; 61 - 62 60 /* Connection and socket states */ 63 61 enum { 64 62 BT_CONNECTED = 1, /* Equal to TCP_ESTABLISHED to make net code happy */ ··· 174 176 175 177 extern int bt_sysfs_init(void); 176 178 extern void bt_sysfs_cleanup(void); 179 + 180 + extern struct class bt_class; 177 181 178 182 #endif /* __BLUETOOTH_H */
-7
include/net/bluetooth/hci_core.h
··· 25 25 #ifndef __HCI_CORE_H 26 26 #define __HCI_CORE_H 27 27 28 - #include <linux/proc_fs.h> 29 28 #include <net/bluetooth/hci.h> 30 29 31 30 /* HCI upper protocols */ ··· 32 33 #define HCI_PROTO_SCO 1 33 34 34 35 #define HCI_INIT_TIMEOUT (HZ * 10) 35 - 36 - extern struct proc_dir_entry *proc_bt_hci; 37 36 38 37 /* HCI Core structures */ 39 38 ··· 122 125 void *core_data; 123 126 124 127 atomic_t promisc; 125 - 126 - #ifdef CONFIG_PROC_FS 127 - struct proc_dir_entry *proc; 128 - #endif 129 128 130 129 struct class_device class_dev; 131 130
-2
include/net/bluetooth/rfcomm.h
··· 351 351 int rfcomm_init_ttys(void); 352 352 void rfcomm_cleanup_ttys(void); 353 353 354 - extern struct proc_dir_entry *proc_bt_rfcomm; 355 - 356 354 #endif /* __RFCOMM_H */
+1 -11
net/bluetooth/af_bluetooth.c
··· 36 36 #include <linux/skbuff.h> 37 37 #include <linux/init.h> 38 38 #include <linux/poll.h> 39 - #include <linux/proc_fs.h> 40 39 #include <net/sock.h> 41 40 42 41 #if defined(CONFIG_KMOD) ··· 49 50 #define BT_DBG(D...) 50 51 #endif 51 52 52 - #define VERSION "2.7" 53 - 54 - struct proc_dir_entry *proc_bt; 55 - EXPORT_SYMBOL(proc_bt); 53 + #define VERSION "2.8" 56 54 57 55 /* Bluetooth sockets */ 58 56 #define BT_MAX_PROTO 8 ··· 308 312 { 309 313 BT_INFO("Core ver %s", VERSION); 310 314 311 - proc_bt = proc_mkdir("bluetooth", NULL); 312 - if (proc_bt) 313 - proc_bt->owner = THIS_MODULE; 314 - 315 315 sock_register(&bt_sock_family_ops); 316 316 317 317 BT_INFO("HCI device and connection manager initialized"); ··· 326 334 bt_sysfs_cleanup(); 327 335 328 336 sock_unregister(PF_BLUETOOTH); 329 - 330 - remove_proc_entry("bluetooth", NULL); 331 337 } 332 338 333 339 subsys_initcall(bt_init);
+3 -1
net/bluetooth/hci_sysfs.c
··· 103 103 kfree(hdev); 104 104 } 105 105 106 - static struct class bt_class = { 106 + struct class bt_class = { 107 107 .name = "bluetooth", 108 108 .release = bt_release, 109 109 #ifdef CONFIG_HOTPLUG 110 110 .hotplug = bt_hotplug, 111 111 #endif 112 112 }; 113 + 114 + EXPORT_SYMBOL_GPL(bt_class); 113 115 114 116 int hci_register_sysfs(struct hci_dev *hdev) 115 117 {
+17 -83
net/bluetooth/l2cap.c
··· 38 38 #include <linux/interrupt.h> 39 39 #include <linux/socket.h> 40 40 #include <linux/skbuff.h> 41 - #include <linux/proc_fs.h> 42 - #include <linux/seq_file.h> 43 41 #include <linux/list.h> 42 + #include <linux/device.h> 44 43 #include <net/sock.h> 45 44 46 45 #include <asm/system.h> ··· 55 56 #define BT_DBG(D...) 56 57 #endif 57 58 58 - #define VERSION "2.7" 59 + #define VERSION "2.8" 59 60 60 61 static struct proto_ops l2cap_sock_ops; 61 62 ··· 2136 2137 return 0; 2137 2138 } 2138 2139 2139 - /* ---- Proc fs support ---- */ 2140 - #ifdef CONFIG_PROC_FS 2141 - static void *l2cap_seq_start(struct seq_file *seq, loff_t *pos) 2140 + static ssize_t l2cap_sysfs_show(struct class *dev, char *buf) 2142 2141 { 2143 2142 struct sock *sk; 2144 2143 struct hlist_node *node; 2145 - loff_t l = *pos; 2144 + char *str = buf; 2146 2145 2147 2146 read_lock_bh(&l2cap_sk_list.lock); 2148 2147 2149 - sk_for_each(sk, node, &l2cap_sk_list.head) 2150 - if (!l--) 2151 - goto found; 2152 - sk = NULL; 2153 - found: 2154 - return sk; 2155 - } 2148 + sk_for_each(sk, node, &l2cap_sk_list.head) { 2149 + struct l2cap_pinfo *pi = l2cap_pi(sk); 2156 2150 2157 - static void *l2cap_seq_next(struct seq_file *seq, void *e, loff_t *pos) 2158 - { 2159 - (*pos)++; 2160 - return sk_next(e); 2161 - } 2151 + str += sprintf(str, "%s %s %d %d 0x%4.4x 0x%4.4x %d %d 0x%x\n", 2152 + batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), 2153 + sk->sk_state, pi->psm, pi->scid, pi->dcid, pi->imtu, 2154 + pi->omtu, pi->link_mode); 2155 + } 2162 2156 2163 - static void l2cap_seq_stop(struct seq_file *seq, void *e) 2164 - { 2165 2157 read_unlock_bh(&l2cap_sk_list.lock); 2158 + 2159 + return (str - buf); 2166 2160 } 2167 2161 2168 - static int l2cap_seq_show(struct seq_file *seq, void *e) 2169 - { 2170 - struct sock *sk = e; 2171 - struct l2cap_pinfo *pi = l2cap_pi(sk); 2172 - 2173 - seq_printf(seq, "%s %s %d %d 0x%4.4x 0x%4.4x %d %d 0x%x\n", 2174 - batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), 2175 - sk->sk_state, pi->psm, pi->scid, pi->dcid, pi->imtu, 2176 - pi->omtu, pi->link_mode); 2177 - return 0; 2178 - } 2179 - 2180 - static struct seq_operations l2cap_seq_ops = { 2181 - .start = l2cap_seq_start, 2182 - .next = l2cap_seq_next, 2183 - .stop = l2cap_seq_stop, 2184 - .show = l2cap_seq_show 2185 - }; 2186 - 2187 - static int l2cap_seq_open(struct inode *inode, struct file *file) 2188 - { 2189 - return seq_open(file, &l2cap_seq_ops); 2190 - } 2191 - 2192 - static struct file_operations l2cap_seq_fops = { 2193 - .owner = THIS_MODULE, 2194 - .open = l2cap_seq_open, 2195 - .read = seq_read, 2196 - .llseek = seq_lseek, 2197 - .release = seq_release, 2198 - }; 2199 - 2200 - static int __init l2cap_proc_init(void) 2201 - { 2202 - struct proc_dir_entry *p = create_proc_entry("l2cap", S_IRUGO, proc_bt); 2203 - if (!p) 2204 - return -ENOMEM; 2205 - p->owner = THIS_MODULE; 2206 - p->proc_fops = &l2cap_seq_fops; 2207 - return 0; 2208 - } 2209 - 2210 - static void __exit l2cap_proc_cleanup(void) 2211 - { 2212 - remove_proc_entry("l2cap", proc_bt); 2213 - } 2214 - 2215 - #else /* CONFIG_PROC_FS */ 2216 - 2217 - static int __init l2cap_proc_init(void) 2218 - { 2219 - return 0; 2220 - } 2221 - 2222 - static void __exit l2cap_proc_cleanup(void) 2223 - { 2224 - return; 2225 - } 2226 - #endif /* CONFIG_PROC_FS */ 2162 + static CLASS_ATTR(l2cap, S_IRUGO, l2cap_sysfs_show, NULL); 2227 2163 2228 2164 static struct proto_ops l2cap_sock_ops = { 2229 2165 .family = PF_BLUETOOTH, ··· 2200 2266 static int __init l2cap_init(void) 2201 2267 { 2202 2268 int err; 2203 - 2269 + 2204 2270 err = proto_register(&l2cap_proto, 0); 2205 2271 if (err < 0) 2206 2272 return err; ··· 2218 2284 goto error; 2219 2285 } 2220 2286 2221 - l2cap_proc_init(); 2287 + class_create_file(&bt_class, &class_attr_l2cap); 2222 2288 2223 2289 BT_INFO("L2CAP ver %s", VERSION); 2224 2290 BT_INFO("L2CAP socket layer initialized"); ··· 2232 2298 2233 2299 static void __exit l2cap_exit(void) 2234 2300 { 2235 - l2cap_proc_cleanup(); 2301 + class_remove_file(&bt_class, &class_attr_l2cap); 2236 2302 2237 2303 if (bt_sock_unregister(BTPROTO_L2CAP) < 0) 2238 2304 BT_ERR("L2CAP socket unregistration failed");
+18 -108
net/bluetooth/rfcomm/core.c
··· 35 35 #include <linux/signal.h> 36 36 #include <linux/init.h> 37 37 #include <linux/wait.h> 38 + #include <linux/device.h> 38 39 #include <linux/net.h> 39 - #include <linux/proc_fs.h> 40 - #include <linux/seq_file.h> 41 40 #include <net/sock.h> 42 41 #include <asm/uaccess.h> 43 42 #include <asm/unaligned.h> ··· 46 47 #include <net/bluetooth/l2cap.h> 47 48 #include <net/bluetooth/rfcomm.h> 48 49 49 - #define VERSION "1.5" 50 + #define VERSION "1.6" 50 51 51 52 #ifndef CONFIG_BT_RFCOMM_DEBUG 52 53 #undef BT_DBG 53 54 #define BT_DBG(D...) 54 - #endif 55 - 56 - #ifdef CONFIG_PROC_FS 57 - struct proc_dir_entry *proc_bt_rfcomm; 58 55 #endif 59 56 60 57 static struct task_struct *rfcomm_thread; ··· 1996 2001 .encrypt_cfm = rfcomm_encrypt_cfm 1997 2002 }; 1998 2003 1999 - /* ---- Proc fs support ---- */ 2000 - #ifdef CONFIG_PROC_FS 2001 - static void *rfcomm_seq_start(struct seq_file *seq, loff_t *pos) 2004 + static ssize_t rfcomm_dlc_sysfs_show(struct class *dev, char *buf) 2002 2005 { 2003 2006 struct rfcomm_session *s; 2004 2007 struct list_head *pp, *p; 2005 - loff_t l = *pos; 2008 + char *str = buf; 2006 2009 2007 2010 rfcomm_lock(); 2008 2011 2009 2012 list_for_each(p, &session_list) { 2010 2013 s = list_entry(p, struct rfcomm_session, list); 2011 - list_for_each(pp, &s->dlcs) 2012 - if (!l--) { 2013 - seq->private = s; 2014 - return pp; 2015 - } 2016 - } 2017 - return NULL; 2018 - } 2014 + list_for_each(pp, &s->dlcs) { 2015 + struct sock *sk = s->sock->sk; 2016 + struct rfcomm_dlc *d = list_entry(pp, struct rfcomm_dlc, list); 2019 2017 2020 - static void *rfcomm_seq_next(struct seq_file *seq, void *e, loff_t *pos) 2021 - { 2022 - struct rfcomm_session *s = seq->private; 2023 - struct list_head *pp, *p = e; 2024 - (*pos)++; 2025 - 2026 - if (p->next != &s->dlcs) 2027 - return p->next; 2028 - 2029 - list_for_each(p, &session_list) { 2030 - s = list_entry(p, struct rfcomm_session, list); 2031 - __list_for_each(pp, &s->dlcs) { 2032 - seq->private = s; 2033 - return pp; 2018 + str += sprintf(str, "%s %s %ld %d %d %d %d\n", 2019 + batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), 2020 + d->state, d->dlci, d->mtu, d->rx_credits, d->tx_credits); 2034 2021 } 2035 2022 } 2036 - return NULL; 2037 - } 2038 2023 2039 - static void rfcomm_seq_stop(struct seq_file *seq, void *e) 2040 - { 2041 2024 rfcomm_unlock(); 2025 + 2026 + return (str - buf); 2042 2027 } 2043 2028 2044 - static int rfcomm_seq_show(struct seq_file *seq, void *e) 2045 - { 2046 - struct rfcomm_session *s = seq->private; 2047 - struct sock *sk = s->sock->sk; 2048 - struct rfcomm_dlc *d = list_entry(e, struct rfcomm_dlc, list); 2049 - 2050 - seq_printf(seq, "%s %s %ld %d %d %d %d\n", 2051 - batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), 2052 - d->state, d->dlci, d->mtu, d->rx_credits, d->tx_credits); 2053 - return 0; 2054 - } 2055 - 2056 - static struct seq_operations rfcomm_seq_ops = { 2057 - .start = rfcomm_seq_start, 2058 - .next = rfcomm_seq_next, 2059 - .stop = rfcomm_seq_stop, 2060 - .show = rfcomm_seq_show 2061 - }; 2062 - 2063 - static int rfcomm_seq_open(struct inode *inode, struct file *file) 2064 - { 2065 - return seq_open(file, &rfcomm_seq_ops); 2066 - } 2067 - 2068 - static struct file_operations rfcomm_seq_fops = { 2069 - .owner = THIS_MODULE, 2070 - .open = rfcomm_seq_open, 2071 - .read = seq_read, 2072 - .llseek = seq_lseek, 2073 - .release = seq_release, 2074 - }; 2075 - 2076 - static int __init rfcomm_proc_init(void) 2077 - { 2078 - struct proc_dir_entry *p; 2079 - 2080 - proc_bt_rfcomm = proc_mkdir("rfcomm", proc_bt); 2081 - if (proc_bt_rfcomm) { 2082 - proc_bt_rfcomm->owner = THIS_MODULE; 2083 - 2084 - p = create_proc_entry("dlc", S_IRUGO, proc_bt_rfcomm); 2085 - if (p) 2086 - p->proc_fops = &rfcomm_seq_fops; 2087 - } 2088 - return 0; 2089 - } 2090 - 2091 - static void __exit rfcomm_proc_cleanup(void) 2092 - { 2093 - remove_proc_entry("dlc", proc_bt_rfcomm); 2094 - 2095 - remove_proc_entry("rfcomm", proc_bt); 2096 - } 2097 - 2098 - #else /* CONFIG_PROC_FS */ 2099 - 2100 - static int __init rfcomm_proc_init(void) 2101 - { 2102 - return 0; 2103 - } 2104 - 2105 - static void __exit rfcomm_proc_cleanup(void) 2106 - { 2107 - return; 2108 - } 2109 - #endif /* CONFIG_PROC_FS */ 2029 + static CLASS_ATTR(rfcomm_dlc, S_IRUGO, rfcomm_dlc_sysfs_show, NULL); 2110 2030 2111 2031 /* ---- Initialization ---- */ 2112 2032 static int __init rfcomm_init(void) ··· 2032 2122 2033 2123 kernel_thread(rfcomm_run, NULL, CLONE_KERNEL); 2034 2124 2035 - BT_INFO("RFCOMM ver %s", VERSION); 2036 - 2037 - rfcomm_proc_init(); 2125 + class_create_file(&bt_class, &class_attr_rfcomm_dlc); 2038 2126 2039 2127 rfcomm_init_sockets(); 2040 2128 ··· 2040 2132 rfcomm_init_ttys(); 2041 2133 #endif 2042 2134 2135 + BT_INFO("RFCOMM ver %s", VERSION); 2136 + 2043 2137 return 0; 2044 2138 } 2045 2139 2046 2140 static void __exit rfcomm_exit(void) 2047 2141 { 2142 + class_remove_file(&bt_class, &class_attr_rfcomm_dlc); 2143 + 2048 2144 hci_unregister_cb(&rfcomm_cb); 2049 2145 2050 2146 /* Terminate working thread. ··· 2065 2153 #endif 2066 2154 2067 2155 rfcomm_cleanup_sockets(); 2068 - 2069 - rfcomm_proc_cleanup(); 2070 2156 } 2071 2157 2072 2158 module_init(rfcomm_init);
+14 -78
net/bluetooth/rfcomm/sock.c
··· 42 42 #include <linux/socket.h> 43 43 #include <linux/skbuff.h> 44 44 #include <linux/list.h> 45 - #include <linux/proc_fs.h> 46 - #include <linux/seq_file.h> 45 + #include <linux/device.h> 47 46 #include <net/sock.h> 48 47 49 48 #include <asm/system.h> ··· 886 887 return result; 887 888 } 888 889 889 - /* ---- Proc fs support ---- */ 890 - #ifdef CONFIG_PROC_FS 891 - static void *rfcomm_seq_start(struct seq_file *seq, loff_t *pos) 890 + static ssize_t rfcomm_sock_sysfs_show(struct class *dev, char *buf) 892 891 { 893 892 struct sock *sk; 894 893 struct hlist_node *node; 895 - loff_t l = *pos; 894 + char *str = buf; 896 895 897 896 read_lock_bh(&rfcomm_sk_list.lock); 898 897 899 - sk_for_each(sk, node, &rfcomm_sk_list.head) 900 - if (!l--) 901 - return sk; 902 - return NULL; 903 - } 898 + sk_for_each(sk, node, &rfcomm_sk_list.head) { 899 + str += sprintf(str, "%s %s %d %d\n", 900 + batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), 901 + sk->sk_state, rfcomm_pi(sk)->channel); 902 + } 904 903 905 - static void *rfcomm_seq_next(struct seq_file *seq, void *e, loff_t *pos) 906 - { 907 - struct sock *sk = e; 908 - (*pos)++; 909 - return sk_next(sk); 910 - } 911 - 912 - static void rfcomm_seq_stop(struct seq_file *seq, void *e) 913 - { 914 904 read_unlock_bh(&rfcomm_sk_list.lock); 905 + 906 + return (str - buf); 915 907 } 916 908 917 - static int rfcomm_seq_show(struct seq_file *seq, void *e) 918 - { 919 - struct sock *sk = e; 920 - seq_printf(seq, "%s %s %d %d\n", 921 - batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), 922 - sk->sk_state, rfcomm_pi(sk)->channel); 923 - return 0; 924 - } 925 - 926 - static struct seq_operations rfcomm_seq_ops = { 927 - .start = rfcomm_seq_start, 928 - .next = rfcomm_seq_next, 929 - .stop = rfcomm_seq_stop, 930 - .show = rfcomm_seq_show 931 - }; 932 - 933 - static int rfcomm_seq_open(struct inode *inode, struct file *file) 934 - { 935 - return seq_open(file, &rfcomm_seq_ops); 936 - } 937 - 938 - static struct file_operations rfcomm_seq_fops = { 939 - .owner = THIS_MODULE, 940 - .open = rfcomm_seq_open, 941 - .read = seq_read, 942 - .llseek = seq_lseek, 943 - .release = seq_release, 944 - }; 945 - 946 - static int __init rfcomm_sock_proc_init(void) 947 - { 948 - struct proc_dir_entry *p = create_proc_entry("sock", S_IRUGO, proc_bt_rfcomm); 949 - if (!p) 950 - return -ENOMEM; 951 - p->proc_fops = &rfcomm_seq_fops; 952 - return 0; 953 - } 954 - 955 - static void __exit rfcomm_sock_proc_cleanup(void) 956 - { 957 - remove_proc_entry("sock", proc_bt_rfcomm); 958 - } 959 - 960 - #else /* CONFIG_PROC_FS */ 961 - 962 - static int __init rfcomm_sock_proc_init(void) 963 - { 964 - return 0; 965 - } 966 - 967 - static void __exit rfcomm_sock_proc_cleanup(void) 968 - { 969 - return; 970 - } 971 - #endif /* CONFIG_PROC_FS */ 909 + static CLASS_ATTR(rfcomm, S_IRUGO, rfcomm_sock_sysfs_show, NULL); 972 910 973 911 static struct proto_ops rfcomm_sock_ops = { 974 912 .family = PF_BLUETOOTH, ··· 933 997 .create = rfcomm_sock_create 934 998 }; 935 999 936 - int __init rfcomm_init_sockets(void) 1000 + int __init rfcomm_init_sockets(void) 937 1001 { 938 1002 int err; 939 1003 ··· 945 1009 if (err < 0) 946 1010 goto error; 947 1011 948 - rfcomm_sock_proc_init(); 1012 + class_create_file(&bt_class, &class_attr_rfcomm); 949 1013 950 1014 BT_INFO("RFCOMM socket layer initialized"); 951 1015 ··· 959 1023 960 1024 void __exit rfcomm_cleanup_sockets(void) 961 1025 { 962 - rfcomm_sock_proc_cleanup(); 1026 + class_remove_file(&bt_class, &class_attr_rfcomm); 963 1027 964 1028 if (bt_sock_unregister(BTPROTO_RFCOMM) < 0) 965 1029 BT_ERR("RFCOMM socket layer unregistration failed");
+14 -80
net/bluetooth/sco.c
··· 38 38 #include <linux/interrupt.h> 39 39 #include <linux/socket.h> 40 40 #include <linux/skbuff.h> 41 - #include <linux/proc_fs.h> 42 - #include <linux/seq_file.h> 41 + #include <linux/device.h> 43 42 #include <linux/list.h> 44 43 #include <net/sock.h> 45 44 ··· 54 55 #define BT_DBG(D...) 55 56 #endif 56 57 57 - #define VERSION "0.4" 58 + #define VERSION "0.5" 58 59 59 60 static struct proto_ops sco_sock_ops; 60 61 ··· 892 893 return 0; 893 894 } 894 895 895 - /* ---- Proc fs support ---- */ 896 - #ifdef CONFIG_PROC_FS 897 - static void *sco_seq_start(struct seq_file *seq, loff_t *pos) 896 + static ssize_t sco_sysfs_show(struct class *dev, char *buf) 898 897 { 899 898 struct sock *sk; 900 899 struct hlist_node *node; 901 - loff_t l = *pos; 900 + char *str = buf; 902 901 903 902 read_lock_bh(&sco_sk_list.lock); 904 903 905 - sk_for_each(sk, node, &sco_sk_list.head) 906 - if (!l--) 907 - goto found; 908 - sk = NULL; 909 - found: 910 - return sk; 911 - } 904 + sk_for_each(sk, node, &sco_sk_list.head) { 905 + str += sprintf(str, "%s %s %d\n", 906 + batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), 907 + sk->sk_state); 908 + } 912 909 913 - static void *sco_seq_next(struct seq_file *seq, void *e, loff_t *pos) 914 - { 915 - struct sock *sk = e; 916 - (*pos)++; 917 - return sk_next(sk); 918 - } 919 - 920 - static void sco_seq_stop(struct seq_file *seq, void *e) 921 - { 922 910 read_unlock_bh(&sco_sk_list.lock); 911 + 912 + return (str - buf); 923 913 } 924 914 925 - static int sco_seq_show(struct seq_file *seq, void *e) 926 - { 927 - struct sock *sk = e; 928 - seq_printf(seq, "%s %s %d\n", 929 - batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), sk->sk_state); 930 - return 0; 931 - } 932 - 933 - static struct seq_operations sco_seq_ops = { 934 - .start = sco_seq_start, 935 - .next = sco_seq_next, 936 - .stop = sco_seq_stop, 937 - .show = sco_seq_show 938 - }; 939 - 940 - static int sco_seq_open(struct inode *inode, struct file *file) 941 - { 942 - return seq_open(file, &sco_seq_ops); 943 - } 944 - 945 - static struct file_operations sco_seq_fops = { 946 - .owner = THIS_MODULE, 947 - .open = sco_seq_open, 948 - .read = seq_read, 949 - .llseek = seq_lseek, 950 - .release = seq_release, 951 - }; 952 - 953 - static int __init sco_proc_init(void) 954 - { 955 - struct proc_dir_entry *p = create_proc_entry("sco", S_IRUGO, proc_bt); 956 - if (!p) 957 - return -ENOMEM; 958 - p->owner = THIS_MODULE; 959 - p->proc_fops = &sco_seq_fops; 960 - return 0; 961 - } 962 - 963 - static void __exit sco_proc_cleanup(void) 964 - { 965 - remove_proc_entry("sco", proc_bt); 966 - } 967 - 968 - #else /* CONFIG_PROC_FS */ 969 - 970 - static int __init sco_proc_init(void) 971 - { 972 - return 0; 973 - } 974 - 975 - static void __exit sco_proc_cleanup(void) 976 - { 977 - return; 978 - } 979 - #endif /* CONFIG_PROC_FS */ 915 + static CLASS_ATTR(sco, S_IRUGO, sco_sysfs_show, NULL); 980 916 981 917 static struct proto_ops sco_sock_ops = { 982 918 .family = PF_BLUETOOTH, ··· 969 1035 goto error; 970 1036 } 971 1037 972 - sco_proc_init(); 1038 + class_create_file(&bt_class, &class_attr_sco); 973 1039 974 1040 BT_INFO("SCO (Voice Link) ver %s", VERSION); 975 1041 BT_INFO("SCO socket layer initialized"); ··· 983 1049 984 1050 static void __exit sco_exit(void) 985 1051 { 986 - sco_proc_cleanup(); 1052 + class_remove_file(&bt_class, &class_attr_sco); 987 1053 988 1054 if (bt_sock_unregister(BTPROTO_SCO) < 0) 989 1055 BT_ERR("SCO socket unregistration failed");