Commit 9d1c40eb authored by Marcel Holtmann's avatar Marcel Holtmann

Bluetooth: hci_uart: Use const data pointer for received data

The TTY layer provides its data pointers as const, but the HCI UART
callbacks expect them as general data pointers. This is of course
wrong and instead of casting them, just fix the individual drivers
to actually take a const data pointer.
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
parent 5c7d2dd2
...@@ -188,7 +188,7 @@ static struct sk_buff *ath_dequeue(struct hci_uart *hu) ...@@ -188,7 +188,7 @@ static struct sk_buff *ath_dequeue(struct hci_uart *hu)
} }
/* Recv data */ /* Recv data */
static int ath_recv(struct hci_uart *hu, void *data, int count) static int ath_recv(struct hci_uart *hu, const void *data, int count)
{ {
int ret; int ret;
......
...@@ -554,10 +554,10 @@ static u16 bscp_get_crc(struct bcsp_struct *bcsp) ...@@ -554,10 +554,10 @@ static u16 bscp_get_crc(struct bcsp_struct *bcsp)
} }
/* Recv data */ /* Recv data */
static int bcsp_recv(struct hci_uart *hu, void *data, int count) static int bcsp_recv(struct hci_uart *hu, const void *data, int count)
{ {
struct bcsp_struct *bcsp = hu->priv; struct bcsp_struct *bcsp = hu->priv;
unsigned char *ptr; const unsigned char *ptr;
BT_DBG("hu %p count %d rx_state %d rx_count %ld", BT_DBG("hu %p count %d rx_state %d rx_count %ld",
hu, count, bcsp->rx_state, bcsp->rx_count); hu, count, bcsp->rx_state, bcsp->rx_count);
......
...@@ -113,7 +113,7 @@ static int h4_enqueue(struct hci_uart *hu, struct sk_buff *skb) ...@@ -113,7 +113,7 @@ static int h4_enqueue(struct hci_uart *hu, struct sk_buff *skb)
} }
/* Recv data */ /* Recv data */
static int h4_recv(struct hci_uart *hu, void *data, int count) static int h4_recv(struct hci_uart *hu, const void *data, int count)
{ {
int ret; int ret;
......
...@@ -511,10 +511,10 @@ static void h5_reset_rx(struct h5 *h5) ...@@ -511,10 +511,10 @@ static void h5_reset_rx(struct h5 *h5)
clear_bit(H5_RX_ESC, &h5->flags); clear_bit(H5_RX_ESC, &h5->flags);
} }
static int h5_recv(struct hci_uart *hu, void *data, int count) static int h5_recv(struct hci_uart *hu, const void *data, int count)
{ {
struct h5 *h5 = hu->priv; struct h5 *h5 = hu->priv;
unsigned char *ptr = data; const unsigned char *ptr = data;
BT_DBG("%s pending %zu count %d", hu->hdev->name, h5->rx_pending, BT_DBG("%s pending %zu count %d", hu->hdev->name, h5->rx_pending,
count); count);
......
...@@ -441,7 +441,7 @@ static void hci_uart_tty_receive(struct tty_struct *tty, const u8 *data, ...@@ -441,7 +441,7 @@ static void hci_uart_tty_receive(struct tty_struct *tty, const u8 *data,
return; return;
spin_lock(&hu->rx_lock); spin_lock(&hu->rx_lock);
hu->proto->recv(hu, (void *) data, count); hu->proto->recv(hu, data, count);
if (hu->hdev) if (hu->hdev)
hu->hdev->stat.byte_rx += count; hu->hdev->stat.byte_rx += count;
......
...@@ -370,10 +370,10 @@ static inline int ll_check_data_len(struct hci_dev *hdev, struct ll_struct *ll, ...@@ -370,10 +370,10 @@ static inline int ll_check_data_len(struct hci_dev *hdev, struct ll_struct *ll,
} }
/* Recv data */ /* Recv data */
static int ll_recv(struct hci_uart *hu, void *data, int count) static int ll_recv(struct hci_uart *hu, const void *data, int count)
{ {
struct ll_struct *ll = hu->priv; struct ll_struct *ll = hu->priv;
char *ptr; const char *ptr;
struct hci_event_hdr *eh; struct hci_event_hdr *eh;
struct hci_acl_hdr *ah; struct hci_acl_hdr *ah;
struct hci_sco_hdr *sh; struct hci_sco_hdr *sh;
......
...@@ -60,7 +60,7 @@ struct hci_uart_proto { ...@@ -60,7 +60,7 @@ struct hci_uart_proto {
int (*open)(struct hci_uart *hu); int (*open)(struct hci_uart *hu);
int (*close)(struct hci_uart *hu); int (*close)(struct hci_uart *hu);
int (*flush)(struct hci_uart *hu); int (*flush)(struct hci_uart *hu);
int (*recv)(struct hci_uart *hu, void *data, int len); int (*recv)(struct hci_uart *hu, const void *data, int len);
int (*enqueue)(struct hci_uart *hu, struct sk_buff *skb); int (*enqueue)(struct hci_uart *hu, struct sk_buff *skb);
int (*setup)(struct hci_uart *hu); int (*setup)(struct hci_uart *hu);
struct sk_buff *(*dequeue)(struct hci_uart *hu); struct sk_buff *(*dequeue)(struct hci_uart *hu);
......
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