iwlwifi: avoid device type checking in generic code
authorWey-Yi Guy <wey-yi.w.guy@intel.com>
Fri, 19 Mar 2010 18:54:49 +0000 (11:54 -0700)
committerReinette Chatre <reinette.chatre@intel.com>
Thu, 25 Mar 2010 18:22:32 +0000 (11:22 -0700)
Avoid checking for specified device type to perform certain function,
switch to .cfg approach as more generic and better implementation
method.

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
drivers/net/wireless/iwlwifi/iwl-4965.c
drivers/net/wireless/iwlwifi/iwl-core.c
drivers/net/wireless/iwlwifi/iwl-core.h
drivers/net/wireless/iwlwifi/iwl-scan.c

index 1b5ced5..1808c97 100644 (file)
@@ -2259,6 +2259,7 @@ struct iwl_cfg iwl4965_agn_cfg = {
        .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
        .monitor_recover_period = IWL_MONITORING_PERIOD,
        .temperature_kelvin = true,
+       .off_channel_workaround = true,
 };
 
 /* Module firmware */
index 9e48352..1b4408a 100644 (file)
@@ -992,12 +992,12 @@ void iwl_set_rxon_chain(struct iwl_priv *priv)
        rx_chain |= idle_rx_cnt  << RXON_RX_CHAIN_CNT_POS;
 
        /* copied from 'iwl_bg_request_scan()' */
-       /* Force use of chains B and C (0x6) for Rx for 4965
-        * Avoid A (0x1) because of its off-channel reception on A-band.
+       /* Force use of chains B and C (0x6) for Rx
+        * Avoid A (0x1) for the device has off-channel reception on A-band.
         * MIMO is not used here, but value is required */
        if (iwl_is_monitor_mode(priv) &&
            !(priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) &&
-           ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) == CSR_HW_REV_TYPE_4965)) {
+           priv->cfg->off_channel_workaround) {
                rx_chain = ANT_ABC << RXON_RX_CHAIN_VALID_POS;
                rx_chain |= ANT_BC << RXON_RX_CHAIN_FORCE_SEL_POS;
                rx_chain |= ANT_ABC << RXON_RX_CHAIN_FORCE_MIMO_SEL_POS;
index e9b0411..9d7a68f 100644 (file)
@@ -306,6 +306,7 @@ struct iwl_cfg {
        /* timer period for monitor the driver queues */
        u32 monitor_recover_period;
        bool temperature_kelvin;
+       bool off_channel_workaround;
 };
 
 /***************************
index 1544d75..5ecfc7f 100644 (file)
@@ -830,10 +830,11 @@ static void iwl_bg_request_scan(struct work_struct *data)
                 */
                scan->good_CRC_th = is_active ? IWL_GOOD_CRC_TH : 0;
 
-               /* Force use of chains B and C (0x6) for scan Rx for 4965
-                * Avoid A (0x1) because of its off-channel reception on A-band.
+               /* Force use of chains B and C (0x6) for scan Rx
+                * Avoid A (0x1) for the device has off-channel reception
+                * on A-band.
                 */
-               if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) == CSR_HW_REV_TYPE_4965)
+               if (priv->cfg->off_channel_workaround)
                        rx_ant = ANT_BC;
        } else {
                IWL_WARN(priv, "Invalid scan band count\n");