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 --- 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 ++++++++++ 17 files changed, 100 insertions(+), 10 deletions(-) (limited to 'drivers') 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}, -- cgit v1.2.3