Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / iwlwifi / iwl3945-base.c
index 8eb347106902c4d7bf5e603ffd02daaab12f9003..bb955d2013e32ac90895d0f16bd2be6b447d4eab 100644 (file)
  *
  *****************************************************************************/
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/pci.h>
+#include <linux/pci-aspm.h>
 #include <linux/slab.h>
 #include <linux/dma-mapping.h>
 #include <linux/delay.h>
@@ -311,9 +314,7 @@ unsigned int iwl3945_fill_beacon_frame(struct iwl_priv *priv,
                                int left)
 {
 
-       if (!iwl_is_associated(priv) || !priv->ibss_beacon ||
-           ((priv->iw_mode != NL80211_IFTYPE_ADHOC) &&
-            (priv->iw_mode != NL80211_IFTYPE_AP)))
+       if (!iwl_is_associated(priv) || !priv->ibss_beacon)
                return 0;
 
        if (priv->ibss_beacon->len > left)
@@ -435,10 +436,7 @@ static void iwl3945_build_tx_cmd_basic(struct iwl_priv *priv,
                tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK;
        }
 
-       priv->cfg->ops->utils->rts_tx_cmd_flag(info, &tx_flags);
-
-       if ((tx_flags & TX_CMD_FLG_RTS_MSK) || (tx_flags & TX_CMD_FLG_CTS_MSK))
-               tx_flags |= TX_CMD_FLG_FULL_TXOP_PROT_MSK;
+       priv->cfg->ops->utils->tx_cmd_protection(priv, info, fc, &tx_flags);
 
        tx_flags &= ~(TX_CMD_FLG_ANT_SEL_MSK);
        if (ieee80211_is_mgmt(fc)) {
@@ -2883,7 +2881,10 @@ void iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
                IWL_DEBUG_INFO(priv, "Scanning while associated...\n");
 
                spin_lock_irqsave(&priv->lock, flags);
-               interval = vif ? vif->bss_conf.beacon_int : 0;
+               if (priv->is_internal_short_scan)
+                       interval = 0;
+               else
+                       interval = vif->bss_conf.beacon_int;
                spin_unlock_irqrestore(&priv->lock, flags);
 
                scan->suspend_time = 0;
@@ -3932,7 +3933,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
         *   space for this driver's private structure */
        hw = iwl_alloc_all(cfg, &iwl3945_hw_ops);
        if (hw == NULL) {
-               printk(KERN_ERR DRV_NAME "Can not allocate network device\n");
+               pr_err("Can not allocate network device\n");
                err = -ENOMEM;
                goto out;
        }
@@ -3960,6 +3961,9 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
        /***************************
         * 2. Initializing PCI bus
         * *************************/
+       pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1 |
+                               PCIE_LINK_STATE_CLKPM);
+
        if (pci_enable_device(pdev)) {
                err = -ENODEV;
                goto out_ieee80211_free_hw;
@@ -4224,19 +4228,18 @@ static int __init iwl3945_init(void)
 {
 
        int ret;
-       printk(KERN_INFO DRV_NAME ": " DRV_DESCRIPTION ", " DRV_VERSION "\n");
-       printk(KERN_INFO DRV_NAME ": " DRV_COPYRIGHT "\n");
+       pr_info(DRV_DESCRIPTION ", " DRV_VERSION "\n");
+       pr_info(DRV_COPYRIGHT "\n");
 
        ret = iwl3945_rate_control_register();
        if (ret) {
-               printk(KERN_ERR DRV_NAME
-                      "Unable to register rate control algorithm: %d\n", ret);
+               pr_err("Unable to register rate control algorithm: %d\n", ret);
                return ret;
        }
 
        ret = pci_register_driver(&iwl3945_driver);
        if (ret) {
-               printk(KERN_ERR DRV_NAME "Unable to initialize PCI module\n");
+               pr_err("Unable to initialize PCI module\n");
                goto error_register;
        }