diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2015-04-05 23:44:59 -0700 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2015-04-07 18:48:21 +0200 |
commit | 79b8df9362e8bd1951e1fddbd65ca87af8df52c8 (patch) | |
tree | b34a614b874924bbdb49dddfacb5fe2636d3a484 /drivers/bluetooth/hci_bcm.c | |
parent | 9a0bb57d2d08f1923aeef3af1877ec0b6f3209ba (diff) |
Bluetooth: hci_uart: Provide generic H:4 receive framework
Future H:4 based UART drivers require custom packet types and custom
receive functions. To support this, extended the h4_recv_buf function
with a packet definition table.
For the default H:4 packets types of ACL data, SCO data and events,
provide helpers to reduce the amount of code duplication.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'drivers/bluetooth/hci_bcm.c')
-rw-r--r-- | drivers/bluetooth/hci_bcm.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c index fe1905c4beb2..1ec0b4a5ffa6 100644 --- a/drivers/bluetooth/hci_bcm.c +++ b/drivers/bluetooth/hci_bcm.c @@ -86,6 +86,12 @@ static int bcm_setup(struct hci_uart *hu) return btbcm_setup_patchram(hu->hdev); } +static const struct h4_recv_pkt bcm_recv_pkts[] = { + { H4_RECV_ACL, .recv = hci_recv_frame }, + { H4_RECV_SCO, .recv = hci_recv_frame }, + { H4_RECV_EVENT, .recv = hci_recv_frame }, +}; + static int bcm_recv(struct hci_uart *hu, const void *data, int count) { struct bcm_data *bcm = hu->priv; @@ -93,7 +99,8 @@ static int bcm_recv(struct hci_uart *hu, const void *data, int count) if (!test_bit(HCI_UART_REGISTERED, &hu->flags)) return -EUNATCH; - bcm->rx_skb = h4_recv_buf(hu->hdev, bcm->rx_skb, data, count); + bcm->rx_skb = h4_recv_buf(hu->hdev, bcm->rx_skb, data, count, + bcm_recv_pkts, ARRAY_SIZE(bcm_recv_pkts)); if (IS_ERR(bcm->rx_skb)) { int err = PTR_ERR(bcm->rx_skb); BT_ERR("%s: Frame reassembly failed (%d)", hu->hdev->name, err); |