On Friday 16 April 2010 21:34:25 Bob Copeland wrote:
> On Fri, Apr 16, 2010 at 12:12:09PM +0900, Bruno Randolf wrote:
> > hello!
> > 
> > we have found the this suspect piece of code in ath5k_hw_reset():
> >                     /* Note: According to docs we can have a newer
> >                     
> >                      * EEPROM on old hardware, so we need to verify
> >                      * that our hardware is new enough to have spur
> >                      * mitigation registers (delta phase etc) */
> >                     
> >                     if (ah->ah_mac_srev >= AR5K_SREV_AR5424 ||
> >                     (ah->ah_mac_srev >= AR5K_SREV_AR5424 &&
> >                     ee->ee_version >= AR5K_EEPROM_VERSION_5_3))
> >                     
> >                             ath5k_hw_set_spur_mitigation_filter(ah,
> >                             
> >                                                             channel);
> > 
> > logically this does not make sense - it's the same as
> > 
> >                     if (ah->ah_mac_srev >= AR5K_SREV_AR5424)
> > 
> > right? did we miss something? what was the intention of this code?
> 
> Madwifi has this:
> 
> if (IS_5413(ah) || (AH_PRIVATE(ah)->ah_eeversion >= AR_EEPROM_VER5_3))
> 
> My guess from the comment is it started out similarly but the other clause
> was added because someone had an earlier chip with a newer eeprom?

ok. then let me suggest the follwing patch:

---

commit d60ca19fc18229aeefed52fd02d91a93665b7360
Author: Bruno Randolf <b...@einfach.org>
Date:   Thu Apr 22 12:45:45 2010 +0900

ath5k: clarify logic when to enable spur mitigation filter
    
The old code logically did not make sense and seems to have been confused by
the fact that we could have newer EEPROMs on older hardware. In any case the
spur mitigation filter was set if the srev was >= AR5K_SREV_AR5424.
    
Spur info is available only from EEPROM versions bigger than 5.3 but but the
EEPOM routines will use static values for older versions, so that should be
o.k.
    
Signed-off-by: Bruno Randolf <b...@einfach.org>

diff --git a/drivers/net/wireless/ath/ath5k/reset.c 
b/drivers/net/wireless/ath/ath5k/reset.c
index 5e23e61..05272ed 100644
--- a/drivers/net/wireless/ath/ath5k/reset.c
+++ b/drivers/net/wireless/ath/ath5k/reset.c
@@ -1097,15 +1097,12 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum 
nl80211_iftype op_mode,
                        if (ret)
                                return ret;
 
-                       /* Note: According to docs we can have a newer
-                        * EEPROM on old hardware, so we need to verify
-                        * that our hardware is new enough to have spur
-                        * mitigation registers (delta phase etc) */
-                       if (ah->ah_mac_srev >= AR5K_SREV_AR5424 ||
-                       (ah->ah_mac_srev >= AR5K_SREV_AR5424 &&
-                       ee->ee_version >= AR5K_EEPROM_VERSION_5_3))
+                       /* Spur info is available only from EEPROM versions
+                        * bigger than 5.3 but but the EEPOM routines will use
+                        * static values for older versions */
+                       if (ah->ah_mac_srev >= AR5K_SREV_AR5424)
                                ath5k_hw_set_spur_mitigation_filter(ah,
-                                                               channel);
+                                                                   channel);
                }
 
                /*Enable/disable 802.11b mode on 5111
_______________________________________________
ath5k-devel mailing list
ath5k-devel@lists.ath5k.org
https://lists.ath5k.org/mailman/listinfo/ath5k-devel

Reply via email to