aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/bluetooth/bluecard_cs.c1
-rw-r--r--drivers/bluetooth/bt3c_cs.c1
-rw-r--r--drivers/bluetooth/btuart_cs.c1
-rw-r--r--drivers/bluetooth/dtl1_cs.c1
-rw-r--r--drivers/bluetooth/hci_vhci.c1
-rw-r--r--include/net/bluetooth/hci_core.h1
-rw-r--r--net/bluetooth/af_bluetooth.c20
-rw-r--r--net/bluetooth/hci_sysfs.c39
8 files changed, 56 insertions, 9 deletions
diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c
index 2830f58d6f77..8eebf9ca3786 100644
--- a/drivers/bluetooth/bluecard_cs.c
+++ b/drivers/bluetooth/bluecard_cs.c
@@ -739,6 +739,7 @@ static int bluecard_open(bluecard_info_t *info)
739 739
740 hdev->type = HCI_PCCARD; 740 hdev->type = HCI_PCCARD;
741 hdev->driver_data = info; 741 hdev->driver_data = info;
742 SET_HCIDEV_DEV(hdev, &info->p_dev->dev);
742 743
743 hdev->open = bluecard_hci_open; 744 hdev->open = bluecard_hci_open;
744 hdev->close = bluecard_hci_close; 745 hdev->close = bluecard_hci_close;
diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c
index c9dba5565cac..df7bb016df49 100644
--- a/drivers/bluetooth/bt3c_cs.c
+++ b/drivers/bluetooth/bt3c_cs.c
@@ -582,6 +582,7 @@ static int bt3c_open(bt3c_info_t *info)
582 582
583 hdev->type = HCI_PCCARD; 583 hdev->type = HCI_PCCARD;
584 hdev->driver_data = info; 584 hdev->driver_data = info;
585 SET_HCIDEV_DEV(hdev, &info->p_dev->dev);
585 586
586 hdev->open = bt3c_hci_open; 587 hdev->open = bt3c_hci_open;
587 hdev->close = bt3c_hci_close; 588 hdev->close = bt3c_hci_close;
diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c
index c889bf8109a1..746ccca97f6f 100644
--- a/drivers/bluetooth/btuart_cs.c
+++ b/drivers/bluetooth/btuart_cs.c
@@ -502,6 +502,7 @@ static int btuart_open(btuart_info_t *info)
502 502
503 hdev->type = HCI_PCCARD; 503 hdev->type = HCI_PCCARD;
504 hdev->driver_data = info; 504 hdev->driver_data = info;
505 SET_HCIDEV_DEV(hdev, &info->p_dev->dev);
505 506
506 hdev->open = btuart_hci_open; 507 hdev->open = btuart_hci_open;
507 hdev->close = btuart_hci_close; 508 hdev->close = btuart_hci_close;
diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c
index be6eed175aa3..0e99def8a1e3 100644
--- a/drivers/bluetooth/dtl1_cs.c
+++ b/drivers/bluetooth/dtl1_cs.c
@@ -484,6 +484,7 @@ static int dtl1_open(dtl1_info_t *info)
484 484
485 hdev->type = HCI_PCCARD; 485 hdev->type = HCI_PCCARD;
486 hdev->driver_data = info; 486 hdev->driver_data = info;
487 SET_HCIDEV_DEV(hdev, &info->p_dev->dev);
487 488
488 hdev->open = dtl1_hci_open; 489 hdev->open = dtl1_hci_open;
489 hdev->close = dtl1_hci_close; 490 hdev->close = dtl1_hci_close;
diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c
index ea589007fa26..aac67a3a6019 100644
--- a/drivers/bluetooth/hci_vhci.c
+++ b/drivers/bluetooth/hci_vhci.c
@@ -277,7 +277,6 @@ static int vhci_open(struct inode *inode, struct file *file)
277 277
278 hdev->type = HCI_VHCI; 278 hdev->type = HCI_VHCI;
279 hdev->driver_data = vhci; 279 hdev->driver_data = vhci;
280 SET_HCIDEV_DEV(hdev, vhci_miscdev.dev);
281 280
282 hdev->open = vhci_open_dev; 281 hdev->open = vhci_open_dev;
283 hdev->close = vhci_close_dev; 282 hdev->close = vhci_close_dev;
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index f6852707bd64..ae67b36d76dc 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -124,6 +124,7 @@ struct hci_dev {
124 124
125 atomic_t promisc; 125 atomic_t promisc;
126 126
127 struct device *dev;
127 struct class_device class_dev; 128 struct class_device class_dev;
128 129
129 struct module *owner; 130 struct module *owner;
diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
index 729461fcfe99..788ea7a2b744 100644
--- a/net/bluetooth/af_bluetooth.c
+++ b/net/bluetooth/af_bluetooth.c
@@ -48,7 +48,7 @@
48#define BT_DBG(D...) 48#define BT_DBG(D...)
49#endif 49#endif
50 50
51#define VERSION "2.9" 51#define VERSION "2.10"
52 52
53/* Bluetooth sockets */ 53/* Bluetooth sockets */
54#define BT_MAX_PROTO 8 54#define BT_MAX_PROTO 8
@@ -307,13 +307,21 @@ static struct net_proto_family bt_sock_family_ops = {
307 307
308static int __init bt_init(void) 308static int __init bt_init(void)
309{ 309{
310 int err;
311
310 BT_INFO("Core ver %s", VERSION); 312 BT_INFO("Core ver %s", VERSION);
311 313
312 sock_register(&bt_sock_family_ops); 314 err = bt_sysfs_init();
315 if (err < 0)
316 return err;
313 317
314 BT_INFO("HCI device and connection manager initialized"); 318 err = sock_register(&bt_sock_family_ops);
319 if (err < 0) {
320 bt_sysfs_cleanup();
321 return err;
322 }
315 323
316 bt_sysfs_init(); 324 BT_INFO("HCI device and connection manager initialized");
317 325
318 hci_sock_init(); 326 hci_sock_init();
319 327
@@ -324,9 +332,9 @@ static void __exit bt_exit(void)
324{ 332{
325 hci_sock_cleanup(); 333 hci_sock_cleanup();
326 334
327 bt_sysfs_cleanup();
328
329 sock_unregister(PF_BLUETOOTH); 335 sock_unregister(PF_BLUETOOTH);
336
337 bt_sysfs_cleanup();
330} 338}
331 339
332subsys_initcall(bt_init); 340subsys_initcall(bt_init);
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index 89918d2f1fdc..7789e26c84b9 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -3,6 +3,8 @@
3#include <linux/kernel.h> 3#include <linux/kernel.h>
4#include <linux/init.h> 4#include <linux/init.h>
5 5
6#include <linux/platform_device.h>
7
6#include <net/bluetooth/bluetooth.h> 8#include <net/bluetooth/bluetooth.h>
7#include <net/bluetooth/hci_core.h> 9#include <net/bluetooth/hci_core.h>
8 10
@@ -197,9 +199,14 @@ struct class bt_class = {
197 .uevent = bt_uevent, 199 .uevent = bt_uevent,
198#endif 200#endif
199}; 201};
200
201EXPORT_SYMBOL_GPL(bt_class); 202EXPORT_SYMBOL_GPL(bt_class);
202 203
204static struct bus_type bt_bus = {
205 .name = "bluetooth",
206};
207
208static struct platform_device *bt_platform;
209
203int hci_register_sysfs(struct hci_dev *hdev) 210int hci_register_sysfs(struct hci_dev *hdev)
204{ 211{
205 struct class_device *cdev = &hdev->class_dev; 212 struct class_device *cdev = &hdev->class_dev;
@@ -211,6 +218,11 @@ int hci_register_sysfs(struct hci_dev *hdev)
211 cdev->class = &bt_class; 218 cdev->class = &bt_class;
212 class_set_devdata(cdev, hdev); 219 class_set_devdata(cdev, hdev);
213 220
221 if (!cdev->dev)
222 cdev->dev = &bt_platform->dev;
223
224 hdev->dev = cdev->dev;
225
214 strlcpy(cdev->class_id, hdev->name, BUS_ID_SIZE); 226 strlcpy(cdev->class_id, hdev->name, BUS_ID_SIZE);
215 err = class_device_register(cdev); 227 err = class_device_register(cdev);
216 if (err < 0) 228 if (err < 0)
@@ -233,10 +245,33 @@ void hci_unregister_sysfs(struct hci_dev *hdev)
233 245
234int __init bt_sysfs_init(void) 246int __init bt_sysfs_init(void)
235{ 247{
236 return class_register(&bt_class); 248 int err;
249
250 bt_platform = platform_device_register_simple("bluetooth", -1, NULL, 0);
251 if (IS_ERR(bt_platform))
252 return PTR_ERR(bt_platform);
253
254 err = bus_register(&bt_bus);
255 if (err < 0) {
256 platform_device_unregister(bt_platform);
257 return err;
258 }
259
260 err = class_register(&bt_class);
261 if (err < 0) {
262 bus_unregister(&bt_bus);
263 platform_device_unregister(bt_platform);
264 return err;
265 }
266
267 return 0;
237} 268}
238 269
239void __exit bt_sysfs_cleanup(void) 270void __exit bt_sysfs_cleanup(void)
240{ 271{
241 class_unregister(&bt_class); 272 class_unregister(&bt_class);
273
274 bus_unregister(&bt_bus);
275
276 platform_device_unregister(bt_platform);
242} 277}