Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 099284bd authored by John W. Linville's avatar John W. Linville
Browse files
parents 073730d7 4ebaa4ed
Loading
Loading
Loading
Loading

drivers/bluetooth/hci_ath.c

100755 → 100644
+3 −3
Original line number Original line Diff line number Diff line
@@ -163,7 +163,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 (bt_cb(skb)->pkt_type == HCI_SCODATA_PKT) {
		kfree(skb);
		kfree_skb(skb);
		return 0;
		return 0;
	}
	}


@@ -217,7 +217,7 @@ static struct hci_uart_proto athp = {
	.flush = ath_flush,
	.flush = ath_flush,
};
};


int ath_init(void)
int __init ath_init(void)
{
{
	int err = hci_uart_register_proto(&athp);
	int err = hci_uart_register_proto(&athp);


@@ -229,7 +229,7 @@ int ath_init(void)
	return err;
	return err;
}
}


int ath_deinit(void)
int __exit ath_deinit(void)
{
{
	return hci_uart_unregister_proto(&athp);
	return hci_uart_unregister_proto(&athp);
}
}
+2 −2
Original line number Original line Diff line number Diff line
@@ -739,7 +739,7 @@ static struct hci_uart_proto bcsp = {
	.flush		= bcsp_flush
	.flush		= bcsp_flush
};
};


int bcsp_init(void)
int __init bcsp_init(void)
{
{
	int err = hci_uart_register_proto(&bcsp);
	int err = hci_uart_register_proto(&bcsp);


@@ -751,7 +751,7 @@ int bcsp_init(void)
	return err;
	return err;
}
}


int bcsp_deinit(void)
int __exit bcsp_deinit(void)
{
{
	return hci_uart_unregister_proto(&bcsp);
	return hci_uart_unregister_proto(&bcsp);
}
}
+4 −103
Original line number Original line Diff line number Diff line
@@ -151,107 +151,8 @@ static inline int h4_check_data_len(struct h4_struct *h4, int len)
/* Recv data */
/* Recv data */
static int h4_recv(struct hci_uart *hu, void *data, int count)
static int h4_recv(struct hci_uart *hu, void *data, int count)
{
{
	struct h4_struct *h4 = hu->priv;
	if (hci_recv_stream_fragment(hu->hdev, data, count) < 0)
	register char *ptr;
		BT_ERR("Frame Reassembly Failed");
	struct hci_event_hdr *eh;
	struct hci_acl_hdr   *ah;
	struct hci_sco_hdr   *sh;
	register int len, type, dlen;

	BT_DBG("hu %p count %d rx_state %ld rx_count %ld", 
			hu, count, h4->rx_state, h4->rx_count);

	ptr = data;
	while (count) {
		if (h4->rx_count) {
			len = min_t(unsigned int, h4->rx_count, count);
			memcpy(skb_put(h4->rx_skb, len), ptr, len);
			h4->rx_count -= len; count -= len; ptr += len;

			if (h4->rx_count)
				continue;

			switch (h4->rx_state) {
			case H4_W4_DATA:
				BT_DBG("Complete data");

				hci_recv_frame(h4->rx_skb);

				h4->rx_state = H4_W4_PACKET_TYPE;
				h4->rx_skb = NULL;
				continue;

			case H4_W4_EVENT_HDR:
				eh = hci_event_hdr(h4->rx_skb);

				BT_DBG("Event header: evt 0x%2.2x plen %d", eh->evt, eh->plen);

				h4_check_data_len(h4, eh->plen);
				continue;

			case H4_W4_ACL_HDR:
				ah = hci_acl_hdr(h4->rx_skb);
				dlen = __le16_to_cpu(ah->dlen);

				BT_DBG("ACL header: dlen %d", dlen);

				h4_check_data_len(h4, dlen);
				continue;

			case H4_W4_SCO_HDR:
				sh = hci_sco_hdr(h4->rx_skb);

				BT_DBG("SCO header: dlen %d", sh->dlen);

				h4_check_data_len(h4, sh->dlen);
				continue;
			}
		}

		/* H4_W4_PACKET_TYPE */
		switch (*ptr) {
		case HCI_EVENT_PKT:
			BT_DBG("Event packet");
			h4->rx_state = H4_W4_EVENT_HDR;
			h4->rx_count = HCI_EVENT_HDR_SIZE;
			type = HCI_EVENT_PKT;
			break;

		case HCI_ACLDATA_PKT:
			BT_DBG("ACL packet");
			h4->rx_state = H4_W4_ACL_HDR;
			h4->rx_count = HCI_ACL_HDR_SIZE;
			type = HCI_ACLDATA_PKT;
			break;

		case HCI_SCODATA_PKT:
			BT_DBG("SCO packet");
			h4->rx_state = H4_W4_SCO_HDR;
			h4->rx_count = HCI_SCO_HDR_SIZE;
			type = HCI_SCODATA_PKT;
			break;

		default:
			BT_ERR("Unknown HCI packet type %2.2x", (__u8)*ptr);
			hu->hdev->stat.err_rx++;
			ptr++; count--;
			continue;
		};

		ptr++; count--;

		/* Allocate packet */
		h4->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC);
		if (!h4->rx_skb) {
			BT_ERR("Can't allocate mem for new packet");
			h4->rx_state = H4_W4_PACKET_TYPE;
			h4->rx_count = 0;
			return -ENOMEM;
		}

		h4->rx_skb->dev = (void *) hu->hdev;
		bt_cb(h4->rx_skb)->pkt_type = type;
	}


	return count;
	return count;
}
}
@@ -272,7 +173,7 @@ static struct hci_uart_proto h4p = {
	.flush		= h4_flush,
	.flush		= h4_flush,
};
};


