]> git.karo-electronics.de Git - linux-beck.git/commitdiff
Bluetooth: hci_uart: Add setup callback
authorLoic Poulain <loic.poulain@intel.com>
Wed, 25 Mar 2015 14:19:30 +0000 (15:19 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 25 Mar 2015 16:31:58 +0000 (17:31 +0100)
Some Bluetooth controllers require initialization before being
used (vendor config, firmware download). Add possibility for a
HCI UART proto to implement this early init via the setup callback.

Signed-off-by: Loic Poulain <loic.poulain@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
drivers/bluetooth/hci_ldisc.c
drivers/bluetooth/hci_uart.h

index dc487b5d11568f9ebcfec033ee0bc47f6d34ece0..48a0c250d5b83d7fe353daee1b99cf06afdab454 100644 (file)
@@ -261,6 +261,16 @@ static int hci_uart_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
        return 0;
 }
 
+static int hci_uart_setup(struct hci_dev *hdev)
+{
+       struct hci_uart *hu = hci_get_drvdata(hdev);
+
+       if (hu->proto->setup)
+               return hu->proto->setup(hu);
+
+       return 0;
+}
+
 /* ------ LDISC part ------ */
 /* hci_uart_tty_open
  *
@@ -426,6 +436,7 @@ static int hci_uart_register_dev(struct hci_uart *hu)
        hdev->close = hci_uart_close;
        hdev->flush = hci_uart_flush;
        hdev->send  = hci_uart_send_frame;
+       hdev->setup = hci_uart_setup;
        SET_HCIDEV_DEV(hdev, hu->tty->dev);
 
        if (test_bit(HCI_UART_RAW_DEVICE, &hu->hdev_flags))
index 247488edcbf93711168c9ee072a97edf923ecd9c..074ed29092b487b700838b34f1504e8379335dd9 100644 (file)
@@ -59,6 +59,7 @@ struct hci_uart_proto {
        int (*flush)(struct hci_uart *hu);
        int (*recv)(struct hci_uart *hu, void *data, int len);
        int (*enqueue)(struct hci_uart *hu, struct sk_buff *skb);
+       int (*setup)(struct hci_uart *hu);
        struct sk_buff *(*dequeue)(struct hci_uart *hu);
 };