From d6a47bfb72f495a72637fbe635220f6af0f4cb6f 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 and 3.10 kernels Signed-off-by: Dominik Sliwa --- backport-include/linux/export.h | 4 +-- backport-include/linux/kernel.h | 2 ++ backport-include/linux/netdevice.h | 2 +- backport-include/linux/pci.h | 5 +++ backport-include/linux/random.h | 4 ++- backport-include/linux/suspend.h | 14 ++++++++ backport-include/linux/thermal.h | 34 +++++++++++++++++++ backport-include/linux/timekeeping.h | 5 +++ backport-include/trace/ftrace.h | 3 +- compat/backport-4.12.c | 2 ++ compat/compat-3.5.c | 4 ++- compat/compat-3.6.c | 2 ++ compat/compat-3.7.c | 3 +- compat/compat-3.8.c | 3 ++ compat/verification/x509_public_key.c | 3 ++ drivers/net/usb/Kconfig | 1 + drivers/net/wireless/ath/ath10k/mac.c | 7 ++++ drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c | 2 ++ drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 2 ++ drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 6 ++++ drivers/net/wireless/intel/iwlwifi/mvm/nvm.c | 6 ++-- drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 7 +++- drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 4 ++- drivers/net/wireless/intel/iwlwifi/pcie/rx.c | 27 +++++++++++++++ drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 9 +++++ drivers/net/wireless/marvell/mwifiex/Kconfig | 3 -- drivers/net/wireless/marvell/mwifiex/pcie.c | 11 +++++-- drivers/net/wireless/marvell/mwifiex/sdio.c | 4 +++ drivers/net/wireless/marvell/mwifiex/usb.c | 4 +++ drivers/net/wireless/mediatek/mt7601u/eeprom.c | 2 ++ drivers/net/wireless/mediatek/mt7601u/trace.c | 3 +- .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c | 12 +++++++ net/wireless/trace.h | 38 +++++++++++----------- 33 files changed, 202 insertions(+), 36 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/kernel.h b/backport-include/linux/kernel.h index f508166..332f153 100644 --- a/backport-include/linux/kernel.h +++ b/backport-include/linux/kernel.h @@ -1,7 +1,9 @@ #ifndef __BACKPORT_KERNEL_H #define __BACKPORT_KERNEL_H #include_next +#if LINUX_VERSION_IS_GEQ(4,5,0) #include +#endif #include /* * some older kernels don't have this and thus don't diff --git a/backport-include/linux/netdevice.h b/backport-include/linux/netdevice.h index 8723f8c..89f5ea3 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,15,0) +#if LINUX_VERSION_IN_RANGE(3,10,0, 4,14,0) static inline int _bp_netdev_upper_dev_link(struct net_device *dev, struct net_device *upper_dev) { diff --git a/backport-include/linux/pci.h b/backport-include/linux/pci.h index 67ac40f..59d1656 100644 --- a/backport-include/linux/pci.h +++ b/backport-include/linux/pci.h @@ -17,6 +17,9 @@ pci_unregister_driver) #endif +#if LINUX_VERSION_IS_LESS(3,4,0) +void pci_stop_and_remove_bus_device(struct pci_dev *dev); +#endif #if LINUX_VERSION_IS_LESS(3,7,0) #define pcie_capability_read_word LINUX_BACKPORT(pcie_capability_read_word) int pcie_capability_read_word(struct pci_dev *dev, int pos, u16 *val); @@ -60,6 +63,8 @@ static inline int pcie_capability_clear_dword(struct pci_dev *dev, int pos, { return pcie_capability_clear_and_set_dword(dev, pos, clear, 0); } + +int pci_pcie_type(struct pci_dev *dev); #endif #ifndef PCI_DEVICE_SUB 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 8874e19..ad61a90 100644 --- a/backport-include/linux/thermal.h +++ b/backport-include/linux/thermal.h @@ -6,6 +6,40 @@ #ifdef CONFIG_THERMAL #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/backport-include/linux/timekeeping.h b/backport-include/linux/timekeeping.h index 56c3dee..602f4c2 100644 --- a/backport-include/linux/timekeeping.h +++ b/backport-include/linux/timekeeping.h @@ -8,6 +8,11 @@ #endif #if LINUX_VERSION_IS_LESS(3,17,0) +#if BITS_PER_LONG < 64 +extern u64 ktime_divns(const ktime_t kt, s64 div); +#else /* BITS_PER_LONG < 64 */ +# define ktime_divns(kt, div) (u64)((kt).tv64 / (div)) +#endif #define ktime_get_ns LINUX_BACKPORT(ktime_get_ns) extern ktime_t ktime_get(void); #define ktime_get_ns LINUX_BACKPORT(ktime_get_ns) diff --git a/backport-include/trace/ftrace.h b/backport-include/trace/ftrace.h index 2daedd5..756ded3 100644 --- a/backport-include/trace/ftrace.h +++ b/backport-include/trace/ftrace.h @@ -9,5 +9,6 @@ #undef __get_dynamic_array_len #define __get_dynamic_array_len(field) \ ((__entry->__data_loc_##field >> 16) & 0xffff) - +#if LINUX_VERSION_IS_GEQ(3,2,0) #include_next +#endif diff --git a/compat/backport-4.12.c b/compat/backport-4.12.c index 4b89682..2c0053f 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.7.c b/compat/compat-3.7.c index a70709c..528d7ec 100644 --- a/compat/compat-3.7.c +++ b/compat/compat-3.7.c @@ -49,10 +49,11 @@ static inline u16 pcie_flags_reg(struct pci_dev *dev) } #define pci_pcie_type LINUX_BACKPORT(pci_pcie_type) -static inline int pci_pcie_type(struct pci_dev *dev) +int pci_pcie_type(struct pci_dev *dev) { return (pcie_flags_reg(dev) & PCI_EXP_FLAGS_TYPE) >> 4; } +EXPORT_SYMBOL_GPL(pci_pcie_type); #define pcie_cap_version LINUX_BACKPORT(pcie_cap_version) static inline int pcie_cap_version(struct pci_dev *dev) 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/compat/verification/x509_public_key.c b/compat/verification/x509_public_key.c index 4c67487..2f513c1 100644 --- a/compat/verification/x509_public_key.c +++ b/compat/verification/x509_public_key.c @@ -10,6 +10,9 @@ */ #define pr_fmt(fmt) "X.509: "fmt +#if LINUX_VERSION_IS_LESS(3,17,0) +#include +#endif #include #include #include diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig index 1768fad..ddad59c 100644 --- a/drivers/net/usb/Kconfig +++ b/drivers/net/usb/Kconfig @@ -572,6 +572,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 cdf2085..d41fd44 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -8125,6 +8125,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; @@ -8208,6 +8209,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/iwl-nvm-parse.c b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c index b815ba3..7c35a0d 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c @@ -78,7 +78,9 @@ #include "iwl-prph.h" #include "iwl-io.h" #include "iwl-csr.h" +#ifdef CONFIG_ACPI #include "fw/acpi.h" +#endif #include "fw/api/nvm-reg.h" #include "fw/api/commands.h" #include "fw/api/cmdhdr.h" diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c index 866c91c..d1d9119 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c @@ -76,7 +76,9 @@ #include "iwl-csr.h" /* for iwl_mvm_rx_card_state_notif */ #include "iwl-io.h" /* for iwl_mvm_rx_card_state_notif */ #include "iwl-prph.h" +#ifdef CONFIG_ACPI #include "fw/acpi.h" +#endif #include "mvm.h" #include "fw/dbg.h" diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h index b1b41cd..a871835 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h @@ -91,7 +91,9 @@ #include "tof.h" #include "fw/runtime.h" #include "fw/dbg.h" +#ifdef CONFIG_ACPI #include "fw/acpi.h" +#endif #include "iwl-nvm-parse.h" #include @@ -768,12 +770,16 @@ enum iwl_mvm_queue_status { struct iwl_mvm_sar_profile { bool enabled; +#ifdef CONFIG_ACPI u8 table[ACPI_SAR_TABLE_SIZE]; +#endif }; +#ifdef CONFIG_ACPI struct iwl_mvm_geo_profile { u8 values[ACPI_GEO_TABLE_SIZE]; }; +#endif struct iwl_mvm { /* for logger access */ diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c b/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c index 4aa328b..66cf14a 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c @@ -75,7 +75,9 @@ #include "iwl-eeprom-read.h" #include "iwl-nvm-parse.h" #include "iwl-prph.h" +#ifdef CONFIG_ACPI #include "fw/acpi.h" +#endif /* Default NVM size to read */ #define IWL_NVM_DEFAULT_CHUNK_SIZE (2 * 1024) @@ -595,7 +597,7 @@ int iwl_mvm_init_mcc(struct iwl_mvm *mvm) regd = iwl_mvm_get_current_regdomain(mvm, NULL); if (IS_ERR_OR_NULL(regd)) return -EIO; - +#ifdef CONFIG_ACPI if (iwl_mvm_is_wifi_mcc_supported(mvm) && !iwl_acpi_get_mcc(mvm->dev, mcc)) { kfree(regd); @@ -604,7 +606,7 @@ int iwl_mvm_init_mcc(struct iwl_mvm *mvm) if (IS_ERR_OR_NULL(regd)) return -EIO; } - +#endif retval = regulatory_set_wiphy_regd_sync_rtnl(mvm->hw->wiphy, regd); kfree(regd); return retval; diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c index caa72be..9902dd6 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c @@ -88,7 +88,9 @@ #include "time-event.h" #include "fw-api.h" #include "fw/api/scan.h" +#ifdef CONFIG_ACPI #include "fw/acpi.h" +#endif #define DRV_DESCRIPTION "The new Intel(R) wireless AGN driver for Linux" MODULE_DESCRIPTION(DRV_DESCRIPTION); @@ -498,8 +500,11 @@ static u32 iwl_mvm_min_backoff(struct iwl_mvm *mvm) if (!backoff) return 0; - +#ifdef CONFIG_ACPI dflt_pwr_limit = iwl_acpi_get_pwr_limit(mvm->dev); +#else + dflt_pwr_limit = 0; +#endif while (backoff->pwr) { if (dflt_pwr_limit >= backoff->pwr) diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c index 0ed7d68..feba7d7 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c @@ -73,9 +73,11 @@ #include #include #include -#include +#ifdef CONFIG_ACPI +#include #include "fw/acpi.h" +#endif #include "iwl-trans.h" #include "iwl-drv.h" diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c index d15f5ba..0f6a767 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c @@ -38,6 +38,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/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c index 5613339..016b505 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c @@ -1950,10 +1950,19 @@ static void iwl_trans_pcie_removal_wk(struct work_struct *wk) dev_err(&pdev->dev, "Device gone - attempting removal\n"); kobject_uevent_env(&pdev->dev.kobj, KOBJ_CHANGE, prop); +#if LINUX_VERSION_IS_GEQ(3,14,0) pci_lock_rescan_remove(); +#endif pci_dev_put(pdev); +#if LINUX_VERSION_IS_LESS(3,2,0) + pci_stop_bus_device(pdev); + pci_remove_bus_device(pdev); +#else pci_stop_and_remove_bus_device(pdev); +#endif +#if LINUX_VERSION_IS_GEQ(3,14,0) pci_unlock_rescan_remove(); +#endif kfree(removal); module_put(THIS_MODULE); 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 248b7b3..a6d643c 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c @@ -320,6 +320,7 @@ static void mwifiex_pcie_shutdown(struct pci_dev *pdev) return; } +#if LINUX_VERSION_IS_GEQ(4,16,0) static void mwifiex_pcie_coredump(struct device *dev) { struct pci_dev *pdev; @@ -332,6 +333,7 @@ static void mwifiex_pcie_coredump(struct device *dev) &card->work_flags)) schedule_work(&card->work); } +#endif static const struct pci_device_id mwifiex_ids[] = { { @@ -428,7 +430,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 @@ -447,7 +449,9 @@ static struct pci_driver __refdata mwifiex_pcie = { .probe = mwifiex_pcie_probe, .remove = mwifiex_pcie_remove, .driver = { +#if LINUX_VERSION_IS_GEQ(4,16,0) .coredump = mwifiex_pcie_coredump, +#endif #ifdef CONFIG_PM_SLEEP .pm = &mwifiex_pcie_pm_ops, #endif @@ -2818,11 +2822,14 @@ static void mwifiex_pcie_device_dump_work(struct mwifiex_adapter *adapter) static void mwifiex_pcie_card_reset_work(struct mwifiex_adapter *adapter) { struct pcie_service_card *card = adapter->card; - +#if LINUX_VERSION_IS_LESS(3,14,0) + pci_reset_function(card->dev); +#else /* We can't afford to wait here; remove() might be waiting on us. If we * can't grab the device lock, maybe we'll get another chance later. */ pci_try_reset_function(card->dev); +#endif } static void mwifiex_pcie_work(struct work_struct *work) diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c index dfdcbc4..f0ba531 100644 --- a/drivers/net/wireless/marvell/mwifiex/sdio.c +++ b/drivers/net/wireless/marvell/mwifiex/sdio.c @@ -466,6 +466,7 @@ static int mwifiex_sdio_suspend(struct device *dev) return ret; } +#if LINUX_VERSION_IS_GEQ(4,16,0) static void mwifiex_sdio_coredump(struct device *dev) { struct sdio_func *func = dev_to_sdio_func(dev); @@ -476,6 +477,7 @@ static void mwifiex_sdio_coredump(struct device *dev) &card->work_flags)) schedule_work(&card->work); } +#endif /* Device ID for SD8786 */ #define SDIO_DEVICE_ID_MARVELL_8786 (0x9116) @@ -526,7 +528,9 @@ static struct sdio_driver mwifiex_sdio = { .remove = mwifiex_sdio_remove, .drv = { .owner = THIS_MODULE, +#if LINUX_VERSION_IS_GEQ(4,16,0) .coredump = mwifiex_sdio_coredump, +#endif .pm = &mwifiex_sdio_pm_ops, } }; diff --git a/drivers/net/wireless/marvell/mwifiex/usb.c b/drivers/net/wireless/marvell/mwifiex/usb.c index 88f4c89..b1ac443 100644 --- a/drivers/net/wireless/marvell/mwifiex/usb.c +++ b/drivers/net/wireless/marvell/mwifiex/usb.c @@ -651,6 +651,7 @@ static void mwifiex_usb_disconnect(struct usb_interface *intf) usb_put_dev(interface_to_usbdev(intf)); } +#if LINUX_VERSION_IS_GEQ(4,16,0) static void mwifiex_usb_coredump(struct device *dev) { struct usb_interface *intf = to_usb_interface(dev); @@ -659,6 +660,7 @@ static void mwifiex_usb_coredump(struct device *dev) mwifiex_fw_dump_event(mwifiex_get_priv(card->adapter, MWIFIEX_BSS_ROLE_ANY)); } +#endif static struct usb_driver mwifiex_usb_driver = { .name = "mwifiex_usb", @@ -669,7 +671,9 @@ static struct usb_driver mwifiex_usb_driver = { .resume = mwifiex_usb_resume, .soft_unbind = 1, .drvwrap.driver = { +#if LINUX_VERSION_IS_GEQ(4,16,0) .coredump = mwifiex_usb_coredump, +#endif }, }; diff --git a/drivers/net/wireless/mediatek/mt7601u/eeprom.c b/drivers/net/wireless/mediatek/mt7601u/eeprom.c index 76117b4..4f2da9c 100644 --- a/drivers/net/wireless/mediatek/mt7601u/eeprom.c +++ b/drivers/net/wireless/mediatek/mt7601u/eeprom.c @@ -12,6 +12,8 @@ * GNU General Public License for more details. */ +#include +#include #include #include #include diff --git a/drivers/net/wireless/mediatek/mt7601u/trace.c b/drivers/net/wireless/mediatek/mt7601u/trace.c index d48a407..385269b 100644 --- a/drivers/net/wireless/mediatek/mt7601u/trace.c +++ b/drivers/net/wireless/mediatek/mt7601u/trace.c @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ - +#if LINUX_VERSION_IS_GEQ(3,2,0) #include #if LINUX_VERSION_IS_LESS(3,4,0) #include @@ -22,3 +22,4 @@ #include "trace.h" #endif +#endif diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c index 4b13129..e67618c 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c @@ -40,6 +40,18 @@ #include "rtl8xxxu.h" #include "rtl8xxxu_regs.h" +#if LINUX_VERSION_IS_LESS(3,2,0) +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; +} +#endif + static struct rtl8xxxu_reg8val rtl8192e_mac_init_table[] = { {0x011, 0xeb}, {0x012, 0x07}, {0x014, 0x75}, {0x303, 0xa7}, {0x428, 0x0a}, {0x429, 0x10}, {0x430, 0x00}, {0x431, 0x00}, diff --git a/net/wireless/trace.h b/net/wireless/trace.h index b0446c2..ab61aa6 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), @@ -3227,25 +3245,6 @@ DEFINE_EVENT(wiphy_wdev_evt, rdev_abort_scan, 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)) -); - TRACE_EVENT(rdev_get_txq_stats, TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev), TP_ARGS(wiphy, wdev), @@ -3259,6 +3258,7 @@ TRACE_EVENT(rdev_get_txq_stats, ), TP_printk(WIPHY_PR_FMT ", " WDEV_PR_FMT, WIPHY_PR_ARG, WDEV_PR_ARG) ); +#endif /* BACKPORTS_TRACE */ #endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */ #undef TRACE_INCLUDE_PATH -- cgit v1.2.3