int h4_init(void)
int __init h4_init(void)
{
{
	int err = hci_uart_register_proto(&h4p);
	int err = hci_uart_register_proto(&h4p);


@@ -284,7 +185,7 @@ int h4_init(void)
	return err;
	return err;
}
}


int h4_deinit(void)
int __exit h4_deinit(void)
{
{
	return hci_uart_unregister_proto(&h4p);
	return hci_uart_unregister_proto(&h4p);
}
}
+2 −2
Original line number Original line Diff line number Diff line
@@ -517,7 +517,7 @@ static struct hci_uart_proto llp = {
	.flush		= ll_flush,
	.flush		= ll_flush,
};
};


int ll_init(void)
int __init ll_init(void)
{
{
	int err = hci_uart_register_proto(&llp);
	int err = hci_uart_register_proto(&llp);


@@ -529,7 +529,7 @@ int ll_init(void)
	return err;
	return err;
}
}


int ll_deinit(void)
int __exit ll_deinit(void)
{
{
	return hci_uart_unregister_proto(&llp);
	return hci_uart_unregister_proto(&llp);
}
}
+2 −0
Original line number Original line Diff line number Diff line
@@ -256,6 +256,7 @@ enum {
	HCI_CONN_ENCRYPT_PEND,
	HCI_CONN_ENCRYPT_PEND,
	HCI_CONN_RSWITCH_PEND,
	HCI_CONN_RSWITCH_PEND,
	HCI_CONN_MODE_CHANGE_PEND,
	HCI_CONN_MODE_CHANGE_PEND,
	HCI_CONN_SCO_SETUP_PEND,
};
};


static inline void hci_conn_hash_init(struct hci_dev *hdev)
static inline void hci_conn_hash_init(struct hci_dev *hdev)
@@ -336,6 +337,7 @@ void hci_acl_connect(struct hci_conn *conn);
void hci_acl_disconn(struct hci_conn *conn, __u8 reason);
void hci_acl_disconn(struct hci_conn *conn, __u8 reason);
void hci_add_sco(struct hci_conn *conn, __u16 handle);
void hci_add_sco(struct hci_conn *conn, __u16 handle);
void hci_setup_sync(struct hci_conn *conn, __u16 handle);
void hci_setup_sync(struct hci_conn *conn, __u16 handle);
void hci_sco_setup(struct hci_conn *conn, __u8 status);


struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst);
struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst);
int hci_conn_del(struct hci_conn *conn);
int hci_conn_del(struct hci_conn *conn);
Loading