]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
Bluetooth: Use new hci_skb_pkt_* wrappers for drivers
authorMarcel Holtmann <marcel@holtmann.org>
Thu, 5 Nov 2015 06:33:56 +0000 (07:33 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 19 Nov 2015 16:50:27 +0000 (17:50 +0100)
The new hci_skb_pkt_* wrappers are mainly intented for drivers to
require less knowledge about bt_cb(sbk) handling. So after converting
the core packet handling, convert all drivers.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
21 files changed:
drivers/bluetooth/bfusb.c
drivers/bluetooth/bluecard_cs.c
drivers/bluetooth/bpa10x.c
drivers/bluetooth/bt3c_cs.c
drivers/bluetooth/btmrvl_main.c
drivers/bluetooth/btmrvl_sdio.c
drivers/bluetooth/btsdio.c
drivers/bluetooth/btuart_cs.c
drivers/bluetooth/btusb.c
drivers/bluetooth/btwilink.c
drivers/bluetooth/dtl1_cs.c
drivers/bluetooth/hci_ath.c
drivers/bluetooth/hci_bcm.c
drivers/bluetooth/hci_bcsp.c
drivers/bluetooth/hci_h4.c
drivers/bluetooth/hci_h5.c
drivers/bluetooth/hci_intel.c
drivers/bluetooth/hci_ldisc.c
drivers/bluetooth/hci_ll.c
drivers/bluetooth/hci_qca.c
drivers/bluetooth/hci_vhci.c

index 616ec2ac1b22f8d3e77f29848f3cd46cf830a94c..72d8bfabef0952f7a063fdff4b27fb5450df810b 100644 (file)
@@ -324,7 +324,7 @@ static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned ch
                        return -ENOMEM;
                }
 
