iwlwifi: remove set_pwr_src operation
authorJohannes Berg <johannes.berg@intel.com>
Wed, 22 Sep 2010 16:02:09 +0000 (18:02 +0200)
committerWey-Yi Guy <wey-yi.w.guy@intel.com>
Thu, 7 Oct 2010 22:52:25 +0000 (15:52 -0700)
The set_pwr_src operation is only ever used from
within the same sub-driver that it is declared
in, so it can just be called directly instead of
being an operation. Also, it is never called to
set the power source to V_aux, so change the two
functions accordingly (but keep the V_aux code
for documentation purposes in a comment).

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
drivers/net/wireless/iwlwifi/iwl-1000.c
drivers/net/wireless/iwlwifi/iwl-3945.c
drivers/net/wireless/iwlwifi/iwl-4965.c
drivers/net/wireless/iwlwifi/iwl-5000.c
drivers/net/wireless/iwlwifi/iwl-6000.c
drivers/net/wireless/iwlwifi/iwl-agn-lib.c
drivers/net/wireless/iwlwifi/iwl-agn.c
drivers/net/wireless/iwlwifi/iwl-core.h
drivers/net/wireless/iwlwifi/iwl-dev.h

index 8aed9ead3a75589361d596710eadecb4a23a24c6..5bdfe9dcd070004a13cc974d77875a5b923807d1 100644 (file)
@@ -196,7 +196,6 @@ static struct iwl_lib_ops iwl1000_lib = {
                .init = iwl_apm_init,
                .stop = iwl_apm_stop,
                .config = iwl1000_nic_config,
-               .set_pwr_src = iwl_set_pwr_src,
        },
        .eeprom_ops = {
                .regulatory_bands = {
index ba3ab04c1fba2be79c4cc7a8546e99b4f13da2e4..824c9428efaa2768a3c52d04f5784bdffee04ea0 100644 (file)
@@ -816,9 +816,12 @@ static u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id, u16 tx_rate)
        return sta_id;
 }
 
-static int iwl3945_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src)
+static void iwl3945_set_pwr_vmain(struct iwl_priv *priv)
 {
-       if (src == IWL_PWR_SRC_VAUX) {
+/*
+ * (for documentation purposes)
+ * to set power to V_AUX, do
+
                if (pci_pme_capable(priv->pci_dev, PCI_D3cold)) {
                        iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
                                        APMG_PS_CTRL_VAL_PWR_SRC_VAUX,
@@ -828,16 +831,14 @@ static int iwl3945_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src)
                                     CSR_GPIO_IN_VAL_VAUX_PWR_SRC,
                                     CSR_GPIO_IN_BIT_AUX_POWER, 5000);
                }
-       } else {
-               iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
-                               APMG_PS_CTRL_VAL_PWR_SRC_VMAIN,
-                               ~APMG_PS_CTRL_MSK_PWR_SRC);
+ */
 
-               iwl_poll_bit(priv, CSR_GPIO_IN, CSR_GPIO_IN_VAL_VMAIN_PWR_SRC,
-                            CSR_GPIO_IN_BIT_AUX_POWER, 5000);  /* uS */
-       }
+       iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
+                       APMG_PS_CTRL_VAL_PWR_SRC_VMAIN,
+                       ~APMG_PS_CTRL_MSK_PWR_SRC);
 
-       return 0;
+       iwl_poll_bit(priv, CSR_GPIO_IN, CSR_GPIO_IN_VAL_VMAIN_PWR_SRC,
+                    CSR_GPIO_IN_BIT_AUX_POWER, 5000);  /* uS */
 }
 
 static int iwl3945_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
@@ -1031,9 +1032,7 @@ int iwl3945_hw_nic_init(struct iwl_priv *priv)
        priv->cfg->ops->lib->apm_ops.init(priv);
        spin_unlock_irqrestore(&priv->lock, flags);
 
-       rc = priv->cfg->ops->lib->apm_ops.set_pwr_src(priv, IWL_PWR_SRC_VMAIN);
-       if (rc)
-               return rc;
+       iwl3945_set_pwr_vmain(priv);
 
        priv->cfg->ops->lib->apm_ops.config(priv);
 
