summaryrefslogtreecommitdiff
path: root/patches/0090-bluetooth-compilation.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/0090-bluetooth-compilation.patch')
-rw-r--r--patches/0090-bluetooth-compilation.patch324
1 files changed, 324 insertions, 0 deletions
diff --git a/patches/0090-bluetooth-compilation.patch b/patches/0090-bluetooth-compilation.patch
new file mode 100644
index 00000000..7ec8d35d
--- /dev/null
+++ b/patches/0090-bluetooth-compilation.patch
@@ -0,0 +1,324 @@
+From b72939f55d0615b43720568c47ce34bd372624f8 Mon Sep 17 00:00:00 2001
+From: Dominik Sliwa <dominik.sliwa@toradex.com>
+Date: Thu, 21 Feb 2019 14:06:40 +0100
+Subject: [PATCH] bluetooth: bluetooth compilation
+
+---
+ net/bluetooth/a2mp.c | 4 ++--
+ net/bluetooth/af_bluetooth.c | 37 ++++++++++++++++++++++++++++++++++++-
+ net/bluetooth/hci_sock.c | 9 +++++++++
+ net/bluetooth/l2cap_core.c | 9 +++++++--
+ net/bluetooth/l2cap_sock.c | 16 ++++++++++++++++
+ net/bluetooth/rfcomm/core.c | 2 +-
+ net/bluetooth/rfcomm/sock.c | 19 ++++++++++++++++++-
+ net/bluetooth/sco.c | 15 +++++++++++++++
+ 8 files changed, 104 insertions(+), 7 deletions(-)
+
+diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c
+index 6554607..3e48459 100644
+--- a/net/bluetooth/a2mp.c
++++ b/net/bluetooth/a2mp.c
+@@ -244,7 +244,7 @@ static int a2mp_discover_rsp(struct amp_mgr *mgr, struct sk_buff *skb,
+ }
+
+ len -= sizeof(*cl);
+- cl = skb_pull(skb, sizeof(*cl));
++ cl = (void *)skb_pull(skb, sizeof(*cl));
+ }
+
+ /* Fall back to L2CAP init sequence */
+@@ -284,7 +284,7 @@ static int a2mp_change_notify(struct amp_mgr *mgr, struct sk_buff *skb,
+ while (skb->len >= sizeof(*cl)) {
+ BT_DBG("Controller id %d type %d status %d", cl->id, cl->type,
+ cl->status);
+- cl = skb_pull(skb, sizeof(*cl));
++ cl = (void *)skb_pull(skb, sizeof(*cl));
+ }
+
+ /* TODO send A2MP_CHANGE_RSP */
+diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
+index deacc52..a8269f8 100644
+--- a/net/bluetooth/af_bluetooth.c
++++ b/net/bluetooth/af_bluetooth.c
+@@ -649,7 +649,11 @@ static int bt_seq_show(struct seq_file *seq, void *v)
+ seq_printf(seq,
+ "%pK %-6d %-6u %-6u %-6u %-6lu %-6lu",
+ sk,
++#if LINUX_VERSION_IS_GEQ(4,13,0)
+ refcount_read(&sk->sk_refcnt),
++#else
++ atomic_read(&sk->sk_refcnt),
++#endif
+ sk_rmem_alloc_get(sk),
+ sk_wmem_alloc_get(sk),
+ from_kuid(seq_user_ns(seq), sock_i_uid(sk)),
+@@ -673,14 +677,45 @@ static const struct seq_operations bt_seq_ops = {
+ .show = bt_seq_show,
+ };
+
++#if LINUX_VERSION_IS_LESS(4,18,0)
++struct bt_seq_state {
++ struct bt_sock_list *l;
++};
++static int bt_seq_open(struct inode *inode, struct file *file)
++{
++ struct bt_sock_list *sk_list;
++ struct bt_seq_state *s;
++
++ sk_list = PDE_DATA(inode);
++ s = __seq_open_private(file, &bt_seq_ops,
++ sizeof(struct bt_seq_state));
++ if (!s)
++ return -ENOMEM;
++
++ s->l = sk_list;
++ return 0;
++}
++
++static const struct file_operations bt_fops = {
++ .open = bt_seq_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = seq_release_private
++};
++#endif
++
+ int bt_procfs_init(struct net *net, const char *name,
+ struct bt_sock_list *sk_list,
+ int (* seq_show)(struct seq_file *, void *))
+ {
+ sk_list->custom_seq_show = seq_show;
+-
++#if LINUX_VERSION_IS_GEQ(4,18,0)
+ if (!proc_create_seq_data(name, 0, net->proc_net, &bt_seq_ops, sk_list))
+ return -ENOMEM;
++#else
++ if (!proc_create_data(name, 0, net->proc_net, &bt_fops, sk_list))
++ return -ENOMEM;
++#endif
+ return 0;
+ }
+
+diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
+index 3d3b23d..542fb36 100644
+--- a/net/bluetooth/hci_sock.c
++++ b/net/bluetooth/hci_sock.c
+@@ -1339,8 +1339,13 @@ done:
+ return err;
+ }
+
++#if LINUX_VERSION_IS_LESS(4,17,0)
++static int hci_sock_getname(struct socket *sock, struct sockaddr *addr,
++ int *sockaddr_len, int peer)
++#else
+ static int hci_sock_getname(struct socket *sock, struct sockaddr *addr,
+ int peer)
++#endif
+ {
+ struct sockaddr_hci *haddr = (struct sockaddr_hci *)addr;
+ struct sock *sk = sock->sk;
+@@ -1363,7 +1368,11 @@ static int hci_sock_getname(struct socket *sock, struct sockaddr *addr,
+ haddr->hci_family = AF_BLUETOOTH;
+ haddr->hci_dev = hdev->id;
+ haddr->hci_channel= hci_pi(sk)->channel;
++#if LINUX_VERSION_IS_LESS(4,17,0)
++ *sockaddr_len = sizeof(*haddr);
++#else
+ err = sizeof(*haddr);
++#endif
+
+ done:
+ release_sock(sk);
+diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
+index 3bbc440..61cb929 100644
+--- a/net/bluetooth/l2cap_core.c
++++ b/net/bluetooth/l2cap_core.c
+@@ -2127,8 +2127,10 @@ static inline int l2cap_skbuff_fromiovec(struct l2cap_chan *chan,
+ struct sk_buff **frag;
+ int sent = 0;
+
+-#if LINUX_VERSION_IS_GEQ(3,19,0)
++#if LINUX_VERSION_IS_GEQ(4,10,0)
+ if (!copy_from_iter_full(skb_put(skb, count), count, &msg->msg_iter))
++#elif LINUX_VERSION_IS_GEQ(3,19,0)
++ if (copy_from_iter(skb_put(skb, count), count, &msg->msg_iter) != count)
+ #else
+ if (chan->ops->memcpy_fromiovec(chan, skb_put(skb, count),
+ msg->msg_iov, count))
+@@ -2152,9 +2154,12 @@ static inline int l2cap_skbuff_fromiovec(struct l2cap_chan *chan,
+
+ *frag = tmp;
+
+-#if LINUX_VERSION_IS_GEQ(3,19,0)
++#if LINUX_VERSION_IS_GEQ(4,10,0)
+ if (!copy_from_iter_full(skb_put(*frag, count), count,
+ &msg->msg_iter))
++#elif LINUX_VERSION_IS_GEQ(3,19,0)
++ if (copy_from_iter(skb_put(*frag, count), count,
++ &msg->msg_iter) != count)
+ #else
+ if (chan->ops->memcpy_fromiovec(chan, skb_put(*frag, count),
+ msg->msg_iov, count))
+diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
+index 406638d..04c3e00 100644
+--- a/net/bluetooth/l2cap_sock.c
++++ b/net/bluetooth/l2cap_sock.c
+@@ -301,8 +301,13 @@ done:
+ return err;
+ }
+
++#if LINUX_VERSION_IS_LESS(4,12,0)
++static int l2cap_sock_accept(struct socket *sock, struct socket *newsock,
++ int flags)
++#else
+ static int l2cap_sock_accept(struct socket *sock, struct socket *newsock,
+ int flags, bool kern)
++#endif
+ {
+ DEFINE_WAIT_FUNC(wait, woken_wake_function);
+ struct sock *sk = sock->sk, *nsk;
+@@ -357,8 +362,14 @@ done:
+ return err;
+ }
+
++
++#if LINUX_VERSION_IS_LESS(4,17,0)
++static int l2cap_sock_getname(struct socket *sock, struct sockaddr *addr,
++ int *len, int peer)
++#else
+ static int l2cap_sock_getname(struct socket *sock, struct sockaddr *addr,
+ int peer)
++#endif
+ {
+ struct sockaddr_l2 *la = (struct sockaddr_l2 *) addr;
+ struct sock *sk = sock->sk;
+@@ -386,7 +397,12 @@ static int l2cap_sock_getname(struct socket *sock, struct sockaddr *addr,
+ la->l2_bdaddr_type = chan->src_type;
+ }
+
++#if LINUX_VERSION_IS_LESS(4,17,0)
++ *len = sizeof(struct sockaddr_l2);
++ return 0;
++#else
+ return sizeof(struct sockaddr_l2);
++#endif
+ }
+
+ static int l2cap_sock_getsockopt_old(struct socket *sock, int optname,
+diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
+index 2289d6c..8e7a632 100644
+--- a/net/bluetooth/rfcomm/core.c
++++ b/net/bluetooth/rfcomm/core.c
+@@ -872,7 +872,7 @@ static int rfcomm_queue_disc(struct rfcomm_dlc *d)
+ if (!skb)
+ return -ENOMEM;
+
+- cmd = __skb_put(skb, sizeof(*cmd));
++ cmd = (void *)__skb_put(skb, sizeof(*cmd));
+ cmd->addr = d->addr;
+ cmd->ctrl = __ctrl(RFCOMM_DISC, 1);
+ cmd->len = __len8(0);
+diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c
+index 90e1c3b..604cf98 100644
+--- a/net/bluetooth/rfcomm/sock.c
++++ b/net/bluetooth/rfcomm/sock.c
+@@ -204,8 +204,11 @@ static void rfcomm_sock_kill(struct sock *sk)
+ {
+ if (!sock_flag(sk, SOCK_ZAPPED) || sk->sk_socket)
+ return;
+-
++#if LINUX_VERSION_IS_GEQ(4,13,0)
+ BT_DBG("sk %p state %d refcnt %d", sk, sk->sk_state, refcount_read(&sk->sk_refcnt));
++#else
++ BT_DBG("sk %p state %d refcnt %d", sk, sk->sk_state, atomic_read(&sk->sk_refcnt));
++#endif
+
+ /* Kill poor orphan */
+ bt_sock_unlink(&rfcomm_sk_list, sk);
+@@ -481,8 +484,12 @@ done:
+ return err;
+ }
+
++#if LINUX_VERSION_IS_LESS(4,12,0)
++static int rfcomm_sock_accept(struct socket *sock, struct socket *newsock, int flags)
++#else
+ static int rfcomm_sock_accept(struct socket *sock, struct socket *newsock, int flags,
+ bool kern)
++#endif
+ {
+ DEFINE_WAIT_FUNC(wait, woken_wake_function);
+ struct sock *sk = sock->sk, *nsk;
+@@ -542,7 +549,12 @@ done:
+ return err;
+ }
+
++#if LINUX_VERSION_IS_LESS(4,17,0)
++static int rfcomm_sock_getname(struct socket *sock, struct sockaddr *addr,
++ int *len, int peer)
++#else
+ static int rfcomm_sock_getname(struct socket *sock, struct sockaddr *addr, int peer)
++#endif
+ {
+ struct sockaddr_rc *sa = (struct sockaddr_rc *) addr;
+ struct sock *sk = sock->sk;
+@@ -561,7 +573,12 @@ static int rfcomm_sock_getname(struct socket *sock, struct sockaddr *addr, int p
+ else
+ bacpy(&sa->rc_bdaddr, &rfcomm_pi(sk)->src);
+
++#if LINUX_VERSION_IS_LESS(4,17,0)
++ *len = sizeof(struct sockaddr_rc);
++ return 0;
++#else
+ return sizeof(struct sockaddr_rc);
++#endif
+ }
+
+ static int rfcomm_sock_sendmsg(struct socket *sock, struct msghdr *msg,
+diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
+index c719f08..aafe828 100644
+--- a/net/bluetooth/sco.c
++++ b/net/bluetooth/sco.c
+@@ -625,8 +625,13 @@ done:
+ return err;
+ }
+
++#if LINUX_VERSION_IS_LESS(4,12,0)
++static int sco_sock_accept(struct socket *sock, struct socket *newsock,
++ int flags)
++#else
+ static int sco_sock_accept(struct socket *sock, struct socket *newsock,
+ int flags, bool kern)
++#endif
+ {
+ DEFINE_WAIT_FUNC(wait, woken_wake_function);
+ struct sock *sk = sock->sk, *ch;
+@@ -680,8 +685,13 @@ done:
+ return err;
+ }
+
++#if LINUX_VERSION_IS_LESS(4,17,0)
++static int sco_sock_getname(struct socket *sock, struct sockaddr *addr,
++ int *len, int peer)
++#else
+ static int sco_sock_getname(struct socket *sock, struct sockaddr *addr,
+ int peer)
++#endif
+ {
+ struct sockaddr_sco *sa = (struct sockaddr_sco *) addr;
+ struct sock *sk = sock->sk;
+@@ -695,7 +705,12 @@ static int sco_sock_getname(struct socket *sock, struct sockaddr *addr,
+ else
+ bacpy(&sa->sco_bdaddr, &sco_pi(sk)->src);
+
++#if LINUX_VERSION_IS_LESS(4,17,0)
++ *len = sizeof(struct sockaddr_sco);
++ return 0;
++#else
+ return sizeof(struct sockaddr_sco);
++#endif
+ }
+
+ static int sco_sock_sendmsg(struct socket *sock, struct msghdr *msg,
+--
+2.13.6
+