-               bt_cb(skb)->pkt_type = pkt_type;
+               hci_skb_pkt_type(skb) = pkt_type;
 
                data->reassembly = skb;
        } else {
@@ -469,9 +469,10 @@ static int bfusb_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
        unsigned char buf[3];
        int sent = 0, size, count;
 
-       BT_DBG("hdev %p skb %p type %d len %d", hdev, skb, bt_cb(skb)->pkt_type, skb->len);
+       BT_DBG("hdev %p skb %p type %d len %d", hdev, skb,
+              hci_skb_pkt_type(skb), skb->len);
 
-       switch (bt_cb(skb)->pkt_type) {
+       switch (hci_skb_pkt_type(skb)) {
        case HCI_COMMAND_PKT:
                hdev->stat.cmd_tx++;
                break;
@@ -484,7 +485,7 @@ static int bfusb_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
        }
 
        /* Prepend skb with frame type */
-       memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
+       memcpy(skb_push(skb, 1), &hci_skb_pkt_type(skb), 1);
 
        count = skb->len;
 
index 36fa1c958c74fadbb6bed47eca40a38e48433be0..c0b3b55769921da4d8bd9c52c12924cfa06908cc 100644 (file)
@@ -261,7 +261,7 @@ static void bluecard_write_wakeup(struct bluecard_info *info)
                if (!skb)
                        break;
 
-               if (bt_cb(skb)->pkt_type & 0x80) {
+               if (hci_skb_pkt_type(skb) & 0x80) {
                        /* Disable RTS */
                        info->ctrl_reg |= REG_CONTROL_RTS;
                        outb(info->ctrl_reg, iobase + REG_CONTROL);
@@ -279,13 +279,13 @@ static void bluecard_write_wakeup(struct bluecard_info *info)
                /* Mark the buffer as dirty */
                clear_bit(ready_bit, &(info->tx_state));
 
-               if (bt_cb(skb)->pkt_type & 0x80) {
+               if (hci_skb_pkt_type(skb) & 0x80) {
                        DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wq);
                        DEFINE_WAIT(wait);
 
                        unsigned char baud_reg;
 
-                       switch (bt_cb(skb)->pkt_type) {
+                       switch (hci_skb_pkt_type(skb)) {
                        case PKT_BAUD_RATE_460800:
                                baud_reg = REG_CONTROL_BAUD_RATE_460800;
                                break;
@@ -402,9 +402,9 @@ static void bluecard_receive(struct bluecard_info *info,
 
                if (info->rx_state == RECV_WAIT_PACKET_TYPE) {
 
-                       bt_cb(info->rx_skb)->pkt_type = buf[i];
+                       hci_skb_pkt_type(info->rx_skb) = buf[i];
 
-                       switch (bt_cb(info->rx_skb)->pkt_type) {
+                       switch (hci_skb_pkt_type(info->rx_skb)) {
 
                        case 0x00:
                                /* init packet */
@@ -436,7 +436,8 @@ static void bluecard_receive(struct bluecard_info *info,
 
                        default:
                                /* unknown packet */
-                               BT_ERR("Unknown HCI packet with type 0x%02x received", bt_cb(info->rx_skb)->pkt_type);
+                               BT_ERR("Unknown HCI packet with type 0x%02x received",
+                                      hci_skb_pkt_type(info->rx_skb));
                                info->hdev->stat.err_rx++;
 
                                kfree_skb(info->rx_skb);
@@ -578,21 +579,21 @@ static int bluecard_hci_set_baud_rate(struct hci_dev *hdev, int baud)
        switch (baud) {
        case 460800:
                cmd[4] = 0x00;
-               bt_cb(skb)->pkt_type = PKT_BAUD_RATE_460800;
+               hci_skb_pkt_type(skb) = PKT_BAUD_RATE_460800;
                break;
        case 230400:
                cmd[4] = 0x01;
-               bt_cb(skb)->pkt_type = PKT_BAUD_RATE_230400;
+               hci_skb_pkt_type(skb) = PKT_BAUD_RATE_230400;
                break;
        case 115200:
                cmd[4] = 0x02;
-               bt_cb(skb)->pkt_type = PKT_BAUD_RATE_115200;
+               hci_skb_pkt_type(skb) = PKT_BAUD_RATE_115200;
                break;
        case 57600:
                /* Fall through... */
        default:
                cmd[4] = 0x03;
-               bt_cb(skb)->pkt_type = PKT_BAUD_RATE_57600;
+               hci_skb_pkt_type(skb) = PKT_BAUD_RATE_57600;
                break;
        }
 
@@ -660,7 +661,7 @@ static int bluecard_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
 {
        struct bluecard_info *info = hci_get_drvdata(hdev);
 
-       switch (bt_cb(skb)->pkt_type) {
+       switch (hci_skb_pkt_type(skb)) {
        case HCI_COMMAND_PKT:
                hdev->stat.cmd_tx++;
                break;
@@ -673,7 +674,7 @@ static int bluecard_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
        }
 
        /* Prepend skb with frame type */
-       memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
+       memcpy(skb_push(skb, 1), &hci_skb_pkt_type(skb), 1);
        skb_queue_tail(&(info->txq), skb);
 
        bluecard_write_wakeup(info);
index 49c397e21b39886ed409461a30479cfcc427772c..fd6b53e9bbf27bdbd64089cc06cf0e82caad40fb 100644 (file)
@@ -295,9 +295,9 @@ static int bpa10x_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
                return -ENOMEM;
 
        /* Prepend skb with frame type */
-       *skb_push(skb, 1) = bt_cb(skb)->pkt_type;
+       *skb_push(skb, 1) = hci_skb_pkt_type(skb);
 
-       switch (bt_cb(skb)->pkt_type) {
+       switch (hci_skb_pkt_type(skb)) {
        case HCI_COMMAND_PKT:
                dr = kmalloc(sizeof(*dr), GFP_ATOMIC);
                if (!dr) {
index 5803aaed958f9518bdf9b6683ae64aa24be0514e..8165ef2fe8777a7e119052e9d1c37848e9c6d885 100644 (file)
@@ -246,10 +246,10 @@ static void bt3c_receive(struct bt3c_info *info)
 
                if (info->rx_state == RECV_WAIT_PACKET_TYPE) {
 
-                       bt_cb(info->rx_skb)->pkt_type = inb(iobase + DATA_L);
+                       hci_skb_pkt_type(info->rx_skb) = inb(iobase + DATA_L);
                        inb(iobase + DATA_H);
 
-                       switch (bt_cb(info->rx_skb)->pkt_type) {
+                       switch (hci_skb_pkt_type(info->rx_skb)) {
 
                        case HCI_EVENT_PKT:
                                info->rx_state = RECV_WAIT_EVENT_HEADER;
@@ -268,7 +268,8 @@ static void bt3c_receive(struct bt3c_info *info)
 
                        default:
                                /* Unknown packet */
-                               BT_ERR("Unknown HCI packet with type 0x%02x received", bt_cb(info->rx_skb)->pkt_type);
+                               BT_ERR("Unknown HCI packet with type 0x%02x received",
+                                      hci_skb_pkt_type(info->rx_skb));
                                info->hdev->stat.err_rx++;
 
                                kfree_skb(info->rx_skb);
@@ -411,7 +412,7 @@ static int bt3c_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
        struct bt3c_info *info = hci_get_drvdata(hdev);
        unsigned long flags;
 
-       switch (bt_cb(skb)->pkt_type) {
+       switch (hci_skb_pkt_type(skb)) {
        case HCI_COMMAND_PKT:
                hdev->stat.cmd_tx++;
                break;
@@ -424,7 +425,7 @@ static int bt3c_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
        }
 
        /* Prepend skb with frame type */
-       memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
+       memcpy(skb_push(skb, 1), &hci_skb_pkt_type(skb), 1);
        skb_queue_tail(&(info->txq), skb);
 
        spin_lock_irqsave(&(info->lock), flags);
index 6af917331962409dded11034273af84e98905313..f2b38c880b11b0410b3eb9aba034cdbc6eef9328 100644 (file)
@@ -196,7 +196,7 @@ static int btmrvl_send_sync_cmd(struct btmrvl_private *priv, u16 opcode,
        if (len)
                memcpy(skb_put(skb, len), param, len);
 
-       bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT;
+       hci_skb_pkt_type(skb) = MRVL_VENDOR_PKT;
 
        skb_queue_head(&priv->adapter->tx_queue, skb);
 
@@ -387,7 +387,7 @@ static int btmrvl_tx_pkt(struct btmrvl_private *priv, struct sk_buff *skb)
        skb->data[0] = (skb->len & 0x0000ff);
        skb->data[1] = (skb->len & 0x00ff00) >> 8;
        skb->data[2] = (skb->len & 0xff0000) >> 16;
-       skb->data[3] = bt_cb(skb)->pkt_type;
+       skb->data[3] = hci_skb_pkt_type(skb);
 
        if (priv->hw_host_to_card)
                ret = priv->hw_host_to_card(priv, skb->data, skb->len);
@@ -434,9 +434,9 @@ static int btmrvl_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
 {
        struct btmrvl_private *priv = hci_get_drvdata(hdev);
 
-       BT_DBG("type=%d, len=%d", skb->pkt_type, skb->len);
+       BT_DBG("type=%d, len=%d", hci_skb_pkt_type(skb), skb->len);
 
-       switch (bt_cb(skb)->pkt_type) {
+       switch (hci_skb_pkt_type(skb)) {
        case HCI_COMMAND_PKT:
                hdev->stat.cmd_tx++;
                break;
index 71ea2a3af29340b09ed1a44ccd3f22f840b8e25f..d3a4acdf98c9d17071cff47879e19819a73c694d 100644 (file)
@@ -698,7 +698,7 @@ static int btmrvl_sdio_card_to_host(struct btmrvl_private *priv)
        case HCI_ACLDATA_PKT:
        case HCI_SCODATA_PKT:
        case HCI_EVENT_PKT:
-               bt_cb(skb)->pkt_type = type;
+               hci_skb_pkt_type(skb) = type;
                skb_put(skb, buf_len);
                skb_pull(skb, SDIO_HEADER_LEN);
 
@@ -713,7 +713,7 @@ static int btmrvl_sdio_card_to_host(struct btmrvl_private *priv)
                break;
 
        case MRVL_VENDOR_PKT:
-               bt_cb(skb)->pkt_type = HCI_VENDOR_PKT;
+               hci_skb_pkt_type(skb) = HCI_VENDOR_PKT;
                skb_put(skb, buf_len);
                skb_pull(skb, SDIO_HEADER_LEN);
 
index 7b624423a7e8f790e8448b421d39b1bf91616b23..2b05661e3818e51877655bfbb34450184e988c94 100644 (file)
@@ -86,7 +86,7 @@ static int btsdio_tx_packet(struct btsdio_data *data, struct sk_buff *skb)
        skb->data[0] = (skb->len & 0x0000ff);
        skb->data[1] = (skb->len & 0x00ff00) >> 8;
        skb->data[2] = (skb->len & 0xff0000) >> 16;
-       skb->data[3] = bt_cb(skb)->pkt_type;
+       skb->data[3] = hci_skb_pkt_type(skb);
 
        err = sdio_writesb(data->func, REG_TDAT, skb->data, skb->len);
        if (err < 0) {
@@ -158,7 +158,7 @@ static int btsdio_rx_packet(struct btsdio_data *data)
 
        data->hdev->stat.byte_rx += len;
 
-       bt_cb(skb)->pkt_type = hdr[3];
+       hci_skb_pkt_type(skb) = hdr[3];
 
        err = hci_recv_frame(data->hdev, skb);
        if (err < 0)
@@ -252,7 +252,7 @@ static int btsdio_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
 
        BT_DBG("%s", hdev->name);
 
-       switch (bt_cb(skb)->pkt_type) {
+       switch (hci_skb_pkt_type(skb)) {
        case HCI_COMMAND_PKT:
                hdev->stat.cmd_tx++;
                break;
index bb8e4025fb9eb8d30d670ce03d9afcc245336e88..9624b29f834977a539300938a71e8cefdf750fc3 100644 (file)
@@ -200,9 +200,9 @@ static void btuart_receive(struct btuart_info *info)
 
                if (info->rx_state == RECV_WAIT_PACKET_TYPE) {
 
-                       bt_cb(info->rx_skb)->pkt_type = inb(iobase + UART_RX);
+                       hci_skb_pkt_type(info->rx_skb) = inb(iobase + UART_RX);
 
-                       switch (bt_cb(info->rx_skb)->pkt_type) {
+                       switch (hci_skb_pkt_type(info->rx_skb)) {
 
                        case HCI_EVENT_PKT:
                                info->rx_state = RECV_WAIT_EVENT_HEADER;
@@ -221,7 +221,8 @@ static void btuart_receive(struct btuart_info *info)
 
                        default:
                                /* Unknown packet */
-                               BT_ERR("Unknown HCI packet with type 0x%02x received", bt_cb(info->rx_skb)->pkt_type);
+                               BT_ERR("Unknown HCI packet with type 0x%02x received",
+                                      hci_skb_pkt_type(info->rx_skb));
                                info->hdev->stat.err_rx++;
 
                                kfree_skb(info->rx_skb);
@@ -424,7 +425,7 @@ static int btuart_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
 {
        struct btuart_info *info = hci_get_drvdata(hdev);
 
-       switch (bt_cb(skb)->pkt_type) {
+       switch (hci_skb_pkt_type(skb)) {
        case HCI_COMMAND_PKT:
                hdev->stat.cmd_tx++;
                break;
@@ -437,7 +438,7 @@ static int btuart_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
        }
 
        /* Prepend skb with frame type */
-       memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
+       memcpy(skb_push(skb, 1), &hci_skb_pkt_type(skb), 1);
        skb_queue_tail(&(info->txq), skb);
 
        btuart_write_wakeup(info);
index 92f0ee388f9e0bfddd0cdf32b684edf25741d991..806353410eb7e2d2a99176eff9a378b39c590655 100644 (file)
@@ -437,22 +437,22 @@ static int btusb_recv_intr(struct btusb_data *data, void *buffer, int count)
                                break;
                        }
 
-                       bt_cb(skb)->pkt_type = HCI_EVENT_PKT;
-                       bt_cb(skb)->expect = HCI_EVENT_HDR_SIZE;
+                       hci_skb_pkt_type(skb) = HCI_EVENT_PKT;
+                       hci_skb_expect(skb) = HCI_EVENT_HDR_SIZE;
                }
 
-               len = min_t(uint, bt_cb(skb)->expect, count);
+               len = min_t(uint, hci_skb_expect(skb), count);
                memcpy(skb_put(skb, len), buffer, len);
 
                count -= len;
                buffer += len;
-               bt_cb(skb)->expect -= len;
+               hci_skb_expect(skb) -= len;
 
                if (skb->len == HCI_EVENT_HDR_SIZE) {
                        /* Complete event header */
-                       bt_cb(skb)->expect = hci_event_hdr(skb)->plen;
+                       hci_skb_expect(skb) = hci_event_hdr(skb)->plen;
 
-                       if (skb_tailroom(skb) < bt_cb(skb)->expect) {
+                       if (skb_tailroom(skb) < hci_skb_expect(skb)) {
                                kfree_skb(skb);
                                skb = NULL;
 
@@ -461,7 +461,7 @@ static int btusb_recv_intr(struct btusb_data *data, void *buffer, int count)
                        }
                }
 
-               if (bt_cb(skb)->expect == 0) {
+               if (!hci_skb_expect(skb)) {
                        /* Complete frame */
                        data->recv_event(data->hdev, skb);
                        skb = NULL;
@@ -492,24 +492,24 @@ static int btusb_recv_bulk(struct btusb_data *data, void *buffer, int count)
                                break;
                        }
 
-                       bt_cb(skb)->pkt_type = HCI_ACLDATA_PKT;
-                       bt_cb(skb)->expect = HCI_ACL_HDR_SIZE;
+                       hci_skb_pkt_type(skb) = HCI_ACLDATA_PKT;
+                       hci_skb_expect(skb) = HCI_ACL_HDR_SIZE;
                }
 
-               len = min_t(uint, bt_cb(skb)->expect, count);
+               len = min_t(uint, hci_skb_expect(skb), count);
                memcpy(skb_put(skb, len), buffer, len);
 
                count -= len;
                buffer += len;
-               bt_cb(skb)->expect -= len;
+               hci_skb_expect(skb) -= len;
 
                if (skb->len == HCI_ACL_HDR_SIZE) {
                        __le16 dlen = hci_acl_hdr(skb)->dlen;
 
                        /* Complete ACL header */
-                       bt_cb(skb)->expect = __le16_to_cpu(dlen);
+                       hci_skb_expect(skb) = __le16_to_cpu(dlen);
 
-                       if (skb_tailroom(skb) < bt_cb(skb)->expect) {
+                       if (skb_tailroom(skb) < hci_skb_expect(skb)) {
                                kfree_skb(skb);
                                skb = NULL;
 
@@ -518,7 +518,7 @@ static int btusb_recv_bulk(struct btusb_data *data, void *buffer, int count)
                        }
                }
 
-               if (bt_cb(skb)->expect == 0) {
+               if (!hci_skb_expect(skb)) {
                        /* Complete frame */
                        hci_recv_frame(data->hdev, skb);
                        skb = NULL;
@@ -549,22 +549,22 @@ static int btusb_recv_isoc(struct btusb_data *data, void *buffer, int count)
                                break;
                        }
 
-                       bt_cb(skb)->pkt_type = HCI_SCODATA_PKT;
-                       bt_cb(skb)->expect = HCI_SCO_HDR_SIZE;
+                       hci_skb_pkt_type(skb) = HCI_SCODATA_PKT;
+                       hci_skb_expect(skb) = HCI_SCO_HDR_SIZE;
                }
 
-               len = min_t(uint, bt_cb(skb)->expect, count);
+               len = min_t(uint, hci_skb_expect(skb), count);
                memcpy(skb_put(skb, len), buffer, len);
 
                count -= len;
                buffer += len;
-               bt_cb(skb)->expect -= len;
+               hci_skb_expect(skb) -= len;
 
                if (skb->len == HCI_SCO_HDR_SIZE) {
                        /* Complete SCO header */
-                       bt_cb(skb)->expect = hci_sco_hdr(skb)->dlen;
+                       hci_skb_expect(skb) = hci_sco_hdr(skb)->dlen;
 
-                       if (skb_tailroom(skb) < bt_cb(skb)->expect) {
+                       if (skb_tailroom(skb) < hci_skb_expect(skb)) {
                                kfree_skb(skb);
                                skb = NULL;
 
@@ -573,7 +573,7 @@ static int btusb_recv_isoc(struct btusb_data *data, void *buffer, int count)
                        }
                }
 
-               if (bt_cb(skb)->expect == 0) {
+               if (!hci_skb_expect(skb)) {
                        /* Complete frame */
                        hci_recv_frame(data->hdev, skb);
                        skb = NULL;
@@ -1257,7 +1257,7 @@ static int btusb_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
 
        BT_DBG("%s", hdev->name);
 
-       switch (bt_cb(skb)->pkt_type) {
+       switch (hci_skb_pkt_type(skb)) {
        case HCI_COMMAND_PKT:
                urb = alloc_ctrl_urb(hdev, skb);
                if (IS_ERR(urb))
@@ -1853,7 +1853,7 @@ static int inject_cmd_complete(struct hci_dev *hdev, __u16 opcode)
 
        *skb_put(skb, 1) = 0x00;
 
-       bt_cb(skb)->pkt_type = HCI_EVENT_PKT;
+       hci_skb_pkt_type(skb) = HCI_EVENT_PKT;
 
        return hci_recv_frame(hdev, skb);
 }
@@ -1945,7 +1945,7 @@ static int btusb_send_frame_intel(struct hci_dev *hdev, struct sk_buff *skb)
 
        BT_DBG("%s", hdev->name);
 
-       switch (bt_cb(skb)->pkt_type) {
+       switch (hci_skb_pkt_type(skb)) {
        case HCI_COMMAND_PKT:
                if (test_bit(BTUSB_BOOTLOADER, &data->flags)) {
                        struct hci_command_hdr *cmd = (void *)skb->data;
index 57eb935aedc73b4a782d42f676ec06a0ad5bed5a..24a652f9252be8995747e7b361691c6da5123e38 100644 (file)
@@ -249,10 +249,10 @@ static int ti_st_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
        hst = hci_get_drvdata(hdev);
 
        /* Prepend skb with frame type */
-       memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
+       memcpy(skb_push(skb, 1), &hci_skb_pkt_type(skb), 1);
 
-       BT_DBG("%s: type %d len %d", hdev->name, bt_cb(skb)->pkt_type,
-                       skb->len);
+       BT_DBG("%s: type %d len %d", hdev->name, hci_skb_pkt_type(skb),
+              skb->len);
 
        /* Insert skb to shared transport layer's transmit queue.
         * Freeing skb memory is taken care in shared transport layer,
@@ -268,7 +268,7 @@ static int ti_st_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
 
        /* ST accepted our skb. So, Go ahead and do rest */
        hdev->stat.byte_tx += len;
-       ti_st_tx_complete(hst, bt_cb(skb)->pkt_type);
+       ti_st_tx_complete(hst, hci_skb_pkt_type(skb));
 
        return 0;
 }
index 5026f66fac88d2a7d8726a917ad0fe985be22a6a..6317c6f323bf1d63ec4960254cca20150c2c0974 100644 (file)
@@ -239,7 +239,7 @@ static void dtl1_receive(struct dtl1_info *info)
                                info->rx_count = nsh->len + (nsh->len & 0x0001);
                                break;
                        case RECV_WAIT_DATA:
-                               bt_cb(info->rx_skb)->pkt_type = nsh->type;
+                               hci_skb_pkt_type(info->rx_skb) = nsh->type;
 
                                /* remove PAD byte if it exists */
                                if (nsh->len & 0x0001) {
@@ -250,7 +250,7 @@ static void dtl1_receive(struct dtl1_info *info)
                                /* remove NSH */
                                skb_pull(info->rx_skb, NSHL);
 
-                               switch (bt_cb(info->rx_skb)->pkt_type) {
+                               switch (hci_skb_pkt_type(info->rx_skb)) {
                                case 0x80:
                                        /* control data for the Nokia Card */
                                        dtl1_control(info, info->rx_skb);
@@ -259,12 +259,13 @@ static void dtl1_receive(struct dtl1_info *info)
                                case 0x83:
                                case 0x84:
                                        /* send frame to the HCI layer */
-                                       bt_cb(info->rx_skb)->pkt_type &= 0x0f;
+                                       hci_skb_pkt_type(info->rx_skb) &= 0x0f;
                                        hci_recv_frame(info->hdev, info->rx_skb);
                                        break;
                                default:
                                        /* unknown packet */
-                                       BT_ERR("Unknown HCI packet with type 0x%02x received", bt_cb(info->rx_skb)->pkt_type);
+                                       BT_ERR("Unknown HCI packet with type 0x%02x received",
+                                              hci_skb_pkt_type(info->rx_skb));
                                        kfree_skb(info->rx_skb);
                                        break;
                                }
@@ -386,7 +387,7 @@ static int dtl1_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
        struct sk_buff *s;
        struct nsh nsh;
 
-       switch (bt_cb(skb)->pkt_type) {
+       switch (hci_skb_pkt_type(skb)) {
        case HCI_COMMAND_PKT:
                hdev->stat.cmd_tx++;
                nsh.type = 0x81;
index d776dfd5147811ef37071e68ffd9d9ceaa961c0d..0ccf6bf01ed41eb39afcb16af924dca760d360f3 100644 (file)
@@ -205,7 +205,7 @@ static int ath_enqueue(struct hci_uart *hu, struct sk_buff *skb)
 {
        struct ath_struct *ath = hu->priv;
 
-       if (bt_cb(skb)->pkt_type == HCI_SCODATA_PKT) {
+       if (hci_skb_pkt_type(skb) == HCI_SCODATA_PKT) {
                kfree_skb(skb);
                return 0;
        }
@@ -213,7 +213,7 @@ static int ath_enqueue(struct hci_uart *hu, struct sk_buff *skb)
        /* Update power management enable flag with parameters of
         * HCI sleep enable vendor specific HCI command.
         */
-       if (bt_cb(skb)->pkt_type == HCI_COMMAND_PKT) {
+       if (hci_skb_pkt_type(skb) == HCI_COMMAND_PKT) {
                struct hci_command_hdr *hdr = (void *)skb->data;
 
                if (__le16_to_cpu(hdr->opcode) == HCI_OP_ATH_SLEEP)
@@ -223,7 +223,7 @@ static int ath_enqueue(struct hci_uart *hu, struct sk_buff *skb)
        BT_DBG("hu %p skb %p", hu, skb);
 
        /* Prepend skb with frame type */
-       memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
+       memcpy(skb_push(skb, 1), &hci_skb_pkt_type(skb), 1);
 
        skb_queue_tail(&ath->txq, skb);
        set_bit(HCI_UART_SENDING, &hu->tx_state);
index cb852cc750b78256cd05fb62eda18dfb28c246aa..3eed35e0207c431b5bd2fbed1cbe0c3494c8c8e8 100644 (file)
@@ -472,7 +472,7 @@ static int bcm_enqueue(struct hci_uart *hu, struct sk_buff *skb)
        bt_dev_dbg(hu->hdev, "hu %p skb %p", hu, skb);
 
        /* Prepend skb with frame type */
-       memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
+       memcpy(skb_push(skb, 1), &hci_skb_pkt_type(skb), 1);
        skb_queue_tail(&bcm->txq, skb);
 
        return 0;
index d0b615a932d11b97cf396a75aad7b23e35accdee..064f2fefad6228748f789364a66437ecb527353c 100644 (file)
@@ -155,7 +155,7 @@ static int bcsp_enqueue(struct hci_uart *hu, struct sk_buff *skb)
                return 0;
        }
 
-       switch (bt_cb(skb)->pkt_type) {
+       switch (hci_skb_pkt_type(skb)) {
        case HCI_ACLDATA_PKT:
        case HCI_COMMAND_PKT:
                skb_queue_tail(&bcsp->rel, skb);
@@ -231,7 +231,7 @@ static struct sk_buff *bcsp_prepare_pkt(struct bcsp_struct *bcsp, u8 *data,
        if (!nskb)
                return NULL;
 
-       bt_cb(nskb)->pkt_type = pkt_type;
+       hci_skb_pkt_type(nskb) = pkt_type;
 
        bcsp_slip_msgdelim(nskb);
 
@@ -291,7 +291,10 @@ static struct sk_buff *bcsp_dequeue(struct hci_uart *hu)
 
        skb = skb_dequeue(&bcsp->unrel);
        if (skb != NULL) {
-               struct sk_buff *nskb = bcsp_prepare_pkt(bcsp, skb->data, skb->len, bt_cb(skb)->pkt_type);
+               struct sk_buff *nskb;
+
+               nskb = bcsp_prepare_pkt(bcsp, skb->data, skb->len,
+                                       hci_skb_pkt_type(skb));
                if (nskb) {
                        kfree_skb(skb);
                        return nskb;
@@ -310,8 +313,10 @@ static struct sk_buff *bcsp_dequeue(struct hci_uart *hu)
        if (bcsp->unack.qlen < BCSP_TXWINSIZE) {
                skb = skb_dequeue(&bcsp->rel);
                if (skb != NULL) {
-                       struct sk_buff *nskb = bcsp_prepare_pkt(bcsp, skb->data, skb->len,
-                                                               bt_cb(skb)->pkt_type);
+                       struct sk_buff *nskb;
+
+                       nskb = bcsp_prepare_pkt(bcsp, skb->data, skb->len,
+                                               hci_skb_pkt_type(skb));
                        if (nskb) {
                                __skb_queue_tail(&bcsp->unack, skb);
                                mod_timer(&bcsp->tbcsp, jiffies + HZ / 4);
@@ -412,7 +417,7 @@ static void bcsp_handle_le_pkt(struct hci_uart *hu)
                if (!nskb)
                        return;
                memcpy(skb_put(nskb, 4), conf_rsp_pkt, 4);
-               bt_cb(nskb)->pkt_type = BCSP_LE_PKT;
+               hci_skb_pkt_type(nskb) = BCSP_LE_PKT;
 
                skb_queue_head(&bcsp->unrel, nskb);
                hci_uart_tx_wakeup(hu);
@@ -494,14 +499,14 @@ static void bcsp_complete_rx_pkt(struct hci_uart *hu)
        bcsp_pkt_cull(bcsp);
        if ((bcsp->rx_skb->data[1] & 0x0f) == 6 &&
                        bcsp->rx_skb->data[0] & 0x80) {
-               bt_cb(bcsp->rx_skb)->pkt_type = HCI_ACLDATA_PKT;
+               hci_skb_pkt_type(bcsp->rx_skb) = HCI_ACLDATA_PKT;
                pass_up = 1;
        } else if ((bcsp->rx_skb->data[1] & 0x0f) == 5 &&
                        bcsp->rx_skb->data[0] & 0x80) {
-               bt_cb(bcsp->rx_skb)->pkt_type = HCI_EVENT_PKT;
+               hci_skb_pkt_type(bcsp->rx_skb) = HCI_EVENT_PKT;
                pass_up = 1;
        } else if ((bcsp->rx_skb->data[1] & 0x0f) == 7) {
-               bt_cb(bcsp->rx_skb)->pkt_type = HCI_SCODATA_PKT;
+               hci_skb_pkt_type(bcsp->rx_skb) = HCI_SCODATA_PKT;
                pass_up = 1;
        } else if ((bcsp->rx_skb->data[1] & 0x0f) == 1 &&
                        !(bcsp->rx_skb->data[0] & 0x80)) {
@@ -523,7 +528,7 @@ static void bcsp_complete_rx_pkt(struct hci_uart *hu)
                                hdr.evt = 0xff;
                                hdr.plen = bcsp->rx_skb->len;
                                memcpy(skb_push(bcsp->rx_skb, HCI_EVENT_HDR_SIZE), &hdr, HCI_EVENT_HDR_SIZE);
-                               bt_cb(bcsp->rx_skb)->pkt_type = HCI_EVENT_PKT;
+                               hci_skb_pkt_type(bcsp->rx_skb) = HCI_EVENT_PKT;
 
                                hci_recv_frame(hu->hdev, bcsp->rx_skb);
                        } else {
index a6fce48da0fb382df7e8600aea320e79ef05713c..635597b6e1681f25e8ed6004c6960369dcae3e1b 100644 (file)
@@ -108,7 +108,7 @@ static int h4_enqueue(struct hci_uart *hu, struct sk_buff *skb)
        BT_DBG("hu %p skb %p", hu, skb);
 
        /* Prepend skb with frame type */
-       memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
+       memcpy(skb_push(skb, 1), &hci_skb_pkt_type(skb), 1);
        skb_queue_tail(&h4->txq, skb);
 
        return 0;
@@ -184,8 +184,8 @@ struct sk_buff *h4_recv_buf(struct hci_dev *hdev, struct sk_buff *skb,
                                if (!skb)
                                        return ERR_PTR(-ENOMEM);
 
-                               bt_cb(skb)->pkt_type = (&pkts[i])->type;
-                               bt_cb(skb)->expect = (&pkts[i])->hlen;
+                               hci_skb_pkt_type(skb) = (&pkts[i])->type;
+                               hci_skb_expect(skb) = (&pkts[i])->hlen;
                                break;
                        }
 
@@ -197,18 +197,18 @@ struct sk_buff *h4_recv_buf(struct hci_dev *hdev, struct sk_buff *skb,
                        buffer += 1;
                }
 
-               len = min_t(uint, bt_cb(skb)->expect - skb->len, count);
+               len = min_t(uint, hci_skb_expect(skb) - skb->len, count);
                memcpy(skb_put(skb, len), buffer, len);
 
                count -= len;
                buffer += len;
 
                /* Check for partial packet */
-               if (skb->len < bt_cb(skb)->expect)
+               if (skb->len < hci_skb_expect(skb))
                        continue;
 
                for (i = 0; i < pkts_count; i++) {
-                       if (bt_cb(skb)->pkt_type == (&pkts[i])->type)
+                       if (hci_skb_pkt_type(skb) == (&pkts[i])->type)
                                break;
                }
 
@@ -228,7 +228,7 @@ struct sk_buff *h4_recv_buf(struct hci_dev *hdev, struct sk_buff *skb,
                        case 1:
                                /* Single octet variable length */
                                dlen = skb->data[(&pkts[i])->loff];
-                               bt_cb(skb)->expect += dlen;
+                               hci_skb_expect(skb) += dlen;
 
                                if (skb_tailroom(skb) < dlen) {
                                        kfree_skb(skb);
@@ -239,7 +239,7 @@ struct sk_buff *h4_recv_buf(struct hci_dev *hdev, struct sk_buff *skb,
                                /* Double octet variable length */
                                dlen = get_unaligned_le16(skb->data +
                                                          (&pkts[i])->loff);
-                               bt_cb(skb)->expect += dlen;
+                               hci_skb_expect(skb) += dlen;
 
                                if (skb_tailroom(skb) < dlen) {
                                        kfree_skb(skb);
index abee2216fdeb263bb6cc1d1052a070825f5926cd..ebefe5eb6b713ce2c083361df34c88cf9a14782d 100644 (file)
@@ -107,7 +107,7 @@ static void h5_link_control(struct hci_uart *hu, const void *data, size_t len)
        if (!nskb)
                return;
 
-       bt_cb(nskb)->pkt_type = HCI_3WIRE_LINK_PKT;
+       hci_skb_pkt_type(nskb) = HCI_3WIRE_LINK_PKT;
 
        memcpy(skb_put(nskb, len), data, len);
 
@@ -360,7 +360,7 @@ static void h5_complete_rx_pkt(struct hci_uart *hu)
        case HCI_EVENT_PKT:
        case HCI_ACLDATA_PKT:
        case HCI_SCODATA_PKT:
-               bt_cb(h5->rx_skb)->pkt_type = H5_HDR_PKT_TYPE(hdr);
+               hci_skb_pkt_type(h5->rx_skb) = H5_HDR_PKT_TYPE(hdr);
 
                /* Remove Three-wire header */
                skb_pull(h5->rx_skb, 4);
@@ -562,7 +562,7 @@ static int h5_enqueue(struct hci_uart *hu, struct sk_buff *skb)
                return 0;
        }
 
-       switch (bt_cb(skb)->pkt_type) {
+       switch (hci_skb_pkt_type(skb)) {
        case HCI_ACLDATA_PKT:
        case HCI_COMMAND_PKT:
                skb_queue_tail(&h5->rel, skb);
@@ -573,7 +573,7 @@ static int h5_enqueue(struct hci_uart *hu, struct sk_buff *skb)
                break;
 
        default:
-               BT_ERR("Unknown packet type %u", bt_cb(skb)->pkt_type);
+               BT_ERR("Unknown packet type %u", hci_skb_pkt_type(skb));
                kfree_skb(skb);
                break;
        }
@@ -642,7 +642,7 @@ static struct sk_buff *h5_prepare_pkt(struct hci_uart *hu, u8 pkt_type,
        if (!nskb)
                return NULL;
 
-       bt_cb(nskb)->pkt_type = pkt_type;
+       hci_skb_pkt_type(nskb) = pkt_type;
 
        h5_slip_delim(nskb);
 
@@ -697,7 +697,7 @@ static struct sk_buff *h5_dequeue(struct hci_uart *hu)
 
        skb = skb_dequeue(&h5->unrel);
        if (skb) {
-               nskb = h5_prepare_pkt(hu, bt_cb(skb)->pkt_type,
+               nskb = h5_prepare_pkt(hu, hci_skb_pkt_type(skb),
                                      skb->data, skb->len);
                if (nskb) {
                        kfree_skb(skb);
@@ -715,7 +715,7 @@ static struct sk_buff *h5_dequeue(struct hci_uart *hu)
 
        skb = skb_dequeue(&h5->rel);
        if (skb) {
-               nskb = h5_prepare_pkt(hu, bt_cb(skb)->pkt_type,
+               nskb = h5_prepare_pkt(hu, hci_skb_pkt_type(skb),
                                      skb->data, skb->len);
                if (nskb) {
                        __skb_queue_tail(&h5->unack, skb);
index 4a414a5a31655a4d3d0a8a0b03749ef73ff14357..69760e2850d96b1281833e2cfaf61dea95f022c5 100644 (file)
@@ -186,7 +186,7 @@ static int intel_lpm_suspend(struct hci_uart *hu)
        }
 
        memcpy(skb_put(skb, sizeof(suspend)), suspend, sizeof(suspend));
-       bt_cb(skb)->pkt_type = HCI_LPM_PKT;
+       hci_skb_pkt_type(skb) = HCI_LPM_PKT;
 
        set_bit(STATE_LPM_TRANSACTION, &intel->flags);
 
@@ -230,7 +230,7 @@ static int intel_lpm_resume(struct hci_uart *hu)
                return -ENOMEM;
        }
 
-       bt_cb(skb)->pkt_type = HCI_LPM_WAKE_PKT;
+       hci_skb_pkt_type(skb) = HCI_LPM_WAKE_PKT;
 
        set_bit(STATE_LPM_TRANSACTION, &intel->flags);
 
@@ -272,7 +272,7 @@ static int intel_lpm_host_wake(struct hci_uart *hu)
 
        memcpy(skb_put(skb, sizeof(lpm_resume_ack)), lpm_resume_ack,
               sizeof(lpm_resume_ack));
-       bt_cb(skb)->pkt_type = HCI_LPM_PKT;
+       hci_skb_pkt_type(skb) = HCI_LPM_PKT;
 
        /* LPM flow is a priority, enqueue packet at list head */
        skb_queue_head(&intel->txq, skb);
@@ -467,7 +467,7 @@ static int inject_cmd_complete(struct hci_dev *hdev, __u16 opcode)
 
        *skb_put(skb, 1) = 0x00;
 
-       bt_cb(skb)->pkt_type = HCI_EVENT_PKT;
+       hci_skb_pkt_type(skb) = HCI_EVENT_PKT;
 
        return hci_recv_frame(hdev, skb);
 }
@@ -517,7 +517,7 @@ static int intel_set_baudrate(struct hci_uart *hu, unsigned int speed)
        }
 
        memcpy(skb_put(skb, sizeof(speed_cmd)), speed_cmd, sizeof(speed_cmd));
-       bt_cb(skb)->pkt_type = HCI_COMMAND_PKT;
+       hci_skb_pkt_type(skb) = HCI_COMMAND_PKT;
 
        hci_uart_set_flow_control(hu, true);
 
@@ -1126,7 +1126,7 @@ static struct sk_buff *intel_dequeue(struct hci_uart *hu)
                return skb;
 
        if (test_bit(STATE_BOOTLOADER, &intel->flags) &&
-           (bt_cb(skb)->pkt_type == HCI_COMMAND_PKT)) {
+           (hci_skb_pkt_type(skb) == HCI_COMMAND_PKT)) {
                struct hci_command_hdr *cmd = (void *)skb->data;
                __u16 opcode = le16_to_cpu(cmd->opcode);
 
@@ -1140,7 +1140,7 @@ static struct sk_buff *intel_dequeue(struct hci_uart *hu)
        }
 
        /* Prepend skb with frame type */
-       memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
+       memcpy(skb_push(skb, 1), &hci_skb_pkt_type(skb), 1);
 
        return skb;
 }
index 96bcec5598c221e4cec2841bbc4eb521d20778c1..03146d707a95cbee41917425a64cc59252885791 100644 (file)
@@ -162,7 +162,7 @@ restart:
                        break;
                }
 
-               hci_uart_tx_complete(hu, bt_cb(skb)->pkt_type);
+               hci_uart_tx_complete(hu, hci_skb_pkt_type(skb));
                kfree_skb(skb);
        }
 
@@ -248,7 +248,8 @@ static int hci_uart_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
 {
        struct hci_uart *hu = hci_get_drvdata(hdev);
 
-       BT_DBG("%s: type %d len %d", hdev->name, bt_cb(skb)->pkt_type, skb->len);
+       BT_DBG("%s: type %d len %d", hdev->name, hci_skb_pkt_type(skb),
+              skb->len);
 
        hu->proto->enqueue(hu, skb);
 
index 9ee24b075f7973e7578043c74e7421ddd535b7b5..02692fe30279cbea1a82e5445a2a5c0884d6f7a4 100644 (file)
@@ -307,7 +307,7 @@ static int ll_enqueue(struct hci_uart *hu, struct sk_buff *skb)
        BT_DBG("hu %p skb %p", hu, skb);
 
        /* Prepend skb with frame type */
-       memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
+       memcpy(skb_push(skb, 1), &hci_skb_pkt_type(skb), 1);
 
        /* lock hcill state */
        spin_lock_irqsave(&ll->hcill_lock, flags);
@@ -493,7 +493,7 @@ static int ll_recv(struct hci_uart *hu, const void *data, int count)
                        return -ENOMEM;
                }
 
-               bt_cb(ll->rx_skb)->pkt_type = type;
+               hci_skb_pkt_type(ll->rx_skb) = type;
        }
 
        return count;
index 71325e443e4631e732c457134cf99822f2610700..683c2b642057f8f3a61e218df3ea37956fc6b67b 100644 (file)
@@ -678,7 +678,7 @@ static int qca_enqueue(struct hci_uart *hu, struct sk_buff *skb)
               qca->tx_ibs_state);
 
        /* Prepend skb with frame type */
-       memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
+       memcpy(skb_push(skb, 1), &hci_skb_pkt_type(skb), 1);
 
        /* Don't go to sleep in middle of patch download or
         * Out-Of-Band(GPIOs control) sleep is selected.
@@ -873,7 +873,7 @@ static int qca_set_baudrate(struct hci_dev *hdev, uint8_t baudrate)
 
        /* Assign commands to change baudrate and packet type. */
        memcpy(skb_put(skb, sizeof(cmd)), cmd, sizeof(cmd));
-       bt_cb(skb)->pkt_type = HCI_COMMAND_PKT;
+       hci_skb_pkt_type(skb) = HCI_COMMAND_PKT;
 
        skb_queue_tail(&qca->txq, skb);
        hci_uart_tx_wakeup(hu);
index ed888e302bc396f000035a63ac310686262fc924..80783dcb7f57525411cb33c4f3d8076dd92920ea 100644 (file)
@@ -80,7 +80,7 @@ static int vhci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
 {
        struct vhci_data *data = hci_get_drvdata(hdev);
 
-       memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
+       memcpy(skb_push(skb, 1), &hci_skb_pkt_type(skb), 1);
        skb_queue_tail(&data->readq, skb);
 
        wake_up_interruptible(&data->read_wait);
@@ -140,7 +140,7 @@ static int vhci_create_device(struct vhci_data *data, __u8 opcode)
                return -EBUSY;
        }
 
-       bt_cb(skb)->pkt_type = HCI_VENDOR_PKT;
+       hci_skb_pkt_type(skb) = HCI_VENDOR_PKT;
 
        *skb_put(skb, 1) = 0xff;
        *skb_put(skb, 1) = opcode;
@@ -183,7 +183,7 @@ static inline ssize_t vhci_get_user(struct vhci_data *data,
                        return -ENODEV;
                }
 
-               bt_cb(skb)->pkt_type = pkt_type;
+               hci_skb_pkt_type(skb) = pkt_type;
 
                ret = hci_recv_frame(data->hdev, skb);
                break;
@@ -234,7 +234,7 @@ static inline ssize_t vhci_put_user(struct vhci_data *data,
 
        data->hdev->stat.byte_tx += len;
 
-       switch (bt_cb(skb)->pkt_type) {
+       switch (hci_skb_pkt_type(skb)) {
        case HCI_COMMAND_PKT:
                data->hdev->stat.cmd_tx++;
                break;