From 36735bb86a5e144603743bb800d7f69362d2ee2d Mon Sep 17 00:00:00 2001 From: Dominik Sliwa Date: Thu, 21 Feb 2019 11:35:20 +0100 Subject: backports: reintroduce bluetooth support Signed-off-by: Dominik Sliwa --- backport/Kconfig.sources | 2 ++ backport/Makefile.kernel | 2 ++ backport/backport-include/linux/kref.h | 13 +++++++++++++ backport/backport-include/linux/of_device.h | 5 +++++ backport/backport-include/linux/skbuff.h | 18 ++++++++++++++++++ backport/compat/Makefile | 1 + backport/compat/backport-4.12.c | 22 ++++++++++++++++++++++ 7 files changed, 63 insertions(+) create mode 100644 backport/backport-include/linux/kref.h create mode 100644 backport/compat/backport-4.12.c (limited to 'backport') 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 + +#if LINUX_VERSION_IS_LESS(4,11,0) +#include +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 +#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 -- cgit v1.2.3