From 84325931ccddb09f6313466fb272e8125569ae07 Mon Sep 17 00:00:00 2001 From: Dominik Sliwa Date: Tue, 21 Nov 2017 16:35:43 +0000 Subject: backports:Backports for tegra 3.1 kernel Signed-off-by: Dominik Sliwa --- backport-include/linux/export.h | 4 +-- backport-include/linux/netdevice.h | 2 +- backport-include/linux/random.h | 4 ++- backport-include/linux/suspend.h | 14 ++++++++++ backport-include/linux/thermal.h | 34 +++++++++++++++++++++++++ compat/backport-4.12.c | 2 ++ compat/compat-3.5.c | 4 ++- compat/compat-3.6.c | 2 ++ compat/compat-3.8.c | 3 +++ drivers/net/usb/Kconfig | 1 + drivers/net/wireless/ath/ath10k/mac.c | 7 +++++ drivers/net/wireless/intel/iwlwifi/pcie/rx.c | 27 ++++++++++++++++++++ drivers/net/wireless/marvell/mwifiex/Kconfig | 3 --- drivers/net/wireless/marvell/mwifiex/pcie.c | 2 +- net/wireless/trace.h | 38 ++++++++++++++-------------- 15 files changed, 119 insertions(+), 28 deletions(-) create mode 100644 backport-include/linux/suspend.h diff --git a/backport-include/linux/export.h b/backport-include/linux/export.h index 6f6cb6a..a3c7799 100644 --- a/backport-include/linux/export.h +++ b/backport-include/linux/export.h @@ -3,7 +3,7 @@ #include -#if LINUX_VERSION_IS_GEQ(3,2,0) +#if LINUX_VERSION_IS_GEQ(3,1,0) #include_next #else #ifndef pr_fmt @@ -14,6 +14,6 @@ #undef pr_fmt #undef backport_undef_pr_fmt #endif -#endif /* LINUX_VERSION_IS_GEQ(3,2,0) */ +#endif /* LINUX_VERSION_IS_GEQ(3,1,0) */ #endif /* _COMPAT_LINUX_EXPORT_H */ diff --git a/backport-include/linux/netdevice.h b/backport-include/linux/netdevice.h index d92c95a..af8185c 100644 --- a/backport-include/linux/netdevice.h +++ b/backport-include/linux/netdevice.h @@ -334,7 +334,7 @@ static inline void netif_trans_update(struct net_device *dev) (_dev)->needs_free_netdev = true; #endif -#if LINUX_VERSION_IS_LESS(4,14,0) +#if LINUX_VERSION_IN_RANGE(3,10,0, 4,13,0) static inline int _bp_netdev_upper_dev_link(struct net_device *dev, struct net_device *upper_dev) { diff --git a/backport-include/linux/random.h b/backport-include/linux/random.h index 7d817d8..fa016cc 100644 --- a/backport-include/linux/random.h +++ b/backport-include/linux/random.h @@ -12,7 +12,9 @@ static inline void add_device_randomness(const void *buf, unsigned int size) } #endif -#if LINUX_VERSION_IS_LESS(3,8,0) +/* #if LINUX_VERSION_IS_LESS(3,8,0) */ +/* already backported in our kernels */ +#if 0 /* backports 496f2f9 */ #define prandom_seed(_seed) srandom32(_seed) #define prandom_u32() random32() diff --git a/backport-include/linux/suspend.h b/backport-include/linux/suspend.h new file mode 100644 index 0000000..6030718 --- /dev/null +++ b/backport-include/linux/suspend.h @@ -0,0 +1,14 @@ +#ifndef __BP_LINUX_SUSPEND_H +#define __BP_LINUX_SUSPEND_H +#include_next + +#if LINUX_VERSION_IS_LESS(3,18,0) +static inline void pm_system_wakeup(void) +{ +#if LINUX_VERSION_IS_GEQ(3,10,0) + freeze_wake(); +#endif +} +#endif + +#endif /* __BP_LINUX_SUSPEND_H */ diff --git a/backport-include/linux/thermal.h b/backport-include/linux/thermal.h index 108a8cf..b0dc643 100644 --- a/backport-include/linux/thermal.h +++ b/backport-include/linux/thermal.h @@ -5,6 +5,40 @@ #if LINUX_VERSION_IS_LESS(3,8,0) #include +#include + +enum thermal_trend { + THERMAL_TREND_STABLE, /* temperature is stable */ + THERMAL_TREND_RAISING, /* temperature is raising */ + THERMAL_TREND_DROPPING, /* temperature is dropping */ + THERMAL_TREND_RAISE_FULL, /* apply highest cooling action */ + THERMAL_TREND_DROP_FULL, /* apply lowest cooling action */ +}; + +struct backport_thermal_zone_device_ops { + int (*bind) (struct thermal_zone_device *, + struct thermal_cooling_device *); + int (*unbind) (struct thermal_zone_device *, + struct thermal_cooling_device *); + int (*get_temp) (struct thermal_zone_device *, int *); + int (*get_mode) (struct thermal_zone_device *, + enum thermal_device_mode *); + int (*set_mode) (struct thermal_zone_device *, + enum thermal_device_mode); + int (*get_trip_type) (struct thermal_zone_device *, int, + enum thermal_trip_type *); + int (*get_trip_temp) (struct thermal_zone_device *, int, int *); + int (*set_trip_temp) (struct thermal_zone_device *, int, int); + int (*get_trip_hyst) (struct thermal_zone_device *, int, int *); + int (*set_trip_hyst) (struct thermal_zone_device *, int, int); + int (*get_crit_temp) (struct thermal_zone_device *, int *); + int (*set_emul_temp) (struct thermal_zone_device *, int); + int (*get_trend) (struct thermal_zone_device *, int, + enum thermal_trend *); + int (*notify) (struct thermal_zone_device *, int, + enum thermal_trip_type); +}; +#define thermal_zone_device_ops LINUX_BACKPORT(thermal_zone_device_ops) struct thermal_bind_params { struct thermal_cooling_device *cdev; diff --git a/compat/backport-4.12.c b/compat/backport-4.12.c index 4b16b16..d28edea 100644 --- a/compat/backport-4.12.c +++ b/compat/backport-4.12.c @@ -109,8 +109,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.5.c b/compat/compat-3.5.c index de31228..721ec0e 100644 --- a/compat/compat-3.5.c +++ b/compat/compat-3.5.c @@ -67,7 +67,9 @@ EXPORT_SYMBOL_GPL(overflowuid); EXPORT_SYMBOL_GPL(overflowgid); #endif -#if IS_ENABLED(CONFIG_PTP_1588_CLOCK) +/* #if IS_ENABLED(CONFIG_PTP_1588_CLOCK) */ +/* backported to all of our kernels */ +#if 0 int ptp_clock_index(struct ptp_clock *ptp) { return ptp->index; diff --git a/compat/compat-3.6.c b/compat/compat-3.6.c index ef36485..9e593f5 100644 --- a/compat/compat-3.6.c +++ b/compat/compat-3.6.c @@ -14,6 +14,7 @@ /* whoopsie ! */ #ifndef CONFIG_COMMON_CLK +#ifndef CONFIG_ARCH_TEGRA int clk_enable(struct clk *clk) { return 0; @@ -25,3 +26,4 @@ void clk_disable(struct clk *clk) } EXPORT_SYMBOL_GPL(clk_disable); #endif +#endif diff --git a/compat/compat-3.8.c b/compat/compat-3.8.c index ff9cd49..21686cc 100644 --- a/compat/compat-3.8.c +++ b/compat/compat-3.8.c @@ -356,6 +356,8 @@ bool hid_ignore(struct hid_device *hdev) } EXPORT_SYMBOL_GPL(hid_ignore); +/* backported to our kernel */ +#if 0 /** * prandom_bytes - get the requested number of pseudo-random bytes * @buf: where to copy the pseudo-random bytes to @@ -386,6 +388,7 @@ void prandom_bytes(void *buf, int bytes) } } EXPORT_SYMBOL_GPL(prandom_bytes); +#endif #ifdef CONFIG_OF /** diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig index b0510c8..5b35675 100644 --- a/drivers/net/usb/Kconfig +++ b/drivers/net/usb/Kconfig @@ -571,6 +571,7 @@ config USB_NET_KALMIA module will be called kalmia. config USB_NET_QMI_WWAN + depends on !KERNEL_3_10 tristate "QMI WWAN driver for Qualcomm MSM based 3G and LTE modems" depends on m depends on USB_USBNET diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 6616df6..f537134 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -7967,6 +7967,7 @@ struct ath10k_vif *ath10k_get_arvif(struct ath10k *ar, u32 vdev_id) #define WRD_METHOD "WRDD" #define WRDD_WIFI (0x07) +#ifdef CONFIG_ACPI static u32 ath10k_mac_wrdd_get_mcc(struct ath10k *ar, union acpi_object *wrdd) { union acpi_object *mcc_pkg; @@ -8050,6 +8051,12 @@ static int ath10k_mac_get_wrdd_regulatory(struct ath10k *ar, u16 *rd) *rd |= COUNTRY_ERD_FLAG; return 0; } +#else +static int ath10k_mac_get_wrdd_regulatory(struct ath10k *ar, u16 *rd) +{ + return -EOPNOTSUPP; +} +#endif static int ath10k_mac_init_rd(struct ath10k *ar) { diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c index a06b661..037787f 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c @@ -37,6 +37,33 @@ #include "internal.h" #include "iwl-op-mode.h" +#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. + */ +#ifndef atomic_dec_if_positive +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 + /****************************************************************************** * * RX path functions diff --git a/drivers/net/wireless/marvell/mwifiex/Kconfig b/drivers/net/wireless/marvell/mwifiex/Kconfig index b37a20c..a8abf60 100644 --- a/drivers/net/wireless/marvell/mwifiex/Kconfig +++ b/drivers/net/wireless/marvell/mwifiex/Kconfig @@ -1,5 +1,4 @@ config MWIFIEX - depends on !KERNEL_3_18 tristate "Marvell WiFi-Ex Driver" depends on m depends on CFG80211 @@ -11,7 +10,6 @@ config MWIFIEX mwifiex. config MWIFIEX_SDIO - depends on !KERNEL_3_2 tristate "Marvell WiFi-Ex Driver for SD8786/SD8787/SD8797/SD8887/SD8897/SD8997" depends on m depends on MWIFIEX && MMC @@ -25,7 +23,6 @@ config MWIFIEX_SDIO mwifiex_sdio. config MWIFIEX_PCIE - depends on !KERNEL_3_16 tristate "Marvell WiFi-Ex Driver for PCIE 8766/8897/8997" depends on m depends on MWIFIEX && PCI diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c index d9dc117..8b20ba0 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c @@ -415,7 +415,7 @@ struct pci_error_handlers mwifiex_pcie_err_handler = { #if LINUX_VERSION_IS_GEQ(4,13,0) .reset_prepare = mwifiex_pcie_reset_prepare, .reset_done = mwifiex_pcie_reset_done, -#else +#elif LINUX_VERSION_IS_GEQ(3,16,0) .reset_notify = mwifiex_pcie_reset_prepare_notify, #endif }; diff --git a/net/wireless/trace.h b/net/wireless/trace.h index 8b33cff..c308920 100644 --- a/net/wireless/trace.h +++ b/net/wireless/trace.h @@ -12,6 +12,9 @@ #include #include "core.h" +#ifndef BACKPORTS_TRACE +#define BACKPORTS_TRACE + #define MAC_ENTRY(entry_mac) __array(u8, entry_mac, ETH_ALEN) #define MAC_ASSIGN(entry_mac, given_mac) do { \ if (given_mac) \ @@ -213,6 +216,18 @@ /************************************************************* * rdev->ops traces * *************************************************************/ +#if LINUX_VERSION_IS_LESS(4,0,0) +#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){} +#endif +DEFINE_EVENT(skip, rdev_set_multicast_to_unicast, + TP_PROTO(struct wiphy *wiphy, struct net_device *dev, bool ena), a); TRACE_EVENT(rdev_suspend, TP_PROTO(struct wiphy *wiphy, struct cfg80211_wowlan *wow), @@ -278,6 +293,9 @@ TRACE_EVENT(rdev_scan, TP_printk(WIPHY_PR_FMT, WIPHY_PR_ARG) ); +#undef DECLARE_EVENT_CLASS +#define DECLARE_EVENT_CLASS(args...) + DECLARE_EVENT_CLASS(wiphy_only_evt, TP_PROTO(struct wiphy *wiphy), TP_ARGS(wiphy), @@ -3154,25 +3172,7 @@ DEFINE_EVENT(wiphy_wdev_evt, rdev_abort_scan, TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev), TP_ARGS(wiphy, wdev) ); - -TRACE_EVENT(rdev_set_multicast_to_unicast, - TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, - const bool enabled), - TP_ARGS(wiphy, netdev, enabled), - TP_STRUCT__entry( - WIPHY_ENTRY - NETDEV_ENTRY - __field(bool, enabled) - ), - TP_fast_assign( - WIPHY_ASSIGN; - NETDEV_ASSIGN; - __entry->enabled = enabled; - ), - TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", unicast: %s", - WIPHY_PR_ARG, NETDEV_PR_ARG, - BOOL_TO_STR(__entry->enabled)) -); +#endif /* BACKPORTS_TRACE */ #endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */ #undef TRACE_INCLUDE_PATH -- cgit v1.2.3