summaryrefslogtreecommitdiff
path: root/patches/collateral-evolutions/network/16-bluetooth
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2013-03-30 00:53:58 +0100
committerJohannes Berg <johannes@sipsolutions.net>2013-03-30 01:06:36 +0100
commit44706a520f6527c67e7f8b741812f11464babda2 (patch)
treeceba8de9f18d05fea9bb4d337391ed79a2bc7cf4 /patches/collateral-evolutions/network/16-bluetooth
parent5bf870f42dc0cf3e31522e05119c0a8f993a280e (diff)
split patches
This splits all patches into per-file patches. I've added the little tool I wrote as well (but it's hard to use). Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Diffstat (limited to 'patches/collateral-evolutions/network/16-bluetooth')
-rw-r--r--patches/collateral-evolutions/network/16-bluetooth/INFO3
-rw-r--r--patches/collateral-evolutions/network/16-bluetooth/drivers_bluetooth_hci_ldisc.c28
-rw-r--r--patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_af_bluetooth.c39
-rw-r--r--patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_bnep_sock.c15
-rw-r--r--patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_cmtp_capi.c14
-rw-r--r--patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_cmtp_sock.c15
-rw-r--r--patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_hci_sock.c29
-rw-r--r--patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_hci_sysfs.c38
-rw-r--r--patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_hidp_core.c220
-rw-r--r--patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_hidp_sock.c15
-rw-r--r--patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_l2cap_sock.c41
-rw-r--r--patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_rfcomm_sock.c28
-rw-r--r--patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_rfcomm_tty.c63
-rw-r--r--patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_sco.c27
14 files changed, 575 insertions, 0 deletions
diff --git a/patches/collateral-evolutions/network/16-bluetooth/INFO b/patches/collateral-evolutions/network/16-bluetooth/INFO
new file mode 100644
index 00000000..7df4a684
--- /dev/null
+++ b/patches/collateral-evolutions/network/16-bluetooth/INFO
@@ -0,0 +1,3 @@
+These changes are required to backport blueooth. A lot can be optimized
+here still, but for now we keep this here.
+
diff --git a/patches/collateral-evolutions/network/16-bluetooth/drivers_bluetooth_hci_ldisc.c b/patches/collateral-evolutions/network/16-bluetooth/drivers_bluetooth_hci_ldisc.c
new file mode 100644
index 00000000..5248d2d6
--- /dev/null
+++ b/patches/collateral-evolutions/network/16-bluetooth/drivers_bluetooth_hci_ldisc.c
@@ -0,0 +1,28 @@
+--- a/drivers/bluetooth/hci_ldisc.c
++++ b/drivers/bluetooth/hci_ldisc.c
+@@ -297,8 +297,13 @@
+ /* FIXME: why is this needed. Note don't use ldisc_ref here as the
+ open path is before the ldisc is referencable */
+
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30))
+ if (tty->ldisc->ops->flush_buffer)
+ tty->ldisc->ops->flush_buffer(tty);
++#else
++ if (tty->ldisc.ops->flush_buffer)
++ tty->ldisc.ops->flush_buffer(tty);
++#endif
+ tty_driver_flush_buffer(tty);
+
+ return 0;
+@@ -524,7 +529,11 @@
+ return hu->hdev_flags;
+
+ default:
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27))
+ err = n_tty_ioctl_helper(tty, file, cmd, arg);
++#else
++ err = n_tty_ioctl(tty, file, cmd, arg);
++#endif
+ break;
+ }
+
diff --git a/patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_af_bluetooth.c b/patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_af_bluetooth.c
new file mode 100644
index 00000000..e4823d52
--- /dev/null
+++ b/patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_af_bluetooth.c
@@ -0,0 +1,39 @@
+--- a/net/bluetooth/af_bluetooth.c
++++ b/net/bluetooth/af_bluetooth.c
+@@ -103,8 +103,12 @@
+ }
+ EXPORT_SYMBOL(bt_sock_unregister);
+
++#if defined(CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN)
+ static int bt_sock_create(struct net *net, struct socket *sock, int proto,
+ int kern)
++#else
++static int bt_sock_create(struct net *net, struct socket *sock, int proto)
++#endif
+ {
+ int err;
+
+@@ -122,7 +126,11 @@
+ read_lock(&bt_proto_lock);
+
+ if (bt_proto[proto] && try_module_get(bt_proto[proto]->owner)) {
++#if defined(CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN)
+ err = bt_proto[proto]->create(net, sock, proto, kern);
++#else
++ err = bt_proto[proto]->create(net, sock, proto);
++#endif
+ if (!err)
+ bt_sock_reclassify_lock(sock->sk, proto);
+ module_put(bt_proto[proto]->owner);
+@@ -455,7 +463,11 @@
+ if (sk->sk_state == BT_LISTEN)
+ return -EINVAL;
+
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31))
+ amount = sk->sk_sndbuf - sk_wmem_alloc_get(sk);
++#else
++ amount = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc);
++#endif
+ if (amount < 0)
+ amount = 0;
+ err = put_user(amount, (int __user *) arg);
diff --git a/patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_bnep_sock.c b/patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_bnep_sock.c
new file mode 100644
index 00000000..13e1f1bc
--- /dev/null
+++ b/patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_bnep_sock.c
@@ -0,0 +1,15 @@
+--- a/net/bluetooth/bnep/sock.c
++++ b/net/bluetooth/bnep/sock.c
+@@ -186,8 +186,12 @@
+ .obj_size = sizeof(struct bt_sock)
+ };
+
++#if defined(CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN)
+ static int bnep_sock_create(struct net *net, struct socket *sock, int protocol,
+ int kern)
++#else
++static int bnep_sock_create(struct net *net, struct socket *sock, int protocol)
++#endif
+ {
+ struct sock *sk;
+
diff --git a/patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_cmtp_capi.c b/patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_cmtp_capi.c
new file mode 100644
index 00000000..25a51dcc
--- /dev/null
+++ b/patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_cmtp_capi.c
@@ -0,0 +1,14 @@
+--- a/net/bluetooth/cmtp/capi.c
++++ b/net/bluetooth/cmtp/capi.c
+@@ -384,7 +384,11 @@
+
+ BT_DBG("ctrl %p", ctrl);
+
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30))
+ capi_ctr_down(ctrl);
++#else
++ capi_ctr_reseted(ctrl);
++#endif
+
+ atomic_inc(&session->terminate);
+ wake_up_process(session->task);
diff --git a/patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_cmtp_sock.c b/patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_cmtp_sock.c
new file mode 100644
index 00000000..eed70c6a
--- /dev/null
+++ b/patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_cmtp_sock.c
@@ -0,0 +1,15 @@
+--- a/net/bluetooth/cmtp/sock.c
++++ b/net/bluetooth/cmtp/sock.c
+@@ -195,8 +195,12 @@
+ .obj_size = sizeof(struct bt_sock)
+ };
+
++#if defined(CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN)
+ static int cmtp_sock_create(struct net *net, struct socket *sock, int protocol,
+ int kern)
++#else
++static int cmtp_sock_create(struct net *net, struct socket *sock, int protocol)
++#endif
+ {
+ struct sock *sk;
+
diff --git a/patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_hci_sock.c b/patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_hci_sock.c
new file mode 100644
index 00000000..87a98121
--- /dev/null
+++ b/patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_hci_sock.c
@@ -0,0 +1,29 @@
+--- a/net/bluetooth/hci_sock.c
++++ b/net/bluetooth/hci_sock.c
+@@ -884,8 +884,13 @@
+ goto done;
+ }
+
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31))
+ static int hci_sock_setsockopt(struct socket *sock, int level, int optname,
+ char __user *optval, unsigned int len)
++#else
++static int hci_sock_setsockopt(struct socket *sock, int level, int optname,
++ char __user *optval, int len)
++#endif
+ {
+ struct hci_ufilter uf = { .opcode = 0 };
+ struct sock *sk = sock->sk;
+@@ -1059,8 +1064,12 @@
+ .obj_size = sizeof(struct hci_pinfo)
+ };
+
++#if defined(CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN)
+ static int hci_sock_create(struct net *net, struct socket *sock, int protocol,
+ int kern)
++#else
++static int hci_sock_create(struct net *net, struct socket *sock, int protocol)
++#endif
+ {
+ struct sock *sk;
+
diff --git a/patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_hci_sysfs.c b/patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_hci_sysfs.c
new file mode 100644
index 00000000..df664bdc
--- /dev/null
+++ b/patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_hci_sysfs.c
@@ -0,0 +1,38 @@
+--- a/net/bluetooth/hci_sysfs.c
++++ b/net/bluetooth/hci_sysfs.c
+@@ -72,7 +72,11 @@
+ .attrs = bt_link_attrs,
+ };
+
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31))
+ static const struct attribute_group *bt_link_groups[] = {
++#else
++static struct attribute_group *bt_link_groups[] = {
++#endif
+ &bt_link_group,
+ NULL
+ };
+@@ -141,7 +145,11 @@
+ dev = device_find_child(&conn->dev, NULL, __match_tty);
+ if (!dev)
+ break;
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29))
+ device_move(dev, NULL, DPM_ORDER_DEV_LAST);
++#else
++ device_move(dev, NULL);
++#endif
+ put_device(dev);
+ }
+
+@@ -379,7 +387,11 @@
+ .attrs = bt_host_attrs,
+ };
+
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31))
+ static const struct attribute_group *bt_host_groups[] = {
++#else
++static struct attribute_group *bt_host_groups[] = {
++#endif
+ &bt_host_group,
+ NULL
+ };
diff --git a/patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_hidp_core.c b/patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_hidp_core.c
new file mode 100644
index 00000000..0807ccc7
--- /dev/null
+++ b/patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_hidp_core.c
@@ -0,0 +1,220 @@
+--- a/net/bluetooth/hidp/core.c
++++ b/net/bluetooth/hidp/core.c
+@@ -383,6 +383,7 @@
+ return ret;
+ }
+
++#if defined(CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN)
+ static int hidp_output_raw_report(struct hid_device *hid, unsigned char *data, size_t count,
+ unsigned char report_type)
+ {
+@@ -441,6 +442,16 @@
+ mutex_unlock(&session->report_mutex);
+ return ret;
+ }
++#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27))
++static int hidp_output_raw_report(struct hid_device *hid, unsigned char *data, size_t count)
++{
++ if (hidp_send_ctrl_message(hid->driver_data,
++ HIDP_TRANS_SET_REPORT | HIDP_DATA_RTYPE_FEATURE,
++ data, count))
++ return -ENOMEM;
++ return count;
++}
++#endif
+
+ static void hidp_idle_timeout(unsigned long arg)
+ {
+@@ -743,8 +754,14 @@
+ }
+
+ if (session->hid) {
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27))
+ hid_destroy_device(session->hid);
+ session->hid = NULL;
++#else
++ if (session->hid->claimed & HID_CLAIMED_INPUT)
++ hidinput_disconnect(session->hid);
++ hid_free_device(session->hid);
++#endif
+ }
+
+ /* Wakeup user-space polling for socket errors */
+@@ -855,6 +872,70 @@
+ {
+ }
+
++#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,27))
++static const struct {
++ __u16 idVendor;
++ __u16 idProduct;
++ unsigned quirks;
++} hidp_blacklist[] = {
++ /* Apple wireless Mighty Mouse */
++ { 0x05ac, 0x030c, HID_QUIRK_MIGHTYMOUSE | HID_QUIRK_INVERT_HWHEEL },
++
++ { } /* Terminating entry */
++};
++static void hidp_setup_quirks(struct hid_device *hid)
++{
++ unsigned int n;
++
++ for (n = 0; hidp_blacklist[n].idVendor; n++)
++ if (hidp_blacklist[n].idVendor == le16_to_cpu(hid->vendor) &&
++ hidp_blacklist[n].idProduct == le16_to_cpu(hid->product))
++ hid->quirks = hidp_blacklist[n].quirks;
++}
++
++static void hidp_setup_hid(struct hidp_session *session,
++ struct hidp_connadd_req *req)
++{
++ struct hid_device *hid = session->hid;
++ struct hid_report *report;
++ bdaddr_t src, dst;
++
++ session->hid = hid;
++
++ hid->driver_data = session;
++
++ baswap(&src, &bt_sk(session->ctrl_sock->sk)->src);
++ baswap(&dst, &bt_sk(session->ctrl_sock->sk)->dst);
++
++ hid->bus = BUS_BLUETOOTH;
++ hid->vendor = req->vendor;
++ hid->product = req->product;
++ hid->version = req->version;
++ hid->country = req->country;
++
++ strncpy(hid->name, req->name, 128);
++ strncpy(hid->phys, batostr(&src), 64);
++ strncpy(hid->uniq, batostr(&dst), 64);
++
++ hid->dev = hidp_get_device(session);
++ hid->hid_open = hidp_open;
++ hid->hid_close = hidp_close;
++
++ hid->hidinput_input_event = hidp_hidinput_event;
++
++ hidp_setup_quirks(hid);
++
++ list_for_each_entry(report, &hid->report_enum[HID_INPUT_REPORT].report_list, list)
++ hidp_send_report(session, report);
++
++ list_for_each_entry(report, &hid->report_enum[HID_FEATURE_REPORT].report_list, list)
++ hidp_send_report(session, report);
++
++ if (hidinput_connect(hid) == 0)
++ hid->claimed |= HID_CLAIMED_INPUT;
++}
++#else
++
+ static int hidp_parse(struct hid_device *hid)
+ {
+ struct hidp_session *session = hid->driver_data;
+@@ -946,7 +1027,9 @@
+ hid->dev.parent = &session->conn->dev;
+ hid->ll_driver = &hidp_hid_driver;
+
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38))
+ hid->hid_get_raw_report = hidp_get_raw_report;
++#endif
+ hid->hid_output_raw_report = hidp_output_raw_report;
+
+ /* True if device is blacklisted in drivers/hid/hid-core.c */
+@@ -964,6 +1047,7 @@
+
+ return err;
+ }
++#endif
+
+ int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock, struct socket *intr_sock)
+ {
+@@ -979,6 +1063,39 @@
+
+ BT_DBG("rd_data %p rd_size %d", req->rd_data, req->rd_size);
+
++#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,27))
++ if (req->rd_size > 0) {
++ unsigned char *buf = kmalloc(req->rd_size, GFP_KERNEL);
++
++ if (!buf) {
++ kfree(session);
++ return -ENOMEM;
++ }
++
++ if (copy_from_user(buf, req->rd_data, req->rd_size)) {
++ kfree(buf);
++ kfree(session);
++ return -EFAULT;
++ }
++
++ session->hid = hid_parse_report(buf, req->rd_size);
++
++ kfree(buf);
++
++ if (!session->hid) {
++ kfree(session);
++ return -EINVAL;
++ }
++ }
++
++ if (!session->hid) {
++ session->input = input_allocate_device();
++ if (!session->input) {
++ kfree(session);
++ return -ENOMEM;
++ }
++ }
++#endif
+ down_write(&hidp_session_sem);
+
+ s = __hidp_get_session(&bt_sk(ctrl_sock->sk)->dst);
+@@ -1026,6 +1143,7 @@
+
+ __hidp_link_session(session);
+
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27))
+ if (req->rd_size > 0) {
+ err = hidp_setup_hid(session, req);
+ if (err && err != -ENODEV)
+@@ -1037,6 +1155,16 @@
+ if (err < 0)
+ goto purge;
+ }
++#else
++ if (session->input) {
++ err = hidp_setup_input(session, req);
++ if (err < 0)
++ goto failed;
++ }
++
++ if (session->hid)
++ hidp_setup_hid(session, req);
++#endif
+
+ hidp_set_timer(session);
+
+@@ -1095,6 +1223,7 @@
+ session->input = NULL;
+ }
+
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27))
+ if (session->hid) {
+ hid_destroy_device(session->hid);
+ session->hid = NULL;
+@@ -1108,10 +1237,15 @@
+
+ skb_queue_purge(&session->ctrl_transmit);
+ skb_queue_purge(&session->intr_transmit);
++#endif
+
+ failed:
+ up_write(&hidp_session_sem);
+
++#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,27))
++ if (session->hid)
++ hid_free_device(session->hid);
++#endif
+ kfree(session);
+ return err;
+ }
diff --git a/patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_hidp_sock.c b/patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_hidp_sock.c
new file mode 100644
index 00000000..0cf1f8c3
--- /dev/null
+++ b/patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_hidp_sock.c
@@ -0,0 +1,15 @@
+--- a/net/bluetooth/hidp/sock.c
++++ b/net/bluetooth/hidp/sock.c
+@@ -235,8 +235,12 @@
+ .obj_size = sizeof(struct bt_sock)
+ };
+
++#if defined(CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN)
+ static int hidp_sock_create(struct net *net, struct socket *sock, int protocol,
+ int kern)
++#else
++static int hidp_sock_create(struct net *net, struct socket *sock, int protocol)
++#endif
+ {
+ struct sock *sk;
+
diff --git a/patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_l2cap_sock.c b/patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_l2cap_sock.c
new file mode 100644
index 00000000..89307b41
--- /dev/null
+++ b/patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_l2cap_sock.c
@@ -0,0 +1,41 @@
+--- a/net/bluetooth/l2cap_sock.c
++++ b/net/bluetooth/l2cap_sock.c
+@@ -573,8 +573,13 @@
+ return err;
+ }
+
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31))
+ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname,
+ char __user *optval, unsigned int optlen)
++#else
++static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname,
++ char __user *optval, int optlen)
++#endif
+ {
+ struct sock *sk = sock->sk;
+ struct l2cap_chan *chan = l2cap_pi(sk)->chan;
+@@ -1225,8 +1230,12 @@
+ return sk;
+ }
+
++#if defined(CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN)
+ static int l2cap_sock_create(struct net *net, struct socket *sock, int protocol,
+ int kern)
++#else
++static int l2cap_sock_create(struct net *net, struct socket *sock, int protocol)
++#endif
+ {
+ struct sock *sk;
+
+@@ -1238,7 +1247,11 @@
+ sock->type != SOCK_DGRAM && sock->type != SOCK_RAW)
+ return -ESOCKTNOSUPPORT;
+
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,32))
+ if (sock->type == SOCK_RAW && !kern && !capable(CAP_NET_RAW))
++#else
++ if (sock->type == SOCK_RAW && !capable(CAP_NET_RAW))
++#endif
+ return -EPERM;
+
+ sock->ops = &l2cap_sock_ops;
diff --git a/patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_rfcomm_sock.c b/patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_rfcomm_sock.c
new file mode 100644
index 00000000..5affe501
--- /dev/null
+++ b/patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_rfcomm_sock.c
@@ -0,0 +1,28 @@
+--- a/net/bluetooth/rfcomm/sock.c
++++ b/net/bluetooth/rfcomm/sock.c
+@@ -304,8 +304,13 @@
+ return sk;
+ }
+
++#if defined(CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN)
+ static int rfcomm_sock_create(struct net *net, struct socket *sock,
+ int protocol, int kern)
++#else
++static int rfcomm_sock_create(struct net *net, struct socket *sock,
++ int protocol)
++#endif
+ {
+ struct sock *sk;
+
+@@ -660,7 +665,11 @@
+ return err;
+ }
+
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31))
+ static int rfcomm_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen)
++#else
++static int rfcomm_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen)
++#endif
+ {
+ struct sock *sk = sock->sk;
+ struct bt_security sec;
diff --git a/patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_rfcomm_tty.c b/patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_rfcomm_tty.c
new file mode 100644
index 00000000..957122ec
--- /dev/null
+++ b/patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_rfcomm_tty.c
@@ -0,0 +1,63 @@
+--- a/net/bluetooth/rfcomm/tty.c
++++ b/net/bluetooth/rfcomm/tty.c
+@@ -708,8 +708,12 @@
+ remove_wait_queue(&dev->wait, &wait);
+
+ if (err == 0)
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29))
+ device_move(dev->tty_dev, rfcomm_get_device(dev),
+ DPM_ORDER_DEV_AFTER_PARENT);
++#else
++ device_move(dev->tty_dev, rfcomm_get_device(dev));
++#endif
+
+ rfcomm_tty_copy_pending(dev);
+
+@@ -733,7 +737,11 @@
+ if (!--dev->port.count) {
+ spin_unlock_irqrestore(&dev->port.lock, flags);
+ if (dev->tty_dev->parent)
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29))
+ device_move(dev->tty_dev, NULL, DPM_ORDER_DEV_LAST);
++#else
++ device_move(dev->tty_dev, NULL);
++#endif
+
+ /* Close DLC and dettach TTY */
+ rfcomm_dlc_close(dev->dlc, 0);
+@@ -809,7 +817,11 @@
+ return room;
+ }
+
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38))
+ static int rfcomm_tty_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)
++#else
++static int rfcomm_tty_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd, unsigned long arg)
++#endif
+ {
+ BT_DBG("tty %p cmd 0x%02x", tty, cmd);
+
+@@ -1068,7 +1080,11 @@
+ }
+ }
+
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38))
+ static int rfcomm_tty_tiocmget(struct tty_struct *tty)
++#else
++static int rfcomm_tty_tiocmget(struct tty_struct *tty, struct file *filp)
++#endif
+ {
+ struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data;
+
+@@ -1077,7 +1093,11 @@
+ return dev->modem_status;
+ }
+
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38))
+ static int rfcomm_tty_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear)
++#else
++static int rfcomm_tty_tiocmset(struct tty_struct *tty, struct file *filp, unsigned int set, unsigned int clear)
++#endif
+ {
+ struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data;
+ struct rfcomm_dlc *dlc = dev->dlc;
diff --git a/patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_sco.c b/patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_sco.c
new file mode 100644
index 00000000..64bc1a4c
--- /dev/null
+++ b/patches/collateral-evolutions/network/16-bluetooth/net_bluetooth_sco.c
@@ -0,0 +1,27 @@
+--- a/net/bluetooth/sco.c
++++ b/net/bluetooth/sco.c
+@@ -423,8 +423,12 @@
+ return sk;
+ }
+
++#if defined(CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN)
+ static int sco_sock_create(struct net *net, struct socket *sock, int protocol,
+ int kern)
++#else
++static int sco_sock_create(struct net *net, struct socket *sock, int protocol)
++#endif
+ {
+ struct sock *sk;
+
+@@ -675,7 +679,11 @@
+ return bt_sock_recvmsg(iocb, sock, msg, len, flags);
+ }
+
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31))
+ static int sco_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen)
++#else
++static int sco_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen)
++#endif
+ {
+ struct sock *sk = sock->sk;
+ int err = 0;