aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@googlemail.com>2012-04-22 08:39:57 -0400
committerGustavo Padovan <gustavo@padovan.org>2012-05-09 00:40:39 -0400
commit9be0dab793f52615274c357fce542b3cbf78f6d7 (patch)
tree0cf367b9ffea5ce863ff4a4af2bb05f45d4e5311
parentfb3340594bd6630c27e31ddeff25b7002fb4558e (diff)
Bluetooth: Move hci_alloc/free_dev close to hci_register/unregister_dev
alloc() and register() (and free() and unregister()) are closely related so move them more closely together. This will also allow to move functionality from register() to alloc() without needing forward-declarations. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
-rw-r--r--net/bluetooth/hci_core.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 22581823e610..d3fb986d6b27 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1092,32 +1092,6 @@ static const struct rfkill_ops hci_rfkill_ops = {
1092 .set_block = hci_rfkill_set_block, 1092 .set_block = hci_rfkill_set_block,
1093}; 1093};
1094 1094
1095/* Alloc HCI device */
1096struct hci_dev *hci_alloc_dev(void)
1097{
1098 struct hci_dev *hdev;
1099
1100 hdev = kzalloc(sizeof(struct hci_dev), GFP_KERNEL);
1101 if (!hdev)
1102 return NULL;
1103
1104 hci_init_sysfs(hdev);
1105 skb_queue_head_init(&hdev->driver_init);
1106
1107 return hdev;
1108}
1109EXPORT_SYMBOL(hci_alloc_dev);
1110
1111/* Free HCI device */
1112void hci_free_dev(struct hci_dev *hdev)
1113{
1114 skb_queue_purge(&hdev->driver_init);
1115
1116 /* will free via device release */
1117 put_device(&hdev->dev);
1118}
1119EXPORT_SYMBOL(hci_free_dev);
1120
1121static void hci_power_on(struct work_struct *work) 1095static void hci_power_on(struct work_struct *work)
1122{ 1096{
1123 struct hci_dev *hdev = container_of(work, struct hci_dev, power_on); 1097 struct hci_dev *hdev = container_of(work, struct hci_dev, power_on);
@@ -1735,6 +1709,32 @@ int hci_le_scan(struct hci_dev *hdev, u8 type, u16 interval, u16 window,
1735 return 0; 1709 return 0;
1736} 1710}
1737 1711
1712/* Alloc HCI device */
1713struct hci_dev *hci_alloc_dev(void)
1714{
1715 struct hci_dev *hdev;
1716
1717 hdev = kzalloc(sizeof(struct hci_dev), GFP_KERNEL);
1718 if (!hdev)
1719 return NULL;
1720
1721 hci_init_sysfs(hdev);
1722 skb_queue_head_init(&hdev->driver_init);
1723
1724 return hdev;
1725}
1726EXPORT_SYMBOL(hci_alloc_dev);
1727
1728/* Free HCI device */
1729void hci_free_dev(struct hci_dev *hdev)
1730{
1731 skb_queue_purge(&hdev->driver_init);
1732
1733 /* will free via device release */
1734 put_device(&hdev->dev);
1735}
1736EXPORT_SYMBOL(hci_free_dev);
1737
1738/* Register HCI device */ 1738/* Register HCI device */
1739int hci_register_dev(struct hci_dev *hdev) 1739int hci_register_dev(struct hci_dev *hdev)
1740{ 1740{