summaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorTedd Ho-Jeong An <tedd.an@intel.com>2021-08-04 17:32:08 -0700
committerMarcel Holtmann <marcel@holtmann.org>2021-08-05 16:03:29 +0200
commit6ec566131de0e330fffd33753b325fb4d6b2d00e (patch)
treef72db21e1ce4294d1b484ab5f437b0faffc13f05 /include/net
parent713baf3dae8f45dc8ada4ed2f5fdcbf94a5c274d (diff)
downloadlinux-stable-6ec566131de0e330fffd33753b325fb4d6b2d00e.tar.gz
linux-stable-6ec566131de0e330fffd33753b325fb4d6b2d00e.tar.bz2
linux-stable-6ec566131de0e330fffd33753b325fb4d6b2d00e.zip
Bluetooth: Add support hdev to allocate private data
This patch adds support hdev to allocate extra size for private data. The size of private data is specified in the hdev_alloc_size(priv_size) and the allocated buffer can be accessed with hci_get_priv(hdev). Signed-off-by: Tedd Ho-Jeong An <tedd.an@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/bluetooth/hci_core.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index b011eeea28c3..a7d06d7da602 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -1224,10 +1224,21 @@ static inline void hci_set_drvdata(struct hci_dev *hdev, void *data)
dev_set_drvdata(&hdev->dev, data);
}
+static inline void *hci_get_priv(struct hci_dev *hdev)
+{
+ return (char *)hdev + sizeof(*hdev);
+}
+
struct hci_dev *hci_dev_get(int index);
struct hci_dev *hci_get_route(bdaddr_t *dst, bdaddr_t *src, u8 src_type);
-struct hci_dev *hci_alloc_dev(void);
+struct hci_dev *hci_alloc_dev_priv(int sizeof_priv);
+
+static inline struct hci_dev *hci_alloc_dev(void)
+{
+ return hci_alloc_dev_priv(0);
+}
+
void hci_free_dev(struct hci_dev *hdev);
int hci_register_dev(struct hci_dev *hdev);
void hci_unregister_dev(struct hci_dev *hdev);