Bluetooth: hci_uart: Use const data pointer for received data
authorMarcel Holtmann <marcel@holtmann.org>
Sun, 5 Apr 2015 03:59:41 +0000 (20:59 -0700)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 7 Apr 2015 16:47:09 +0000 (18:47 +0200)
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: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
drivers/bluetooth/hci_ath.c
drivers/bluetooth/hci_bcsp.c
drivers/bluetooth/hci_h4.c
drivers/bluetooth/hci_h5.c
drivers/bluetooth/hci_ldisc.c
drivers/bluetooth/hci_ll.c
drivers/bluetooth/hci_uart.h

index 9c4dcf4c62ea763e318ecc41f7ef5db03a9fbe67..4e89d3e33b7bafc80540cc35096f4deb85b4bf22 100644 (file)
@@ -188,7 +188,7 @@ static struct sk_buff *ath_dequeue(struct hci_uart *hu)
 }
 
 /* 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;
 
index 21cc45b34f134fe8028606e2595d381a125e0926..50ef2e613d598f3bb77a18e2a389d5f4aaeb4436 100644 (file)
@@ -554,10 +554,10 @@ static u16 bscp_get_crc(struct bcsp_struct *bcsp)
 }
 
 /* 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;
-       unsigned char *ptr;
+       const unsigned char *ptr;
 
        BT_DBG("hu %p count %d rx_state %d rx_count %ld", 
                hu, count, bcsp->rx_state, bcsp->rx_count);
index 0d9ba07d273099aaa4110c7f8d69e76b7cdce2cc..97a5df4941b4fa8fbabfcbadfdc3ee4fb93b7e74 100644 (file)
@@ -113,7 +113,7 @@ static int h4_enqueue(struct hci_uart *hu, struct sk_buff *skb)
 }
 
 /* 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;
 
index ec0fa7732c0d953c359c86f16a5f307a00f3d930..0f681cc1af6445eca6042a5d3ebd09bc39cc64d8 100644 (file)
@@ -511,10 +511,10 @@ static void h5_reset_rx(struct h5 *h5)
        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;
-       unsigned char *ptr = data;
+       const unsigned char *ptr = data;
 
        BT_DBG("%s pending %zu count %d", hu->hdev->name, h5->rx_pending,
               count);
index a3b906bcfca68bb3a20977a8afc5f39ae659945a..50dbaf3579ed638a1ea99258bc2aee7c76486584 100644 (file)
@@ -441,7 +441,7 @@ static void hci_uart_tty_receive(struct tty_struct *tty, const u8 *data,
                return;
 
        spin_lock(&hu->rx_lock);
-       hu->proto->recv(hu, (void *) data, count);
+       hu->proto->recv(hu, data, count);
 
        if (hu->hdev)
                hu->hdev->stat.byte_rx += count;
index 69a90b1b5ff56131aa7a2e51b7d18aabba28b560..79eea1cbd9885c07aad3c9069579bbcdf002d61b 100644 (file)
@@ -370,10 +370,10 @@ static inline int ll_check_data_len(struct hci_dev *hdev, struct ll_struct *ll,
 }
 
 /* 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;
-       char *ptr;
+       const char *ptr;
        struct hci_event_hdr *eh;
        struct hci_acl_hdr   *ah;
        struct hci_sco_hdr   *sh;
index 4dc8ab3009a961fc6ba269431c630e7e4b6fc3d1..79bbcefb01127df94ab7c780fcfb0077444f4842 100644 (file)
@@ -60,7 +60,7 @@ struct hci_uart_proto {
        int (*open)(struct hci_uart *hu);
        int (*close)(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 (*setup)(struct hci_uart *hu);
        struct sk_buff *(*dequeue)(struct hci_uart *hu);