Commit 618e8bc2 authored by Marcel Holtmann's avatar Marcel Holtmann

Bluetooth: Use new hci_skb_pkt_* wrappers for drivers

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: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
parent d79f34e3
...@@ -324,7 +324,7 @@ static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned ch ...@@ -324,7 +324,7 @@ static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned ch
return -ENOMEM; return -ENOMEM;
} }
bt_cb(skb)->pkt_type = pkt_type; hci_skb_pkt_type(skb) = pkt_type;
data->reassembly = skb; data->reassembly = skb;
} else { } else {
...@@ -469,9 +469,10 @@ static int bfusb_send_frame(struct hci_dev *hdev, struct sk_buff *skb) ...@@ -469,9 +469,10 @@ static int bfusb_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
unsigned char buf[3]; unsigned char buf[3];
int sent = 0, size, count; 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: case HCI_COMMAND_PKT:
hdev->stat.cmd_tx++; hdev->stat.cmd_tx++;
break; break;
...@@ -484,7 +485,7 @@ static int bfusb_send_frame(struct hci_dev *hdev, struct sk_buff *skb) ...@@ -484,7 +485,7 @@ static int bfusb_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
} }
/* Prepend skb with frame type */ /* 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; count = skb->len;
......
...@@ -261,7 +261,7 @@ static void bluecard_write_wakeup(struct bluecard_info *info) ...@@ -261,7 +261,7 @@ static void bluecard_write_wakeup(struct bluecard_info *info)
if (!skb) if (!skb)
break; break;
if (bt_cb(skb)->pkt_type & 0x80) { if (hci_skb_pkt_type(skb) & 0x80) {
/* Disable RTS */ /* Disable RTS */
info->ctrl_reg |= REG_CONTROL_RTS; info->ctrl_reg |= REG_CONTROL_RTS;
outb(info->ctrl_reg, iobase + REG_CONTROL); outb(info->ctrl_reg, iobase + REG_CONTROL);
...@@ -279,13 +279,13 @@ static void bluecard_write_wakeup(struct bluecard_info *info) ...@@ -279,13 +279,13 @@ static void bluecard_write_wakeup(struct bluecard_info *info)
/* Mark the buffer as dirty */ /* Mark the buffer as dirty */
clear_bit(ready_bit, &(info->tx_state)); 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); DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wq);
DEFINE_WAIT(wait); DEFINE_WAIT(wait);
unsigned char baud_reg; unsigned char baud_reg;
switch (bt_cb(skb)->pkt_type) { switch (hci_skb_pkt_type(skb)) {
case PKT_BAUD_RATE_460800: case PKT_BAUD_RATE_460800:
baud_reg = REG_CONTROL_BAUD_RATE_460800; baud_reg = REG_CONTROL_BAUD_RATE_460800;
break; break;
...@@ -402,9 +402,9 @@ static void bluecard_receive(struct bluecard_info *info, ...@@ -402,9 +402,9 @@ static void bluecard_receive(struct bluecard_info *info,
if (info->rx_state == RECV_WAIT_PACKET_TYPE) { 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: case 0x00:
/* init packet */ /* init packet */
...@@ -436,7 +436,8 @@ static void bluecard_receive(struct bluecard_info *info, ...@@ -436,7 +436,8 @@ static void bluecard_receive(struct bluecard_info *info,
default: default:
/* unknown packet */ /* 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++; info->hdev->stat.err_rx++;
kfree_skb(info->rx_skb); kfree_skb(info->rx_skb);
...@@ -578,21 +579,21 @@ static int bluecard_hci_set_baud_rate(struct hci_dev *hdev, int baud) ...@@ -578,21 +579,21 @@ static int bluecard_hci_set_baud_rate(struct hci_dev *hdev, int baud)
switch (baud) { switch (baud) {
case 460800: case 460800:
cmd[4] = 0x00; cmd[4] = 0x00;
bt_cb(skb)->pkt_type = PKT_BAUD_RATE_460800; hci_skb_pkt_type(skb) = PKT_BAUD_RATE_460800;
break; break;
case 230400: case 230400:
cmd[4] = 0x01; cmd[4] = 0x01;
bt_cb(skb)->pkt_type = PKT_BAUD_RATE_230400; hci_skb_pkt_type(skb) = PKT_BAUD_RATE_230400;
break; break;
case 115200: case 115200:
cmd[4] = 0x02; cmd[4] = 0x02;
bt_cb(skb)->pkt_type = PKT_BAUD_RATE_115200; hci_skb_pkt_type(skb) = PKT_BAUD_RATE_115200;
break; break;
case 57600: case 57600:
/* Fall through... */ /* Fall through... */
default: default:
cmd[4] = 0x03; cmd[4] = 0x03;
bt_cb(skb)->pkt_type = PKT_BAUD_RATE_57600; hci_skb_pkt_type(skb) = PKT_BAUD_RATE_57600;
break; break;
} }
...@@ -660,7 +661,7 @@ static int bluecard_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb) ...@@ -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); struct bluecard_info *info = hci_get_drvdata(hdev);
switch (bt_cb(skb)->pkt_type) { switch (hci_skb_pkt_type(skb)) {
case HCI_COMMAND_PKT: case HCI_COMMAND_PKT:
hdev->stat.cmd_tx++; hdev->stat.cmd_tx++;
break; break;
...@@ -673,7 +674,7 @@ static int bluecard_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb) ...@@ -673,7 +674,7 @@ static int bluecard_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
} }
/* Prepend skb with frame type */ /* 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); skb_queue_tail(&(info->txq), skb);
bluecard_write_wakeup(info); bluecard_write_wakeup(info);
......
...@@ -295,9 +295,9 @@ static int bpa10x_send_frame(struct hci_dev *hdev, struct sk_buff *skb) ...@@ -295,9 +295,9 @@ static int bpa10x_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
return -ENOMEM; return -ENOMEM;
/* Prepend skb with frame type */ /* 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: case HCI_COMMAND_PKT:
dr = kmalloc(sizeof(*dr), GFP_ATOMIC); dr = kmalloc(sizeof(*dr), GFP_ATOMIC);
if (!dr) { if (!dr) {
......
...@@ -246,10 +246,10 @@ static void bt3c_receive(struct bt3c_info *info) ...@@ -246,10 +246,10 @@ static void bt3c_receive(struct bt3c_info *info)
if (info->rx_state == RECV_WAIT_PACKET_TYPE) { 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); inb(iobase + DATA_H);
switch (bt_cb(info->rx_skb)->pkt_type) { switch (hci_skb_pkt_type(info->rx_skb)) {
case HCI_EVENT_PKT: case HCI_EVENT_PKT:
info->rx_state = RECV_WAIT_EVENT_HEADER; info->rx_state = RECV_WAIT_EVENT_HEADER;
...@@ -268,7 +268,8 @@ static void bt3c_receive(struct bt3c_info *info) ...@@ -268,7 +268,8 @@ static void bt3c_receive(struct bt3c_info *info)
default: default:
/* Unknown packet */ /* 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++; info->hdev->stat.err_rx++;
kfree_skb(info->rx_skb); kfree_skb(info->rx_skb);
...@@ -411,7 +412,7 @@ static int bt3c_hci_send_frame(struct hci_dev *hdev, struct sk_buff *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); struct bt3c_info *info = hci_get_drvdata(hdev);
unsigned long flags; unsigned long flags;
switch (bt_cb(skb)->pkt_type) { switch (hci_skb_pkt_type(skb)) {
case HCI_COMMAND_PKT: case HCI_COMMAND_PKT:
hdev->stat.cmd_tx++; hdev->stat.cmd_tx++;
break; break;
...@@ -424,7 +425,7 @@ static int bt3c_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb) ...@@ -424,7 +425,7 @@ static int bt3c_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
} }
/* Prepend skb with frame type */ /* 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); skb_queue_tail(&(info->txq), skb);
spin_lock_irqsave(&(info->lock), flags); spin_lock_irqsave(&(info->lock), flags);
......
...@@ -196,7 +196,7 @@ static int btmrvl_send_sync_cmd(struct btmrvl_private *priv, u16 opcode, ...@@ -196,7 +196,7 @@ static int btmrvl_send_sync_cmd(struct btmrvl_private *priv, u16 opcode,
if (len) if (len)
memcpy(skb_put(skb, len), param, 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); 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) ...@@ -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[0] = (skb->len & 0x0000ff);
skb->data[1] = (skb->len & 0x00ff00) >> 8; skb->data[1] = (skb->len & 0x00ff00) >> 8;
skb->data[2] = (skb->len & 0xff0000) >> 16; 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) if (priv->hw_host_to_card)
ret = priv->hw_host_to_card(priv, skb->data, skb->len); 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) ...@@ -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); 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: case HCI_COMMAND_PKT:
hdev->stat.cmd_tx++; hdev->stat.cmd_tx++;
break; break;
......
...@@ -698,7 +698,7 @@ static int btmrvl_sdio_card_to_host(struct btmrvl_private *priv) ...@@ -698,7 +698,7 @@ static int btmrvl_sdio_card_to_host(struct btmrvl_private *priv)
case HCI_ACLDATA_PKT: case HCI_ACLDATA_PKT:
case HCI_SCODATA_PKT: case HCI_SCODATA_PKT:
case HCI_EVENT_PKT: case HCI_EVENT_PKT:
bt_cb(skb)->pkt_type = type; hci_skb_pkt_type(skb) = type;
skb_put(skb, buf_len); skb_put(skb, buf_len);
skb_pull(skb, SDIO_HEADER_LEN); skb_pull(skb, SDIO_HEADER_LEN);
...@@ -713,7 +713,7 @@ static int btmrvl_sdio_card_to_host(struct btmrvl_private *priv) ...@@ -713,7 +713,7 @@ static int btmrvl_sdio_card_to_host(struct btmrvl_private *priv)
break; break;
case MRVL_VENDOR_PKT: 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_put(skb, buf_len);
skb_pull(skb, SDIO_HEADER_LEN); skb_pull(skb, SDIO_HEADER_LEN);
......
...@@ -86,7 +86,7 @@ static int btsdio_tx_packet(struct btsdio_data *data, struct sk_buff *skb) ...@@ -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[0] = (skb->len & 0x0000ff);
skb->data[1] = (skb->len & 0x00ff00) >> 8; skb->data[1] = (skb->len & 0x00ff00) >> 8;
skb->data[2] = (skb->len & 0xff0000) >> 16; 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); err = sdio_writesb(data->func, REG_TDAT, skb->data, skb->len);
if (err < 0) { if (err < 0) {
...@@ -158,7 +158,7 @@ static int btsdio_rx_packet(struct btsdio_data *data) ...@@ -158,7 +158,7 @@ static int btsdio_rx_packet(struct btsdio_data *data)
data->hdev->stat.byte_rx += len; 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); err = hci_recv_frame(data->hdev, skb);
if (err < 0) if (err < 0)
...@@ -252,7 +252,7 @@ static int btsdio_send_frame(struct hci_dev *hdev, struct sk_buff *skb) ...@@ -252,7 +252,7 @@ static int btsdio_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
BT_DBG("%s", hdev->name); BT_DBG("%s", hdev->name);
switch (bt_cb(skb)->pkt_type) { switch (hci_skb_pkt_type(skb)) {
case HCI_COMMAND_PKT: case HCI_COMMAND_PKT:
hdev->stat.cmd_tx++; hdev->stat.cmd_tx++;
break; break;
......
...@@ -200,9 +200,9 @@ static void btuart_receive(struct btuart_info *info) ...@@ -200,9 +200,9 @@ static void btuart_receive(struct btuart_info *info)
if (info->rx_state == RECV_WAIT_PACKET_TYPE) { 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: case HCI_EVENT_PKT:
info->rx_state = RECV_WAIT_EVENT_HEADER; info->rx_state = RECV_WAIT_EVENT_HEADER;
...@@ -221,7 +221,8 @@ static void btuart_receive(struct btuart_info *info) ...@@ -221,7 +221,8 @@ static void btuart_receive(struct btuart_info *info)
default: default:
/* Unknown packet */ /* 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++; info->hdev->stat.err_rx++;
kfree_skb(info->rx_skb); kfree_skb(info->rx_skb);
...@@ -424,7 +425,7 @@ static int btuart_hci_send_frame(struct hci_dev *hdev, struct sk_buff *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); struct btuart_info *info = hci_get_drvdata(hdev);
switch (bt_cb(skb)->pkt_type) { switch (hci_skb_pkt_type(skb)) {
case HCI_COMMAND_PKT: case HCI_COMMAND_PKT:
hdev->stat.cmd_tx++; hdev->stat.cmd_tx++;
break; break;
...@@ -437,7 +438,7 @@ static int btuart_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb) ...@@ -437,7 +438,7 @@ static int btuart_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
} }
/* Prepend skb with frame type */ /* 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); skb_queue_tail(&(info->txq), skb);
btuart_write_wakeup(info); btuart_write_wakeup(info);
......
...@@ -437,22 +437,22 @@ static int btusb_recv_intr(struct btusb_data *data, void *buffer, int count) ...@@ -437,22 +437,22 @@ static int btusb_recv_intr(struct btusb_data *data, void *buffer, int count)
break; break;
} }
bt_cb(skb)->pkt_type = HCI_EVENT_PKT; hci_skb_pkt_type(skb) = HCI_EVENT_PKT;
bt_cb(skb)->expect = HCI_EVENT_HDR_SIZE; 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); memcpy(skb_put(skb, len), buffer, len);
count -= len; count -= len;
buffer += len; buffer += len;
bt_cb(skb)->expect -= len; hci_skb_expect(skb) -= len;
if (skb->len == HCI_EVENT_HDR_SIZE) { if (skb->len == HCI_EVENT_HDR_SIZE) {
/* Complete event header */ /* 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); kfree_skb(skb);
skb = NULL; skb = NULL;
...@@ -461,7 +461,7 @@ static int btusb_recv_intr(struct btusb_data *data, void *buffer, int count) ...@@ -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 */ /* Complete frame */
data->recv_event(data->hdev, skb); data->recv_event(data->hdev, skb);
skb = NULL; skb = NULL;
...@@ -492,24 +492,24 @@ static int btusb_recv_bulk(struct btusb_data *data, void *buffer, int count) ...@@ -492,24 +492,24 @@ static int btusb_recv_bulk(struct btusb_data *data, void *buffer, int count)
break; break;
} }
bt_cb(skb)->pkt_type = HCI_ACLDATA_PKT; hci_skb_pkt_type(skb) = HCI_ACLDATA_PKT;
bt_cb(skb)->expect = HCI_ACL_HDR_SIZE; 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); memcpy(skb_put(skb, len), buffer, len);
count -= len; count -= len;
buffer += len; buffer += len;
bt_cb(skb)->expect -= len; hci_skb_expect(skb) -= len;
if (skb->len == HCI_ACL_HDR_SIZE) { if (skb->len == HCI_ACL_HDR_SIZE) {
__le16 dlen = hci_acl_hdr(skb)->dlen; __le16 dlen = hci_acl_hdr(skb)->dlen;
/* Complete ACL header */ /* 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); kfree_skb(skb);
skb = NULL; skb = NULL;
...@@ -518,7 +518,7 @@ static int btusb_recv_bulk(struct btusb_data *data, void *buffer, int count) ...@@ -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 */ /* Complete frame */
hci_recv_frame(data->hdev, skb); hci_recv_frame(data->hdev, skb);
skb = NULL; skb = NULL;
...@@ -549,22 +549,22 @@ static int btusb_recv_isoc(struct btusb_data *data, void *buffer, int count) ...@@ -549,22 +549,22 @@ static int btusb_recv_isoc(struct btusb_data *data, void *buffer, int count)
break; break;
} }
bt_cb(skb)->pkt_type = HCI_SCODATA_PKT; hci_skb_pkt_type(skb) = HCI_SCODATA_PKT;
bt_cb(skb)->expect = HCI_SCO_HDR_SIZE; 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); memcpy(skb_put(skb, len), buffer, len);
count -= len; count -= len;
buffer += len; buffer += len;
bt_cb(skb)->expect -= len; hci_skb_expect(skb) -= len;
if (skb->len == HCI_SCO_HDR_SIZE) { if (skb->len == HCI_SCO_HDR_SIZE) {
/* Complete SCO header */ /* 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); kfree_skb(skb);
skb = NULL; skb = NULL;
...@@ -573,7 +573,7 @@ static int btusb_recv_isoc(struct btusb_data *data, void *buffer, int count) ...@@ -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 */ /* Complete frame */
hci_recv_frame(data->hdev, skb); hci_recv_frame(data->hdev, skb);
skb = NULL; skb = NULL;
...@@ -1257,7 +1257,7 @@ static int btusb_send_frame(struct hci_dev *hdev, struct sk_buff *skb) ...@@ -1257,7 +1257,7 @@ static int btusb_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
BT_DBG("%s", hdev->name); BT_DBG("%s", hdev->name);
switch (bt_cb(skb)->pkt_type) { switch (hci_skb_pkt_type(skb)) {
case HCI_COMMAND_PKT: case HCI_COMMAND_PKT:
urb = alloc_ctrl_urb(hdev, skb); urb = alloc_ctrl_urb(hdev, skb);
if (IS_ERR(urb)) if (IS_ERR(urb))
...@@ -1853,7 +1853,7 @@ static int inject_cmd_complete(struct hci_dev *hdev, __u16 opcode) ...@@ -1853,7 +1853,7 @@ static int inject_cmd_complete(struct hci_dev *hdev, __u16 opcode)
*skb_put(skb, 1) = 0x00; *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); return hci_recv_frame(hdev, skb);
} }
...@@ -1945,7 +1945,7 @@ static int btusb_send_frame_intel(struct hci_dev *hdev, struct sk_buff *skb) ...@@ -1945,7 +1945,7 @@ static int btusb_send_frame_intel(struct hci_dev *hdev, struct sk_buff *skb)
BT_DBG("%s", hdev->name); BT_DBG("%s", hdev->name);
switch (bt_cb(skb)->pkt_type) { switch (hci_skb_pkt_type(skb)) {
case HCI_COMMAND_PKT: case HCI_COMMAND_PKT:
if (test_bit(BTUSB_BOOTLOADER, &data->flags)) { if (test_bit(BTUSB_BOOTLOADER, &data->flags)) {
struct hci_command_hdr *cmd = (void *)skb->data; struct hci_command_hdr *cmd = (void *)skb->data;
......
...@@ -249,9 +249,9 @@ static int ti_st_send_frame(struct hci_dev *hdev, struct sk_buff *skb) ...@@ -249,9 +249,9 @@ static int ti_st_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
hst = hci_get_drvdata(hdev); hst = hci_get_drvdata(hdev);
/* Prepend skb with frame type */ /* 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, BT_DBG("%s: type %d len %d", hdev->name, hci_skb_pkt_type(skb),
skb->len); skb->len);
/* Insert skb to shared transport layer's transmit queue. /* Insert skb to shared transport layer's transmit queue.
...@@ -268,7 +268,7 @@ static int ti_st_send_frame(struct hci_dev *hdev, struct sk_buff *skb) ...@@ -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 */ /* ST accepted our skb. So, Go ahead and do rest */
hdev->stat.byte_tx += len; 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; return 0;
} }
......
...@@ -239,7 +239,7 @@ static void dtl1_receive(struct dtl1_info *info) ...@@ -239,7 +239,7 @@ static void dtl1_receive(struct dtl1_info *info)
info->rx_count = nsh->len + (nsh->len & 0x0001); info->rx_count = nsh->len + (nsh->len & 0x0001);
break; break;
case RECV_WAIT_DATA: 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 */ /* remove PAD byte if it exists */
if (nsh->len & 0x0001) { if (nsh->len & 0x0001) {
...@@ -250,7 +250,7 @@ static void dtl1_receive(struct dtl1_info *info) ...@@ -250,7 +250,7 @@ static void dtl1_receive(struct dtl1_info *info)
/* remove NSH */ /* remove NSH */
skb_pull(info->rx_skb, NSHL); skb_pull(info->rx_skb, NSHL);
switch (bt_cb(info->rx_skb)->pkt_type) { switch (hci_skb_pkt_type(info->rx_skb)) {
case 0x80: case 0x80:
/* control data for the Nokia Card */ /* control data for the Nokia Card */
dtl1_control(info, info->rx_skb); dtl1_control(info, info->rx_skb);
...@@ -259,12 +259,13 @@ static void dtl1_receive(struct dtl1_info *info) ...@@ -259,12 +259,13 @@ static void dtl1_receive(struct dtl1_info *info)
case 0x83: case 0x83:
case 0x84: case 0x84:
/* send frame to the HCI layer */ /* 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); hci_recv_frame(info->hdev, info->rx_skb);
break; break;
default: default:
/* unknown packet */ /* 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); kfree_skb(info->rx_skb);
break; break;
} }
...@@ -386,7 +387,7 @@ static int dtl1_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb) ...@@ -386,7 +387,7 @@ static int dtl1_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
struct sk_buff *s; struct sk_buff *s;
struct nsh nsh; struct nsh nsh;
switch (bt_cb(skb)->pkt_type) { switch (hci_skb_pkt_type(skb)) {
case HCI_COMMAND_PKT: case HCI_COMMAND_PKT:
hdev->stat.cmd_tx++; hdev->stat.cmd_tx++;
nsh.type = 0x81; nsh.type = 0x81;
......
...@@ -205,7 +205,7 @@ static int ath_enqueue(struct hci_uart *hu, struct sk_buff *skb) ...@@ -205,7 +205,7 @@ static int ath_enqueue(struct hci_uart *hu, struct sk_buff *skb)
{ {
struct ath_struct *ath = hu->priv; 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); kfree_skb(skb);
return 0; return 0;
} }
...@@ -213,7 +213,7 @@ static int ath_enqueue(struct hci_uart *hu, struct sk_buff *skb) ...@@ -213,7 +213,7 @@ static int ath_enqueue(struct hci_uart *hu, struct sk_buff *skb)
/* Update power management enable flag with parameters of /* Update power management enable flag with parameters of
* HCI sleep enable vendor specific HCI command. * 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; struct hci_command_hdr *hdr = (void *)skb->data;
if (__le16_to_cpu(hdr->opcode) == HCI_OP_ATH_SLEEP) 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) ...@@ -223,7 +223,7 @@ static int ath_enqueue(struct hci_uart *hu, struct sk_buff *skb)
BT_DBG("hu %p skb %p", hu, skb); BT_DBG("hu %p skb %p", hu, skb);
/* Prepend skb with frame type */ /* 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); skb_queue_tail(&ath->txq, skb);
set_bit(HCI_UART_SENDING, &hu->tx_state); set_bit(HCI_UART_SENDING, &hu->tx_state);
......
...@@ -472,7 +472,7 @@ static int bcm_enqueue(struct hci_uart *hu, struct sk_buff *skb) ...@@ -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); bt_dev_dbg(hu->hdev, "hu %p skb %p", hu, skb);
/* Prepend skb with frame type */ /* 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); skb_queue_tail(&bcm->txq, skb);
return 0; return 0;
......
...@@ -155,7 +155,7 @@ static int bcsp_enqueue(struct hci_uart *hu, struct sk_buff *skb) ...@@ -155,7 +155,7 @@ static int bcsp_enqueue(struct hci_uart *hu, struct sk_buff *skb)
return 0; return 0;
} }
switch (bt_cb(skb)->pkt_type) { switch (hci_skb_pkt_type(skb)) {
case HCI_ACLDATA_PKT: case HCI_ACLDATA_PKT:
case HCI_COMMAND_PKT: case HCI_COMMAND_PKT:
skb_queue_tail(&bcsp->rel, skb); skb_queue_tail(&bcsp->rel, skb);
...@@ -231,7 +231,7 @@ static struct sk_buff *bcsp_prepare_pkt(struct bcsp_struct *bcsp, u8 *data, ...@@ -231,7 +231,7 @@ static struct sk_buff *bcsp_prepare_pkt(struct bcsp_struct *bcsp, u8 *data,
if (!nskb) if (!nskb)
return NULL; return NULL;
bt_cb(nskb)->pkt_type = pkt_type; hci_skb_pkt_type(nskb) = pkt_type;
bcsp_slip_msgdelim(nskb); bcsp_slip_msgdelim(nskb);
...@@ -291,7 +291,10 @@ static struct sk_buff *bcsp_dequeue(struct hci_uart *hu) ...@@ -291,7 +291,10 @@ static struct sk_buff *bcsp_dequeue(struct hci_uart *hu)
skb = skb_dequeue(&bcsp->unrel); skb = skb_dequeue(&bcsp->unrel);
if (skb != NULL) { 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) { if (nskb) {
kfree_skb(skb); kfree_skb(skb);
return nskb; return nskb;
...@@ -310,8 +313,10 @@ static struct sk_buff *bcsp_dequeue(struct hci_uart *hu) ...@@ -310,8 +313,10 @@ static struct sk_buff *bcsp_dequeue(struct hci_uart *hu)
if (bcsp->unack.qlen < BCSP_TXWINSIZE) { if (bcsp->unack.qlen < BCSP_TXWINSIZE) {
skb = skb_dequeue(&bcsp->rel); skb = skb_dequeue(&bcsp->rel);
if (skb != NULL) { if (skb != NULL) {
struct sk_buff *nskb = bcsp_prepare_pkt(bcsp, skb->data, skb->len, struct sk_buff *nskb;
bt_cb(skb)->pkt_type);
nskb = bcsp_prepare_pkt(bcsp, skb->data, skb->len,
hci_skb_pkt_type(skb));
if (nskb) { if (nskb) {
__skb_queue_tail(&bcsp->unack, skb); __skb_queue_tail(&bcsp->unack, skb);
mod_timer(&bcsp->tbcsp, jiffies + HZ / 4); mod_timer(&bcsp->tbcsp, jiffies + HZ / 4);
...@@ -412,7 +417,7 @@ static void bcsp_handle_le_pkt(struct hci_uart *hu) ...@@ -412,7 +417,7 @@ static void bcsp_handle_le_pkt(struct hci_uart *hu)
if (!nskb) if (!nskb)
return; return;
memcpy(skb_put(nskb, 4), conf_rsp_pkt, 4); 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); skb_queue_head(&bcsp->unrel, nskb);
hci_uart_tx_wakeup(hu); hci_uart_tx_wakeup(hu);
...@@ -494,14 +499,14 @@ static void bcsp_complete_rx_pkt(struct hci_uart *hu) ...@@ -494,14 +499,14 @@ static void bcsp_complete_rx_pkt(struct hci_uart *hu)
bcsp_pkt_cull(bcsp); bcsp_pkt_cull(bcsp);
if ((bcsp->rx_skb->data[1] & 0x0f) == 6 && if ((bcsp->rx_skb->data[1] & 0x0f) == 6 &&
bcsp->rx_skb->data[0] & 0x80) { 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; pass_up = 1;
} else if ((bcsp->rx_skb->data[1] & 0x0f) == 5 && } else if ((bcsp->rx_skb->data[1] & 0x0f) == 5 &&
bcsp->rx_skb->data[0] & 0x80) { 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; pass_up = 1;
} else if ((bcsp->rx_skb->data[1] & 0x0f) == 7) { } 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; pass_up = 1;
} else if ((bcsp->rx_skb->data[1] & 0x0f) == 1 && } else if ((bcsp->rx_skb->data[1] & 0x0f) == 1 &&
!(bcsp->rx_skb->data[0] & 0x80)) { !(bcsp->rx_skb->data[0] & 0x80)) {
...@@ -523,7 +528,7 @@ static void bcsp_complete_rx_pkt(struct hci_uart *hu) ...@@ -523,7 +528,7 @@ static void bcsp_complete_rx_pkt(struct hci_uart *hu)
hdr.evt = 0xff; hdr.evt = 0xff;
hdr.plen = bcsp->rx_skb->len; hdr.plen = bcsp->rx_skb->len;
memcpy(skb_push(bcsp->rx_skb, HCI_EVENT_HDR_SIZE), &hdr, HCI_EVENT_HDR_SIZE); 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); hci_recv_frame(hu->hdev, bcsp->rx_skb);
} else { } else {
......
...@@ -108,7 +108,7 @@ static int h4_enqueue(struct hci_uart *hu, struct sk_buff *skb) ...@@ -108,7 +108,7 @@ static int h4_enqueue(struct hci_uart *hu, struct sk_buff *skb)
BT_DBG("hu %p skb %p", hu, skb); BT_DBG("hu %p skb %p", hu, skb);
/* Prepend skb with frame type */ /* 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); skb_queue_tail(&h4->txq, skb);
return 0; return 0;
...@@ -184,8 +184,8 @@ struct sk_buff *h4_recv_buf(struct hci_dev *hdev, struct sk_buff *skb, ...@@ -184,8 +184,8 @@ struct sk_buff *h4_recv_buf(struct hci_dev *hdev, struct sk_buff *skb,
if (!skb) if (!skb)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
bt_cb(skb)->pkt_type = (&pkts[i])->type; hci_skb_pkt_type(skb) = (&pkts[i])->type;
bt_cb(skb)->expect = (&pkts[i])->hlen; hci_skb_expect(skb) = (&pkts[i])->hlen;
break; break;
} }
...@@ -197,18 +197,18 @@ struct sk_buff *h4_recv_buf(struct hci_dev *hdev, struct sk_buff *skb, ...@@ -197,18 +197,18 @@ struct sk_buff *h4_recv_buf(struct hci_dev *hdev, struct sk_buff *skb,
buffer += 1; 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); memcpy(skb_put(skb, len), buffer, len);
count -= len; count -= len;
buffer += len; buffer += len;
/* Check for partial packet */ /* Check for partial packet */
if (skb->len < bt_cb(skb)->expect) if (skb->len < hci_skb_expect(skb))
continue; continue;
for (i = 0; i < pkts_count; i++) { 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; break;
} }
...@@ -228,7 +228,7 @@ struct sk_buff *h4_recv_buf(struct hci_dev *hdev, struct sk_buff *skb, ...@@ -228,7 +228,7 @@ struct sk_buff *h4_recv_buf(struct hci_dev *hdev, struct sk_buff *skb,
case 1: case 1:
/* Single octet variable length */ /* Single octet variable length */
dlen = skb->data[(&pkts[i])->loff]; dlen = skb->data[(&pkts[i])->loff];
bt_cb(skb)->expect += dlen; hci_skb_expect(skb) += dlen;
if (skb_tailroom(skb) < dlen) { if (skb_tailroom(skb) < dlen) {
kfree_skb(skb); kfree_skb(skb);
...@@ -239,7 +239,7 @@ struct sk_buff *h4_recv_buf(struct hci_dev *hdev, struct sk_buff *skb, ...@@ -239,7 +239,7 @@ struct sk_buff *h4_recv_buf(struct hci_dev *hdev, struct sk_buff *skb,
/* Double octet variable length */ /* Double octet variable length */
dlen = get_unaligned_le16(skb->data + dlen = get_unaligned_le16(skb->data +
(&pkts[i])->loff); (&pkts[i])->loff);
bt_cb(skb)->expect += dlen; hci_skb_expect(skb) += dlen;
if (skb_tailroom(skb) < dlen) { if (skb_tailroom(skb) < dlen) {
kfree_skb(skb); kfree_skb(skb);
......
...@@ -107,7 +107,7 @@ static void h5_link_control(struct hci_uart *hu, const void *data, size_t len) ...@@ -107,7 +107,7 @@ static void h5_link_control(struct hci_uart *hu, const void *data, size_t len)
if (!nskb) if (!nskb)
return; 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); memcpy(skb_put(nskb, len), data, len);
...@@ -360,7 +360,7 @@ static void h5_complete_rx_pkt(struct hci_uart *hu) ...@@ -360,7 +360,7 @@ static void h5_complete_rx_pkt(struct hci_uart *hu)
case HCI_EVENT_PKT: case HCI_EVENT_PKT:
case HCI_ACLDATA_PKT: case HCI_ACLDATA_PKT:
case HCI_SCODATA_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 */ /* Remove Three-wire header */
skb_pull(h5->rx_skb, 4); skb_pull(h5->rx_skb, 4);
...@@ -562,7 +562,7 @@ static int h5_enqueue(struct hci_uart *hu, struct sk_buff *skb) ...@@ -562,7 +562,7 @@ static int h5_enqueue(struct hci_uart *hu, struct sk_buff *skb)
return 0; return 0;
} }
switch (bt_cb(skb)->pkt_type) { switch (hci_skb_pkt_type(skb)) {
case HCI_ACLDATA_PKT: case HCI_ACLDATA_PKT:
case HCI_COMMAND_PKT: case HCI_COMMAND_PKT:
skb_queue_tail(&h5->rel, skb); skb_queue_tail(&h5->rel, skb);
...@@ -573,7 +573,7 @@ static int h5_enqueue(struct hci_uart *hu, struct sk_buff *skb) ...@@ -573,7 +573,7 @@ static int h5_enqueue(struct hci_uart *hu, struct sk_buff *skb)
break; break;
default: 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); kfree_skb(skb);
break; break;
} }
...@@ -642,7 +642,7 @@ static struct sk_buff *h5_prepare_pkt(struct hci_uart *hu, u8 pkt_type, ...@@ -642,7 +642,7 @@ static struct sk_buff *h5_prepare_pkt(struct hci_uart *hu, u8 pkt_type,
if (!nskb) if (!nskb)
return NULL; return NULL;
bt_cb(nskb)->pkt_type = pkt_type; hci_skb_pkt_type(nskb) = pkt_type;
h5_slip_delim(nskb); h5_slip_delim(nskb);
...@@ -697,7 +697,7 @@ static struct sk_buff *h5_dequeue(struct hci_uart *hu) ...@@ -697,7 +697,7 @@ static struct sk_buff *h5_dequeue(struct hci_uart *hu)
skb = skb_dequeue(&h5->unrel); skb = skb_dequeue(&h5->unrel);
if (skb) { 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); skb->data, skb->len);
if (nskb) { if (nskb) {
kfree_skb(skb); kfree_skb(skb);
...@@ -715,7 +715,7 @@ static struct sk_buff *h5_dequeue(struct hci_uart *hu) ...@@ -715,7 +715,7 @@ static struct sk_buff *h5_dequeue(struct hci_uart *hu)
skb = skb_dequeue(&h5->rel); skb = skb_dequeue(&h5->rel);
if (skb) { 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); skb->data, skb->len);
if (nskb) { if (nskb) {
__skb_queue_tail(&h5->unack, skb); __skb_queue_tail(&h5->unack, skb);
......
...@@ -186,7 +186,7 @@ static int intel_lpm_suspend(struct hci_uart *hu) ...@@ -186,7 +186,7 @@ static int intel_lpm_suspend(struct hci_uart *hu)
} }
memcpy(skb_put(skb, sizeof(suspend)), suspend, sizeof(suspend)); 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); set_bit(STATE_LPM_TRANSACTION, &intel->flags);
...@@ -230,7 +230,7 @@ static int intel_lpm_resume(struct hci_uart *hu) ...@@ -230,7 +230,7 @@ static int intel_lpm_resume(struct hci_uart *hu)
return -ENOMEM; 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); set_bit(STATE_LPM_TRANSACTION, &intel->flags);
...@@ -272,7 +272,7 @@ static int intel_lpm_host_wake(struct hci_uart *hu) ...@@ -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, memcpy(skb_put(skb, sizeof(lpm_resume_ack)), lpm_resume_ack,
sizeof(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 */ /* LPM flow is a priority, enqueue packet at list head */
skb_queue_head(&intel->txq, skb); skb_queue_head(&intel->txq, skb);
...@@ -467,7 +467,7 @@ static int inject_cmd_complete(struct hci_dev *hdev, __u16 opcode) ...@@ -467,7 +467,7 @@ static int inject_cmd_complete(struct hci_dev *hdev, __u16 opcode)
*skb_put(skb, 1) = 0x00; *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); return hci_recv_frame(hdev, skb);
} }
...@@ -517,7 +517,7 @@ static int intel_set_baudrate(struct hci_uart *hu, unsigned int speed) ...@@ -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)); 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); hci_uart_set_flow_control(hu, true);
...@@ -1126,7 +1126,7 @@ static struct sk_buff *intel_dequeue(struct hci_uart *hu) ...@@ -1126,7 +1126,7 @@ static struct sk_buff *intel_dequeue(struct hci_uart *hu)
return skb; return skb;
if (test_bit(STATE_BOOTLOADER, &intel->flags) && 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; struct hci_command_hdr *cmd = (void *)skb->data;
__u16 opcode = le16_to_cpu(cmd->opcode); __u16 opcode = le16_to_cpu(cmd->opcode);
...@@ -1140,7 +1140,7 @@ static struct sk_buff *intel_dequeue(struct hci_uart *hu) ...@@ -1140,7 +1140,7 @@ static struct sk_buff *intel_dequeue(struct hci_uart *hu)
} }
/* Prepend skb with frame type */ /* 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; return skb;
} }
......
...@@ -162,7 +162,7 @@ static void hci_uart_write_work(struct work_struct *work) ...@@ -162,7 +162,7 @@ static void hci_uart_write_work(struct work_struct *work)
break; break;
} }
hci_uart_tx_complete(hu, bt_cb(skb)->pkt_type); hci_uart_tx_complete(hu, hci_skb_pkt_type(skb));
kfree_skb(skb); kfree_skb(skb);
} }
...@@ -248,7 +248,8 @@ static int hci_uart_send_frame(struct hci_dev *hdev, struct sk_buff *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); 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); hu->proto->enqueue(hu, skb);
......
...@@ -307,7 +307,7 @@ static int ll_enqueue(struct hci_uart *hu, struct sk_buff *skb) ...@@ -307,7 +307,7 @@ static int ll_enqueue(struct hci_uart *hu, struct sk_buff *skb)
BT_DBG("hu %p skb %p", hu, skb); BT_DBG("hu %p skb %p", hu, skb);
/* Prepend skb with frame type */ /* 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 */ /* lock hcill state */
spin_lock_irqsave(&ll->hcill_lock, flags); spin_lock_irqsave(&ll->hcill_lock, flags);
...@@ -493,7 +493,7 @@ static int ll_recv(struct hci_uart *hu, const void *data, int count) ...@@ -493,7 +493,7 @@ static int ll_recv(struct hci_uart *hu, const void *data, int count)
return -ENOMEM; return -ENOMEM;
} }
bt_cb(ll->rx_skb)->pkt_type = type; hci_skb_pkt_type(ll->rx_skb) = type;
} }
return count; return count;
......
...@@ -678,7 +678,7 @@ static int qca_enqueue(struct hci_uart *hu, struct sk_buff *skb) ...@@ -678,7 +678,7 @@ static int qca_enqueue(struct hci_uart *hu, struct sk_buff *skb)
qca->tx_ibs_state); qca->tx_ibs_state);
/* Prepend skb with frame type */ /* 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 /* Don't go to sleep in middle of patch download or
* Out-Of-Band(GPIOs control) sleep is selected. * Out-Of-Band(GPIOs control) sleep is selected.
...@@ -873,7 +873,7 @@ static int qca_set_baudrate(struct hci_dev *hdev, uint8_t baudrate) ...@@ -873,7 +873,7 @@ static int qca_set_baudrate(struct hci_dev *hdev, uint8_t baudrate)
/* Assign commands to change baudrate and packet type. */ /* Assign commands to change baudrate and packet type. */
memcpy(skb_put(skb, sizeof(cmd)), cmd, sizeof(cmd)); 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); skb_queue_tail(&qca->txq, skb);
hci_uart_tx_wakeup(hu); hci_uart_tx_wakeup(hu);
......
...@@ -80,7 +80,7 @@ static int vhci_send_frame(struct hci_dev *hdev, struct sk_buff *skb) ...@@ -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); 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); skb_queue_tail(&data->readq, skb);
wake_up_interruptible(&data->read_wait); wake_up_interruptible(&data->read_wait);
...@@ -140,7 +140,7 @@ static int vhci_create_device(struct vhci_data *data, __u8 opcode) ...@@ -140,7 +140,7 @@ static int vhci_create_device(struct vhci_data *data, __u8 opcode)
return -EBUSY; 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) = 0xff;
*skb_put(skb, 1) = opcode; *skb_put(skb, 1) = opcode;
...@@ -183,7 +183,7 @@ static inline ssize_t vhci_get_user(struct vhci_data *data, ...@@ -183,7 +183,7 @@ static inline ssize_t vhci_get_user(struct vhci_data *data,
return -ENODEV; return -ENODEV;
} }
bt_cb(skb)->pkt_type = pkt_type; hci_skb_pkt_type(skb) = pkt_type;
ret = hci_recv_frame(data->hdev, skb); ret = hci_recv_frame(data->hdev, skb);
break; break;
...@@ -234,7 +234,7 @@ static inline ssize_t vhci_put_user(struct vhci_data *data, ...@@ -234,7 +234,7 @@ static inline ssize_t vhci_put_user(struct vhci_data *data,
data->hdev->stat.byte_tx += len; data->hdev->stat.byte_tx += len;
switch (bt_cb(skb)->pkt_type) { switch (hci_skb_pkt_type(skb)) {
case HCI_COMMAND_PKT: case HCI_COMMAND_PKT:
data->hdev->stat.cmd_tx++; data->hdev->stat.cmd_tx++;
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment