diff options
Diffstat (limited to 'net/bluetooth/hci_sysfs.c')
-rw-r--r-- | net/bluetooth/hci_sysfs.c | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index 661b461cf0b0..c62d254a1379 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c | |||
@@ -436,17 +436,12 @@ static const struct file_operations inquiry_cache_fops = { | |||
436 | static int blacklist_show(struct seq_file *f, void *p) | 436 | static int blacklist_show(struct seq_file *f, void *p) |
437 | { | 437 | { |
438 | struct hci_dev *hdev = f->private; | 438 | struct hci_dev *hdev = f->private; |
439 | struct list_head *l; | 439 | struct bdaddr_list *b; |
440 | 440 | ||
441 | hci_dev_lock_bh(hdev); | 441 | hci_dev_lock_bh(hdev); |
442 | 442 | ||
443 | list_for_each(l, &hdev->blacklist) { | 443 | list_for_each_entry(b, &hdev->blacklist, list) |
444 | struct bdaddr_list *b; | ||
445 | |||
446 | b = list_entry(l, struct bdaddr_list, list); | ||
447 | |||
448 | seq_printf(f, "%s\n", batostr(&b->bdaddr)); | 444 | seq_printf(f, "%s\n", batostr(&b->bdaddr)); |
449 | } | ||
450 | 445 | ||
451 | hci_dev_unlock_bh(hdev); | 446 | hci_dev_unlock_bh(hdev); |
452 | 447 | ||
@@ -485,17 +480,12 @@ static void print_bt_uuid(struct seq_file *f, u8 *uuid) | |||
485 | static int uuids_show(struct seq_file *f, void *p) | 480 | static int uuids_show(struct seq_file *f, void *p) |
486 | { | 481 | { |
487 | struct hci_dev *hdev = f->private; | 482 | struct hci_dev *hdev = f->private; |
488 | struct list_head *l; | 483 | struct bt_uuid *uuid; |
489 | 484 | ||
490 | hci_dev_lock_bh(hdev); | 485 | hci_dev_lock_bh(hdev); |
491 | 486 | ||
492 | list_for_each(l, &hdev->uuids) { | 487 | list_for_each_entry(uuid, &hdev->uuids, list) |
493 | struct bt_uuid *uuid; | ||
494 | |||
495 | uuid = list_entry(l, struct bt_uuid, list); | ||
496 | |||
497 | print_bt_uuid(f, uuid->uuid); | 488 | print_bt_uuid(f, uuid->uuid); |
498 | } | ||
499 | 489 | ||
500 | hci_dev_unlock_bh(hdev); | 490 | hci_dev_unlock_bh(hdev); |
501 | 491 | ||
@@ -543,22 +533,28 @@ static int auto_accept_delay_get(void *data, u64 *val) | |||
543 | DEFINE_SIMPLE_ATTRIBUTE(auto_accept_delay_fops, auto_accept_delay_get, | 533 | DEFINE_SIMPLE_ATTRIBUTE(auto_accept_delay_fops, auto_accept_delay_get, |
544 | auto_accept_delay_set, "%llu\n"); | 534 | auto_accept_delay_set, "%llu\n"); |
545 | 535 | ||
546 | int hci_register_sysfs(struct hci_dev *hdev) | 536 | void hci_init_sysfs(struct hci_dev *hdev) |
537 | { | ||
538 | struct device *dev = &hdev->dev; | ||
539 | |||
540 | dev->type = &bt_host; | ||
541 | dev->class = bt_class; | ||
542 | |||
543 | dev_set_drvdata(dev, hdev); | ||
544 | device_initialize(dev); | ||
545 | } | ||
546 | |||
547 | int hci_add_sysfs(struct hci_dev *hdev) | ||
547 | { | 548 | { |
548 | struct device *dev = &hdev->dev; | 549 | struct device *dev = &hdev->dev; |
549 | int err; | 550 | int err; |
550 | 551 | ||
551 | BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus); | 552 | BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus); |
552 | 553 | ||
553 | dev->type = &bt_host; | ||
554 | dev->class = bt_class; | ||
555 | dev->parent = hdev->parent; | 554 | dev->parent = hdev->parent; |
556 | |||
557 | dev_set_name(dev, "%s", hdev->name); | 555 | dev_set_name(dev, "%s", hdev->name); |
558 | 556 | ||
559 | dev_set_drvdata(dev, hdev); | 557 | err = device_add(dev); |
560 | |||
561 | err = device_register(dev); | ||
562 | if (err < 0) | 558 | if (err < 0) |
563 | return err; | 559 | return err; |
564 | 560 | ||
@@ -582,7 +578,7 @@ int hci_register_sysfs(struct hci_dev *hdev) | |||
582 | return 0; | 578 | return 0; |
583 | } | 579 | } |
584 | 580 | ||
585 | void hci_unregister_sysfs(struct hci_dev *hdev) | 581 | void hci_del_sysfs(struct hci_dev *hdev) |
586 | { | 582 | { |
587 | BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus); | 583 | BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus); |
588 | 584 | ||