diff options
author | Dominik Sliwa <dominik.sliwa@toradex.com> | 2019-02-21 14:48:31 +0100 |
---|---|---|
committer | Dominik Sliwa <dominik.sliwa@toradex.com> | 2019-02-22 15:26:14 +0100 |
commit | 515a1fa55cda2b1d952872e1786857481bd54fcc (patch) | |
tree | 4c66dd52c58f3d1da423a1ed7f92c4f720e24685 /patches/0095-backport-old-tegra-compile.patch | |
parent | c956caceefd8e859c8b783dd13dad197dc1f7907 (diff) |
backports: support 3.1 and 3.10 tegra kernels
Changes specific to vendor kernels
Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Diffstat (limited to 'patches/0095-backport-old-tegra-compile.patch')
-rw-r--r-- | patches/0095-backport-old-tegra-compile.patch | 279 |
1 files changed, 279 insertions, 0 deletions
diff --git a/patches/0095-backport-old-tegra-compile.patch b/patches/0095-backport-old-tegra-compile.patch new file mode 100644 index 00000000..31519871 --- /dev/null +++ b/patches/0095-backport-old-tegra-compile.patch @@ -0,0 +1,279 @@ +From c1d1a970c7ad8a79b54f18297445b32230c0b9ce Mon Sep 17 00:00:00 2001 +From: Dominik Sliwa <dominik.sliwa@toradex.com> +Date: Fri, 22 Feb 2019 12:49:27 +0100 +Subject: [PATCH] old tegra compile + +--- + backport-include/linux/atomic.h | 25 +++++++++++++++++++++++++ + backport-include/linux/hrtimer.h | 20 ++++++++++++++++++++ + backport-include/linux/skbuff.h | 1 + + backport-include/linux/string.h | 4 ++++ + backport-include/linux/timekeeping.h | 2 ++ + compat/backport-3.17.c | 2 ++ + compat/backport-4.18.c | 2 ++ + compat/backport-genetlink.c | 2 ++ + compat/compat-3.3.c | 25 +++++++++++++++++++++++++ + drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 4 ++++ + net/wireless/trace.h | 17 +++++++++++++++++ + 11 files changed, 104 insertions(+) + +diff --git a/backport-include/linux/atomic.h b/backport-include/linux/atomic.h +index b4dd2e1..7baa2f5 100644 +--- a/backport-include/linux/atomic.h ++++ b/backport-include/linux/atomic.h +@@ -51,4 +51,29 @@ + + #endif /* atomic_try_cmpxchg_acquire */ + ++#if LINUX_VERSION_IS_LESS(3,7,0) ++/* ++ * atomic_dec_if_positive - decrement by 1 if old value positive ++ * @v: pointer of type atomic_t ++ * ++ * The function returns the old value of *v minus 1, even if ++ * the atomic variable, v, was not decremented. ++ */ ++static inline int atomic_dec_if_positive(atomic_t *v) ++{ ++ int c, old, dec; ++ c = atomic_read(v); ++ for (;;) { ++ dec = c - 1; ++ if (unlikely(dec < 0)) ++ break; ++ old = atomic_cmpxchg((v), c, dec); ++ if (likely(old == c)) ++ break; ++ c = old; ++ } ++ return dec; ++} ++#endif ++ + #endif /* __BP_ATOMIC_H */ +diff --git a/backport-include/linux/hrtimer.h b/backport-include/linux/hrtimer.h +index 2c186dd..cb18567 100644 +--- a/backport-include/linux/hrtimer.h ++++ b/backport-include/linux/hrtimer.h +@@ -3,8 +3,28 @@ + #include_next <linux/hrtimer.h> + + #if LINUX_VERSION_IS_LESS(3,17,0) ++#if LINUX_VERSION_IS_LESS(3,3,0) ++inline u64 bp_ktime_divns(const ktime_t kt, s64 div) ++{ ++ u64 dclc; ++ int sft = 0; ++ ++ dclc = ktime_to_ns(kt); ++ /* Make sure the divisor is less than 2^32: */ ++ while (div >> 32) { ++ sft++; ++ div >>= 1; ++ } ++ dclc >>= sft; ++ do_div(dclc, (unsigned long) div); ++ ++ return dclc; ++} ++#define ktime_get_boottime_seconds() bp_ktime_divns(ktime_get_boottime(), NSEC_PER_SEC) ++#else + u64 bp_ktime_divns(const ktime_t kt, s64 div); + #define ktime_divns bp_ktime_divns ++#endif + #endif /* < 3.17 */ + + #endif /* __BACKPORT_LINUX_HRTIMER_H */ +diff --git a/backport-include/linux/skbuff.h b/backport-include/linux/skbuff.h +index 7b1fe6e..277d892 100644 +--- a/backport-include/linux/skbuff.h ++++ b/backport-include/linux/skbuff.h +@@ -12,6 +12,7 @@ + #endif + + #if LINUX_VERSION_IS_LESS(3,3,0) ++void kfree_skb_list(struct sk_buff *segs); + #define __pskb_copy LINUX_BACKPORT(__pskb_copy) + extern struct sk_buff *__pskb_copy(struct sk_buff *skb, + int headroom, gfp_t gfp_mask); +diff --git a/backport-include/linux/string.h b/backport-include/linux/string.h +index 2bfdf74..dda80d8 100644 +--- a/backport-include/linux/string.h ++++ b/backport-include/linux/string.h +@@ -37,4 +37,8 @@ char *strreplace(char *s, char old, char new); + int match_string(const char * const *array, size_t n, const char *string); + #endif /* LINUX_VERSION_IS_LESS(4,5,0) */ + ++#if LINUX_VERSION_IS_LESS(3,3,0) ++void *memchr_inv(const void *s, int c, size_t n); ++#endif ++ + #endif /* __BACKPORT_LINUX_STRING_H */ +diff --git a/backport-include/linux/timekeeping.h b/backport-include/linux/timekeeping.h +index a0d65fb..571c602 100644 +--- a/backport-include/linux/timekeeping.h ++++ b/backport-include/linux/timekeeping.h +@@ -30,7 +30,9 @@ static inline u64 ktime_get_boot_ns(void) + #endif /* < 3.17 */ + + #if LINUX_VERSION_IS_LESS(4,18,0) ++#if LINUX_VERSION_IS_GEQ(3,4,0) + extern time64_t ktime_get_boottime_seconds(void); ++#endif + #endif /* < 4.18 */ + + #if LINUX_VERSION_IS_LESS(3,19,0) +diff --git a/compat/backport-3.17.c b/compat/backport-3.17.c +index 5961e3b..19c2eca 100644 +--- a/compat/backport-3.17.c ++++ b/compat/backport-3.17.c +@@ -146,6 +146,7 @@ char *devm_kasprintf(struct device *dev, gfp_t gfp, const char *fmt, ...) + } + EXPORT_SYMBOL_GPL(devm_kasprintf); + ++#if LINUX_VERSION_IS_GEQ(3,3,0) + u64 bp_ktime_divns(const ktime_t kt, s64 div) + { + u64 dclc; +@@ -163,6 +164,7 @@ u64 bp_ktime_divns(const ktime_t kt, s64 div) + return dclc; + } + EXPORT_SYMBOL_GPL(bp_ktime_divns); ++#endif + + #define STANDARD_PARAM_DEF(name, type, format, strtolfn) \ + int param_set_##name(const char *val, const struct kernel_param *kp) \ +diff --git a/compat/backport-4.18.c b/compat/backport-4.18.c +index c47fabe..a08fd7c 100644 +--- a/compat/backport-4.18.c ++++ b/compat/backport-4.18.c +@@ -4,8 +4,10 @@ + + #include <linux/hrtimer.h> + ++#if LINUX_VERSION_IS_GEQ(3,4,0) + time64_t ktime_get_boottime_seconds(void) + { + return ktime_divns(ktime_get_boottime(), NSEC_PER_SEC); + } + EXPORT_SYMBOL_GPL(ktime_get_boottime_seconds); ++#endif +diff --git a/compat/backport-genetlink.c b/compat/backport-genetlink.c +index d841566..906fc04 100644 +--- a/compat/backport-genetlink.c ++++ b/compat/backport-genetlink.c +@@ -85,8 +85,10 @@ static void extack_netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, + + skb = nlmsg_new(payload + tlvlen, GFP_KERNEL); + if (!skb) { ++#if LINUX_VERSION_IS_GEQ(3,10,0) + NETLINK_CB(in_skb).sk->sk_err = ENOBUFS; + NETLINK_CB(in_skb).sk->sk_error_report(NETLINK_CB(in_skb).sk); ++#endif + return; + } + +diff --git a/compat/compat-3.3.c b/compat/compat-3.3.c +index 1185a5d..54e1c78 100644 +--- a/compat/compat-3.3.c ++++ b/compat/compat-3.3.c +@@ -11,6 +11,7 @@ + #include <linux/kernel.h> + #include <linux/version.h> + #include <linux/skbuff.h> ++#include <linux/string.h> + #include <linux/module.h> + #include <linux/workqueue.h> + #include <net/dst.h> +@@ -224,3 +225,27 @@ void backport_destroy_workqueue(struct workqueue_struct *wq) + spin_unlock(&wq_name_lock); + } + EXPORT_SYMBOL_GPL(backport_destroy_workqueue); ++ ++void *memchr_inv(const void *s, int c, size_t n) ++{ ++ const unsigned char *p = s; ++ while (n-- != 0) ++ if ((unsigned char)c != *p++) ++ return (void *)(p - 1); ++ ++ return NULL; ++} ++EXPORT_SYMBOL_GPL(memchr_inv); ++ ++void kfree_skb_list(struct sk_buff *segs) ++{ ++ while (segs) { ++ struct sk_buff *next = segs->next; ++ ++ kfree_skb(segs); ++ segs = next; ++ } ++} ++EXPORT_SYMBOL(kfree_skb_list); ++ ++ +diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c +index eaf0a19..27b8388 100644 +--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c ++++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c +@@ -96,6 +96,7 @@ static void iwl_trans_pcie_dump_regs(struct iwl_trans *trans) + { + #define PCI_DUMP_SIZE 64 + #define PREFIX_LEN 32 ++#if LINUX_VERSION_IS_GEQ(3,3,0) + struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); + struct pci_dev *pdev = trans_pcie->pci_dev; + u32 i, pos, alloc_size, *ptr, *buf; +@@ -178,6 +179,9 @@ err_read: + out: + trans_pcie->pcie_dbg_dumped_once = 1; + kfree(buf); ++#else ++ return ; ++#endif + } + + static void iwl_trans_pcie_sw_reset(struct iwl_trans *trans) +diff --git a/net/wireless/trace.h b/net/wireless/trace.h +index b0446c2..7c6901d 100644 +--- a/net/wireless/trace.h ++++ b/net/wireless/trace.h +@@ -214,6 +214,23 @@ + * rdev->ops traces * + *************************************************************/ + ++ ++#if LINUX_VERSION_IS_LESS(3,10,0) ++#ifndef BACKPORTS_TRACE ++#define BACKPORTS_TRACE ++#undef TP_PROTO ++#define TP_PROTO(args...) args ++#undef DECLARE_TRACE ++#define DECLARE_TRACE(args...) ++#undef DEFINE_EVENT ++#define DEFINE_EVENT(skip,name,proto,args...) inline void trace_##name(proto){} ++#undef TRACE_EVENT ++#define TRACE_EVENT(name,proto,args...) inline void trace_##name(proto){} ++#undef DECLARE_EVENT_CLASS ++#define DECLARE_EVENT_CLASS(args...) ++#endif ++#endif ++ + TRACE_EVENT(rdev_suspend, + TP_PROTO(struct wiphy *wiphy, struct cfg80211_wowlan *wow), + TP_ARGS(wiphy, wow), +diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c +index fefd5e3..1b14bf8 100644 +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -12287,7 +12287,7 @@ static int nl80211_crit_protocol_start(struct sk_buff *skb, + + ret = rdev_crit_proto_start(rdev, wdev, proto, duration); + if (!ret) +- rdev->crit_proto_nlportid = info->snd_portid; ++ rdev->crit_proto_nlportid = genl_info_snd_portid(info); + + return ret; + } +-- |