aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/bluetooth/hci_sysfs.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index 3987d167f04e..3ccb4b0b8fc2 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -13,16 +13,30 @@
13#define BT_DBG(D...) 13#define BT_DBG(D...)
14#endif 14#endif
15 15
16static ssize_t show_name(struct device *dev, struct device_attribute *attr, char *buf) 16static inline char *typetostr(int type)
17{ 17{
18 struct hci_dev *hdev = dev_get_drvdata(dev); 18 switch (type) {
19 return sprintf(buf, "%s\n", hdev->name); 19 case HCI_VHCI:
20 return "VIRTUAL";
21 case HCI_USB:
22 return "USB";
23 case HCI_PCCARD:
24 return "PCCARD";
25 case HCI_UART:
26 return "UART";
27 case HCI_RS232:
28 return "RS232";
29 case HCI_PCI:
30 return "PCI";
31 default:
32 return "UNKNOWN";
33 }
20} 34}
21 35
22static ssize_t show_type(struct device *dev, struct device_attribute *attr, char *buf) 36static ssize_t show_type(struct device *dev, struct device_attribute *attr, char *buf)
23{ 37{
24 struct hci_dev *hdev = dev_get_drvdata(dev); 38 struct hci_dev *hdev = dev_get_drvdata(dev);
25 return sprintf(buf, "%d\n", hdev->type); 39 return sprintf(buf, "%s\n", typetostr(hdev->type));
26} 40}
27 41
28static ssize_t show_address(struct device *dev, struct device_attribute *attr, char *buf) 42static ssize_t show_address(struct device *dev, struct device_attribute *attr, char *buf)
@@ -33,12 +47,6 @@ static ssize_t show_address(struct device *dev, struct device_attribute *attr, c
33 return sprintf(buf, "%s\n", batostr(&bdaddr)); 47 return sprintf(buf, "%s\n", batostr(&bdaddr));
34} 48}
35 49
36static ssize_t show_flags(struct device *dev, struct device_attribute *attr, char *buf)
37{
38 struct hci_dev *hdev = dev_get_drvdata(dev);
39 return sprintf(buf, "0x%lx\n", hdev->flags);
40}
41
42static ssize_t show_inquiry_cache(struct device *dev, struct device_attribute *attr, char *buf) 50static ssize_t show_inquiry_cache(struct device *dev, struct device_attribute *attr, char *buf)
43{ 51{
44 struct hci_dev *hdev = dev_get_drvdata(dev); 52 struct hci_dev *hdev = dev_get_drvdata(dev);
@@ -141,10 +149,8 @@ static ssize_t store_sniff_min_interval(struct device *dev, struct device_attrib
141 return count; 149 return count;
142} 150}
143 151
144static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
145static DEVICE_ATTR(type, S_IRUGO, show_type, NULL); 152static DEVICE_ATTR(type, S_IRUGO, show_type, NULL);
146static DEVICE_ATTR(address, S_IRUGO, show_address, NULL); 153static DEVICE_ATTR(address, S_IRUGO, show_address, NULL);
147static DEVICE_ATTR(flags, S_IRUGO, show_flags, NULL);
148static DEVICE_ATTR(inquiry_cache, S_IRUGO, show_inquiry_cache, NULL); 154static DEVICE_ATTR(inquiry_cache, S_IRUGO, show_inquiry_cache, NULL);
149 155
150static DEVICE_ATTR(idle_timeout, S_IRUGO | S_IWUSR, 156static DEVICE_ATTR(idle_timeout, S_IRUGO | S_IWUSR,
@@ -155,10 +161,8 @@ static DEVICE_ATTR(sniff_min_interval, S_IRUGO | S_IWUSR,
155 show_sniff_min_interval, store_sniff_min_interval); 161 show_sniff_min_interval, store_sniff_min_interval);
156 162
157static struct device_attribute *bt_attrs[] = { 163static struct device_attribute *bt_attrs[] = {
158 &dev_attr_name,
159 &dev_attr_type, 164 &dev_attr_type,
160 &dev_attr_address, 165 &dev_attr_address,
161 &dev_attr_flags,
162 &dev_attr_inquiry_cache, 166 &dev_attr_inquiry_cache,
163 &dev_attr_idle_timeout, 167 &dev_attr_idle_timeout,
164 &dev_attr_sniff_max_interval, 168 &dev_attr_sniff_max_interval,
@@ -214,11 +218,9 @@ int hci_register_sysfs(struct hci_dev *hdev)
214 218
215void hci_unregister_sysfs(struct hci_dev *hdev) 219void hci_unregister_sysfs(struct hci_dev *hdev)
216{ 220{
217 struct device *dev = &hdev->dev;
218
219 BT_DBG("%p name %s type %d", hdev, hdev->name, hdev->type); 221 BT_DBG("%p name %s type %d", hdev, hdev->name, hdev->type);
220 222
221 device_del(dev); 223 device_del(&hdev->dev);
222} 224}
223 225
224int __init bt_sysfs_init(void) 226int __init bt_sysfs_init(void)