summaryrefslogtreecommitdiff
path: root/backport
diff options
context:
space:
mode:
authorDominik Sliwa <dominik.sliwa@toradex.com>2019-02-21 11:35:20 +0100
committerDominik Sliwa <dominik.sliwa@toradex.com>2019-02-21 14:07:51 +0100
commit36735bb86a5e144603743bb800d7f69362d2ee2d (patch)
tree363158c7f80f3fc5a7690ca9d9ff6e5fcd7fa52e /backport
parente7720369ef69376d1244b49373e34663eaa6b5a1 (diff)
backports: reintroduce bluetooth support
Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Diffstat (limited to 'backport')
-rw-r--r--backport/Kconfig.sources2
-rw-r--r--backport/Makefile.kernel2
-rw-r--r--backport/backport-include/linux/kref.h13
-rw-r--r--backport/backport-include/linux/of_device.h5
-rw-r--r--backport/backport-include/linux/skbuff.h18
-rw-r--r--backport/compat/Makefile1
-rw-r--r--backport/compat/backport-4.12.c22
7 files changed, 63 insertions, 0 deletions
diff --git a/backport/Kconfig.sources b/backport/Kconfig.sources
index 11e27df9..c2713a14 100644
--- a/backport/Kconfig.sources
+++ b/backport/Kconfig.sources
@@ -12,6 +12,8 @@ source "$BACKPORT_DIR/drivers/net/usb/Kconfig"
source "$BACKPORT_DIR/drivers/ssb/Kconfig"
source "$BACKPORT_DIR/drivers/bcma/Kconfig"
+source "$BACKPORT_DIR/drivers/tty/serdev/Kconfig"
+
source "$BACKPORT_DIR/drivers/usb/class/Kconfig"
source "$BACKPORT_DIR/drivers/staging/Kconfig"
diff --git a/backport/Makefile.kernel b/backport/Makefile.kernel
index 8156b1ea..4264ebb1 100644
--- a/backport/Makefile.kernel
+++ b/backport/Makefile.kernel
@@ -50,4 +50,6 @@ obj-$(CPTCFG_USB_NET_RNDIS_WLAN) += drivers/net/usb/
obj-$(CPTCFG_USB_WDM) += drivers/usb/class/
obj-$(CPTCFG_USB_USBNET) += drivers/net/usb/
+obj-$(CPTCFG_SERIAL_DEV_BUS) += drivers/tty/serdev/
+
obj-$(CPTCFG_STAGING) += drivers/staging/
diff --git a/backport/backport-include/linux/kref.h b/backport/backport-include/linux/kref.h
new file mode 100644
index 00000000..631488f5
--- /dev/null
+++ b/backport/backport-include/linux/kref.h
@@ -0,0 +1,13 @@
+#ifndef __BACKPORT_LINUX_KREF_H
+#define __BACKPORT_LINUX_KREF_H
+#include_next <linux/kref.h>
+
+#if LINUX_VERSION_IS_LESS(4,11,0)
+#include <linux/refcount.h>
+static inline unsigned int kref_read(const struct kref *kref)
+{
+ return refcount_read((const refcount_t *)&kref->refcount);
+}
+#endif /* < 4.11 */
+
+#endif /* __BACKPORT_LINUX_KREF_H */
diff --git a/backport/backport-include/linux/of_device.h b/backport/backport-include/linux/of_device.h
index cdd366e3..2178a338 100644
--- a/backport/backport-include/linux/of_device.h
+++ b/backport/backport-include/linux/of_device.h
@@ -23,4 +23,9 @@ static inline int backport_of_dma_configure(struct device *dev,
#define of_dma_configure LINUX_BACKPORT(of_dma_configure)
#endif /* < 4.18 */
+#if LINUX_VERSION_IS_LESS(4,12,0)
+ssize_t bp_of_device_modalias(struct device *dev, char *str, ssize_t len);
+#define of_device_modalias bp_of_device_modalias
+#endif /* < 4.12 */
+
#endif /* __BP_OF_DEVICE_H */
diff --git a/backport/backport-include/linux/skbuff.h b/backport/backport-include/linux/skbuff.h
index 44b2a5de..7b1fe6ed 100644
--- a/backport/backport-include/linux/skbuff.h
+++ b/backport/backport-include/linux/skbuff.h
@@ -380,6 +380,24 @@ static inline void skb_put_u8(struct sk_buff *skb, u8 val)
{
*(u8 *)skb_put(skb, 1) = val;
}
+
+static inline void *__skb_put_zero(struct sk_buff *skb, unsigned int len)
+{
+ void *tmp = __skb_put(skb, len);
+
+ memset(tmp, 0, len);
+ return tmp;
+}
+
+static inline void *__skb_put_data(struct sk_buff *skb, const void *data,
+ unsigned int len)
+{
+ void *tmp = __skb_put(skb, len);
+
+ memcpy(tmp, data, len);
+ return tmp;
+}
+
#endif
#if LINUX_VERSION_IS_LESS(4,20,0)
diff --git a/backport/compat/Makefile b/backport/compat/Makefile
index 99b52faa..69106de4 100644
--- a/backport/compat/Makefile
+++ b/backport/compat/Makefile
@@ -36,6 +36,7 @@ compat-$(CPTCFG_KERNEL_4_6) += backport-4.6.o
compat-$(CPTCFG_KERNEL_4_7) += backport-4.7.o
compat-$(CPTCFG_KERNEL_4_8) += backport-4.8.o
compat-$(CPTCFG_KERNEL_4_10) += backport-4.10.o
+compat-$(CPTCFG_KERNEL_4_12) += backport-4.12.o
compat-$(CPTCFG_KERNEL_4_18) += backport-4.18.o
compat-$(CPTCFG_KERNEL_4_20) += backport-4.20.o
diff --git a/backport/compat/backport-4.12.c b/backport/compat/backport-4.12.c
new file mode 100644
index 00000000..413ae7f1
--- /dev/null
+++ b/backport/compat/backport-4.12.c
@@ -0,0 +1,22 @@
+#ifdef CONFIG_OF
+#include <linux/of_device.h>
+#endif
+
+#ifdef CONFIG_OF
+/**
+ * of_device_modalias - Fill buffer with newline terminated modalias string
+ */
+ssize_t bp_of_device_modalias(struct device *dev, char *str, ssize_t len)
+{
+ ssize_t sl = of_device_get_modalias(dev, str, len - 2);
+ if (sl < 0)
+ return sl;
+ if (sl > len - 2)
+ return -ENOMEM;
+
+ str[sl++] = '\n';
+ str[sl] = 0;
+ return sl;
+}
+EXPORT_SYMBOL_GPL(bp_of_device_modalias);
+#endif