@@ -2707,7 +2706,6 @@ static struct iwl_lib_ops iwl3945_lib = {
                .init = iwl3945_apm_init,
                .stop = iwl_apm_stop,
                .config = iwl3945_nic_config,
-               .set_pwr_src = iwl3945_set_pwr_src,
        },
        .eeprom_ops = {
                .regulatory_bands = {
index c192856bb644952abbe0abccd1845d5e75beca0a..cda4a319ed9791ffbb17eec20df1ab100e3ec21a 100644 (file)
@@ -2268,7 +2268,6 @@ static struct iwl_lib_ops iwl4965_lib = {
                .init = iwl_apm_init,
                .stop = iwl_apm_stop,
                .config = iwl4965_nic_config,
-               .set_pwr_src = iwl_set_pwr_src,
        },
        .eeprom_ops = {
                .regulatory_bands = {
index 084271e5e4688bcce38a15d9d368f88cd899391f..c90a16cdfaffd245c0de7ec6aed6b11809ef307a 100644 (file)
@@ -370,7 +370,6 @@ static struct iwl_lib_ops iwl5000_lib = {
                .init = iwl_apm_init,
                .stop = iwl_apm_stop,
                .config = iwl5000_nic_config,
-               .set_pwr_src = iwl_set_pwr_src,
        },
        .eeprom_ops = {
                .regulatory_bands = {
@@ -440,7 +439,6 @@ static struct iwl_lib_ops iwl5150_lib = {
                .init = iwl_apm_init,
                .stop = iwl_apm_stop,
                .config = iwl5000_nic_config,
-               .set_pwr_src = iwl_set_pwr_src,
        },
        .eeprom_ops = {
                .regulatory_bands = {
index 84f181443f02cfe82616b9091f7ebf3100321949..02103a7ae1dfdd04c9ff8045249877ebbb13fdb9 100644 (file)
@@ -310,7 +310,6 @@ static struct iwl_lib_ops iwl6000_lib = {
                .init = iwl_apm_init,
                .stop = iwl_apm_stop,
                .config = iwl6000_nic_config,
-               .set_pwr_src = iwl_set_pwr_src,
        },
        .eeprom_ops = {
                .regulatory_bands = {
@@ -383,7 +382,6 @@ static struct iwl_lib_ops iwl6000g2b_lib = {
                .init = iwl_apm_init,
                .stop = iwl_apm_stop,
                .config = iwl6000_nic_config,
-               .set_pwr_src = iwl_set_pwr_src,
        },
        .eeprom_ops = {
                .regulatory_bands = {
index ff5f2fc4d6d9b0a17dac818cae3335e893d61e8c..0ad0d44893ab9306479d76837e3e73745f5b00cb 100644 (file)
@@ -685,6 +685,23 @@ int iwlagn_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
        return 0;
 }
 
+static void iwlagn_set_pwr_vmain(struct iwl_priv *priv)
+{
+/*
+ * (for documentation purposes)
+ * to set power to V_AUX, do:
+
+               if (pci_pme_capable(priv->pci_dev, PCI_D3cold))
+                       iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
+                                              APMG_PS_CTRL_VAL_PWR_SRC_VAUX,
+                                              ~APMG_PS_CTRL_MSK_PWR_SRC);
+ */
+
+       iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
+                              APMG_PS_CTRL_VAL_PWR_SRC_VMAIN,
+                              ~APMG_PS_CTRL_MSK_PWR_SRC);
+}
+
 int iwlagn_hw_nic_init(struct iwl_priv *priv)
 {
        unsigned long flags;
@@ -700,7 +717,7 @@ int iwlagn_hw_nic_init(struct iwl_priv *priv)
 
        spin_unlock_irqrestore(&priv->lock, flags);
 
-       ret = priv->cfg->ops->lib->apm_ops.set_pwr_src(priv, IWL_PWR_SRC_VMAIN);
+       iwlagn_set_pwr_vmain(priv);
 
        priv->cfg->ops->lib->apm_ops.config(priv);
 
index 8233c64104110051214dc765937bc9115d328b98..75472a3d87dec5d39281b3066ca82aec203e4b03 100644 (file)
@@ -935,22 +935,6 @@ static void iwl_rx_card_state_notif(struct iwl_priv *priv,
                wake_up_interruptible(&priv->wait_command_queue);
 }
 
-int iwl_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src)
-{
-       if (src == IWL_PWR_SRC_VAUX) {
-               if (pci_pme_capable(priv->pci_dev, PCI_D3cold))
-                       iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
-                                              APMG_PS_CTRL_VAL_PWR_SRC_VAUX,
-                                              ~APMG_PS_CTRL_MSK_PWR_SRC);
-       } else {
-               iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
-                                      APMG_PS_CTRL_VAL_PWR_SRC_VMAIN,
-                                      ~APMG_PS_CTRL_MSK_PWR_SRC);
-       }
-
-       return 0;
-}
-
 static void iwl_bg_tx_flush(struct work_struct *work)
 {
        struct iwl_priv *priv =
index f3c3d8531505ec1744a717bff62aeb2e579f6d4b..ae77279d3d9827740cff7df39b936febe77142fd 100644 (file)
@@ -119,7 +119,6 @@ struct iwl_apm_ops {
        int (*init)(struct iwl_priv *priv);
        void (*stop)(struct iwl_priv *priv);
        void (*config)(struct iwl_priv *priv);
-       int (*set_pwr_src)(struct iwl_priv *priv, enum iwl_pwr_src src);
 };
 
 struct iwl_debugfs_ops {
index 2b04714c3a9cbc3780e6f4d9f1d32062dd86b463..2c57dbd2de19feaed665432e90fad559dc5cbfdb 100644 (file)
@@ -282,13 +282,6 @@ struct iwl_channel_info {
  */
 #define IWL_IPAN_MCAST_QUEUE           8
 
-/* Power management (not Tx power) structures */
-
-enum iwl_pwr_src {
-       IWL_PWR_SRC_VMAIN,
-       IWL_PWR_SRC_VAUX,
-};
-
 #define IEEE80211_DATA_LEN              2304
 #define IEEE80211_4ADDR_LEN             30
 #define IEEE80211_HLEN                  (IEEE80211_4ADDR_LEN)
@@ -732,7 +725,6 @@ struct iwl_hw_params {
  *
  ****************************************************************************/
 extern void iwl_update_chain_flags(struct iwl_priv *priv);
-extern int iwl_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src);
 extern const u8 iwl_bcast_addr[ETH_ALEN];
 extern int iwl_rxq_stop(struct iwl_priv *priv);
 extern void iwl_txq_ctx_stop(struct iwl_priv *priv);