@@ -651,7 +651,7 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i
release_firmware(firmware);
/* Initialize and register HCI device */
- hdev = hci_alloc_dev();
+ hdev = hci_alloc_dev(0);
if (!hdev) {
BT_ERR("Can't allocate HCI device");
goto done;
@@ -694,7 +694,7 @@ static int bluecard_open(struct bluecard_info *info)
info->rx_skb = NULL;
/* Initialize HCI device */
- hdev = hci_alloc_dev();
+ hdev = hci_alloc_dev(0);
if (!hdev) {
BT_ERR("Can't allocate HCI device");
return -ENOMEM;
@@ -380,7 +380,7 @@ static int bpa10x_probe(struct usb_interface *intf,
init_usb_anchor(&data->tx_anchor);
init_usb_anchor(&data->rx_anchor);
- hdev = hci_alloc_dev();
+ hdev = hci_alloc_dev(0);
if (!hdev)
return -ENOMEM;
@@ -550,7 +550,7 @@ static int bt3c_open(struct bt3c_info *info)
info->rx_skb = NULL;
/* Initialize HCI device */
- hdev = hci_alloc_dev();
+ hdev = hci_alloc_dev(0);
if (!hdev) {
BT_ERR("Can't allocate HCI device");
return -ENOMEM;
@@ -680,7 +680,7 @@ int btmrvl_register_hdev(struct btmrvl_private *priv)
struct btmrvl_sdio_card *card = priv->btmrvl_dev.card;
int ret;
- hdev = hci_alloc_dev();
+ hdev = hci_alloc_dev(0);
if (!hdev) {
BT_ERR("Can not allocate HCI device");
goto err_hdev;
@@ -959,7 +959,7 @@ static int btmtksdio_probe(struct sdio_func *func,
skb_queue_head_init(&bdev->txq);
/* Initialize and register HCI device */
- hdev = hci_alloc_dev();
+ hdev = hci_alloc_dev(0);
if (!hdev) {
dev_err(&func->dev, "Can't allocate HCI device\n");
return -ENOMEM;
@@ -987,7 +987,7 @@ static int btmtkuart_probe(struct serdev_device *serdev)
skb_queue_head_init(&bdev->txq);
/* Initialize and register HCI device */
- hdev = hci_alloc_dev();
+ hdev = hci_alloc_dev(0);
if (!hdev) {
dev_err(&serdev->dev, "Can't allocate HCI device\n");
return -ENOMEM;
@@ -147,7 +147,7 @@ static int btqcomsmd_probe(struct platform_device *pdev)
goto destroy_acl_channel;
}
- hdev = hci_alloc_dev();
+ hdev = hci_alloc_dev(0);
if (!hdev) {
ret = -ENOMEM;
goto destroy_cmd_channel;
@@ -121,7 +121,7 @@ static int rsi_hci_attach(void *priv, struct rsi_proto_ops *ops)
ops->set_bt_context(priv, h_adapter);
h_adapter->proto_ops = ops;
- hdev = hci_alloc_dev();
+ hdev = hci_alloc_dev(0);
if (!hdev) {
BT_ERR("Failed to alloc HCI device");
goto err;
@@ -310,7 +310,7 @@ static int btsdio_probe(struct sdio_func *func,
skb_queue_head_init(&data->txq);
- hdev = hci_alloc_dev();
+ hdev = hci_alloc_dev(0);
if (!hdev)
return -ENOMEM;
@@ -4560,7 +4560,7 @@ static int btusb_probe(struct usb_interface *intf,
data->recv_bulk = btusb_recv_bulk;
}
- hdev = hci_alloc_dev();
+ hdev = hci_alloc_dev(0);
if (!hdev)
return -ENOMEM;
@@ -449,7 +449,7 @@ static int dtl1_open(struct dtl1_info *info)
set_bit(XMIT_WAITING, &(info->tx_state));
/* Initialize HCI device */
- hdev = hci_alloc_dev();
+ hdev = hci_alloc_dev(0);
if (!hdev) {
BT_ERR("Can't allocate HCI device");
return -ENOMEM;
@@ -627,7 +627,7 @@ static int hci_uart_register_dev(struct hci_uart *hu)
BT_DBG("");
/* Initialize and register HCI device */
- hdev = hci_alloc_dev();
+ hdev = hci_alloc_dev(0);
if (!hdev) {
BT_ERR("Can't allocate HCI device");
return -ENOMEM;
@@ -313,7 +313,7 @@ int hci_uart_register_device(struct hci_uart *hu,
set_bit(HCI_UART_PROTO_READY, &hu->flags);
/* Initialize and register HCI device */
- hdev = hci_alloc_dev();
+ hdev = hci_alloc_dev(0);
if (!hdev) {
BT_ERR("Can't allocate HCI device");
err = -ENOMEM;
@@ -96,7 +96,7 @@ static int __vhci_create_device(struct vhci_data *data, __u8 opcode)
if (!skb)
return -ENOMEM;
- hdev = hci_alloc_dev();
+ hdev = hci_alloc_dev(0);
if (!hdev) {
kfree_skb(skb);
return -ENOMEM;
@@ -283,7 +283,7 @@ static int virtbt_probe(struct virtio_device *vdev)
if (err)
return err;
- hdev = hci_alloc_dev();
+ hdev = hci_alloc_dev(0);
if (!hdev) {
err = -ENOMEM;
goto failed;
@@ -1223,10 +1223,15 @@ 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(int sizeof_priv);
void hci_free_dev(struct hci_dev *hdev);
int hci_register_dev(struct hci_dev *hdev);
void hci_unregister_dev(struct hci_dev *hdev);
@@ -3751,11 +3751,18 @@ static int hci_suspend_notifier(struct notifier_block *nb, unsigned long action,
}
/* Alloc HCI device */
-struct hci_dev *hci_alloc_dev(void)
+struct hci_dev *hci_alloc_dev(int sizeof_priv)
{
struct hci_dev *hdev;
+ unsigned int alloc_size;
- hdev = kzalloc(sizeof(*hdev), GFP_KERNEL);
+ alloc_size = sizeof(*hdev);
+ if (sizeof_priv) {
+ /* Fixme: May need ALIGN-ment? */
+ alloc_size += sizeof_priv;
+ }
+
+ hdev = kzalloc(alloc_size, GFP_KERNEL);
if (!hdev)
return NULL;